Class 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 Details

    • transfigurationMap

      protected Map<org.bukkit.Material,org.bukkit.entity.EntityType> transfigurationMap
      If this is populated, any material type key will be changed to the entity type
  • Constructor Details

    • ItemToEntityTransfiguration

      public ItemToEntityTransfiguration(Ollivanders2 plugin)
      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 plugin
      player - the player who cast this spell
      rightWand - 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:
      transfigureEntity in class EntityTransfiguration
      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:
      canTransfigure in class EntityTransfiguration
      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