Search in sources :

Example 6 with ClientboundPlayerInfoPacket

use of net.minecraft.network.protocol.game.ClientboundPlayerInfoPacket in project Denizen-For-Bukkit by DenizenScript.

the class ProfileEditorImpl method updatePlayerProfiles.

public static void updatePlayerProfiles(ClientboundPlayerInfoPacket packet) {
    ClientboundPlayerInfoPacket.Action action = packet.getAction();
    if (action != ClientboundPlayerInfoPacket.Action.ADD_PLAYER) {
        return;
    }
    List<ClientboundPlayerInfoPacket.PlayerUpdate> dataList = packet.getEntries();
    if (dataList != null) {
        try {
            for (ClientboundPlayerInfoPacket.PlayerUpdate data : dataList) {
                GameProfile gameProfile = data.getProfile();
                if (fakeProfiles.containsKey(gameProfile.getId())) {
                    playerInfoData_gameProfile_Setter.invoke(data, getGameProfile(fakeProfiles.get(gameProfile.getId())));
                }
            }
        } catch (Throwable e) {
            Debug.echoError(e);
        }
    }
}
Also used : GameProfile(com.mojang.authlib.GameProfile) ClientboundPlayerInfoPacket(net.minecraft.network.protocol.game.ClientboundPlayerInfoPacket)

Aggregations

ClientboundPlayerInfoPacket (net.minecraft.network.protocol.game.ClientboundPlayerInfoPacket)6 GameProfile (com.mojang.authlib.GameProfile)4 UUID (java.util.UUID)2 Component (net.minecraft.network.chat.Component)2 ClientboundAddPlayerPacket (net.minecraft.network.protocol.game.ClientboundAddPlayerPacket)2 ClientboundRemoveEntitiesPacket (net.minecraft.network.protocol.game.ClientboundRemoveEntitiesPacket)2 ServerLevel (net.minecraft.server.level.ServerLevel)2 ServerPlayer (net.minecraft.server.level.ServerPlayer)2 Player (org.bukkit.entity.Player)2 BukkitRunnable (org.bukkit.scheduler.BukkitRunnable)2 CraftServer (org.bukkit.craftbukkit.v1_17_R1.CraftServer)1 CraftPlayer (org.bukkit.craftbukkit.v1_17_R1.entity.CraftPlayer)1 CraftServer (org.bukkit.craftbukkit.v1_18_R1.CraftServer)1 CraftPlayer (org.bukkit.craftbukkit.v1_18_R1.entity.CraftPlayer)1