Package lol.pyr.znpcsplus.api.npc
Interface Npc
- All Superinterfaces:
PropertyHolder
Base class for all NPCs
-
Method Summary
Modifier and TypeMethodDescriptionvoidaddAction(InteractionAction action) Adds an action to this NPCvoidClears all actions from this NPCvoideditAction(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 NPCintgetType()getUuid()Gets the unique ID of this NPCSet<org.bukkit.entity.Player>org.bukkit.WorldgetWorld()Gets theWorldthis NPC is in Note: can be null if the world is unloaded or does not existvoidhide(org.bukkit.entity.Player player) Hides this NPC from a playerbooleanGets if the npc is enabled or not, i.e.booleanisVisibleTo(org.bukkit.entity.Player player) Gets if this NPC is visible to a playervoidremoveAction(int index) Removes an action from this NPCvoidrespawn(org.bukkit.entity.Player player) Respawns this NPC for a playervoidsetEnabled(boolean enabled) Sets if the npc is enabled or not, i.e.voidsetHeadRotation(float yaw, float pitch) Sets the head rotation of this NPC for all players/viewersvoidsetHeadRotation(org.bukkit.entity.Player player, float yaw, float pitch) Sets the head rotation of this NPC for a playervoidsetLocation(NpcLocation location) Sets the location of this NPCvoidSets the npc type of this NPCvoidshow(org.bukkit.entity.Player player) Shows this NPC to a playervoidswingHand(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- TheNpcTypeto set
-
getType
NpcType getType()- Returns:
- The
NpcTypeof this NPC
-
getLocation
NpcLocation getLocation()Gets the location of this NPC- Returns:
- The
NpcLocationof this NPC
-
setLocation
Sets the location of this NPC- Parameters:
location- TheNpcLocationto set
-
getHologram
Hologram getHologram()Gets the hologram of this NPC- Returns:
- The
Hologramof 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 theWorldthis NPC is in Note: can be null if the world is unloaded or does not exist- Returns:
- The
Worldthis NPC is in
-
getActions
List<? extends InteractionAction> getActions()Gets the list of actions for this NPC- Returns:
- The
ListofInteractionActions 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- TheInteractionActionto add
-
editAction
Edits an action for this NPC- Parameters:
index- The index of the action to editaction- TheInteractionActionto 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- ThePlayerto 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- ThePlayerto hide from
-
show
void show(org.bukkit.entity.Player player) Shows this NPC to a player- Parameters:
player- ThePlayerto show to
-
respawn
void respawn(org.bukkit.entity.Player player) Respawns this NPC for a player- Parameters:
player- ThePlayerto 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- ThePlayerto 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
-