For version 2.7-SNAPSHOT.

This commit is contained in:
Jitse Boonstra
2020-04-26 12:09:58 +02:00
parent 820a0f1c36
commit 95e9cd5f27
30 changed files with 223 additions and 188 deletions
+1 -1
View File
@@ -8,7 +8,7 @@
<parent>
<groupId>net.jitse</groupId>
<artifactId>npclib-nms</artifactId>
<version>2.6-SNAPSHOT</version>
<version>2.7-SNAPSHOT</version>
</parent>
<artifactId>npclib-nms-v1_15_R1</artifactId>
@@ -1,6 +1,9 @@
package net.jitse.npclib.nms.v1_15_R1;
import com.mojang.authlib.GameProfile;
import com.mojang.authlib.properties.Property;
import net.jitse.npclib.NPCLib;
import net.jitse.npclib.api.skin.Skin;
import net.jitse.npclib.api.state.NPCSlot;
import net.jitse.npclib.hologram.Hologram;
import net.jitse.npclib.internal.MinecraftVersion;
@@ -102,4 +105,19 @@ public class NPC_v1_15_R1 extends NPCBase {
PacketPlayOutEntityEquipment packet = new PacketPlayOutEntityEquipment(entityId, nmsSlot, CraftItemStack.asNMSCopy(item));
playerConnection.sendPacket(packet);
}
@Override
public void updateSkin(Skin skin) {
GameProfile newProfile = new GameProfile(uuid, name);
newProfile.getProperties().get("textures").clear();
newProfile.getProperties().put("textures", new Property("textures", skin.getValue(), skin.getSignature()));
this.packetPlayOutPlayerInfoAdd = new PacketPlayOutPlayerInfoWrapper().create(PacketPlayOutPlayerInfo.EnumPlayerInfoAction.ADD_PLAYER, newProfile, name);
for (Player player : Bukkit.getOnlinePlayers()) {
PlayerConnection playerConnection = ((CraftPlayer) player).getHandle().playerConnection;
playerConnection.sendPacket(packetPlayOutPlayerInfoRemove);
playerConnection.sendPacket(packetPlayOutEntityDestroy);
playerConnection.sendPacket(packetPlayOutPlayerInfoAdd);
playerConnection.sendPacket(packetPlayOutNamedEntitySpawn);
}
}
}