From 9ce89e3d5c0f910fca6c3a6bc80882b3a45a231a Mon Sep 17 00:00:00 2001 From: ChomeNS <95471003+ChomeNS@users.noreply.github.com> Date: Sun, 13 Aug 2023 12:31:20 +0700 Subject: [PATCH] pcrash??? --- README.md | 2 + .../chomens_bot/commands/PCrashCommand.java | 41 +++++++++++++++++++ .../plugins/CommandHandlerPlugin.java | 1 + 3 files changed, 44 insertions(+) create mode 100644 src/main/java/land/chipmunk/chayapak/chomens_bot/commands/PCrashCommand.java 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;