Class ItemEnchant
java.lang.Object
net.pottercraft.ollivanders2.spell.O2Spell
net.pottercraft.ollivanders2.spell.ItemEnchant
Place an enchantment on an item.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected ItemEnchantmentTypeThe type of enchantmentprotected ArrayList<org.bukkit.Material> The list of item types that this can enchant, if limited.protected ArrayList<O2ItemType> The list of item types that this can enchant, if limited.Fields inherited from class net.pottercraft.ollivanders2.spell.O2Spell
branch, cooldownMessage, defaultRadius, flavorText, isAllowedFailureMessage, location, maxProjectileDistance, maxSpellLifetime, noProjectile, player, rightWand, spellMasteryLevel, spellType, text, usesModifier, vector -
Constructor Summary
ConstructorsConstructorDescriptionItemEnchant(@NotNull Ollivanders2 plugin, @NotNull org.bukkit.entity.Player player, @NotNull Double rightWand) Constructor.ItemEnchant(Ollivanders2 plugin) Default constructor for use in generating spell text. -
Method Summary
Modifier and TypeMethodDescriptionprotected @Nullable org.bukkit.entity.ItemalterItem(org.bukkit.entity.Item item) Do any after effects on the item.protected org.bukkit.inventory.ItemStackalterItem(org.bukkit.inventory.ItemStack itemStack) Do any after effects on the item.protected booleancanBeEnchanted(@NotNull org.bukkit.entity.Item item) Can this item be enchanted by this spell?protected booleancanBeEnchanted(@NotNull org.bukkit.inventory.ItemStack itemStack) Can this item be enchanted by this spell?voidOverride checkEffect to handle the enchantments that target an item in the player's inventory.protected voidAdd the enchantment to an item stack in the projectile's locationprotected voidEnchants the item held in the player's off-handprotected voidinitEnchantmentArgs(org.bukkit.inventory.ItemStack itemStack) Set the enchantment arg string.Methods inherited from class net.pottercraft.ollivanders2.spell.O2Spell
getCloseEntities, getCoolDown, getFailureMessage, getFlavorText, getLevel, getLifeTicks, getMagicBranch, getName, getNearbyDamageableEntities, getNearbyItems, getNearbyLivingEntities, getNearbyPlayers, getSuccessMessage, getTargetBlock, getText, getWorldGuardFlags, hasHitTarget, isAtMaxDistance, isKilled, isSpellAllowed, kill, move, revert, sendFailureMessage, sendSuccessMessage, setUsesModifier
-
Field Details
-
enchantmentType
The type of enchantment -
o2ItemTypeAllowList
The list of item types that this can enchant, if limited. When empty, all item types can be enchanted Cannot be mixed and match with o2ItemTypeAllowList (only use one or the other) -
itemTypeAllowlist
The list of item types that this can enchant, if limited. When empty, all item types can be enchanted. Cannot be mixed and match with o2ItemTypeAllowList (only use one or the other)
-
-
Constructor Details
-
ItemEnchant
Default constructor for use in generating spell text. Do not use to cast the spell.- Parameters:
plugin- the Ollivanders2 plugin
-
ItemEnchant
public ItemEnchant(@NotNull @NotNull Ollivanders2 plugin, @NotNull @NotNull org.bukkit.entity.Player player, @NotNull @NotNull Double rightWand) Constructor.- Parameters:
plugin- a callback to the MC pluginplayer- the player who cast this spellrightWand- which wand the player was using
-
-
Method Details
-
checkEffect
public void checkEffect()Override checkEffect to handle the enchantments that target an item in the player's inventory.- Overrides:
checkEffectin classO2Spell
-
enchantHeldItem
protected void enchantHeldItem()Enchants the item held in the player's off-hand -
doCheckEffect
protected void doCheckEffect()Add the enchantment to an item stack in the projectile's location- Specified by:
doCheckEffectin classO2Spell
-
canBeEnchanted
protected boolean canBeEnchanted(@NotNull @NotNull org.bukkit.inventory.ItemStack itemStack) Can this item be enchanted by this spell?- Parameters:
itemStack- the item to check- Returns:
- true if it can be enchanted, false otherwise
-
canBeEnchanted
protected boolean canBeEnchanted(@NotNull @NotNull org.bukkit.entity.Item item) Can this item be enchanted by this spell?- Parameters:
item- the item to check- Returns:
- true if it can be enchanted, false otherwise
-
initEnchantmentArgs
protected void initEnchantmentArgs(org.bukkit.inventory.ItemStack itemStack) Set the enchantment arg string. This needs to be overridden by the classes that need it.- Parameters:
itemStack- the item being enchanted
-
alterItem
@Nullable protected @Nullable org.bukkit.entity.Item alterItem(org.bukkit.entity.Item item) Do any after effects on the item. This needs to be overridden by the classes that need it.- Parameters:
item- the item to affect- Returns:
- the altered item
-
alterItem
protected org.bukkit.inventory.ItemStack alterItem(org.bukkit.inventory.ItemStack itemStack) Do any after effects on the item. This needs to be overridden by the classes that need it.- Parameters:
itemStack- the item to affect- Returns:
- the altered item
-