Interface SpecialItem


public interface SpecialItem
Represents the type of SpecialItem and not one for every given item to the player. Meaning there's only one global instance of every type.

Use GameAPI.registerSpecialItem(String, Plugin, String, ItemStack) to initiate a new one.

  • Method Details

    • getType

      SpecialItemType getType()
      Returns the type to make it easier for you to differentiate it
      Returns:
      The type of this special item
    • getId

      String getId()
      Returns the id that's being used in e.g. the shop config
      Returns:
      The id of this item
    • getName

      default String getName()
      Same as getName(CommandSender), but uses the default language
      Returns:
      The name of the item in the default language
    • getName

      String getName(@Nullable @Nullable CommandSender sender)
      Returns the name of this item in the language of the given sender.
      If sender is null then it'll use the default language instead
      Parameters:
      sender - The person from which it should look up the language. Null if it should take the default language
      Returns:
      The name of the item in the language of the sender
    • getItemStack

      ItemStack getItemStack()
      Returns the item that the player will receive once he purchases the item.

      Keep in mind that this is not the original ItemStack. The plugin may add its own tags to make it unique and more identifiable from others. Use getOriginalItemStack() if you look to obtain the original one.

      Returns:
      The ItemStack of the item that's useable ingame
    • getOriginalItemStack

      ItemStack getOriginalItemStack()
      Returns the original ItemStack that's being passed during initiation.

      The returned ItemStack is not usable ingame. Use getItemStack() instead if that's what you're looking for.

      Returns:
      The original, non-modified ItemStack
    • isSpecialItem

      boolean isSpecialItem(ItemStack itemStack)
      Returns whether or not the given ItemStack is running this SpecialItem when used.
      Returns:
      true if it's the one for this SpecialItem. Otherwise false
    • getPlugin

      Plugin getPlugin()
      Returns the plugin that created the item
      Returns:
      The plugin that created this special item
    • getHandler

      SpecialItemUseHandler getHandler()
      Returns the handler that's been called whenever someone uses an item
      Uses DeadSpecialItemUseHandler as the default one
      Returns:
      The use handler of the special item
    • setHandler

      void setHandler(SpecialItemUseHandler handler)
      Set the handler that's been called whenever someone uses the item.
      Parameters:
      handler - The new use handler
    • isRegistered

      default boolean isRegistered()
      Returns whether this item has been registered using GameAPI.registerSpecialItem(SpecialItem)
      Returns:
      Whether this item is registered