From b6730eca0efd6878e79b9caeac5a682a9f11bad5 Mon Sep 17 00:00:00 2001 From: yoyosource Date: Fri, 3 Mar 2023 16:31:13 +0100 Subject: [PATCH] Hotfix NoClipCommand Signed-off-by: yoyosource --- .../bausystem/features/util/NoClipCommand.java | 17 +---------------- 1 file changed, 1 insertion(+), 16 deletions(-) diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/util/NoClipCommand.java b/BauSystem_Main/src/de/steamwar/bausystem/features/util/NoClipCommand.java index 46fdf535..3aab2cca 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/util/NoClipCommand.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/util/NoClipCommand.java @@ -46,14 +46,6 @@ import java.util.function.BiFunction; @Linked public class NoClipCommand extends SWCommand implements Listener { - public static final Class playerInfoPacket = Reflection.getClass("{nms.network.protocol.game}.PacketPlayOutPlayerInfo"); - private static final Class playerInfoActionClass = Reflection.getClass("{nms.network.protocol.game}.PacketPlayOutPlayerInfo$EnumPlayerInfoAction"); - private static final Reflection.FieldAccessor playerInfoAction = Reflection.getField(playerInfoPacket, playerInfoActionClass, 0); - private static final Object updateGamemode = playerInfoActionClass.getEnumConstants()[1]; - private static final Reflection.FieldAccessor playerInfoData = Reflection.getField(playerInfoPacket, List.class, 0); - public static final Class playerInfoDataClass = Reflection.getClass("{nms.network.protocol.game}.PacketPlayOutPlayerInfo$PlayerInfoData"); - public static final Class enumGamemode = Reflection.getClass("{nms.world.level}.EnumGamemode"); - private static final Object spectator = enumGamemode.getEnumConstants()[Core.getVersion() > 15 ? 3 : 4]; public static final Class iChatBaseComponent = Reflection.getClass("{nms.network.chat}.IChatBaseComponent"); public static final Class gameStateChange = Reflection.getClass("{nms.network.protocol.game}.PacketPlayOutGameStateChange"); @@ -160,13 +152,6 @@ public class NoClipCommand extends SWCommand implements Listener { } private static void pseudoSpectator(Player player) { - TinyProtocol.instance.sendPacket(player, playerInfoPacket(updateGamemode, new GameProfile(player.getUniqueId(), player.getName()), spectator)); - } - - private static Object playerInfoPacket(Object action, GameProfile profile, Object mode) { - Object packet = Reflection.newInstance(playerInfoPacket); - playerInfoAction.set(packet, action); - playerInfoData.set(packet, Collections.singletonList(ProtocolWrapper.impl.playerInfoDataConstructor(packet, profile, mode))); - return packet; + TinyProtocol.instance.sendPacket(player, de.steamwar.core.ProtocolWrapper.impl.playerInfoPacketConstructor(de.steamwar.core.ProtocolWrapper.PlayerInfoAction.GAMEMODE, new GameProfile(player.getUniqueId(), player.getName()), GameMode.CREATIVE)); } } \ No newline at end of file