Skip to content

Commit 2c390b0

Browse files
committed
Update Waypoints
1 parent 7f9ba3d commit 2c390b0

9 files changed

Lines changed: 723 additions & 258 deletions

File tree

src/main/java/net/wurstclient/commands/NoGoZoneCmd.java

Lines changed: 26 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ public NoGoZoneCmd()
2626
super("nogozone",
2727
"Manages NoGoZones - areas you cannot re-enter after leaving.\n"
2828
+ "Use when NoGoZone hack is enabled.",
29-
".nogozone add", ".nogozone list", ".nogozone remove <id>",
29+
".nogozone add [x z]", ".nogozone list", ".nogozone remove <id>",
3030
".nogozone clear");
3131
}
3232

@@ -39,7 +39,7 @@ public void call(String[] args) throws CmdException
3939
switch(args[0].toLowerCase())
4040
{
4141
case "add":
42-
addZone();
42+
addZone(args);
4343
break;
4444

4545
case "list":
@@ -61,29 +61,46 @@ public void call(String[] args) throws CmdException
6161
}
6262
}
6363

64-
private void addZone()
64+
private void addZone(String[] args) throws CmdError
6565
{
6666
if(MC.player == null)
6767
{
6868
ChatUtils.error("You must be in a world to add a NoGoZone.");
6969
return;
7070
}
71+
if(args.length != 1 && args.length != 3)
72+
throw new CmdError("Usage: .nogozone add [x z]");
7173

7274
// Read the effective render distance (capped by server view distance)
7375
int renderDistance = MC.options.getEffectiveRenderDistance();
74-
// Add +1 as specified
75-
int chunkRadius = renderDistance + 1;
76+
// Add +3 as specified
77+
int chunkRadius = renderDistance + 3;
7678

77-
BlockPos playerPos = MC.player.blockPosition();
78-
int id = NoGoZoneHack.addZone(playerPos, chunkRadius);
79+
BlockPos zonePos = args.length == 3
80+
? parseXZ(args[1], args[2], MC.player.blockPosition().getY())
81+
: MC.player.blockPosition();
82+
int id = NoGoZoneHack.addZone(zonePos, chunkRadius);
7983
WURST.getHax().noGoZoneHack.setEnabled(true);
8084

8185
int blockRadius = chunkRadius * 16;
82-
ChatUtils.message("NoGoZone #" + id + " created at " + playerPos.getX()
83-
+ " " + playerPos.getY() + " " + playerPos.getZ() + " with radius "
86+
ChatUtils.message("NoGoZone #" + id + " created at " + zonePos.getX()
87+
+ " " + zonePos.getY() + " " + zonePos.getZ() + " with radius "
8488
+ blockRadius + " blocks (" + chunkRadius + " chunks).");
8589
}
8690

91+
private BlockPos parseXZ(String xStr, String zStr, int y) throws CmdError
92+
{
93+
try
94+
{
95+
return new BlockPos(Integer.parseInt(xStr), y,
96+
Integer.parseInt(zStr));
97+
98+
}catch(NumberFormatException e)
99+
{
100+
throw new CmdError("Invalid coordinates: " + xStr + " " + zStr);
101+
}
102+
}
103+
87104
private void listZones()
88105
{
89106
List<NoGoZone> zones = NoGoZoneHack.getZones();

0 commit comments

Comments
 (0)