Class WGUtils

java.lang.Object
dev.espi.protectionstones.utils.WGUtils

public class WGUtils extends Object
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static int
     
    static int
     
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static boolean
     
    static String
    createPSID​(double bx, double by, double bz)
     
    static String
    createPSID​(org.bukkit.Location l)
     
    static Set<com.sk89q.worldguard.protection.regions.ProtectedRegion>
    findOverlapOrAdjacentRegions​(com.sk89q.worldguard.protection.regions.ProtectedRegion r, com.sk89q.worldguard.protection.managers.RegionManager rgm, org.bukkit.World w)
    Find regions that are overlapping or adjacent to the region given.
    static Set<com.sk89q.worldguard.protection.regions.ProtectedRegion>
    findOverlapOrAdjacentRegions​(com.sk89q.worldguard.protection.regions.ProtectedRegion r, List<com.sk89q.worldguard.protection.regions.ProtectedRegion> regionsToCheck, org.bukkit.World w)
    Find regions that are overlapping or adjacent to the region given.
    static HashMap<org.bukkit.World,​com.sk89q.worldguard.protection.managers.RegionManager>
    Get all region managers for all worlds.
    static com.sk89q.worldguard.protection.regions.ProtectedCuboidRegion
     
    static com.sk89q.worldguard.protection.flags.registry.FlagRegistry
     
    static com.sk89q.worldedit.math.BlockVector3
    getMaxChunkVector​(double bx, double by, double bz, long chunkRadius, long yRadius)
     
    static com.sk89q.worldedit.math.BlockVector3
    getMaxVector​(double bx, double by, double bz, long xRadius, long yRadius, long zRadius)
     
    static com.sk89q.worldedit.math.BlockVector3
    getMinChunkVector​(double bx, double by, double bz, long chunkRadius, long yRadius)
     
    static com.sk89q.worldedit.math.BlockVector3
    getMinVector​(double bx, double by, double bz, long xRadius, long yRadius, long zRadius)
     
    getPlayerAdjacentRegionGroups​(org.bukkit.entity.Player p, com.sk89q.worldguard.protection.managers.RegionManager rm)
     
    static List<com.sk89q.worldedit.math.BlockVector2>
     
    static com.sk89q.worldguard.protection.managers.RegionManager
    getRegionManagerWithPlayer​(org.bukkit.entity.Player p)
     
    static com.sk89q.worldguard.protection.managers.RegionManager
    getRegionManagerWithWorld​(org.bukkit.World w)
    Get a RegionManager from a world.
    static List<com.sk89q.worldguard.protection.regions.ProtectedRegion>
    getTransientEdgeRegions​(org.bukkit.World w, com.sk89q.worldguard.protection.regions.ProtectedRegion r)
    Find the list of regions that border `r` (adjacent to the edge), but do not include the corners.
    static boolean
    hasNoAccess​(com.sk89q.worldguard.protection.regions.ProtectedRegion region, org.bukkit.entity.Player p, com.sk89q.worldguard.LocalPlayer lp, boolean canBeMember)
     
    static String
    matchLocationToPSID​(org.bukkit.Location l)
     
    static boolean
    overlapsStrongerRegion​(org.bukkit.World w, com.sk89q.worldguard.protection.regions.ProtectedRegion r, com.sk89q.worldguard.LocalPlayer lp)
     
    static PSLocation
     
    static <T extends com.sk89q.worldguard.protection.flags.Flag<String>>
    void
    setFlagIfNeeded​(com.sk89q.worldguard.protection.regions.ProtectedRegion region, T flag, String value)
     
    static <T extends com.sk89q.worldguard.protection.flags.Flag<List<V>>,​ V>
    void
    setFlagIfNeeded​(com.sk89q.worldguard.protection.regions.ProtectedRegion region, T flag, List<V> value)
     
    static <T extends com.sk89q.worldguard.protection.flags.Flag<Set<V>>,​ V>
    void
    setFlagIfNeeded​(com.sk89q.worldguard.protection.regions.ProtectedRegion region, T flag, Set<V> value)
     

    Methods inherited from class java.lang.Object

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

  • Constructor Details

    • WGUtils

      public WGUtils()
  • Method Details

    • getFlagRegistry

      public static com.sk89q.worldguard.protection.flags.registry.FlagRegistry getFlagRegistry()
    • getRegionManagerWithPlayer

      public static com.sk89q.worldguard.protection.managers.RegionManager getRegionManagerWithPlayer(org.bukkit.entity.Player p)
    • getRegionManagerWithWorld

      public static com.sk89q.worldguard.protection.managers.RegionManager getRegionManagerWithWorld(org.bukkit.World w)
      Get a RegionManager from a world.
      Parameters:
      w - the world
      Returns:
      the region manager, or null if it is not found
    • getAllRegionManagers

      public static HashMap<org.bukkit.World,​com.sk89q.worldguard.protection.managers.RegionManager> getAllRegionManagers()
      Get all region managers for all worlds. Use this instead of looping worlds manually because some worlds may not have a region manager.
      Returns:
      returns all region managers from all worlds
    • parsePSRegionToLocation

      public static PSLocation parsePSRegionToLocation(String regionId)
    • findOverlapOrAdjacentRegions

      public static Set<com.sk89q.worldguard.protection.regions.ProtectedRegion> findOverlapOrAdjacentRegions(com.sk89q.worldguard.protection.regions.ProtectedRegion r, com.sk89q.worldguard.protection.managers.RegionManager rgm, org.bukkit.World w)
      Find regions that are overlapping or adjacent to the region given.
      Parameters:
      r -
      rgm -
      w -
      Returns:
      the list of regions
    • findOverlapOrAdjacentRegions

      public static Set<com.sk89q.worldguard.protection.regions.ProtectedRegion> findOverlapOrAdjacentRegions(com.sk89q.worldguard.protection.regions.ProtectedRegion r, List<com.sk89q.worldguard.protection.regions.ProtectedRegion> regionsToCheck, org.bukkit.World w)
      Find regions that are overlapping or adjacent to the region given.
      Parameters:
      r -
      regionsToCheck -
      w -
      Returns:
      the list of regions
    • getTransientEdgeRegions

      public static List<com.sk89q.worldguard.protection.regions.ProtectedRegion> getTransientEdgeRegions(org.bukkit.World w, com.sk89q.worldguard.protection.regions.ProtectedRegion r)
      Find the list of regions that border `r` (adjacent to the edge), but do not include the corners.
      Parameters:
      r - region
      Returns:
      the list of regions
    • overlapsStrongerRegion

      public static boolean overlapsStrongerRegion(org.bukkit.World w, com.sk89q.worldguard.protection.regions.ProtectedRegion r, com.sk89q.worldguard.LocalPlayer lp)
    • matchLocationToPSID

      public static String matchLocationToPSID(org.bukkit.Location l)
    • getMinVector

      public static com.sk89q.worldedit.math.BlockVector3 getMinVector(double bx, double by, double bz, long xRadius, long yRadius, long zRadius)
    • getMaxVector

      public static com.sk89q.worldedit.math.BlockVector3 getMaxVector(double bx, double by, double bz, long xRadius, long yRadius, long zRadius)
    • getMinChunkVector

      public static com.sk89q.worldedit.math.BlockVector3 getMinChunkVector(double bx, double by, double bz, long chunkRadius, long yRadius)
    • getMaxChunkVector

      public static com.sk89q.worldedit.math.BlockVector3 getMaxChunkVector(double bx, double by, double bz, long chunkRadius, long yRadius)
    • createPSID

      public static String createPSID(double bx, double by, double bz)
    • createPSID

      public static String createPSID(org.bukkit.Location l)
    • hasNoAccess

      public static boolean hasNoAccess(com.sk89q.worldguard.protection.regions.ProtectedRegion region, org.bukkit.entity.Player p, com.sk89q.worldguard.LocalPlayer lp, boolean canBeMember)
    • getPlayerAdjacentRegionGroups

      public static HashMap<String,​ArrayList<String>> getPlayerAdjacentRegionGroups(org.bukkit.entity.Player p, com.sk89q.worldguard.protection.managers.RegionManager rm)
    • getDefaultProtectedRegion

      public static com.sk89q.worldguard.protection.regions.ProtectedCuboidRegion getDefaultProtectedRegion(PSProtectBlock b, PSLocation v)
    • getPointsFromDecomposedRegion

      public static List<com.sk89q.worldedit.math.BlockVector2> getPointsFromDecomposedRegion(PSRegion r)
    • canMergeRegionTypes

      public static boolean canMergeRegionTypes(PSProtectBlock current, PSRegion mergeInto)
    • setFlagIfNeeded

      public static <T extends com.sk89q.worldguard.protection.flags.Flag<String>> void setFlagIfNeeded(com.sk89q.worldguard.protection.regions.ProtectedRegion region, T flag, String value)
    • setFlagIfNeeded

      public static <T extends com.sk89q.worldguard.protection.flags.Flag<Set<V>>,​ V> void setFlagIfNeeded(com.sk89q.worldguard.protection.regions.ProtectedRegion region, T flag, Set<V> value)
    • setFlagIfNeeded

      public static <T extends com.sk89q.worldguard.protection.flags.Flag<List<V>>,​ V> void setFlagIfNeeded(com.sk89q.worldguard.protection.regions.ProtectedRegion region, T flag, List<V> value)