Class HavenBagsPlacementBlocker
java.lang.Object
valorless.valorlessutils.havenbags.HavenBagsPlacementBlocker
- All Implemented Interfaces:
org.bukkit.event.Listener
A safeguard listener that prevents players from placing "HavenBags" items or skin tokens as blocks
when the HavenBags plugin is not enabled.
This ensures items that are meant to function only as bags (or special tokens) cannot be placed in the world as normal blocks, which could otherwise corrupt gameplay or break bag functionality.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic void
init()
Initializes the placement blocker by loading the HavenBags config and registering the event listener.static Boolean
IsBag
(org.bukkit.inventory.ItemStack item) Checks whether the given item is a HavenBag.static Boolean
IsSkinToken
(org.bukkit.inventory.ItemStack item) Checks whether the given item is a skin token.void
onBlockPlace
(org.bukkit.event.block.BlockPlaceEvent event) Event handler that prevents bag items or skin tokens from being placed as blocks if HavenBags is missing or disabled.
-
Constructor Details
-
HavenBagsPlacementBlocker
public HavenBagsPlacementBlocker()
-
-
Method Details
-
init
public static void init()Initializes the placement blocker by loading the HavenBags config and registering the event listener. If the config cannot be loaded, the blocker will not activate. -
onBlockPlace
public void onBlockPlace(org.bukkit.event.block.BlockPlaceEvent event) Event handler that prevents bag items or skin tokens from being placed as blocks if HavenBags is missing or disabled. Cancels the block placement if the placed item is recognized as a bag or token.- Parameters:
event
- the block placement event
-
IsBag
Checks whether the given item is a HavenBag.- Parameters:
item
- the item to check- Returns:
- true if the item contains a
bag-uuid
NBT tag
-
IsSkinToken
Checks whether the given item is a skin token.- Parameters:
item
- the item to check- Returns:
- true if the item contains a
bag-token-skin
NBT tag
-