Class Talisman
java.lang.Object
io.github.thebusybiscuit.slimefun4.api.items.SlimefunItem
io.github.thebusybiscuit.slimefun4.implementation.items.magical.talismans.Talisman
- All Implemented Interfaces:
Placeable
- Direct Known Subclasses:
MagicianTalisman
-
Field Summary
Modifier and TypeFieldDescriptionprotected final boolean
protected final int
protected final boolean
protected final PotionEffect[]
protected final String
protected static final ItemGroup
Fields inherited from class io.github.thebusybiscuit.slimefun4.api.items.SlimefunItem
addon, disenchantable, enchantable, hidden, recipeOutput, useableInWorkbench
-
Constructor Summary
ModifierConstructorDescriptionprotected
Talisman
(ItemGroup itemGroup, SlimefunItemStack item, ItemStack[] recipe, boolean consumable, boolean cancelEvent, String messageSuffix, int chance, PotionEffect... effects) Talisman
(SlimefunItemStack item, ItemStack[] recipe, boolean consumable, boolean cancelEvent, String messageSuffix, int chance, PotionEffect... effects) Talisman
(SlimefunItemStack item, ItemStack[] recipe, boolean consumable, boolean cancelEvent, String messageSuffix, PotionEffect... effects) Talisman
(SlimefunItemStack item, ItemStack[] recipe, String messageSuffix, int chance, PotionEffect... effects) -
Method Summary
Modifier and TypeMethodDescriptionint
This returns the chance of thisTalisman
activating.protected final String
boolean
This returns whether theTalisman
will be consumed upon use.protected boolean
boolean
isSilent()
This returns whether theTalisman
is silent.void
load()
This method is used for internal purposes only.void
This method is called afterSlimefunItem.register(SlimefunAddon)
.void
static boolean
trigger
(Event e, SlimefunItem item) static boolean
trigger
(Event e, SlimefunItem item, boolean sendMessage) static boolean
trigger
(Event e, SlimefunItemStack stack) static boolean
trigger
(Event e, SlimefunItemStack stack, boolean sendMessage) Methods inherited from class io.github.thebusybiscuit.slimefun4.api.items.SlimefunItem
addItemHandler, addItemSetting, addOfficialWikipage, callItemHandler, canUse, equals, error, getAddon, getBlockTicker, getById, getByItem, getDrops, getDrops, getHandlers, getId, getItem, getItemGroup, getItemName, getItemSetting, getItemSettings, getOptionalById, getOptionalByItem, getRecipe, getRecipeOutput, getRecipeType, getResearch, getState, getWikipage, hashCode, hasResearch, info, isDisabled, isDisabledIn, isDisenchantable, isEnchantable, isHidden, isItem, isItemStackImmutable, isTicking, isUseableInWorkbench, preRegister, register, sendDeprecationWarning, setHidden, setItemGroup, setRecipe, setRecipeOutput, setRecipeType, setResearch, setUseableInWorkbench, toString, warn
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface io.github.thebusybiscuit.slimefun4.core.attributes.Placeable
useVanillaBlockBreaking
-
Field Details
-
TALISMANS_ITEMGROUP
-
suffix
-
consumable
protected final boolean consumable -
cancel
protected final boolean cancel -
effects
-
chance
protected final int chance
-
-
Constructor Details
-
Talisman
@ParametersAreNonnullByDefault public Talisman(SlimefunItemStack item, ItemStack[] recipe, boolean consumable, boolean cancelEvent, @Nullable String messageSuffix, PotionEffect... effects) -
Talisman
@ParametersAreNonnullByDefault public Talisman(SlimefunItemStack item, ItemStack[] recipe, @Nullable String messageSuffix, int chance, PotionEffect... effects) -
Talisman
@ParametersAreNonnullByDefault public Talisman(SlimefunItemStack item, ItemStack[] recipe, boolean consumable, boolean cancelEvent, @Nullable String messageSuffix, int chance, PotionEffect... effects) -
Talisman
@ParametersAreNonnullByDefault protected Talisman(ItemGroup itemGroup, SlimefunItemStack item, ItemStack[] recipe, boolean consumable, boolean cancelEvent, @Nullable String messageSuffix, int chance, PotionEffect... effects)
-
-
Method Details
-
isConsumable
public boolean isConsumable()This returns whether theTalisman
will be consumed upon use.- Returns:
- Whether this
Talisman
is consumed on use.
-
getChance
public int getChance()This returns the chance of thisTalisman
activating. The chance will be between 1 and 100.- Returns:
- The chance of this
Talisman
activating.
-
getEffects
-
isEventCancelled
protected boolean isEventCancelled() -
postRegister
public void postRegister()Description copied from class:SlimefunItem
This method is called afterSlimefunItem.register(SlimefunAddon)
. Override this method to add any additional setup that needs to happen after the original registration of thisSlimefunItem
.- Overrides:
postRegister
in classSlimefunItem
-
load
public void load()Description copied from class:SlimefunItem
This method is used for internal purposes only.- Overrides:
load
in classSlimefunItem
-
trigger
-
trigger
@ParametersAreNonnullByDefault public static boolean trigger(Event e, SlimefunItemStack stack, boolean sendMessage) -
trigger
-
trigger
@ParametersAreNonnullByDefault public static boolean trigger(Event e, SlimefunItem item, boolean sendMessage) -
isSilent
public boolean isSilent()This returns whether theTalisman
is silent. A silentTalisman
will not send a message to aPlayer
when activated.- Returns:
- Whether this
Talisman
is silent
-
getMessageSuffix
-
sendMessage
This method sends the givenPlayer
the message of thisTalisman
. Dependent on the selected config setting, the message will be sent via the actionbar or in the chat window.- Parameters:
p
- ThePlayer
who shall receive the message
-