Interface Npc

All Superinterfaces:
PropertyHolder

public interface Npc extends PropertyHolder
Base class for all NPCs
  • Method Details

    • setType

      void setType(NpcType type)
      Sets the npc type of this NPC
      Parameters:
      type - The NpcType to set
    • getType

      NpcType getType()
      Returns:
      The NpcType of this NPC
    • getLocation

      NpcLocation getLocation()
      Gets the location of this NPC
      Returns:
      The NpcLocation of this NPC
    • setLocation

      void setLocation(NpcLocation location)
      Sets the location of this NPC
      Parameters:
      location - The NpcLocation to set
    • getHologram

      Hologram getHologram()
      Gets the hologram of this NPC
      Returns:
      The Hologram of this NPC
    • setEnabled

      void setEnabled(boolean enabled)
      Sets if the npc is enabled or not, i.e. if it should be visible to players
      Parameters:
      enabled - If the npc should be enabled
    • isEnabled

      boolean isEnabled()
      Gets if the npc is enabled or not, i.e. if it should be visible to players
      Returns:
      If the npc is enabled or not
    • getUuid

      UUID getUuid()
      Gets the unique ID of this NPC
      Returns:
      The unique ID of this NPC
    • getWorld

      org.bukkit.World getWorld()
      Gets the World this NPC is in Note: can be null if the world is unloaded or does not exist
      Returns:
      The World this NPC is in
    • getActions

      List<? extends InteractionAction> getActions()
      Gets the list of actions for this NPC
      Returns:
      The List of InteractionActions for this NPC
    • removeAction

      void removeAction(int index)
      Removes an action from this NPC
      Parameters:
      index - The index of the action to remove
    • addAction

      void addAction(InteractionAction action)
      Adds an action to this NPC
      Parameters:
      action - The InteractionAction to add
    • editAction

      void editAction(int index, InteractionAction action)
      Edits an action for this NPC
      Parameters:
      index - The index of the action to edit
      action - The InteractionAction to set
    • clearActions

      void clearActions()
      Clears all actions from this NPC
    • isVisibleTo

      boolean isVisibleTo(org.bukkit.entity.Player player)
      Gets if this NPC is visible to a player
      Parameters:
      player - The Player to check
      Returns:
      If this NPC is visible to the player
    • hide

      void hide(org.bukkit.entity.Player player)
      Hides this NPC from a player
      Parameters:
      player - The Player to hide from
    • show

      void show(org.bukkit.entity.Player player)
      Shows this NPC to a player
      Parameters:
      player - The Player to show to
    • respawn

      void respawn(org.bukkit.entity.Player player)
      Respawns this NPC for a player
      Parameters:
      player - The Player to respawn for
    • setHeadRotation

      void setHeadRotation(org.bukkit.entity.Player player, float yaw, float pitch)
      Sets the head rotation of this NPC for a player
      Parameters:
      player - The Player to set the head rotation for
      yaw - The yaw to set
      pitch - The pitch to set
    • setHeadRotation

      void setHeadRotation(float yaw, float pitch)
      Sets the head rotation of this NPC for all players/viewers
      Parameters:
      yaw - The yaw to set
      pitch - The pitch to set
    • getPacketEntityId

      int getPacketEntityId()
      Returns:
      The entity id of the packet entity that this npc object represents
    • getViewers

      Set<org.bukkit.entity.Player> getViewers()
      Returns:
      The set of players that can currently see this npc
    • swingHand

      void swingHand(boolean offHand)
      Swings the entity's hand
      Parameters:
      offHand - Should the hand be the offhand