Class RegionManager

java.lang.Object
me.fami6xx.rpuniverse.core.regions.RegionManager
All Implemented Interfaces:
org.bukkit.event.Listener

public class RegionManager extends Object implements 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 Details

    • getInstance

      public static RegionManager 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

      public Region createRegion(String name, org.bukkit.Location corner1, org.bukkit.Location corner2)
      Create and store a region in memory. Does NOT auto-save to file.
    • deleteRegion

      public boolean deleteRegion(UUID regionId)
      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

      public Region getRegionByName(String name)
      Finds a region by name. Returns the first match or null if none found.
    • getRegionById

      public Region getRegionById(UUID regionId)
      Get a region by its UUID.
    • getAllRegions

      public Collection<Region> getAllRegions()
      Returns all current regions.
    • getRegionsContainingLocation

      public List<Region> getRegionsContainingLocation(org.bukkit.Location loc)
      Returns all regions that contain the given location (same world, x/y/z in range).
    • showRegion

      public void showRegion(org.bukkit.entity.Player player, Region region)
      Shows region boundaries to a player (repeats via the scheduled task).
    • hideRegion

      public void hideRegion(org.bukkit.entity.Player player, Region region)
      Hides region boundaries (particles) for a player.
    • isShowingRegion

      public boolean isShowingRegion(org.bukkit.entity.Player player, Region region)
      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)