Fix the worldborder being a piece of garbage

This commit is contained in:
Esophose 2019-03-07 17:25:55 -07:00
parent 6c2736e054
commit 9e5c25f7bc
2 changed files with 9 additions and 8 deletions

View File

@ -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));
}
}

View File

@ -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();