mirror of
https://github.com/plexusorg/Plex.git
synced 2025-07-01 15:46:42 +00:00
Add CommandSpy
This commit is contained in:
30
src/main/java/dev/plex/command/impl/CommandSpyCMD.java
Normal file
30
src/main/java/dev/plex/command/impl/CommandSpyCMD.java
Normal file
@ -0,0 +1,30 @@
|
||||
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;
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user