mirror of
https://github.com/plexusorg/Plex.git
synced 2024-09-30 05:56:12 +00:00
31 lines
1.3 KiB
Java
31 lines
1.3 KiB
Java
|
package dev.plex.command.impl;
|
||
|
|
||
|
import dev.plex.command.PlexCommand;
|
||
|
import dev.plex.command.annotation.CommandParameters;
|
||
|
import dev.plex.command.annotation.CommandPermissions;
|
||
|
import dev.plex.command.source.RequiredCommandSource;
|
||
|
import dev.plex.player.PlexPlayer;
|
||
|
import dev.plex.rank.enums.Rank;
|
||
|
import net.kyori.adventure.text.Component;
|
||
|
import net.kyori.adventure.text.format.NamedTextColor;
|
||
|
import org.bukkit.command.CommandSender;
|
||
|
import org.bukkit.entity.Player;
|
||
|
import org.jetbrains.annotations.NotNull;
|
||
|
import org.jetbrains.annotations.Nullable;
|
||
|
|
||
|
@CommandPermissions(level = Rank.ADMIN, permission = "plex.commandspy", source = RequiredCommandSource.IN_GAME)
|
||
|
@CommandParameters(name = "commandspy", aliases = "cmdspy", description = "Spy on other player's commands")
|
||
|
public class CommandSpyCMD extends PlexCommand
|
||
|
{
|
||
|
@Override
|
||
|
protected Component execute(@NotNull CommandSender sender, @Nullable Player playerSender, @NotNull String[] args)
|
||
|
{
|
||
|
PlexPlayer plexPlayer = getPlexPlayer(playerSender);
|
||
|
plexPlayer.setCommandSpy(!plexPlayer.isCommandSpy());
|
||
|
Component component = Component.text("CommandSpy has been").color(NamedTextColor.GRAY)
|
||
|
.append(Component.space())
|
||
|
.append(Component.text(plexPlayer.isCommandSpy() ? "enabled." : "disabled.").color(NamedTextColor.GRAY));
|
||
|
return component;
|
||
|
}
|
||
|
}
|