Package net.citizensnpcs.npc.skin
Class SkinPacketTracker
java.lang.Object
net.citizensnpcs.npc.skin.SkinPacketTracker
Handles and synchronizes add and remove packets for Player type NPC's in order to properly apply the NPC skin.
Used as one instance per NPC entity.
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptiongetSkin()
Get the NPC skin.void
notifySkinChange
(boolean forceUpdate) Notify that the NPC skin has been changed.void
Invoke when the NPC entity is removed.void
Invoke when the NPC entity is spawned.void
updateNearbyViewers
(double radius) Send skin related packets to all nearby players within the specified block radius.void
updateViewer
(Player player) Send skin related packets to a player.
-
Constructor Details
-
SkinPacketTracker
Constructor.- Parameters:
entity
- The skinnable entity the instance belongs to.
-
-
Method Details
-
getSkin
Get the NPC skin. -
notifySkinChange
public void notifySkinChange(boolean forceUpdate) Notify that the NPC skin has been changed. -
onRemoveNPC
public void onRemoveNPC()Invoke when the NPC entity is removed.Sends remove packets to all players.
-
onSpawnNPC
public void onSpawnNPC()Invoke when the NPC entity is spawned. -
updateNearbyViewers
public void updateNearbyViewers(double radius) Send skin related packets to all nearby players within the specified block radius.- Parameters:
radius
- The radius.
-
updateViewer
Send skin related packets to a player.- Parameters:
player
- The player.
-