Modifier and Type | Class and Description |
---|---|
static class |
Equipment.EquipmentSlot |
Constructor and Description |
---|
Equipment() |
Modifier and Type | Method and Description |
---|---|
org.bukkit.inventory.ItemStack |
get(Equipment.EquipmentSlot slot) |
org.bukkit.inventory.ItemStack |
get(int slot)
Get an NPC's equipment from the given slot.
|
org.bukkit.inventory.ItemStack[] |
getEquipment()
Get all of an NPC's equipment.
|
Map<Equipment.EquipmentSlot,org.bukkit.inventory.ItemStack> |
getEquipmentBySlot()
Get all of the equipment as a
Map . |
void |
load(DataKey key)
Loads a trait.
|
void |
onSpawn()
Called when an
NPC is spawned. |
void |
save(DataKey key)
Saves a trait.
|
void |
set(Equipment.EquipmentSlot slot,
org.bukkit.inventory.ItemStack item) |
void |
set(int slot,
org.bukkit.inventory.ItemStack item)
Set the armor from the given slot as the given item.
|
String |
toString() |
public org.bukkit.inventory.ItemStack get(Equipment.EquipmentSlot slot)
get(int)
public org.bukkit.inventory.ItemStack get(int slot)
slot
- Slot where the armor is located (0-5)public org.bukkit.inventory.ItemStack[] getEquipment()
public Map<Equipment.EquipmentSlot,org.bukkit.inventory.ItemStack> getEquipmentBySlot()
Map
.public void load(DataKey key) throws NPCLoadException
Trait
load
in class Trait
key
- DataKey to load fromNPCLoadException
- Thrown if this trait failed to load properlypublic void onSpawn()
Trait
NPC
is spawned. NPC.getEntity()
will return null until this is called. This is
also called onAttach when the NPC is already spawned.public void set(Equipment.EquipmentSlot slot, org.bukkit.inventory.ItemStack item)
set(int, ItemStack)
public void set(int slot, org.bukkit.inventory.ItemStack item)
slot
- Slot of the armor (must be between 0 and 5)item
- Item to set the armor asCopyright © 2021. All rights reserved.