public final class RegionCommands extends Object
| Constructor and Description |
|---|
RegionCommands(WorldGuardPlugin plugin) |
| Modifier and Type | Method and Description |
|---|---|
protected static ProtectedRegion |
checkExistingRegion(RegionManager regionManager,
String id,
boolean allowGlobal)
Get a protected region by a given name, otherwise throw a
CommandException. |
protected static void |
checkRegionDoesNotExist(RegionManager manager,
String id,
boolean mayRedefine)
Check that a region with the given ID does not already exist.
|
protected static ProtectedRegion |
checkRegionFromSelection(org.bukkit.entity.Player player,
String id)
Create a
ProtectedRegion from the player's selection. |
protected static String |
checkRegionId(String id,
boolean allowGlobal)
Validate a region ID.
|
protected static RegionManager |
checkRegionManager(WorldGuardPlugin plugin,
org.bukkit.World world)
Check that the given region manager is not null.
|
protected static ProtectedRegion |
checkRegionStandingIn(RegionManager regionManager,
org.bukkit.entity.Player player)
Get the region at the player's location, if possible.
|
protected static ProtectedRegion |
checkRegionStandingIn(RegionManager regionManager,
org.bukkit.entity.Player player,
boolean allowGlobal)
Get the region at the player's location, if possible.
|
protected static com.sk89q.worldedit.bukkit.selections.Selection |
checkSelection(org.bukkit.entity.Player player)
Get a WorldEdit selection for a player, or emit an exception if there is none
available.
|
protected static org.bukkit.World |
checkWorld(com.sk89q.minecraft.util.commands.CommandContext args,
org.bukkit.command.CommandSender sender,
char flag)
Gets the world from the given flag, or falling back to the the current player
if the sender is a player, otherwise reporting an error.
|
void |
claim(com.sk89q.minecraft.util.commands.CommandContext args,
org.bukkit.command.CommandSender sender)
Claiming command for users.
|
void |
define(com.sk89q.minecraft.util.commands.CommandContext args,
org.bukkit.command.CommandSender sender)
Defines a new region.
|
void |
flag(com.sk89q.minecraft.util.commands.CommandContext args,
org.bukkit.command.CommandSender sender)
Set a flag.
|
protected static RegionPermissionModel |
getPermissionModel(org.bukkit.command.CommandSender sender)
Get the permission model to lookup permissions.
|
void |
info(com.sk89q.minecraft.util.commands.CommandContext args,
org.bukkit.command.CommandSender sender)
Get information about a region.
|
protected static void |
informNewUser(org.bukkit.command.CommandSender sender,
RegionManager manager,
ProtectedRegion region)
Inform a new user about automatic protection.
|
void |
list(com.sk89q.minecraft.util.commands.CommandContext args,
org.bukkit.command.CommandSender sender)
List regions.
|
void |
load(com.sk89q.minecraft.util.commands.CommandContext args,
org.bukkit.command.CommandSender sender)
Reload the region database.
|
void |
migrateDB(com.sk89q.minecraft.util.commands.CommandContext args,
org.bukkit.command.CommandSender sender)
Migrate the region database.
|
void |
migrateUuid(com.sk89q.minecraft.util.commands.CommandContext args,
org.bukkit.command.CommandSender sender)
Migrate the region databases to use UUIDs rather than name.
|
void |
redefine(com.sk89q.minecraft.util.commands.CommandContext args,
org.bukkit.command.CommandSender sender)
Re-defines a region with a new selection.
|
void |
remove(com.sk89q.minecraft.util.commands.CommandContext args,
org.bukkit.command.CommandSender sender)
Remove a region.
|
void |
save(com.sk89q.minecraft.util.commands.CommandContext args,
org.bukkit.command.CommandSender sender)
Re-save the region database.
|
void |
select(com.sk89q.minecraft.util.commands.CommandContext args,
org.bukkit.command.CommandSender sender)
Get a WorldEdit selection from a region.
|
protected static <V> void |
setFlag(ProtectedRegion region,
Flag<V> flag,
org.bukkit.command.CommandSender sender,
String value)
Utility method to set a flag.
|
void |
setParent(com.sk89q.minecraft.util.commands.CommandContext args,
org.bukkit.command.CommandSender sender)
Set the parent of a region.
|
protected static void |
setPlayerSelection(org.bukkit.entity.Player player,
ProtectedRegion region)
Set a player's selection to a given region.
|
void |
setPriority(com.sk89q.minecraft.util.commands.CommandContext args,
org.bukkit.command.CommandSender sender)
Set the priority of a region.
|
void |
teleport(com.sk89q.minecraft.util.commands.CommandContext args,
org.bukkit.command.CommandSender sender)
Teleport to a region
|
protected static void |
warnAboutDimensions(org.bukkit.command.CommandSender sender,
ProtectedRegion region)
Warn the sender if the dimensions of the given region are worrying.
|
protected static void |
warnAboutSaveFailures(org.bukkit.command.CommandSender sender)
Warn the region saving is failing.
|
public RegionCommands(WorldGuardPlugin plugin)
public void define(com.sk89q.minecraft.util.commands.CommandContext args,
org.bukkit.command.CommandSender sender)
throws com.sk89q.minecraft.util.commands.CommandException
args - the argumentssender - the sendercom.sk89q.minecraft.util.commands.CommandException - any errorpublic void redefine(com.sk89q.minecraft.util.commands.CommandContext args,
org.bukkit.command.CommandSender sender)
throws com.sk89q.minecraft.util.commands.CommandException
args - the argumentssender - the sendercom.sk89q.minecraft.util.commands.CommandException - any errorpublic void claim(com.sk89q.minecraft.util.commands.CommandContext args,
org.bukkit.command.CommandSender sender)
throws com.sk89q.minecraft.util.commands.CommandException
This command is a joke and it needs to be rewritten. It was contributed code :(
args - the argumentssender - the sendercom.sk89q.minecraft.util.commands.CommandException - any errorpublic void select(com.sk89q.minecraft.util.commands.CommandContext args,
org.bukkit.command.CommandSender sender)
throws com.sk89q.minecraft.util.commands.CommandException
args - the argumentssender - the sendercom.sk89q.minecraft.util.commands.CommandException - any errorpublic void info(com.sk89q.minecraft.util.commands.CommandContext args,
org.bukkit.command.CommandSender sender)
throws com.sk89q.minecraft.util.commands.CommandException
args - the argumentssender - the sendercom.sk89q.minecraft.util.commands.CommandException - any errorpublic void list(com.sk89q.minecraft.util.commands.CommandContext args,
org.bukkit.command.CommandSender sender)
throws com.sk89q.minecraft.util.commands.CommandException
args - the argumentssender - the sendercom.sk89q.minecraft.util.commands.CommandException - any errorpublic void flag(com.sk89q.minecraft.util.commands.CommandContext args,
org.bukkit.command.CommandSender sender)
throws com.sk89q.minecraft.util.commands.CommandException
args - the argumentssender - the sendercom.sk89q.minecraft.util.commands.CommandException - any errorpublic void setPriority(com.sk89q.minecraft.util.commands.CommandContext args,
org.bukkit.command.CommandSender sender)
throws com.sk89q.minecraft.util.commands.CommandException
args - the argumentssender - the sendercom.sk89q.minecraft.util.commands.CommandException - any errorpublic void setParent(com.sk89q.minecraft.util.commands.CommandContext args,
org.bukkit.command.CommandSender sender)
throws com.sk89q.minecraft.util.commands.CommandException
args - the argumentssender - the sendercom.sk89q.minecraft.util.commands.CommandException - any errorpublic void remove(com.sk89q.minecraft.util.commands.CommandContext args,
org.bukkit.command.CommandSender sender)
throws com.sk89q.minecraft.util.commands.CommandException
args - the argumentssender - the sendercom.sk89q.minecraft.util.commands.CommandException - any errorpublic void load(com.sk89q.minecraft.util.commands.CommandContext args,
org.bukkit.command.CommandSender sender)
throws com.sk89q.minecraft.util.commands.CommandException
args - the argumentssender - the sendercom.sk89q.minecraft.util.commands.CommandException - any errorpublic void save(com.sk89q.minecraft.util.commands.CommandContext args,
org.bukkit.command.CommandSender sender)
throws com.sk89q.minecraft.util.commands.CommandException
args - the argumentssender - the sendercom.sk89q.minecraft.util.commands.CommandException - any errorpublic void migrateDB(com.sk89q.minecraft.util.commands.CommandContext args,
org.bukkit.command.CommandSender sender)
throws com.sk89q.minecraft.util.commands.CommandException
args - the argumentssender - the sendercom.sk89q.minecraft.util.commands.CommandException - any errorpublic void migrateUuid(com.sk89q.minecraft.util.commands.CommandContext args,
org.bukkit.command.CommandSender sender)
throws com.sk89q.minecraft.util.commands.CommandException
args - the argumentssender - the sendercom.sk89q.minecraft.util.commands.CommandException - any errorpublic void teleport(com.sk89q.minecraft.util.commands.CommandContext args,
org.bukkit.command.CommandSender sender)
throws com.sk89q.minecraft.util.commands.CommandException
args - the argumentssender - the sendercom.sk89q.minecraft.util.commands.CommandException - any errorprotected static RegionPermissionModel getPermissionModel(org.bukkit.command.CommandSender sender)
sender - the senderprotected static org.bukkit.World checkWorld(com.sk89q.minecraft.util.commands.CommandContext args,
org.bukkit.command.CommandSender sender,
char flag)
throws com.sk89q.minecraft.util.commands.CommandException
args - the argumentssender - the senderflag - the flag (such as 'w')com.sk89q.minecraft.util.commands.CommandException - on errorprotected static String checkRegionId(String id, boolean allowGlobal) throws com.sk89q.minecraft.util.commands.CommandException
id - the idallowGlobal - whether __global__ is allowedcom.sk89q.minecraft.util.commands.CommandException - thrown on an errorprotected static ProtectedRegion checkExistingRegion(RegionManager regionManager, String id, boolean allowGlobal) throws com.sk89q.minecraft.util.commands.CommandException
CommandException.
This also validates the region ID.
regionManager - the region managerid - the name to searchallowGlobal - true to allow selecting __global__com.sk89q.minecraft.util.commands.CommandException - thrown if no region is found by the given nameprotected static ProtectedRegion checkRegionStandingIn(RegionManager regionManager, org.bukkit.entity.Player player) throws com.sk89q.minecraft.util.commands.CommandException
If the player is standing in several regions, an error will be raised and a list of regions will be provided.
regionManager - the region managerplayer - the playercom.sk89q.minecraft.util.commands.CommandException - thrown if no region was foundprotected static ProtectedRegion checkRegionStandingIn(RegionManager regionManager, org.bukkit.entity.Player player, boolean allowGlobal) throws com.sk89q.minecraft.util.commands.CommandException
If the player is standing in several regions, an error will be raised and a list of regions will be provided.
If the player is not standing in any regions, the global region will returned if allowGlobal is true and it exists.
regionManager - the region managerplayer - the playerallowGlobal - whether to search for a global region if no others are foundcom.sk89q.minecraft.util.commands.CommandException - thrown if no region was foundprotected static com.sk89q.worldedit.bukkit.selections.Selection checkSelection(org.bukkit.entity.Player player)
throws com.sk89q.minecraft.util.commands.CommandException
player - the playercom.sk89q.minecraft.util.commands.CommandException - thrown on an errorprotected static void checkRegionDoesNotExist(RegionManager manager, String id, boolean mayRedefine) throws com.sk89q.minecraft.util.commands.CommandException
manager - the managerid - the IDcom.sk89q.minecraft.util.commands.CommandException - thrown if the ID already existsprotected static RegionManager checkRegionManager(WorldGuardPlugin plugin, org.bukkit.World world) throws com.sk89q.minecraft.util.commands.CommandException
plugin - the pluginworld - the worldcom.sk89q.minecraft.util.commands.CommandException - thrown if the manager is nullprotected static ProtectedRegion checkRegionFromSelection(org.bukkit.entity.Player player, String id) throws com.sk89q.minecraft.util.commands.CommandException
ProtectedRegion from the player's selection.player - the playerid - the ID of the new regioncom.sk89q.minecraft.util.commands.CommandException - thrown on an errorprotected static void warnAboutSaveFailures(org.bukkit.command.CommandSender sender)
sender - the sender to send the message toprotected static void warnAboutDimensions(org.bukkit.command.CommandSender sender,
ProtectedRegion region)
sender - the sender to send the message toregion - the regionprotected static void informNewUser(org.bukkit.command.CommandSender sender,
RegionManager manager,
ProtectedRegion region)
sender - the sender to send the message tomanager - the region managerregion - the regionprotected static void setPlayerSelection(org.bukkit.entity.Player player,
ProtectedRegion region)
throws com.sk89q.minecraft.util.commands.CommandException
player - the playerregion - the regioncom.sk89q.minecraft.util.commands.CommandException - thrown on a command errorprotected static <V> void setFlag(ProtectedRegion region, Flag<V> flag, org.bukkit.command.CommandSender sender, String value) throws InvalidFlagFormat
region - the regionflag - the flagsender - the sendervalue - the valueInvalidFlagFormat - thrown if the value is invalidCopyright © 2015. All Rights Reserved.