java.lang.Object
net.pottercraft.ollivanders2.item.enchantment.Enchantment
net.pottercraft.ollivanders2.item.enchantment.PORTUS

public class PORTUS extends Enchantment
PORTUS portkey enchantment for items.

PORTUS is an expert-level enchantment that transforms an item into a portkey—a magical transportation device that teleports players to a predetermined destination when picked up. Portkeys are powerful magical objects that can transport multiple players at once within a configurable radius.

Portkey behavior:

  • Player pickup: teleports the player and all players within the radius to the destination
  • Non-player pickup: blocked, only players can activate portkeys
  • Hopper pickup: blocked, portkeys cannot be collected by automated systems
  • Round-trip: after activation, the destination is updated to return to the pickup location
  • Proximity check: portkeys won't activate if the player is within 3 blocks of the destination

Teleportation can be blocked by stationary spells:

See Also:
  • Constructor Details

    • PORTUS

      public PORTUS(@NotNull @NotNull Ollivanders2 plugin, int mag, @Nullable @Nullable String args, @Nullable @Nullable String itemLore)
      Constructor for creating a PORTUS portkey enchantment instance.

      Parses the destination location from the args parameter and optionally reads the portkey radius from the plugin configuration (key: "portkeyRadius"). If the destination cannot be parsed (invalid format, world not found), the portkey will not function.

      Parameters:
      plugin - the Ollivanders2 plugin instance
      mag - the magnitude (power level) of this enchantment
      args - the destination location in the format "world_name X Y Z", e.g., "world 10 100 5"
      itemLore - optional custom lore to display on the enchanted portkey item
  • Method Details

    • doEntityPickupItem

      public void doEntityPickupItem(@NotNull @NotNull org.bukkit.event.entity.EntityPickupItemEvent event)
      Activate the portkey when a player picks it up.

      When a player picks up a portkey, this method teleports the player and all nearby players (within the configured radius) to the portkey's destination. After teleportation, the destination is updated to the pickup location, creating a round-trip portkey.

      Teleportation is blocked when:

      Specified by:
      doEntityPickupItem in class Enchantment
      Parameters:
      event - the entity item pickup event
    • doInventoryPickupItem

      public void doInventoryPickupItem(@NotNull @NotNull org.bukkit.event.inventory.InventoryPickupItemEvent event)
      Prevent hoppers and block inventories from picking up portkeys.

      Portkeys can only be activated by players, so automated collection systems are blocked. This ensures portkeys remain available for players to find and use as intended.

      Specified by:
      doInventoryPickupItem in class Enchantment
      Parameters:
      event - the inventory pickup item event
    • doItemDrop

      public void doItemDrop(@NotNull @NotNull org.bukkit.event.player.PlayerDropItemEvent event)
      No special handling for item drop events.

      PORTUS portkeys do not have any special behavior when dropped. The portkey only activates when picked up by a player, not when dropped.

      Specified by:
      doItemDrop in class Enchantment
      Parameters:
      event - the player drop item event (not used)
    • doItemHeld

      public void doItemHeld(@NotNull @NotNull org.bukkit.event.player.PlayerItemHeldEvent event)
      No special handling for item held events.

      PORTUS portkeys do not have any special behavior when the player switches between hotbar slots. The portkey only activates when picked up from the world, not when held or switched to.

      Specified by:
      doItemHeld in class Enchantment
      Parameters:
      event - the player item held event (not used)
    • getRadius

      public int getRadius()
      Get the effect radius for this portkey
      Returns:
      the effect radius
    • getDestination

      @Nullable public @Nullable org.bukkit.Location getDestination()
      Get the destination location for this portkey.

      Returns a clone of the destination so that it cannot be modified by other classes. The destination may be null if the portkey was not properly configured (invalid args format, world not found, etc.).

      Returns:
      the destination location, or null if the portkey destination was not properly configured