Use command API properly

This commit is contained in:
FlorianMichael 2023-08-01 13:12:43 +02:00
parent 1ca7b9edc7
commit 58bcc1c2d6
No known key found for this signature in database
GPG Key ID: C2FB87E71C425126

View File

@ -11,7 +11,7 @@ import org.bukkit.plugin.java.JavaPlugin;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
@Info(name = "commandspy", description = "Spy on commands executed by players.", usage = "/commandspy") @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 public class CommandSpyCommand extends Commander
{ {
@ -30,18 +30,12 @@ public class CommandSpyCommand extends Commander
} }
@Base @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()). final var commandSpy = ((Datura) getPlugin()).
getCommandSpy(); getCommandSpy();
final var uuid = ((Player) sender). final var uuid = sender.
getUniqueId(); getUniqueId();
if (commandSpy.isSpying(uuid)) if (commandSpy.isSpying(uuid))