diff --git a/src/main/java/land/chipmunk/chipmunkmod/util/BotValidationUtilities.java b/src/main/java/land/chipmunk/chipmunkmod/util/BotValidationUtilities.java index d300d1b..4467000 100644 --- a/src/main/java/land/chipmunk/chipmunkmod/util/BotValidationUtilities.java +++ b/src/main/java/land/chipmunk/chipmunkmod/util/BotValidationUtilities.java @@ -67,19 +67,21 @@ public class BotValidationUtilities { public static int chomens (String command) throws RuntimeException { final Configuration.BotInfo info = ChipmunkMod.CONFIG.bots.chomens; + 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 { + String[] arguments = command.split(" "); + MessageDigest md = MessageDigest.getInstance("SHA-256"); String time = String.valueOf(System.currentTimeMillis() / 5_000); - String input = time + key; + String input = client.player.getUuidAsString() + arguments[0] + time + key; byte[] hash = md.digest(input.getBytes(StandardCharsets.UTF_8)); String stringHash = Hexadecimal.encode(hash).substring(0, 16); - String[] arguments = command.split(" "); - final String toSend = prefix + arguments[0] + " " + stringHash + " " + String.join(" ", Arrays.copyOfRange(arguments, 1, arguments.length)); CustomChat.INSTANCE.chat(toSend);