Package lol.pyr.znpcsplus.api.npc
Interface Npc
- All Superinterfaces:
PropertyHolder
Base class for all NPCs
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addAction
(InteractionAction action) Adds an action to this NPCvoid
Clears all actions from this NPCvoid
editAction
(int index, InteractionAction action) Edits an action for this NPCList<? extends InteractionAction>
Gets the list of actions for this NPCGets the hologram of this NPCGets the location of this NPCint
getType()
getUuid()
Gets the unique ID of this NPCSet<org.bukkit.entity.Player>
org.bukkit.World
getWorld()
Gets theWorld
this NPC is in Note: can be null if the world is unloaded or does not existvoid
hide
(org.bukkit.entity.Player player) Hides this NPC from a playerboolean
Gets if the npc is enabled or not, i.e.boolean
isVisibleTo
(org.bukkit.entity.Player player) Gets if this NPC is visible to a playervoid
removeAction
(int index) Removes an action from this NPCvoid
respawn
(org.bukkit.entity.Player player) Respawns this NPC for a playervoid
setEnabled
(boolean enabled) Sets if the npc is enabled or not, i.e.void
setHeadRotation
(float yaw, float pitch) Sets the head rotation of this NPC for all players/viewersvoid
setHeadRotation
(org.bukkit.entity.Player player, float yaw, float pitch) Sets the head rotation of this NPC for a playervoid
setLocation
(NpcLocation location) Sets the location of this NPCvoid
Sets the npc type of this NPCvoid
show
(org.bukkit.entity.Player player) Shows this NPC to a playervoid
swingHand
(boolean offHand) Swings the entity's handMethods inherited from interface lol.pyr.znpcsplus.api.entity.PropertyHolder
getAppliedProperties, getItemProperty, getProperty, hasProperty, setItemProperty, setProperty
-
Method Details
-
setType
Sets the npc type of this NPC- Parameters:
type
- TheNpcType
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
Sets the location of this NPC- Parameters:
location
- TheNpcLocation
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 theWorld
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
ofInteractionAction
s for this NPC
-
removeAction
void removeAction(int index) Removes an action from this NPC- Parameters:
index
- The index of the action to remove
-
addAction
Adds an action to this NPC- Parameters:
action
- TheInteractionAction
to add
-
editAction
Edits an action for this NPC- Parameters:
index
- The index of the action to editaction
- TheInteractionAction
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
- ThePlayer
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
- ThePlayer
to hide from
-
show
void show(org.bukkit.entity.Player player) Shows this NPC to a player- Parameters:
player
- ThePlayer
to show to
-
respawn
void respawn(org.bukkit.entity.Player player) Respawns this NPC for a player- Parameters:
player
- ThePlayer
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
- ThePlayer
to set the head rotation foryaw
- The yaw to setpitch
- 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 setpitch
- 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
-