Class PowerItemsEvent

java.lang.Object
valorless.rarespawns.events.PowerItemsEvent
All Implemented Interfaces:
org.bukkit.event.Listener

public class PowerItemsEvent extends Object implements org.bukkit.event.Listener
Bukkit listener for RareSpawns power items.

Handles placement and interaction logic for special items (Breaker, Redstone, Trowel), including permissions, claims, sound/particle feedback, drops, and cooldowns. Register with init() during plugin startup.

  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    HandleEvent(String id, org.bukkit.event.Event event)
    Central dispatcher for power item behavior.
    static void
    Registers this listener with the server's plugin manager.
    static boolean
    isBlockCustom(org.bukkit.inventory.ItemStack item)
     
    boolean
    isEntityBlockingPlacement(org.bukkit.block.Block block)
    Checks whether any non-trivial entity overlaps the target block space, preventing placement.
    static Boolean
    isWorldBlacklisted(org.bukkit.World world, ItemData itemData)
    World access control: treats the provided list as an allow-list.
    void
    onBlockPhysics(org.bukkit.event.block.BlockPhysicsEvent event)
    Cancels physics updates for blocks marked with "noUpdate" metadata.
    void
    onBlockPlace(org.bukkit.event.block.BlockPlaceEvent event)
    Handles rare item placement.
    void
    onBlockRedstone(org.bukkit.event.block.BlockRedstoneEvent event)
    Locks redstone current for blocks marked with "noUpdate" metadata.
    void
    onPlayerInteract(org.bukkit.event.player.PlayerInteractEvent event)
    Handles right-click interactions with blocks while holding a rare item.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • PowerItemsEvent

      public PowerItemsEvent()
  • Method Details

    • init

      public static void init()
      Registers this listener with the server's plugin manager.
    • onBlockPlace

      public void onBlockPlace(org.bukkit.event.block.BlockPlaceEvent event)
      Handles rare item placement. Dispatches to specific power item logic when a matching item is placed against a block.
      Parameters:
      event - Block place event
    • onPlayerInteract

      public void onPlayerInteract(org.bukkit.event.player.PlayerInteractEvent event)
      Handles right-click interactions with blocks while holding a rare item.
      Parameters:
      event - Player interact event
    • onBlockPhysics

      public void onBlockPhysics(org.bukkit.event.block.BlockPhysicsEvent event)
      Cancels physics updates for blocks marked with "noUpdate" metadata. Prevents server from immediately reverting programmatic redstone changes.
      Parameters:
      event - block physics event
    • onBlockRedstone

      public void onBlockRedstone(org.bukkit.event.block.BlockRedstoneEvent event)
      Locks redstone current for blocks marked with "noUpdate" metadata.
      Parameters:
      event - redstone update event
    • HandleEvent

      public Boolean HandleEvent(String id, org.bukkit.event.Event event)
      Central dispatcher for power item behavior. Verifies claims and permissions and invokes the matching handler based on PowerItemType.
      Parameters:
      id - rare item identifier
      event - triggering event (place or interact)
      Returns:
      true if the event was handled and item effects applied; false otherwise
    • isBlockCustom

      public static boolean isBlockCustom(org.bukkit.inventory.ItemStack item)
    • isWorldBlacklisted

      public static Boolean isWorldBlacklisted(org.bukkit.World world, ItemData itemData)
      World access control: treats the provided list as an allow-list. Returns true if the current world is not allowed and the item should be blocked. Supports dimension wildcards "*_nether" and "*_the_end".
      Parameters:
      world - world of the action
      itemData - power item data containing the allow list
      Returns:
      true if the world is blocked for this item
    • isEntityBlockingPlacement

      public boolean isEntityBlockingPlacement(org.bukkit.block.Block block)
      Checks whether any non-trivial entity overlaps the target block space, preventing placement.
      Parameters:
      block - target block position
      Returns:
      true if an entity is blocking placement