From 46601772ad53b2f1d2e2fb03f561bb73a99621ea Mon Sep 17 00:00:00 2001 From: Picono435 Date: Tue, 27 Dec 2022 14:07:42 +0000 Subject: [PATCH] Fixed minor issue with bounds not being correctly generated making the command not 100% reliable --- .../java/com/gmail/picono435/randomtp/api/RandomTPAPI.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/common/src/main/java/com/gmail/picono435/randomtp/api/RandomTPAPI.java b/common/src/main/java/com/gmail/picono435/randomtp/api/RandomTPAPI.java index 755ab79..3ddfd62 100644 --- a/common/src/main/java/com/gmail/picono435/randomtp/api/RandomTPAPI.java +++ b/common/src/main/java/com/gmail/picono435/randomtp/api/RandomTPAPI.java @@ -127,7 +127,7 @@ private static Pair generateCoordinates(ServerLevel world, Pla int minDistance = (int) (player.getX() + Config.getMinDistance()); if(minDistance > world.getWorldBorder().getMaxX()) minDistance = (int) (world.getWorldBorder().getMaxX() - 10); if(maxDistance < minDistance) maxDistance = maxDistance ^ minDistance ^ (minDistance = maxDistance); - if(maxDistance == minDistance) minDistance = minDistance + 1; + if(maxDistance == minDistance) minDistance = minDistance - 1; x = random.ints(minDistance, maxDistance).findAny().getAsInt(); } int z; @@ -147,7 +147,7 @@ private static Pair generateCoordinates(ServerLevel world, Pla int minDistance = (int) (player.getZ() + Config.getMinDistance()); if(minDistance > world.getWorldBorder().getMaxZ()) minDistance = (int) (world.getWorldBorder().getMaxZ() - 10); if(maxDistance < minDistance) maxDistance = maxDistance ^ minDistance ^ (minDistance = maxDistance); - if(maxDistance == minDistance) minDistance = minDistance + 1; + if(maxDistance == minDistance) minDistance = minDistance - 1; z = random.ints(minDistance, maxDistance).findAny().getAsInt(); } return new Pair<>(x, z);