From 9db73f7361d56ff81c49c3ef2b55b941a5356d65 Mon Sep 17 00:00:00 2001 From: DieZeitungsente Date: Sun, 28 Apr 2024 19:22:58 +0200 Subject: [PATCH] Experimentalized AutoXd --- .../java/spigey/asteroide/AsteroideAddon.java | 1 - .../java/spigey/asteroide/modules/AutoXd.java | 51 ------------------- .../modules/ExperimentalModules.java | 26 ++++++++++ 3 files changed, 26 insertions(+), 52 deletions(-) delete mode 100644 src/main/java/spigey/asteroide/modules/AutoXd.java diff --git a/src/main/java/spigey/asteroide/AsteroideAddon.java b/src/main/java/spigey/asteroide/AsteroideAddon.java index 64a667c..3c3cb95 100644 --- a/src/main/java/spigey/asteroide/AsteroideAddon.java +++ b/src/main/java/spigey/asteroide/AsteroideAddon.java @@ -33,7 +33,6 @@ public void onInitialize() { // Modules addModule(new AutoKys()); addModule(new ServerCrashModule()); - // addModule(new AutoXd()); addModule(new AutoChatGame()); addModule(new AntiAnnouncement()); addModule(new AutoBack()); diff --git a/src/main/java/spigey/asteroide/modules/AutoXd.java b/src/main/java/spigey/asteroide/modules/AutoXd.java deleted file mode 100644 index ca6f289..0000000 --- a/src/main/java/spigey/asteroide/modules/AutoXd.java +++ /dev/null @@ -1,51 +0,0 @@ -package spigey.asteroide.modules; - -import meteordevelopment.meteorclient.MeteorClient; -import meteordevelopment.meteorclient.events.packets.PacketEvent; -import meteordevelopment.meteorclient.settings.Setting; -import meteordevelopment.meteorclient.settings.SettingGroup; -import meteordevelopment.meteorclient.settings.StringListSetting; -import meteordevelopment.meteorclient.systems.modules.Module; -import meteordevelopment.orbit.EventHandler; -import meteordevelopment.orbit.EventPriority; -import net.minecraft.client.network.OtherClientPlayerEntity; -import net.minecraft.entity.Entity; -import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.network.packet.s2c.play.*; -import spigey.asteroide.AsteroideAddon; -import spigey.asteroide.events.PlayerDeathEvent; - - -import java.util.List; -import java.util.Random; - -import static spigey.asteroide.util.msg; - -public class AutoXd extends Module { - private boolean active4 = false; - private final SettingGroup sgGeneral = settings.getDefaultGroup(); - private final Setting> messages = sgGeneral.add(new StringListSetting.Builder().name("messages").description("Randomly takes the message from the list and sends on each death.").defaultValue("xd", "skill issue").build()); - public AutoXd() { - super(AsteroideAddon.CATEGORY, "auto-xd", "Sends a message when someone dies"); - } - - @Override - public void onActivate() { - if(active4){return;} - MeteorClient.EVENT_BUS.subscribe(this); - active4 = true; - } - - @EventHandler - private void onPlayerDeath(PlayerDeathEvent event){ - if(!isActive()){return;} - PlayerEntity victim = event.getPlayer(); - msg(messages.get().get(randomNum(0,messages.get().size() - 1)) - .replace("{player}", victim.getGameProfile().getName()) - ); - } - private static final Random random = new Random(); - public static int randomNum(int min, int max) { - return random.nextInt(max - min + 1) + min; - } -} diff --git a/src/main/java/spigey/asteroide/modules/ExperimentalModules.java b/src/main/java/spigey/asteroide/modules/ExperimentalModules.java index 3bdb708..f693704 100644 --- a/src/main/java/spigey/asteroide/modules/ExperimentalModules.java +++ b/src/main/java/spigey/asteroide/modules/ExperimentalModules.java @@ -10,11 +10,14 @@ import net.minecraft.entity.player.PlayerEntity; import net.minecraft.network.packet.s2c.play.EntitiesDestroyS2CPacket; import spigey.asteroide.AsteroideAddon; +import spigey.asteroide.events.PlayerDeathEvent; import spigey.asteroide.events.SendMessageEvent; +import spigey.asteroide.util; import java.util.List; import static spigey.asteroide.util.banstuff; +import static spigey.asteroide.util.msg; public class ExperimentalModules extends Module { public ExperimentalModules() { @@ -61,6 +64,20 @@ public ExperimentalModules() { .defaultValue(false) .build() ); + private final Setting auto_xd = sgGeneral.add(new BoolSetting.Builder() + .name("Auto Xd") + .description("Sends a message when someone dies") + .defaultValue(false) + .build() + ); + private final Setting> autoxdmessages = sgGeneral.add(new StringListSetting.Builder() + .name("AutoXd: messages") + .description("Randomly takes the message from the list and sends on each death.") + .defaultValue("xd", "skill issue") + .visible(() -> auto_xd.get()) + .build() + ); + private boolean activated = false; @Override public void onActivate() { @@ -118,4 +135,13 @@ private void onPacketReceive(PacketEvent.Receive event){ } } } + @EventHandler + private void onPlayerDeath(PlayerDeathEvent event){ + if(!isActive()){return;} + if(!auto_xd.get()){return;} + PlayerEntity victim = event.getPlayer(); + msg(messages.get().get(util.randomNum(0, messages.get().size() - 1)) + .replace("{player}", victim.getGameProfile().getName()) + ); + } }