Class RegionManager
java.lang.Object
me.fami6xx.rpuniverse.core.regions.RegionManager
- All Implemented Interfaces:
org.bukkit.event.Listener
Manages all regions in memory and provides save/load functionality via manual JSON
(including corner1 and corner2). Also provides a method to get all regions containing a location.
-
Method Summary
Modifier and TypeMethodDescriptioncreateRegion(String name, org.bukkit.Location corner1, org.bukkit.Location corner2)Create and store a region in memory.booleandeleteRegion(UUID regionId)Deletes a region from memory by its UUID.Returns all current regions.static RegionManagerGet the singleton instance of RegionManager.getRegionById(UUID regionId)Get a region by its UUID.getRegionByName(String name)Finds a region by name.getRegionsContainingLocation(org.bukkit.Location loc)Returns all regions that contain the given location (same world, x/y/z in range).voidhideRegion(org.bukkit.entity.Player player, Region region)Hides region boundaries (particles) for a player.voidinit()Load all regions from file (if any), manually parsing corner1 and corner2.booleanisShowingRegion(org.bukkit.entity.Player player, Region region)Checks if the player is currently showing a given region.voidonBlockBreakEvent(org.bukkit.event.block.BlockBreakEvent e)voidonPlayerQuit(org.bukkit.event.player.PlayerQuitEvent e)voidSave all regions to file, manually writing out corner1 and corner2 in JSON.voidshowRegion(org.bukkit.entity.Player player, Region region)Shows region boundaries to a player (repeats via the scheduled task).voidshutdown()Saves all regions and cancels the repeating particle task.
-
Method Details
-
getInstance
Get the singleton instance of RegionManager. -
init
public void init()Load all regions from file (if any), manually parsing corner1 and corner2. -
shutdown
public void shutdown()Saves all regions and cancels the repeating particle task. -
saveAllRegions
public void saveAllRegions()Save all regions to file, manually writing out corner1 and corner2 in JSON. -
createRegion
Create and store a region in memory. Does NOT auto-save to file. -
deleteRegion
Deletes a region from memory by its UUID. Does NOT auto-save to file.- Returns:
- true if the region was removed, false if it didn't exist
-
getRegionByName
Finds a region by name. Returns the first match or null if none found. -
getRegionById
Get a region by its UUID. -
getAllRegions
Returns all current regions. -
getRegionsContainingLocation
Returns all regions that contain the given location (same world, x/y/z in range). -
showRegion
Shows region boundaries to a player (repeats via the scheduled task). -
hideRegion
Hides region boundaries (particles) for a player. -
isShowingRegion
Checks if the player is currently showing a given region. -
onPlayerQuit
public void onPlayerQuit(org.bukkit.event.player.PlayerQuitEvent e) -
onBlockBreakEvent
public void onBlockBreakEvent(org.bukkit.event.block.BlockBreakEvent e)
-