Interface WorldGuardCompatibility

All Known Implementing Classes:
NoWorldGuard

public interface WorldGuardCompatibility
This interface outlines an API to use different versions of World Guard.
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Interface
    Description
    static enum 
    This enum outlines the different data types that a flag can store.
  • Method Summary

    Modifier and Type
    Method
    Description
    @NotNull Set<String>
    Returns a keySet from the Map of register flags.
    @Nullable Object
    getValue(@NotNull org.bukkit.Location location, @NotNull String flagName)
    Returns the value of a flag with the given flagName.
    boolean
    Returns true if world guard is installed.
    void
    registerFlag(@NotNull String flag, @NotNull WorldGuardCompatibility.FlagType type)
    Registers a new flag with the given name and datatype.
    boolean
    testFlag(@NotNull org.bukkit.Location location, @Nullable org.bukkit.entity.Player player, @NotNull String flagName)
    Tests the state flag with the given flagName.
  • Method Details

    • testFlag

      boolean testFlag(@NotNull @NotNull org.bukkit.Location location, @Nullable @Nullable org.bukkit.entity.Player player, @NotNull @NotNull String flagName)
      Tests the state flag with the given flagName. This method will return true if that flag is enabled for the given location.

      If the player argument is not null, this method can also return true if they have permission to override a region's permission. For example, region owners can bypass most, if not all restrictions.

      Parameters:
      location - The non-null coordinates to test for regions.
      player - The player involved, or null.
      flagName - The non-null name of the flag.
      Returns:
      true if the flag is enabled.
    • getValue

      @Nullable @Nullable Object getValue(@NotNull @NotNull org.bukkit.Location location, @NotNull @NotNull String flagName)
      Returns the value of a flag with the given flagName. The returned value depends on the region that contains the location.

      The datatype of the returned value depends on the WorldGuardCompatibility.FlagType.

      Parameters:
      location - The non-null coordinates to test for regions.
      flagName - The non-null name of the flag.
      Returns:
      The value of the flag for that region, or null.
    • registerFlag

      void registerFlag(@NotNull @NotNull String flag, @NotNull @NotNull WorldGuardCompatibility.FlagType type)
      Registers a new flag with the given name and datatype.
      Parameters:
      flag - The non-null flag name.
      type - The non-null data type of the flag.
      Throws:
      NullPointerException - If type is null.
    • isInstalled

      boolean isInstalled()
      Returns true if world guard is installed. This is the same as PluginManager#getPlugin("WorldGuard") != null.
      Returns:
      true if the server uses world guard.
    • getRegisteredFlags

      @NotNull @NotNull Set<String> getRegisteredFlags()
      Returns a keySet from the Map of register flags. Only flags added using registerFlag(String, FlagType) are added to the backing map.
      Returns:
      The non-null set of flag names.