Class ItemToEntityTransfiguration
java.lang.Object
net.pottercraft.ollivanders2.spell.O2Spell
net.pottercraft.ollivanders2.spell.TransfigurationBase
net.pottercraft.ollivanders2.spell.EntityTransfiguration
net.pottercraft.ollivanders2.spell.ItemToEntityTransfiguration
- All Implemented Interfaces:
org.bukkit.event.Listener
- Direct Known Subclasses:
LAPIFORS,MORTUOS_SUSCITATE,SNUFFLIFORS
public abstract class ItemToEntityTransfiguration
extends EntityTransfiguration
implements org.bukkit.event.Listener
Transform items to entities. This spell always consumes the item (ie. it doesn't come back on revert)
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected Map<org.bukkit.Material, org.bukkit.entity.EntityType> If this is populated, any material type key will be changed to the entity typeFields inherited from class net.pottercraft.ollivanders2.spell.TransfigurationBase
successRateFields 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
ConstructorsConstructorDescriptionItemToEntityTransfiguration(@NotNull Ollivanders2 plugin, @NotNull org.bukkit.entity.Player player, @NotNull Double rightWand) Constructor.Default constructor for use in generating spell text. -
Method Summary
Modifier and TypeMethodDescriptionprotected booleancanTransfigure(@NotNull org.bukkit.entity.Entity entity) Determine if this entity be transfigured by this spell.voidonEntityDeath(org.bukkit.event.entity.EntityDeathEvent event) Handle when the entity is killed.protected @Nullable org.bukkit.entity.EntitytransfigureEntity(@NotNull org.bukkit.entity.Entity entity) Transfigures item into EntityType.Methods inherited from class net.pottercraft.ollivanders2.spell.EntityTransfiguration
isBlockTransfigured, isEntityTransfigured, revertMethods inherited from class net.pottercraft.ollivanders2.spell.TransfigurationBase
doCheckEffect, isConsumeOriginal, isPermanent, isTransfiguredMethods inherited from class net.pottercraft.ollivanders2.spell.O2Spell
checkEffect, getCloseEntities, getCoolDown, getFailureMessage, getFlavorText, getLevel, getLifeTicks, getMagicBranch, getName, getNearbyDamageableEntities, getNearbyItems, getNearbyLivingEntities, getNearbyPlayers, getSuccessMessage, getTargetBlock, getText, getWorldGuardFlags, hasHitTarget, isAtMaxDistance, isKilled, isSpellAllowed, kill, move, sendFailureMessage, sendSuccessMessage, setUsesModifier
-
Field Details
-
transfigurationMap
If this is populated, any material type key will be changed to the entity type
-
-
Constructor Details
-
ItemToEntityTransfiguration
Default constructor for use in generating spell text. Do not use to cast the spell.- Parameters:
plugin- the Ollivanders2 plugin
-
ItemToEntityTransfiguration
public ItemToEntityTransfiguration(@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
-
transfigureEntity
@Nullable protected @Nullable org.bukkit.entity.Entity transfigureEntity(@NotNull @NotNull org.bukkit.entity.Entity entity) Transfigures item into EntityType.- Specified by:
transfigureEntityin classEntityTransfiguration- Parameters:
entity- the item to transfigure- Returns:
- the transfigured entity if successful, null otherwise
-
canTransfigure
protected boolean canTransfigure(@NotNull @NotNull org.bukkit.entity.Entity entity) Determine if this entity be transfigured by this spell.Entity can transfigure if:
1. (super) success check passes
2. (super) It is not in the blocked list
3. (super) It is in the allowed list, if the allowed list exists
4. (super) The entity is not already the target type
5. (super) There are no WorldGuard permissions preventing the caster from altering this entity type
6. The entity is an Item
7. The item type is in the transfiguration map, if it is populated
8. The item is not enchanted -or- the magic level of the enchantment is lower than this spell's magic level- Overrides:
canTransfigurein classEntityTransfiguration- Parameters:
entity- the entity to check- Returns:
- true if it can be changed
-
onEntityDeath
public void onEntityDeath(org.bukkit.event.entity.EntityDeathEvent event) Handle when the entity is killed.- Parameters:
event- the entity death event
-