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 Summary
Modifier and TypeMethodDescriptionReturns the handler that's been called whenever someone uses an item
UsesDeadSpecialItemUseHandler
as the default onegetId()
Returns the id that's being used in e.g. the shop configReturns the item that the player will receive once he purchases the item.default String
getName()
Same asgetName(CommandSender)
, but uses the default languagegetName
(@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 insteadReturns the original ItemStack that's being passed during initiation.Returns the plugin that created the itemgetType()
Returns the type to make it easier for you to differentiate itdefault boolean
Returns whether this item has been registered usingGameAPI.registerSpecialItem(SpecialItem)
boolean
isSpecialItem
(ItemStack itemStack) Returns whether or not the givenItemStack
is running this SpecialItem when used.void
setHandler
(SpecialItemUseHandler handler) Set the handler that's been called whenever someone uses the item.
-
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
Same asgetName(CommandSender)
, but uses the default language- Returns:
- The name of the item in the default language
-
getName
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
Returns whether or not the givenItemStack
is running this SpecialItem when used.- Returns:
true
if it's the one for this SpecialItem. Otherwisefalse
-
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
UsesDeadSpecialItemUseHandler
as the default one- Returns:
- The use handler of the special item
-
setHandler
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 usingGameAPI.registerSpecialItem(SpecialItem)
- Returns:
- Whether this item is registered
-