diff --git a/README.md b/README.md index 03704b6..c1faceb 100644 --- a/README.md +++ b/README.md @@ -17,6 +17,8 @@ public class ExploitsPlugin { public ExploitsPlugin (Bot bot) {} public void kick (UUID uuid) {} + + public void pcrash (UUID uuid) {} } ``` diff --git a/src/main/java/land/chipmunk/chayapak/chomens_bot/commands/PCrashCommand.java b/src/main/java/land/chipmunk/chayapak/chomens_bot/commands/PCrashCommand.java new file mode 100644 index 0000000..2b2c0bc --- /dev/null +++ b/src/main/java/land/chipmunk/chayapak/chomens_bot/commands/PCrashCommand.java @@ -0,0 +1,41 @@ +package land.chipmunk.chayapak.chomens_bot.commands; + +import land.chipmunk.chayapak.chomens_bot.Bot; +import land.chipmunk.chayapak.chomens_bot.command.Command; +import land.chipmunk.chayapak.chomens_bot.command.CommandContext; +import land.chipmunk.chayapak.chomens_bot.command.TrustLevel; +import land.chipmunk.chayapak.chomens_bot.data.chat.PlayerEntry; +import land.chipmunk.chayapak.chomens_bot.util.ColorUtilities; +import net.kyori.adventure.text.Component; +import net.kyori.adventure.text.format.NamedTextColor; + +public class PCrashCommand extends Command { + public PCrashCommand () { + super( + "pcrash", + "Crashes a player using particle", + new String[] { " <{player}>" }, + new String[] { "particlecrash" }, + TrustLevel.TRUSTED, + false + ); + } + + @Override + public Component execute(CommandContext context, String[] args, String[] fullArgs) { + if (args.length == 0) return Component.text("Not enough arguments").color(NamedTextColor.RED); + + final Bot bot = context.bot; + + final PlayerEntry player = bot.players.getEntry(args[0]); + + if (player == null) return Component.text("Invalid player name").color(NamedTextColor.RED); + + bot.exploits.pcrash(player.profile.getId()); + + return Component.translatable( + "Attempting to crash %s", + Component.text(player.profile.getName()).color(ColorUtilities.getColorByString(bot.config.colorPalette.secondary)) + ).color(ColorUtilities.getColorByString(bot.config.colorPalette.defaultColor)); + } +} diff --git a/src/main/java/land/chipmunk/chayapak/chomens_bot/plugins/CommandHandlerPlugin.java b/src/main/java/land/chipmunk/chayapak/chomens_bot/plugins/CommandHandlerPlugin.java index c23fd2b..25d78a8 100644 --- a/src/main/java/land/chipmunk/chayapak/chomens_bot/plugins/CommandHandlerPlugin.java +++ b/src/main/java/land/chipmunk/chayapak/chomens_bot/plugins/CommandHandlerPlugin.java @@ -52,6 +52,7 @@ public class CommandHandlerPlugin { registerCommand(new EvalCommand()); registerCommand(new InfoCommand()); registerCommand(new ConsoleServerCommand()); + registerCommand(new PCrashCommand()); } public boolean disabled = false;