Skip to content

Commit ea4c1f5

Browse files
committed
Added AntiSocial
1 parent f8bf4de commit ea4c1f5

File tree

8 files changed

+380
-77
lines changed

8 files changed

+380
-77
lines changed

README.md

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -152,14 +152,19 @@ Build without the flag to get the full CevAPI experience; build with the flag fo
152152
- Right-clicking item frames (with items in them) or signs interacts with the block behind them. Hold sneak to interact with the frame or sign normally.
153153
- Toggle between signs, frames or both
154154

155-
### Location on Disconnect
156-
- Copyable XYZ co-ordinates on disconnect/kick (Works with AutoLeave)
157-
158-
![Disc](https://i.imgur.com/b327XLx.png)
159-
160-
### Anti-Fingerprint
161-
- Detects and stops resource-pack fingerprinting.
162-
- Basic protections are already enabled by default.
155+
### Location on Disconnect
156+
- Copyable XYZ co-ordinates on disconnect/kick (Works with AutoLeave)
157+
158+
![Disc](https://i.imgur.com/b327XLx.png)
159+
160+
### Antisocial
161+
- Hooks into the PlayerESP enter/leave detector (even if ESP itself is off) and logs out the instant someone walks into range.
162+
- Reuses AutoLeave's Quit/Chars/SelfHurt modes so you can pick the safest disconnect for your server.
163+
- Perfect for hiding or protecting yourself while AFK farming—optionally toggles AutoReconnect off so you stay gone.
164+
165+
### Anti-Fingerprint
166+
- Detects and stops resource-pack fingerprinting.
167+
- Basic protections are already enabled by default.
163168
- Policies: Observe (vanilla prompt + log), BlockLocal (decline private/LAN), BlockAll (decline all), SandboxAll (server sees fail; client saves copy).
164169
- Detects burst requests (N in M ms) with toasts; supports host whitelist.
165170
- Cache defenses: clear before download and per-session cache isolation.

src/main/java/net/wurstclient/WurstClient.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@
4141
import net.wurstclient.settings.SettingsFile;
4242
import net.wurstclient.update.ProblematicResourcePackDetector;
4343
import net.wurstclient.update.WurstUpdater;
44+
import net.wurstclient.util.PlayerRangeAlertManager;
4445
import net.wurstclient.util.json.JsonException;
4546
import net.wurstclient.nicewurst.NiceWurstModule;
4647
import net.wurstclient.config.BuildConfig;
@@ -71,6 +72,7 @@ public enum WurstClient
7172
private RotationFaker rotationFaker;
7273
private FriendsList friends;
7374
private WurstTranslator translator;
75+
private PlayerRangeAlertManager playerRangeAlertManager;
7476

7577
private boolean enabled = true;
7678
private static boolean guiInitialized;
@@ -91,6 +93,7 @@ public void initialize()
9193
plausible.pageview("/");
9294

9395
eventManager = new EventManager(this);
96+
playerRangeAlertManager = new PlayerRangeAlertManager(eventManager);
9497

9598
Path enabledHacksFile = wurstFolder.resolve("enabled-hacks.json");
9699
Path favoritesHacksFile = wurstFolder.resolve("favourites.json");
@@ -302,6 +305,11 @@ public WurstTranslator getTranslator()
302305
return translator;
303306
}
304307

308+
public PlayerRangeAlertManager getPlayerRangeAlertManager()
309+
{
310+
return playerRangeAlertManager;
311+
}
312+
305313
public boolean isEnabled()
306314
{
307315
return enabled;

src/main/java/net/wurstclient/hack/HackList.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ public final class HackList implements UpdateListener
4040
public final AntiHungerHack antiHungerHack = new AntiHungerHack();
4141
public final AntiKnockbackHack antiKnockbackHack = new AntiKnockbackHack();
4242
public final AntiSpamHack antiSpamHack = new AntiSpamHack();
43+
public final AntisocialHack antisocialHack = new AntisocialHack();
4344
public final AntiWaterPushHack antiWaterPushHack = new AntiWaterPushHack();
4445
public final AntiWobbleHack antiWobbleHack = new AntiWobbleHack();
4546
public final ArrowDmgHack arrowDmgHack = new ArrowDmgHack();
Lines changed: 102 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,102 @@
1+
/*
2+
* Copyright (c) 2014-2025 Wurst-Imperium and contributors.
3+
*
4+
* This source code is subject to the terms of the GNU General Public
5+
* License, version 3. If a copy of the GPL was not distributed with this
6+
* file, You can obtain one at: https://www.gnu.org/licenses/gpl-3.0.txt
7+
*/
8+
package net.wurstclient.hacks;
9+
10+
import net.minecraft.entity.player.PlayerEntity;
11+
import net.wurstclient.Category;
12+
import net.wurstclient.SearchTags;
13+
import net.wurstclient.hack.Hack;
14+
import net.wurstclient.settings.CheckboxSetting;
15+
import net.wurstclient.settings.EnumSetting;
16+
import net.wurstclient.util.ChatUtils;
17+
import net.wurstclient.util.PlayerRangeAlertManager;
18+
19+
@SearchTags({"antisocial", "auto logout", "auto quit", "afk logout"})
20+
public final class AntisocialHack extends Hack
21+
implements PlayerRangeAlertManager.Listener
22+
{
23+
private final EnumSetting<AutoLeaveHack.Mode> mode = new EnumSetting<>(
24+
"Mode",
25+
"\u00a7lQuit\u00a7r mode just quits the game normally.\n"
26+
+ "Bypasses NoCheat+ but not CombatLog.\n\n"
27+
+ "\u00a7lChars\u00a7r mode sends a special chat message that"
28+
+ " causes the server to kick you.\n"
29+
+ "Bypasses NoCheat+ and some versions of CombatLog.\n\n"
30+
+ "\u00a7lSelfHurt\u00a7r mode sends the packet for attacking"
31+
+ " another player, but with yourself as both the attacker and the"
32+
+ " target, causing the server to kick you.\n"
33+
+ "Bypasses both CombatLog and NoCheat+.",
34+
AutoLeaveHack.Mode.values(), AutoLeaveHack.Mode.QUIT);
35+
private final CheckboxSetting disableAutoReconnect = new CheckboxSetting(
36+
"Disable AutoReconnect", "Turns off AutoReconnect after Antisocial"
37+
+ " disconnects you so you stay hidden.",
38+
true);
39+
private final CheckboxSetting ignoreNpcs =
40+
new CheckboxSetting("Ignore NPCs",
41+
"Skips players that don't show up on the tab list (matches"
42+
+ " PlayerESP's ignore-NPC logic).",
43+
true);
44+
45+
private final PlayerRangeAlertManager alertManager =
46+
WURST.getPlayerRangeAlertManager();
47+
private boolean triggered;
48+
49+
public AntisocialHack()
50+
{
51+
super("Antisocial");
52+
setCategory(Category.COMBAT);
53+
addSetting(mode);
54+
addSetting(disableAutoReconnect);
55+
addSetting(ignoreNpcs);
56+
}
57+
58+
@Override
59+
protected void onEnable()
60+
{
61+
alertManager.addListener(this);
62+
}
63+
64+
@Override
65+
protected void onDisable()
66+
{
67+
alertManager.removeListener(this);
68+
triggered = false;
69+
}
70+
71+
@Override
72+
public void onPlayerEnter(PlayerEntity player,
73+
PlayerRangeAlertManager.PlayerInfo info)
74+
{
75+
if(triggered)
76+
return;
77+
78+
if(ignoreNpcs.isChecked() && info.isProbablyNpc())
79+
return;
80+
81+
triggered = true;
82+
83+
String intruder =
84+
player == null ? info.getName() : player.getName().getString();
85+
ChatUtils.message("\u00a76Antisocial:\u00a7r " + intruder
86+
+ " entered your range. Leaving via "
87+
+ mode.getSelected().toString() + " mode.");
88+
89+
mode.getSelected().leave();
90+
91+
if(disableAutoReconnect.isChecked())
92+
WURST.getHax().autoReconnectHack.setEnabled(false);
93+
94+
setEnabled(false);
95+
}
96+
97+
@Override
98+
public void onPlayerExit(PlayerRangeAlertManager.PlayerInfo info)
99+
{
100+
// not needed
101+
}
102+
}

src/main/java/net/wurstclient/hacks/AutoLeaveHack.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ public void onUpdate()
101101
return;
102102

103103
// leave server
104-
mode.getSelected().leave.run();
104+
mode.getSelected().leave();
105105

106106
// disable
107107
setEnabled(false);
@@ -136,5 +136,10 @@ public String toString()
136136
{
137137
return name;
138138
}
139+
140+
public void leave()
141+
{
142+
leave.run();
143+
}
139144
}
140145
}

