Class NPC
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioncreate()
Creates the NPC.void
delete()
Permanantly deletes an NPC.Gets the equipment object representing the NPC's armor and hand itemsGets the object representing the NPC's settingsvoid
injectPlayer
(org.bukkit.entity.Player player) Injects the npc into the player's connection.void
lookAt
(org.bukkit.entity.Entity e, boolean atHead) Points the NPC's head in the direction of an entityvoid
lookAt
(org.bukkit.Location location) Points the NPC's head at a locationvoid
moveTo
(org.bukkit.Location location) Move the npc to the specified location.void
Reloads the NPC's settings within the Settings and Equipment objectsvoid
remove()
Temporarily removes an NPC.setActions
(Collection<Action> actions) Sets the NPC's actions to the specified CollectionsetBoots
(org.bukkit.inventory.ItemStack item) Deprecated.setChestplate
(org.bukkit.inventory.ItemStack item) Deprecated.in favour ofinvalid reference
dev.foxikle.customnpcs.data.Equipment#setChest(ItemStack)
void
setEquipment
(Equipment equipment) Sets the npc's equipmentsetHandItem
(org.bukkit.inventory.ItemStack item) Deprecated.in favour ofinvalid reference
dev.foxikle.customnpcs.data.Equipment#setHand(ItemStack)
setHeading
(double heading) Deprecated.in favour ofinvalid reference
Settings#setDirection(double)
setHelmet
(org.bukkit.inventory.ItemStack item) Deprecated.in favour ofinvalid reference
dev.foxikle.customnpcs.data.Equipment#setHead(ItemStack)
setInteractable
(boolean interactable) Deprecated.in favour ofinvalid reference
Settings#setInteractable(boolean)
setLeggings
(org.bukkit.inventory.ItemStack item) Deprecated.in favour ofinvalid reference
dev.foxikle.customnpcs.data.Equipment#setLegs(ItemStack)
Deprecated.in favour ofSettings.setName(Component)
setName
(@NotNull net.kyori.adventure.text.Component name) Deprecated.in favour ofSettings.setName(Component)
setOffhandItem
(org.bukkit.inventory.ItemStack item) Deprecated.in favour ofinvalid reference
dev.foxikle.customnpcs.data.Equipment#setOffhand(ItemStack)
setPostion
(@NotNull org.bukkit.Location loc) Sets the location of the NPCsetResilient
(boolean resilient) Deprecated.in favour ofinvalid reference
Settings#setResilient(boolean)
void
setSettings
(Settings settings) Sets the npc's settingsSets the leggings the NPC is wearingsetTunnelVision
(boolean tunnelVision) Deprecated.in favour ofinvalid reference
Settings#setTunnelvision(boolean)
void
swingArm()
Swings the NPC's arm
-
Constructor Details
-
NPC
public NPC(@NotNull @NotNull org.bukkit.World world) The intended way to create an NPCBy default, this npc has no actions
By default, this npc has no skin
By default, this npc has no name
By default, this npc is not interactable
By default, this npc is not resilient
By default, this npc has a yaw of 0
By default, this npc has tunnelvision
- Parameters:
world
- The world for the NPC to be created in- Throws:
NullPointerException
- if the world is nullIllegalStateException
- if the API is not initilized- Since:
- 1.5-pre5
-
NPC
public NPC(dev.foxikle.customnpcs.internal.interfaces.InternalNpc npc) A constructor for creating an api friendly npc object using an internal npc object.- Parameters:
npc
- the internal npc to wrap for the api
-
-
Method Details
-
setName
Deprecated.in favour ofSettings.setName(Component)
Sets the display name of the NPC This supports SERIALIZED MiniMessage.
- Parameters:
name
- the new name- Returns:
- the NPC with the modified name
- Since:
- 1.5.2-pre3
-
setName
@Deprecated @ScheduledForRemoval(inVersion="1.7") public NPC setName(@NotNull @NotNull net.kyori.adventure.text.Component name) Deprecated.in favour ofSettings.setName(Component)
Sets the display name of the NPC
- Parameters:
name
- of the NPC as an Adventure Component- Returns:
- the NPC with the modified name
- Since:
- 1.5.2-pre3
-
setPostion
Sets the location of the NPC
- Parameters:
loc
- the new location for the NPC- Returns:
- the NPC with the modified location
- Since:
- 1.5.2-pre3
-
setTunnelVision
Deprecated.in favour ofinvalid reference
Settings#setTunnelvision(boolean)
Sets the tunnelvision of the npc- Parameters:
tunnelVision
- if the npc should have TunnelVision (Not looking at players)- Returns:
- the npc with the modified TunnelVision
-
setSkin
public NPC setSkin(@NotNull @NotNull String skinName, @NotNull @NotNull String signature, @NotNull @NotNull String value) Sets the leggings the NPC is wearing
- Parameters:
skinName
- the name to reference the skin by.signature
- the encoded signature of the skin.value
- the encoded value of the skin- Returns:
- the NPC with the modified skin
- Throws:
NullPointerException
- if any argument is null- Since:
- 1.5.2-pre3
- See Also:
-
setHelmet
@Deprecated @ScheduledForRemoval(inVersion="1.7") public NPC setHelmet(org.bukkit.inventory.ItemStack item) Deprecated.in favour ofinvalid reference
dev.foxikle.customnpcs.data.Equipment#setHead(ItemStack)
Sets the helmet the NPC is wearing
- Parameters:
item
- the item to be used- Returns:
- the NPC with the modified helmet
- Since:
- 1.5.2-pre3
-
setChestplate
@Deprecated @ScheduledForRemoval(inVersion="1.7") public NPC setChestplate(org.bukkit.inventory.ItemStack item) Deprecated.in favour ofinvalid reference
dev.foxikle.customnpcs.data.Equipment#setChest(ItemStack)
Sets the chestplate the NPC is wearing
- Parameters:
item
- the item to be used- Returns:
- the NPC with the modified chestplate
- Since:
- 1.5.2-pre3
-
setLeggings
@Deprecated @ScheduledForRemoval(inVersion="1.7") public NPC setLeggings(org.bukkit.inventory.ItemStack item) Deprecated.in favour ofinvalid reference
dev.foxikle.customnpcs.data.Equipment#setLegs(ItemStack)
Sets the leggings the NPC is wearing
- Parameters:
item
- the item to be used- Returns:
- the NPC with the modified pair leggings
- Since:
- 1.5.2-pre3
-
setBoots
@Deprecated @ScheduledForRemoval(inVersion="1.7") public NPC setBoots(org.bukkit.inventory.ItemStack item) Deprecated.in favour ofinvalid reference
dev.foxikle.customnpcs.data.Equipment#setBoots(ItemStack)
Sets the boots the NPC is wearing
- Parameters:
item
- the item to be used- Returns:
- the NPC with the modified pair of boots
- Since:
- 1.5.2-pre3
-
setHandItem
@Deprecated @ScheduledForRemoval(inVersion="1.7") public NPC setHandItem(org.bukkit.inventory.ItemStack item) Deprecated.in favour ofinvalid reference
dev.foxikle.customnpcs.data.Equipment#setHand(ItemStack)
Sets the item in the NPC's hand
- Parameters:
item
- the item to be used- Returns:
- the NPC with the modified hand item
- Since:
- 1.5.2-pre3
-
setOffhandItem
@Deprecated @ScheduledForRemoval(inVersion="1.7") public NPC setOffhandItem(org.bukkit.inventory.ItemStack item) Deprecated.in favour ofinvalid reference
dev.foxikle.customnpcs.data.Equipment#setOffhand(ItemStack)
Sets the item in the NPC's offhand
- Parameters:
item
- the item to be used- Returns:
- the NPC with the modified offhand item
- Since:
- 1.5.2-pre3
-
setInteractable
Deprecated.in favour ofinvalid reference
Settings#setInteractable(boolean)
Sets the NPC's interactability
- Parameters:
interactable
- should the NPC be interactable?- Returns:
- the NPC with the modified interacability
- Since:
- 1.5.2-pre3
-
setResilient
Deprecated.in favour ofinvalid reference
Settings#setResilient(boolean)
Sets the NPC's persistence (staying on server restart/reload).
- Parameters:
resilient
- should the NPC persist on reloads/server restarts?- Returns:
- the NPC with the modified resiliency
- Since:
- 1.5.2-pre3
-
setHeading
Deprecated.in favour ofinvalid reference
Settings#setDirection(double)
Sets the NPC's facing direction
- Parameters:
heading
- the heading the NPC should face.- Returns:
- the NPC with the modified heading
- Since:
- 1.5.2-pre3
-
setActions
Sets the NPC's actions to the specified Collection
- Parameters:
actions
- the colection of actions- Returns:
- the NPC with the modified set of actions
- Since:
- 1.5.2-pre3
- See Also:
-
moveTo
public void moveTo(org.bukkit.Location location) Move the npc to the specified location. Takes into account pitch and yaw- Parameters:
location
- the location to move to
-
swingArm
public void swingArm()Swings the NPC's arm- Since:
- 1.5.2-pre3
-
injectPlayer
public void injectPlayer(org.bukkit.entity.Player player) Injects the npc into the player's connection. This should be handled by the plugin, but this is here for more control.- Parameters:
player
- the player to inject- Since:
- 1.5.2-pre3
- See Also:
-
lookAt
public void lookAt(org.bukkit.entity.Entity e, boolean atHead) Points the NPC's head in the direction of an entity- Parameters:
e
- The entity to look atatHead
- If the npc should look head (true), or feet (false)
-
lookAt
public void lookAt(org.bukkit.Location location) Points the NPC's head at a location- Parameters:
location
- the location to look at
-
create
Creates the NPC.
- Returns:
- UUID the NPC's uuid for later reference
- Since:
- 1.5.2-pre3
-
delete
public void delete()Permanantly deletes an NPC. They will NOT reappear on the next reload or server restart. The NPC will NOT be despawned. Only applicable if the NPC is resilient.
- Throws:
IllegalStateException
- if the NPC is not resilient- Since:
- 1.5.2-pre3
-
remove
public void remove()Temporarily removes an NPC. They will reappear on the next reload or server restart IF it is resilient.
- Since:
- 1.5.2-pre3
-
getSettings
Gets the object representing the NPC's settings- Returns:
- the object containing the resilience, tunnelvision, and interactablility
-
getEquipment
Gets the equipment object representing the NPC's armor and hand items- Returns:
- the equipment object holding the NPC's items
-
reloadSettings
public void reloadSettings()Reloads the NPC's settings within the Settings and Equipment objects- See Also:
-
setSettings
Sets the npc's settings- Parameters:
settings
- the settings to set- See Also:
-
setEquipment
Sets the npc's equipment- Parameters:
equipment
- the equipment to set- See Also:
-
invalid reference