Class WorldGuardUtils

java.lang.Object
nl.mtvehicles.core.infrastructure.dependencies.WorldGuardUtils

public class WorldGuardUtils extends Object
Methods for WorldGuard soft-dependency.
Beware!
Do not initialise this class directly. Use DependencyModule.worldGuard instead.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static HashMap<WGFlag,​org.codemc.worldguardwrapper.flag.IWrappedFlag<org.codemc.worldguardwrapper.flag.WrappedState>>
    HashMap which contains custom flags
    static org.codemc.worldguardwrapper.WorldGuardWrapper
    WorldGuardWrapper instance (supports both WG v6 and v7 API)
  • Constructor Summary

    Constructors
    Constructor
    Description
    Default constructor which registers flags - do not use this.
    Use DependencyModule.worldGuard instead.
  • Method Summary

    Modifier and Type
    Method
    Description
    getRegionNames​(org.bukkit.Location loc)
     
    boolean
    isInRegionWithFlag​(org.bukkit.entity.Player player, org.bukkit.Location loc, WGFlag customFlag, boolean flagState)
    Check whether a location is in a region with a (custom) flag of a specified state.
    boolean
    isInRegionWithFlag​(org.bukkit.entity.Player player, org.bukkit.Location loc, WGFlag customFlag, org.codemc.worldguardwrapper.flag.WrappedState flagState)
    Check whether a location is in a region with a (custom) flag of a specified state.
    boolean
    isInsideGasStation​(org.bukkit.entity.Player player, org.bukkit.Location loc)
    Check whether the given location is inside a gas station

    Methods inherited from class java.lang.Object

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

    • instance

      public static org.codemc.worldguardwrapper.WorldGuardWrapper instance
      WorldGuardWrapper instance (supports both WG v6 and v7 API)
    • flags

      public static HashMap<WGFlag,​org.codemc.worldguardwrapper.flag.IWrappedFlag<org.codemc.worldguardwrapper.flag.WrappedState>> flags
      HashMap which contains custom flags
      See Also:
      WGFlag
  • Constructor Details

    • WorldGuardUtils

      public WorldGuardUtils()
      Default constructor which registers flags - do not use this.
      Use DependencyModule.worldGuard instead.
  • Method Details

    • isInsideGasStation

      public boolean isInsideGasStation(org.bukkit.entity.Player player, org.bukkit.Location loc)
      Check whether the given location is inside a gas station
    • getRegionNames

      public Set<String> getRegionNames(org.bukkit.Location loc)
    • isInRegionWithFlag

      public boolean isInRegionWithFlag(org.bukkit.entity.Player player, org.bukkit.Location loc, WGFlag customFlag, org.codemc.worldguardwrapper.flag.WrappedState flagState)
      Check whether a location is in a region with a (custom) flag of a specified state.
      Parameters:
      player - Player (may change the flag depending on who the player is)
      loc - Location which may be inside a region
      customFlag - Custom WorldGuard flag (see WGFlag)
      flagState - State of the flag (ALLOW/DENY)
      Returns:
      True if location is in at least 1 region with the flag with the specified state.
    • isInRegionWithFlag

      public boolean isInRegionWithFlag(org.bukkit.entity.Player player, org.bukkit.Location loc, WGFlag customFlag, boolean flagState)
      Check whether a location is in a region with a (custom) flag of a specified state.
      Parameters:
      player - (may change the flag depending on who the player is)
      loc - Location which may be inside a region
      customFlag - Custom WorldGuard flag (see WGFlag)
      flagState - State of the flag - specified by a boolean (true = ALLOW / false = DENY)
      Returns:
      True if location is in at least 1 region with the flag with the specified state.