Class LivingEntityToItemTransfiguration

Direct Known Subclasses:
LEPUS_SACCULUM, RANACULUS_AMPHORAM, SCARABAEUS_FIBULUM

public abstract class LivingEntityToItemTransfiguration extends EntityTransfiguration
Transforms entities in to items. This spell kills the entity (i.e. it does not revert)
  • Field Details

    • transfigurationMap

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

    • LivingEntityToItemTransfiguration

      public LivingEntityToItemTransfiguration(Ollivanders2 plugin)
      Default constructor for use in generating spell text. Do not use to cast the spell.
      Parameters:
      plugin - the Ollivanders2 plugin
    • LivingEntityToItemTransfiguration

      public LivingEntityToItemTransfiguration(@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. (super) It is not already under a non-permanent transfiguration
      7. The entity is a LivingEntity
      8. The entity type is in the transfiguration map, if it is populated

      Overrides:
      canTransfigure in class EntityTransfiguration
      Parameters:
      entity - the entity to check
      Returns:
      true if it can be changed