Package valorless.rarespawns.events
Class PowerItemsEvent
java.lang.Object
valorless.rarespawns.events.PowerItemsEvent
- All Implemented Interfaces:
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 -
Method Summary
Modifier and TypeMethodDescriptionHandleEvent(String id, org.bukkit.event.Event event) Central dispatcher for power item behavior.static voidinit()Registers this listener with the server's plugin manager.static booleanisBlockCustom(org.bukkit.inventory.ItemStack item) booleanisEntityBlockingPlacement(org.bukkit.block.Block block) Checks whether any non-trivial entity overlaps the target block space, preventing placement.static BooleanisWorldBlacklisted(org.bukkit.World world, ItemData itemData) World access control: treats the provided list as an allow-list.voidonBlockPhysics(org.bukkit.event.block.BlockPhysicsEvent event) Cancels physics updates for blocks marked with "noUpdate" metadata.voidonBlockPlace(org.bukkit.event.block.BlockPlaceEvent event) Handles rare item placement.voidonBlockRedstone(org.bukkit.event.block.BlockRedstoneEvent event) Locks redstone current for blocks marked with "noUpdate" metadata.voidonPlayerInteract(org.bukkit.event.player.PlayerInteractEvent event) Handles right-click interactions with blocks while holding a rare item.
-
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
Central dispatcher for power item behavior. Verifies claims and permissions and invokes the matching handler based onPowerItemType.- Parameters:
id- rare item identifierevent- 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
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 actionitemData- 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
-