Fixed improper d field reflection in WorldBorder SD-3861

This commit is contained in:
BuildTools 2019-09-22 02:28:42 -06:00
parent 56c1bf509d
commit 0b20a3669a

View File

@ -44,11 +44,7 @@ public final class WorldBorder {
Object worldBorder = worldBorderClass.getConstructor().newInstance(); Object worldBorder = worldBorderClass.getConstructor().newInstance();
if (NMSUtil.getVersionNumber() < 9) { if (NMSUtil.getVersionNumber() >= 9) {
Field borderSize = worldBorder.getClass().getDeclaredField("d");
borderSize.setAccessible(true);
borderSize.set(worldBorder, size);
} else {
Object craftWorld = craftWorldClass.cast(centerLocation.getWorld()); Object craftWorld = craftWorldClass.cast(centerLocation.getWorld());
Method getHandleMethod = craftWorld.getClass().getMethod("getHandle"); Method getHandleMethod = craftWorld.getClass().getMethod("getHandle");
Object worldServer = getHandleMethod.invoke(craftWorld); Object worldServer = getHandleMethod.invoke(craftWorld);