mirror of
https://github.com/songoda/FabledSkyBlock.git
synced 2024-11-07 03:00:29 +01:00
Fixed WorldBorder reducing of 1 block on tp
This commit is contained in:
parent
746137b8f2
commit
45a00b1eef
@ -1532,7 +1532,7 @@ public class IslandManager {
|
||||
}
|
||||
|
||||
for (Player all : getPlayersAtIsland(island)) {
|
||||
WorldBorder.send(all, island.getBorderColor(), island.getSize()+2, island.getLocation(worldManager.getIslandWorld(all.getWorld()), IslandEnvironment.Island));
|
||||
WorldBorder.send(all, island.getBorderColor(), island.getSize(), island.getLocation(worldManager.getIslandWorld(all.getWorld()), IslandEnvironment.Island));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,8 +1,11 @@
|
||||
package com.songoda.skyblock.utils.world;
|
||||
|
||||
import java.lang.reflect.Constructor;
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.lang.reflect.Method;
|
||||
|
||||
import com.songoda.core.compatibility.ServerVersion;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
@ -35,16 +38,17 @@ public final class WorldBorder {
|
||||
}
|
||||
|
||||
public static void send(Player player, Color color, double size, Location centerLocation) {
|
||||
size +=2;
|
||||
try {
|
||||
if (centerLocation == null || centerLocation.getWorld() == null)
|
||||
return;
|
||||
|
||||
|
||||
if (size % 2 == 1)
|
||||
size++;
|
||||
|
||||
Object worldBorder = worldBorderClass.getConstructor().newInstance();
|
||||
|
||||
if (NMSUtil.getVersionNumber() >= 9) {
|
||||
if (ServerVersion.isServerVersionAtLeast(ServerVersion.V1_9)) {
|
||||
Object craftWorld = craftWorldClass.cast(centerLocation.getWorld());
|
||||
Method getHandleMethod = craftWorld.getClass().getMethod("getHandle");
|
||||
Object worldServer = getHandleMethod.invoke(craftWorld);
|
||||
@ -73,7 +77,7 @@ public final class WorldBorder {
|
||||
Object packet = packetPlayOutWorldBorderConstructor.newInstance(worldBorder,
|
||||
Enum.valueOf((Class<Enum>) packetPlayOutWorldBorderEnumClass, "INITIALIZE"));
|
||||
NMSUtil.sendPacket(player, packet);
|
||||
} catch (Exception e) {
|
||||
} catch (InstantiationException | InvocationTargetException | NoSuchMethodException | IllegalAccessException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user