src/main/java/net/wurstclient/hacks/PlayerEspHack.java

Lines changed: 39 additions & 68 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,6 @@
1313
import java.util.Map;
1414
import java.util.Optional;
1515
import java.util.UUID;
16-
import java.util.Set;
17-
import java.util.HashSet;
1816
import java.util.stream.Collectors;
1917
import java.util.stream.Stream;
2018

@@ -49,6 +47,7 @@
4947
import net.wurstclient.util.ChatUtils;
5048
import net.wurstclient.util.EntityUtils;
5149
import net.wurstclient.util.FakePlayerEntity;
50+
import net.wurstclient.util.PlayerRangeAlertManager;
5251
import net.wurstclient.util.RenderUtils;
5352
import net.wurstclient.util.RenderUtils.ColoredBox;
5453
import net.wurstclient.util.RenderUtils.ColoredPoint;
@@ -79,9 +78,36 @@ public final class PlayerEspHack extends Hack implements UpdateListener,
7978
"When enabled, notifies in chat when a player leaves PlayerESP\n"
8079
+ "visibility, showing distance and XYZ at which they left.",
8180
false);
82-
private final Set<UUID> prevVisible = new HashSet<>();
83-
private final Map<UUID, Vec3d> lastPositions = new HashMap<>();
84-
private final Map<UUID, String> lastNames = new HashMap<>();
81+
private final PlayerRangeAlertManager alertManager =
82+
WURST.getPlayerRangeAlertManager();
83+
private final PlayerRangeAlertManager.Listener alertListener =
84+
new PlayerRangeAlertManager.Listener()
85+
{
86+
@Override
87+
public void onPlayerEnter(PlayerEntity player,
88+
PlayerRangeAlertManager.PlayerInfo info)
89+
{
90+
if(!isEnabled() || !enterAlert.isChecked())
91+
return;
92+
93+
if(ignoreNpcs.isChecked() && info.isProbablyNpc())
94+
return;
95+
96+
sendEnterMessage(player);
97+
}
98+
99+
@Override
100+
public void onPlayerExit(PlayerRangeAlertManager.PlayerInfo info)
101+
{
102+
if(!isEnabled() || !exitAlert.isChecked())
103+
return;
104+
105+
if(ignoreNpcs.isChecked() && info.isProbablyNpc())
106+
return;
107+
108+
sendExitMessage(info);
109+
}
110+
};
85111
private final CheckboxSetting randomBrightColors = new CheckboxSetting(
86112
"Unique colors for players",
87113
"When enabled, assigns each player a bright color from a shared\n"
@@ -161,6 +187,7 @@ protected void onEnable()
161187
EVENTS.add(UpdateListener.class, this);
162188
EVENTS.add(CameraTransformViewBobbingListener.class, this);
163189
EVENTS.add(RenderListener.class, this);
190+
alertManager.addListener(alertListener);
164191
}
165192

