From 9e5c25f7bc3c152a81d47b499b9f33538544a4c3 Mon Sep 17 00:00:00 2001 From: Esophose Date: Thu, 7 Mar 2019 17:25:55 -0700 Subject: [PATCH] Fix the worldborder being a piece of garbage --- .../goodandevil/skyblock/island/IslandManager.java | 4 ++-- .../skyblock/utils/world/WorldBorder.java | 13 +++++++------ 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/src/main/java/me/goodandevil/skyblock/island/IslandManager.java b/src/main/java/me/goodandevil/skyblock/island/IslandManager.java index af6cf671..5fa9d7c1 100644 --- a/src/main/java/me/goodandevil/skyblock/island/IslandManager.java +++ b/src/main/java/me/goodandevil/skyblock/island/IslandManager.java @@ -1078,7 +1078,7 @@ public class IslandManager { } if (configLoad.getBoolean("Island.WorldBorder.Enable") && island.isBorder()) { - WorldBorder.send(player, island.getBorderColor(), island.getSize() + 2.5, + WorldBorder.send(player, island.getBorderColor(), island.getSize(), island.getLocation(worldManager.getIslandWorld(player.getWorld()), IslandEnvironment.Island)); } else { @@ -1215,7 +1215,7 @@ public class IslandManager { } for (Player all : getPlayersAtIsland(island)) { - WorldBorder.send(all, island.getBorderColor(), island.getSize() + 2.5, island + WorldBorder.send(all, island.getBorderColor(), island.getSize(), island .getLocation(worldManager.getIslandWorld(all.getWorld()), IslandEnvironment.Island)); } } diff --git a/src/main/java/me/goodandevil/skyblock/utils/world/WorldBorder.java b/src/main/java/me/goodandevil/skyblock/utils/world/WorldBorder.java index 3d4c5d60..29e98d63 100644 --- a/src/main/java/me/goodandevil/skyblock/utils/world/WorldBorder.java +++ b/src/main/java/me/goodandevil/skyblock/utils/world/WorldBorder.java @@ -1,14 +1,13 @@ package me.goodandevil.skyblock.utils.world; +import me.goodandevil.skyblock.utils.version.NMSUtil; +import org.bukkit.Location; +import org.bukkit.entity.Player; + import java.lang.reflect.Constructor; import java.lang.reflect.Field; import java.lang.reflect.Method; -import org.bukkit.Location; -import org.bukkit.entity.Player; - -import me.goodandevil.skyblock.utils.version.NMSUtil; - public final class WorldBorder { private static Class packetPlayOutWorldBorder, packetPlayOutWorldBorderEnumClass, worldBorderClass, @@ -37,7 +36,9 @@ public final class WorldBorder { public static void send(Player player, Color color, double size, Location centerLocation) { try { - size = size - 2.5; + // Adjust border size to fit around whole-blocks, odd numbers only! + size += size % 2 == 0 ? 1 : 0; + centerLocation = centerLocation.clone(); centerLocation.add(.5, 0, .5); Object worldBorder = worldBorderClass.getConstructor().newInstance();