Skip to content

Commit

Permalink
Experimentalized AutoXd
Browse files Browse the repository at this point in the history
  • Loading branch information
Spigey committed Apr 28, 2024
1 parent 5479329 commit 9db73f7
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 52 deletions.
1 change: 0 additions & 1 deletion src/main/java/spigey/asteroide/AsteroideAddon.java
Original file line number Diff line number Diff line change
Expand Up @@ -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());
Expand Down
51 changes: 0 additions & 51 deletions src/main/java/spigey/asteroide/modules/AutoXd.java

This file was deleted.

26 changes: 26 additions & 0 deletions src/main/java/spigey/asteroide/modules/ExperimentalModules.java
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down Expand Up @@ -61,6 +64,20 @@ public ExperimentalModules() {
.defaultValue(false)
.build()
);
private final Setting<Boolean> auto_xd = sgGeneral.add(new BoolSetting.Builder()
.name("Auto Xd")
.description("Sends a message when someone dies")
.defaultValue(false)
.build()
);
private final Setting<List<String>> 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() {
Expand Down Expand Up @@ -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())
);
}
}

0 comments on commit 9db73f7

Please sign in to comment.