diff --git a/src/main/java/net/wurstclient/hacks/MassTpaHack.java b/src/main/java/net/wurstclient/hacks/MassTpaHack.java index a5897baca0..c44de26bf3 100644 --- a/src/main/java/net/wurstclient/hacks/MassTpaHack.java +++ b/src/main/java/net/wurstclient/hacks/MassTpaHack.java @@ -57,11 +57,14 @@ public final class MassTpaHack extends Hack + " requests when someone accepts one of them.", true); + private final CheckboxSetting isActiveMassTpaFlooding = new CheckboxSetting( + "TPA Flood", "Re-request TPA from all players except my friend", false); + private final Random random = new Random(); private final ArrayList players = new ArrayList<>(); private String command; - private int index; + private int sendTpaCount; private int timer; public MassTpaHack() @@ -72,6 +75,7 @@ public MassTpaHack() addSetting(delay); addSetting(ignoreErrors); addSetting(stopWhenAccepted); + addSetting(isActiveMassTpaFlooding); } @Override @@ -79,7 +83,7 @@ protected void onEnable() { // reset state players.clear(); - index = 0; + sendTpaCount = 0; timer = 0; // cache command in case the setting is changed mid-run @@ -92,6 +96,10 @@ protected void onEnable() String name = info.getProfile().getName(); name = StringHelper.stripTextFormat(name); + if(isActiveMassTpaFlooding.isChecked() + && WURST.getFriends().contains(name)) + continue; + if(name.equalsIgnoreCase(playerName)) continue; @@ -126,16 +134,30 @@ public void onUpdate() return; } - if(index >= players.size()) + if(isActiveMassTpaFlooding.isChecked() + && sendTpaCount >= players.size()) + { + sendTpaCount = 0; + + if(command.equals("tpa")) + command = "tpacancel"; + + else if(command.equals("tpacancel")) + command = "tpa"; + } + + if(!isActiveMassTpaFlooding.isChecked() + && sendTpaCount >= players.size()) { + command = commandSetting.getValue().substring(1); setEnabled(false); return; } MC.getNetworkHandler() - .sendChatCommand(command + " " + players.get(index)); + .sendChatCommand(command + " " + players.get(sendTpaCount)); - index++; + sendTpaCount++; timer = delay.getValueI() - 1; }