mirror of
https://github.com/plexusorg/Plex.git
synced 2025-04-18 15:53:00 +00:00
* Attempt to improve the tab completion for Plex * i give up for the night * steven is a god * Fix permission node
43 lines
1.7 KiB
Java
43 lines
1.7 KiB
Java
package dev.plex.command.impl;
|
|
|
|
import dev.plex.cache.DataUtils;
|
|
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 net.kyori.adventure.text.Component;
|
|
import org.bukkit.command.CommandSender;
|
|
import org.bukkit.entity.Player;
|
|
import org.jetbrains.annotations.NotNull;
|
|
import org.jetbrains.annotations.Nullable;
|
|
|
|
import java.util.Collections;
|
|
import java.util.List;
|
|
|
|
@CommandPermissions(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)
|
|
{
|
|
if (playerSender != null)
|
|
{
|
|
PlexPlayer plexPlayer = plugin.getPlayerCache().getPlexPlayer(playerSender.getUniqueId());
|
|
plexPlayer.setCommandSpy(!plexPlayer.isCommandSpy());
|
|
DataUtils.update(plexPlayer);
|
|
send(sender, messageComponent("toggleCommandSpy")
|
|
.append(Component.space())
|
|
.append(plexPlayer.isCommandSpy() ? messageComponent("enabled") : messageComponent("disabled")));
|
|
}
|
|
return null;
|
|
}
|
|
|
|
@Override
|
|
public @NotNull List<String> smartTabComplete(@NotNull CommandSender sender, @NotNull String alias, @NotNull String[] args) throws IllegalArgumentException
|
|
{
|
|
return Collections.emptyList();
|
|
}
|
|
}
|