From 58bcc1c2d604cbc1e8ac3688defc02a31a7f0e96 Mon Sep 17 00:00:00 2001 From: FlorianMichael <60033407+FlorianMichael@users.noreply.github.com> Date: Tue, 1 Aug 2023 13:12:43 +0200 Subject: [PATCH] Use command API properly --- .../totalfreedom/datura/cmd/CommandSpyCommand.java | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/Datura/src/main/java/me/totalfreedom/datura/cmd/CommandSpyCommand.java b/Datura/src/main/java/me/totalfreedom/datura/cmd/CommandSpyCommand.java index 1773d46..d099696 100644 --- a/Datura/src/main/java/me/totalfreedom/datura/cmd/CommandSpyCommand.java +++ b/Datura/src/main/java/me/totalfreedom/datura/cmd/CommandSpyCommand.java @@ -11,7 +11,7 @@ import org.bukkit.plugin.java.JavaPlugin; import org.jetbrains.annotations.NotNull; @Info(name = "commandspy", description = "Spy on commands executed by players.", usage = "/commandspy") -@Permissive(perm = "datura.commandspy") +@Permissive(perm = "datura.commandspy", onlyPlayers = true) public class CommandSpyCommand extends Commander { @@ -30,18 +30,12 @@ public class CommandSpyCommand extends Commander } @Base - public void commandSpy(final CommandSender sender) + public void commandSpy(final Player sender) { - if (!(sender instanceof Player)) - { - sender.sendPlainMessage("You have to be a player to perform this command."); - return; - } - final var commandSpy = ((Datura) getPlugin()). getCommandSpy(); - final var uuid = ((Player) sender). + final var uuid = sender. getUniqueId(); if (commandSpy.isSpying(uuid))