Skip to content

Commit

Permalink
Fixed MinRadius Issue (#211)
Browse files Browse the repository at this point in the history
* Fixed MinRadius Issue

No longer sends players to exclusively the corners of the map. Now sends them to anywhere where x or z is above the MinRadius (while both being below the MaxRadius)

* Fixed MinRadius Issue

No longer sends players to exclusively the corners of the map. Now sends them to anywhere where x or z is above the MinRadius (while both being below the MaxRadius)


Fixes this issue.
#210

* Update QueueHandler.java

* MaxRadius and MinRadius fix
  • Loading branch information
ZepsiZola authored May 5, 2024
1 parent 9ab1648 commit e6ccb3b
Showing 1 changed file with 6 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -105,19 +105,13 @@ public static boolean isInCircle(Location loc, RTPWorld rtpWorld) {
}

public static boolean isInSquare(Location loc, RTPWorld rtpWorld) {
int center_x = rtpWorld.getCenterX();
int center_z = rtpWorld.getCenterZ();
int radius = rtpWorld.getMaxRadius();
int radius_max = rtpWorld.getMaxRadius();
int radius_min = rtpWorld.getMinRadius();
int x = loc.getBlockX();
int z = loc.getBlockZ();
boolean xright = x <= center_x + radius && x >= center_x + radius_min;
boolean xleft = x >= center_x - radius && x <= center_x - radius_min;
if (!(xleft || xright))
return false;
boolean zbottom = z <= center_z + radius && z >= center_z + radius_min;
boolean ztop = z >= center_z - radius && z <= center_z - radius_min;
return ztop || zbottom;
int x = loc.getBlockX() - rtpWorld.getCenterX();
int z = loc.getBlockZ() - rtpWorld.getCenterZ();
return ((Math.abs(x)>=radius_min || Math.abs(z)>=radius_min) && (Math.abs(x) <= radius_max && Math.abs(z) <= radius_max));
// Returns true if the x or z coordinate is above the MinRadius and if they are both under the MaxRadius. Returns false otherwise.
// (All locations provided should be below the MaxRadius anyway, but I put it in just in-case.)
}
}

0 comments on commit e6ccb3b

Please sign in to comment.