Class ModdedItem

java.lang.Object
me.mythicalflame.spigotmodding.items.ModdedItem
Direct Known Subclasses:
ModdedArmorPiece, ModdedConsumable

public abstract class ModdedItem extends Object
This class represents a custom item.
  • Constructor Summary

    Constructors
    Constructor
    Description
    ModdedItem(String namespace, String id, org.bukkit.Material material, String name, Integer customModelData, List<String> lore)
    Constructs a ModdedItem object.
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    equals(Object other)
     
    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
     
    org.bukkit.inventory.ItemStack
     
    org.bukkit.inventory.ItemStack
    getItem(int amount)
     
    final org.bukkit.Material
     
    final String
     
    final boolean
     
    int
     
    void
    onAttack(org.bukkit.event.entity.EntityDamageByEntityEvent event, EventType type)
    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
    onKill(org.bukkit.event.entity.EntityDeathEvent event, EventType type)
    This method is intended to be overridden and is called when a player is the killer in an EntityDeathEvent.
    void
    onTick(org.bukkit.entity.Player player, EventType type)
    This method is intended to be overridden and is called every tick.

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
  • 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

      public final String getNamespace()
      Returns:
      The non-null namespace that this item belongs to.
    • getID

      public final String 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

      public final String getDisplayName()
      Returns:
      The nullable display name of this item.
    • getCustomModelData

      public final Integer 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

      public void onTick(org.bukkit.entity.Player player, EventType type)
      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

      public 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.
      Parameters:
      event - The PlayerInteractEvent.
      type - The type of this event.
    • onKill

      public void onKill(org.bukkit.event.entity.EntityDeathEvent event, EventType type)
      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

      public void onAttack(org.bukkit.event.entity.EntityDamageByEntityEvent event, EventType type)
      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

      public boolean equals(Object other)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object