From b5f80816c3da64cfa65c5290435a75e9dde0b503 Mon Sep 17 00:00:00 2001 From: OmerBenGera Date: Fri, 24 Nov 2023 20:58:52 +0200 Subject: [PATCH] Fixed errors on Spigot servers due to missing methods --- .../wildloaders/nms/v1_20_2/ChunkLoaderNPCImpl.java | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/NMS/v1_20_2/src/main/java/com/bgsoftware/wildloaders/nms/v1_20_2/ChunkLoaderNPCImpl.java b/NMS/v1_20_2/src/main/java/com/bgsoftware/wildloaders/nms/v1_20_2/ChunkLoaderNPCImpl.java index 8905379..2b01030 100644 --- a/NMS/v1_20_2/src/main/java/com/bgsoftware/wildloaders/nms/v1_20_2/ChunkLoaderNPCImpl.java +++ b/NMS/v1_20_2/src/main/java/com/bgsoftware/wildloaders/nms/v1_20_2/ChunkLoaderNPCImpl.java @@ -64,9 +64,13 @@ public final class ChunkLoaderNPCImpl extends ServerPlayer implements ChunkLoade this.advancements = new DummyPlayerAdvancements(minecraftServer, this); SET_GAMEMODE.invoke(this.gameMode, GameType.CREATIVE, null); - setLoadViewDistance(2); - setTickViewDistance(2); - setSendViewDistance(2); + try { + setLoadViewDistance(2); + setTickViewDistance(2); + setSendViewDistance(2); + } catch (Throwable ignored) { + // Doesn't exist on Spigot + } fauxSleeping = true; @@ -136,7 +140,7 @@ public final class ChunkLoaderNPCImpl extends ServerPlayer implements ChunkLoade public class DummyServerGamePacketListenerImpl extends ServerGamePacketListenerImpl { DummyServerGamePacketListenerImpl(MinecraftServer minecraftServer, ServerPlayer serverPlayer) { - super(minecraftServer, new DummyConnection(), serverPlayer, CommonListenerCookie.createInitial(ChunkLoaderNPCImpl.this.gameProfile)); + super(minecraftServer, new DummyConnection(), serverPlayer, CommonListenerCookie.createInitial(ChunkLoaderNPCImpl.this.getGameProfile())); } @Override