Class ModdedItem
java.lang.Object
me.mythicalflame.spigotmodding.items.ModdedItem
- Direct Known Subclasses:
ModdedArmorPiece
,ModdedConsumable
This class represents a custom item.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionboolean
protected org.bukkit.inventory.ItemStack
finalizeItem
(org.bukkit.inventory.ItemStack stack) This method is intended to be overridden by mod developers and is used to provide more control over the item.final Integer
final String
final String
getID()
org.bukkit.inventory.ItemStack
getItem()
org.bukkit.inventory.ItemStack
getItem
(int amount) final org.bukkit.Material
final String
final boolean
int
hashCode()
void
This method is intended to be overridden and is called when a player is the damager in an EntityDamageByEntityEvent.void
onInteract
(org.bukkit.event.player.PlayerInteractEvent event, EventType type) This method is intended to be overridden and is called when a player is associated with a PlayerInteractEvent.void
This method is intended to be overridden and is called when a player is the killer in an EntityDeathEvent.void
This method is intended to be overridden and is called every tick.
-
Constructor Details
-
ModdedItem
public ModdedItem(String namespace, String id, org.bukkit.Material material, String name, Integer customModelData, List<String> lore) Constructs a ModdedItem object.- Parameters:
namespace
- The non-null namespace that this item belongs to.id
- The non-null ID of this item.material
- The non-null Material that this item is based off of.name
- The nullable display name of this item.customModelData
- The nullable custom model data value of this item.lore
- The nullable lore of the item.
-
-
Method Details
-
finalizeItem
protected org.bukkit.inventory.ItemStack finalizeItem(org.bukkit.inventory.ItemStack stack) This method is intended to be overridden by mod developers and is used to provide more control over the item.Overrides of this method must NOT change the material of the ItemStack.
- Parameters:
stack
- The initial ItemStack created by the constructor with its specified parameters.- Returns:
- The finalized ItemStack representation of the item.
-
getNamespace
- Returns:
- The non-null namespace that this item belongs to.
-
getID
- Returns:
- The non-null ID of this item.
-
getMaterial
public final org.bukkit.Material getMaterial()- Returns:
- The non-null Material that this item is based off of.
-
getDisplayName
- Returns:
- The nullable display name of this item.
-
getCustomModelData
- Returns:
- The nullable custom model data value of this item.
-
hasCustomModelData
public final boolean hasCustomModelData()- Returns:
- Whether the item has custom model data or not.
-
getItem
public org.bukkit.inventory.ItemStack getItem()- Returns:
- A clone of the ItemStack representation of this item with an amount of 1.
-
getItem
public org.bukkit.inventory.ItemStack getItem(int amount) - Parameters:
amount
- The amount of items that should be in the ItemStack.- Returns:
- A clone of the ItemStack representation of this item with a variable amount.
-
onTick
This method is intended to be overridden and is called every tick.- Parameters:
player
- The player that has the item.type
- The type of this event.
-
onInteract
This method is intended to be overridden and is called when a player is associated with a PlayerInteractEvent.- Parameters:
event
- The PlayerInteractEvent.type
- The type of this event.
-
onKill
This method is intended to be overridden and is called when a player is the killer in an EntityDeathEvent.- Parameters:
event
- The EntityDeathEvent.type
- The type of this event.
-
onAttack
This method is intended to be overridden and is called when a player is the damager in an EntityDamageByEntityEvent.- Parameters:
event
- The EntityDamageByEntityEvent.type
- The type of this event.
-
equals
-
hashCode
public int hashCode()
-