From 06522fadccab06ec3075ada277d9c3c7159372a1 Mon Sep 17 00:00:00 2001 From: ChomeNS <95471003+ChomeNS@users.noreply.github.com> Date: Wed, 27 Nov 2024 16:58:18 +0700 Subject: [PATCH] feat: stop skids from making 69420 clones + some more stuff --- .gitignore | 3 +- README.md | 25 ++---------- build-number.txt | 2 +- .../chomens_bot/command/Command.java | 6 +-- .../chomens_bot/commands/KickCommand.java | 19 +++++++-- .../chomens_bot/commands/PCrashCommand.java | 39 ------------------- .../plugins/CommandHandlerPlugin.java | 1 - 7 files changed, 26 insertions(+), 69 deletions(-) delete mode 100644 src/main/java/me/chayapak1/chomens_bot/commands/PCrashCommand.java diff --git a/.gitignore b/.gitignore index 43fcca4..d4196f2 100644 --- a/.gitignore +++ b/.gitignore @@ -9,8 +9,9 @@ run/ *.ipr *.iws -# Exploits plugin +# Exploits stuff src/main/java/me/chayapak1/chomens_bot/plugins/ExploitsPlugin.java +src/main/java/me/chayapak1/chomens_bot/data/exploitMethods/ # Testing plugins src/main/java/me/chayapak1/chomens_bot/plugins/testing diff --git a/README.md b/README.md index feffbcf..7a5c3dc 100644 --- a/README.md +++ b/README.md @@ -1,27 +1,10 @@ # ChomeNS Bot Java -A Java verison of ChomeNS Bot. +A Java version of ChomeNS Bot. # Compiling -You will see that the exploits plugin is missing because I gitignored it to prevent exploit leaks -To make this successfully compile just make `ExploitsPlugin.java` in the plugins folder and add this code: +To make this successfully compile, you will have to fix the missing `ExploitsPlugin.java` in the `plugins` package, and also some enums related to it. -```java -package me.chayapak1.chomens_bot.plugins; +After that, you can now run `./gradlew build` to actually get the `.jar` file. -import me.chayapak1.chomens_bot.Bot; - -import java.util.UUID; - -public class ExploitsPlugin { - public ExploitsPlugin (Bot bot) {} - - public void kick (UUID uuid) {} - - public void pcrash (UUID uuid) {} -} -``` - -Then at the root of the project run `./gradlew build` to build. - -The .jar file will be at `build/libs`, to run the bot do `java -jar chomens_bot-rolling-all.jar` +The .jar file will be at `build/libs`, to run the bot simply do `java -jar chomens_bot-rolling-all.jar` diff --git a/build-number.txt b/build-number.txt index 6a333d3..d1d06ad 100644 --- a/build-number.txt +++ b/build-number.txt @@ -1 +1 @@ -1107 \ No newline at end of file +1111 \ No newline at end of file diff --git a/src/main/java/me/chayapak1/chomens_bot/command/Command.java b/src/main/java/me/chayapak1/chomens_bot/command/Command.java index 9cbd506..6d7b4d7 100644 --- a/src/main/java/me/chayapak1/chomens_bot/command/Command.java +++ b/src/main/java/me/chayapak1/chomens_bot/command/Command.java @@ -4,9 +4,9 @@ import net.kyori.adventure.text.Component; public abstract class Command { public final String name; - public final String description; - public final String[] usages; - public final String[] aliases; + public String description; + public String[] usages; + public String[] aliases; public final TrustLevel trustLevel; public final boolean consoleOnly; diff --git a/src/main/java/me/chayapak1/chomens_bot/commands/KickCommand.java b/src/main/java/me/chayapak1/chomens_bot/commands/KickCommand.java index c165661..b807c98 100644 --- a/src/main/java/me/chayapak1/chomens_bot/commands/KickCommand.java +++ b/src/main/java/me/chayapak1/chomens_bot/commands/KickCommand.java @@ -6,9 +6,11 @@ import me.chayapak1.chomens_bot.command.CommandContext; import me.chayapak1.chomens_bot.command.CommandException; import me.chayapak1.chomens_bot.command.TrustLevel; import me.chayapak1.chomens_bot.data.PlayerEntry; +import me.chayapak1.chomens_bot.data.exploitMethods.Kick; import me.chayapak1.chomens_bot.util.ColorUtilities; import net.kyori.adventure.text.Component; +import java.util.Arrays; import java.util.UUID; public class KickCommand extends Command { @@ -16,17 +18,23 @@ public class KickCommand extends Command { super( "kick", "Kicks a player", - new String[] { "" }, + new String[] {}, new String[] {}, TrustLevel.TRUSTED, false ); + + final String allMethods = String.join("|", Arrays.stream(Kick.values()).map(Enum::name).toList()); + + this.usages = new String[] { "<" + allMethods + "> " }; } @Override public Component execute(CommandContext context) throws CommandException { final Bot bot = context.bot; + final Kick method = context.getEnum(Kick.class); + final PlayerEntry entry = bot.players.getEntry(context.getString(true, true)); if (entry == null) throw new CommandException(Component.text("Invalid player name")); @@ -34,11 +42,16 @@ public class KickCommand extends Command { final String name = entry.profile.getName(); final UUID uuid = entry.profile.getId(); - bot.exploits.kick(uuid); + bot.exploits.kick(method, uuid); return Component.empty() - .append(Component.text("Kicking player ")) + .append(Component.text("Kicking player")) + .append(Component.space()) .append(Component.text(name).color(ColorUtilities.getColorByString(bot.config.colorPalette.username))) + .append(Component.space()) + .append(Component.text("with method")) + .append(Component.space()) + .append(Component.text(method.name()).color(ColorUtilities.getColorByString(bot.config.colorPalette.string))) .color(ColorUtilities.getColorByString(bot.config.colorPalette.defaultColor)); } } diff --git a/src/main/java/me/chayapak1/chomens_bot/commands/PCrashCommand.java b/src/main/java/me/chayapak1/chomens_bot/commands/PCrashCommand.java deleted file mode 100644 index 26f416d..0000000 --- a/src/main/java/me/chayapak1/chomens_bot/commands/PCrashCommand.java +++ /dev/null @@ -1,39 +0,0 @@ -package me.chayapak1.chomens_bot.commands; - -import me.chayapak1.chomens_bot.Bot; -import me.chayapak1.chomens_bot.command.Command; -import me.chayapak1.chomens_bot.command.CommandContext; -import me.chayapak1.chomens_bot.command.CommandException; -import me.chayapak1.chomens_bot.command.TrustLevel; -import me.chayapak1.chomens_bot.data.PlayerEntry; -import me.chayapak1.chomens_bot.util.ColorUtilities; -import net.kyori.adventure.text.Component; - -public class PCrashCommand extends Command { - public PCrashCommand () { - super( - "pcrash", - "Crashes a player using particle", - new String[] { "" }, - new String[] { "particlecrash" }, - TrustLevel.TRUSTED, - false - ); - } - - @Override - public Component execute(CommandContext context) throws CommandException { - final Bot bot = context.bot; - - final PlayerEntry player = bot.players.getEntry(context.getString(true, true)); - - if (player == null) throw new CommandException(Component.text("Invalid player name")); - - 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/me/chayapak1/chomens_bot/plugins/CommandHandlerPlugin.java b/src/main/java/me/chayapak1/chomens_bot/plugins/CommandHandlerPlugin.java index 0d74489..17ae0e5 100644 --- a/src/main/java/me/chayapak1/chomens_bot/plugins/CommandHandlerPlugin.java +++ b/src/main/java/me/chayapak1/chomens_bot/plugins/CommandHandlerPlugin.java @@ -51,7 +51,6 @@ public class CommandHandlerPlugin { registerCommand(new EvalCommand()); registerCommand(new InfoCommand()); registerCommand(new ConsoleCommand()); - registerCommand(new PCrashCommand()); // registerCommand(new ScreenshareCommand()); registerCommand(new WhitelistCommand()); registerCommand(new SeenCommand());