mirror of
https://code.chipmunk.land/ChomeNS/chipmunkmod.git
synced 2025-11-13 21:06:16 +00:00
feat: uwu bot hashing (qilk)
This commit is contained in:
parent
6aa61cf724
commit
4d536c5a24
3 changed files with 31 additions and 0 deletions
|
|
@ -18,6 +18,7 @@ public class ValidateCommand {
|
||||||
// .then(literal("chipmunk").then(argument("command", greedyString()).executes(c -> chipmunk(getString(c, "command")))))
|
// .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("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("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("nbot").then(argument("command", greedyString()).executes(c -> nbot(getString(c, "command")))))
|
||||||
.then(literal("kittycorp").then(argument("command", greedyString()).executes(c -> kittycorp(getString(c, "command")))))
|
.then(literal("kittycorp").then(argument("command", greedyString()).executes(c -> kittycorp(getString(c, "command")))))
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -32,6 +32,7 @@ public class Configuration {
|
||||||
public BotInfo chipmunk = new BotInfo("'", null);
|
public BotInfo chipmunk = new BotInfo("'", null);
|
||||||
public ChomeNSBotInfo chomens = new ChomeNSBotInfo("*", null, null);
|
public ChomeNSBotInfo chomens = new ChomeNSBotInfo("*", null, null);
|
||||||
public BotInfo fnfboyfriend = new BotInfo("~", null);
|
public BotInfo fnfboyfriend = new BotInfo("~", null);
|
||||||
|
public BotInfo qilk = new BotInfo(">", null);
|
||||||
public BotInfo nbot = new BotInfo("?", null);
|
public BotInfo nbot = new BotInfo("?", null);
|
||||||
public BotInfo kittycorp = new BotInfo("^", null);
|
public BotInfo kittycorp = new BotInfo("^", null);
|
||||||
public TestBotInfo testbot = new TestBotInfo("-", null);
|
public TestBotInfo testbot = new TestBotInfo("-", null);
|
||||||
|
|
|
||||||
|
|
@ -115,6 +115,35 @@ public class BotValidationUtilities {
|
||||||
return Command.SINGLE_SUCCESS;
|
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) {
|
public static int fnfboyfriend (String command) {
|
||||||
try {
|
try {
|
||||||
final String prefix = ChipmunkMod.CONFIG.bots.fnfboyfriend.prefix;
|
final String prefix = ChipmunkMod.CONFIG.bots.fnfboyfriend.prefix;
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue