@@ -26,8 +26,8 @@ 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 [x z] " , ".nogozone list" , ".nogozone remove <id> " ,
30- ".nogozone clear" );
29+ ".nogozone add [x z [radius]] " , ".nogozone list" ,
30+ ".nogozone remove <id>" , ".nogozone clear" );
3131 }
3232
3333 @ Override
@@ -68,24 +68,30 @@ private void addZone(String[] args) throws CmdError
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]" );
71+ if (args .length != 1 && args .length != 3 && args . length != 4 )
72+ throw new CmdError ("Usage: .nogozone add [x z [radius] ]" );
7373
7474 // Read the effective render distance (capped by server view distance)
7575 int renderDistance = MC .options .getEffectiveRenderDistance ();
7676 // Add +3 as specified
77- int chunkRadius = renderDistance + 3 ;
77+ int blockRadius = ( renderDistance + 3 ) * 16 ;
7878
7979 BlockPos zonePos = args .length == 3
8080 ? parseXZ (args [1 ], args [2 ], MC .player .blockPosition ().getY ())
8181 : MC .player .blockPosition ();
82- int id = NoGoZoneHack .addZone (zonePos , chunkRadius );
82+ if (args .length == 4 )
83+ {
84+ zonePos =
85+ parseXZ (args [1 ], args [2 ], MC .player .blockPosition ().getY ());
86+ blockRadius = parseRadius (args [3 ]);
87+ }
88+
89+ int id = NoGoZoneHack .addZone (zonePos , blockRadius );
8390 WURST .getHax ().noGoZoneHack .setEnabled (true );
8491
85- int blockRadius = chunkRadius * 16 ;
8692 ChatUtils .message ("NoGoZone #" + id + " created at " + zonePos .getX ()
8793 + " " + zonePos .getY () + " " + zonePos .getZ () + " with radius "
88- + blockRadius + " blocks (" + chunkRadius + " chunks) ." );
94+ + blockRadius + " blocks." );
8995 }
9096
9197 private BlockPos parseXZ (String xStr , String zStr , int y ) throws CmdError
@@ -101,6 +107,21 @@ private BlockPos parseXZ(String xStr, String zStr, int y) throws CmdError
101107 }
102108 }
103109
110+ private int parseRadius (String radiusStr ) throws CmdError
111+ {
112+ try
113+ {
114+ int radius = Integer .parseInt (radiusStr );
115+ if (radius < 1 )
116+ throw new CmdError ("Radius must be at least 1 block." );
117+ return radius ;
118+
119+ }catch (NumberFormatException e )
120+ {
121+ throw new CmdError ("Invalid radius: " + radiusStr );
122+ }
123+ }
124+
104125 private void listZones ()
105126 {
106127 List <NoGoZone > zones = NoGoZoneHack .getZones ();
@@ -116,8 +137,7 @@ private void listZones()
116137 {
117138 ChatUtils .message (" #" + zone .id + " | XYZ: " + zone .center .getX ()
118139 + " " + zone .center .getY () + " " + zone .center .getZ ()
119- + " | Radius: " + zone .getBlockRadius () + " blocks ("
120- + zone .chunkRadius + " chunks)" );
140+ + " | Radius: " + zone .getBlockRadius () + " blocks" );
121141 }
122142 }
123143
0 commit comments