166193
@Override
@@ -169,10 +196,8 @@ protected void onDisable()
169196
EVENTS.remove(UpdateListener.class, this);
170197
EVENTS.remove(CameraTransformViewBobbingListener.class, this);
171198
EVENTS.remove(RenderListener.class, this);
199+
alertManager.removeListener(alertListener);
172200
losStates.clear();
173-
prevVisible.clear();
174-
lastPositions.clear();
175-
lastNames.clear();
176201
}
177202

178203
@Override
@@ -202,69 +227,12 @@ public void onUpdate()
202227

203228
players.addAll(stream.collect(Collectors.toList()));
204229

205-
// detect enter / exit visibility changes
206-
handleVisibilityChanges();
207-
208230
if(losThreatDetection.isChecked())
209231
updateLosStates(Util.getMeasuringTimeMs());
210232
else
211233
losStates.clear();
212234
}
213235

214-
/**
215-
* Detect which players entered or left the PlayerESP-visible list since
216-
* the last update and send chat alerts if configured.
217-
*/
218-
private void handleVisibilityChanges()
219-
{
220-
// Build a set of currently visible *non-bot* players. Use the same
221-
// bot/NPC checks PlayerESP already uses: FakePlayerEntity and
222-
// (when enabled) players missing from the client's tab-list.
223-
Set<UUID> currentNonBot = new HashSet<>();
224-
225-
// Added players (only non-bots)
226-
for(PlayerEntity p : players)
227-
{
228-
// skip known fake players
229-
if(p instanceof FakePlayerEntity)
230-
continue;
231-
232-
UUID id = p.getUuid();
233-
234-
// If ignoreNpcs is enabled, treat players not on the client
235-
// player list as bots/NPCs and ignore them for alerts.
236-
if(ignoreNpcs.isChecked() && MC.getNetworkHandler() != null
237-
&& MC.getNetworkHandler().getPlayerListEntry(id) == null)
238-
{
239-
continue;
240-
}
241-
242-
currentNonBot.add(id);
243-
lastPositions.put(id, new Vec3d(p.getX(), p.getY(), p.getZ()));
244-
lastNames.put(id, p.getName().getString());
245-
if(!prevVisible.contains(id) && enterAlert.isChecked())
246-
sendEnterMessage(p);
247-
}
248-
249-
// Removed players (only consider previously tracked non-bot IDs)
250-
for(UUID id : new HashSet<>(prevVisible))
251-
{
252-
if(!currentNonBot.contains(id))
253-
{
254-
Vec3d pos = lastPositions.get(id);
255-
String name = lastNames.getOrDefault(id, "<unknown>");
256-
if(exitAlert.isChecked())
257-
sendExitMessage(id, name, pos);
258-
lastPositions.remove(id);
259-
lastNames.remove(id);
260-
prevVisible.remove(id);
261-
}
262-
}
263-
264-
prevVisible.clear();
265-
prevVisible.addAll(currentNonBot);
266-
}
267-
268236
private void sendEnterMessage(PlayerEntity p)
269237
{
270238
if(MC.player == null)
@@ -292,21 +260,24 @@ private void sendEnterMessage(PlayerEntity p)
292260
ChatUtils.component(msg);
293261
}
294262

