Class SkinPacketTracker

java.lang.Object
net.citizensnpcs.npc.skin.SkinPacketTracker

public class SkinPacketTracker extends Object
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 Details

    • SkinPacketTracker

      public SkinPacketTracker(SkinnableEntity entity)
      Constructor.
      Parameters:
      entity - The skinnable entity the instance belongs to.
  • Method Details

    • getSkin

      public Skin 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

      public void updateViewer(Player player)
      Send skin related packets to a player.
      Parameters:
      player - The player.