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 ClassesModifier and TypeInterfaceDescriptionstatic enumThis enum outlines the different data types that a flag can store. -
Method Summary
Modifier and TypeMethodDescriptionReturns a keySet from theMapof register flags.@Nullable ObjectReturns the value of a flag with the givenflagName.booleanReturnstrueif world guard is installed.voidregisterFlag(@NotNull String flag, @NotNull WorldGuardCompatibility.FlagType type) Registers a new flag with the given name and datatype.booleantestFlag(@NotNull org.bukkit.Location location, @Nullable org.bukkit.entity.Player player, @NotNull String flagName) Tests the state flag with the givenflagName.
-
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 givenflagName. This method will returntrueif that flag is enabled for the givenlocation.If the
playerargument is notnull, this method can also returntrueif 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, ornull.flagName- The non-null name of the flag.- Returns:
trueif 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 givenflagName. The returned value depends on the region that contains thelocation.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 isnull.
-
isInstalled
boolean isInstalled()Returnstrueif world guard is installed. This is the same asPluginManager#getPlugin("WorldGuard") != null.- Returns:
trueif the server uses world guard.
-
getRegisteredFlags
Returns a keySet from theMapof register flags. Only flags added usingregisterFlag(String, FlagType)are added to the backing map.- Returns:
- The non-null set of flag names.
-