Signed-off-by: yoyosource <yoyosource@nidido.de>
Dieser Commit ist enthalten in:
Ursprung
2d8b9defaa
Commit
b6730eca0e
@ -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<List> 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));
|
||||
}
|
||||
}
|
In neuem Issue referenzieren
Einen Benutzer sperren