From 4d536c5a249900cd49e2462abec19eeb7405b5b3 Mon Sep 17 00:00:00 2001 From: ChomeNS <95471003+chomens@users.noreply.github.com> Date: Sun, 6 Apr 2025 15:48:30 +0700 Subject: [PATCH] feat: uwu bot hashing (qilk) --- .../chipmunkmod/commands/ValidateCommand.java | 1 + .../chipmunkmod/config/Configuration.java | 1 + .../util/BotValidationUtilities.java | 29 +++++++++++++++++++ 3 files changed, 31 insertions(+) diff --git a/src/main/java/land/chipmunk/chipmunkmod/commands/ValidateCommand.java b/src/main/java/land/chipmunk/chipmunkmod/commands/ValidateCommand.java index 673273c..8e5e7e9 100644 --- a/src/main/java/land/chipmunk/chipmunkmod/commands/ValidateCommand.java +++ b/src/main/java/land/chipmunk/chipmunkmod/commands/ValidateCommand.java @@ -18,6 +18,7 @@ public class ValidateCommand { // .then(literal("chipmunk").then(argument("command", greedyString()).executes(c -> chipmunk(getString(c, "command"))))) .then(literal("chomens").then(argument("command", greedyString()).executes(c -> chomens(getString(c, "command"))))) .then(literal("fnfboyfriend").then(argument("command", greedyString()).executes(c -> fnfboyfriend(getString(c, "command"))))) + .then(literal("qilk").then(argument("command", greedyString()).executes(c -> qilk(getString(c, "command"))))) .then(literal("nbot").then(argument("command", greedyString()).executes(c -> nbot(getString(c, "command"))))) .then(literal("kittycorp").then(argument("command", greedyString()).executes(c -> kittycorp(getString(c, "command"))))) ); diff --git a/src/main/java/land/chipmunk/chipmunkmod/config/Configuration.java b/src/main/java/land/chipmunk/chipmunkmod/config/Configuration.java index 3b8e5ee..267e61b 100644 --- a/src/main/java/land/chipmunk/chipmunkmod/config/Configuration.java +++ b/src/main/java/land/chipmunk/chipmunkmod/config/Configuration.java @@ -32,6 +32,7 @@ public class Configuration { public BotInfo chipmunk = new BotInfo("'", null); public ChomeNSBotInfo chomens = new ChomeNSBotInfo("*", null, null); public BotInfo fnfboyfriend = new BotInfo("~", null); + public BotInfo qilk = new BotInfo(">", null); public BotInfo nbot = new BotInfo("?", null); public BotInfo kittycorp = new BotInfo("^", null); public TestBotInfo testbot = new TestBotInfo("-", null); diff --git a/src/main/java/land/chipmunk/chipmunkmod/util/BotValidationUtilities.java b/src/main/java/land/chipmunk/chipmunkmod/util/BotValidationUtilities.java index fd6a230..9ff8abd 100644 --- a/src/main/java/land/chipmunk/chipmunkmod/util/BotValidationUtilities.java +++ b/src/main/java/land/chipmunk/chipmunkmod/util/BotValidationUtilities.java @@ -115,6 +115,35 @@ public class BotValidationUtilities { return Command.SINGLE_SUCCESS; } + public static int qilk (String command) throws RuntimeException { + final Configuration.BotInfo info = ChipmunkMod.CONFIG.bots.qilk; + final MinecraftClient client = MinecraftClient.getInstance(); + + final String prefix = info.prefix; + final String key = info.key; + if (key == null) throw new RuntimeException("The key of the bot is unspecified (null), did you incorrectly add it to your config?"); + + try { + MessageDigest md = MessageDigest.getInstance("SHA-256"); + long time = Math.floorDiv(System.currentTimeMillis(), 2000); + + String[] wholeArguments = command.split(" "); + String[] restArguments = Arrays.copyOfRange(wholeArguments, 1, wholeArguments.length); + + // lol this is literally chomens bot input with uwu and : + String input = "uwu:" + key + ":" + client.player.getUuidAsString() + ":" + wholeArguments[0] + ":" + time; + + byte[] hash = md.digest(input.getBytes(StandardCharsets.UTF_8)); + String stringHash = new String(Hex.encodeHex(hash)); + + Chat.sendChatMessage(prefix + wholeArguments[0] + " " + stringHash + " " + String.join(" ", restArguments), true); + } catch (NoSuchAlgorithmException e) { + e.printStackTrace(); + } + + return Command.SINGLE_SUCCESS; + } + public static int fnfboyfriend (String command) { try { final String prefix = ChipmunkMod.CONFIG.bots.fnfboyfriend.prefix;