295-
private void sendExitMessage(UUID id, String name, Vec3d pos)
263+
private void sendExitMessage(PlayerRangeAlertManager.PlayerInfo info)
296264
{
297265
if(MC.player == null)
298266
return;
267+
268+
Vec3d pos = info.getLastPos();
299269
double dist = pos == null ? -1.0
300270
: Math.round(pos.distanceTo(
301271
new Vec3d(MC.player.getX(), MC.player.getY(), MC.player.getZ()))
302272
* 10.0) / 10.0;
303273
int x = pos == null ? 0 : (int)Math.round(pos.x);
304274
int y = pos == null ? 0 : (int)Math.round(pos.y);
305275
int z = pos == null ? 0 : (int)Math.round(pos.z);
306-
MutableText nameText = MutableText.of(Text.literal(name).getContent());
276+
MutableText nameText =
277+
MutableText.of(Text.literal(info.getName()).getContent());
307278
if(randomBrightColors.isChecked())
308279
{
309-
int idx = Math.abs(id.hashCode());
280+
int idx = Math.abs(info.getUuid().hashCode());
310281
java.awt.Color gen = net.wurstclient.util.PlayerColorRegistry
311282
.generateBrightColor(idx);
312283
nameText.setStyle(nameText.getStyle().withColor(TextColor.fromRgb(

0 commit comments

Comments
 (0)