public final class RegionCommands
extends java.lang.Object
| Constructor and Description |
|---|
RegionCommands(WorldGuard worldGuard) |
| Modifier and Type | Method and Description |
|---|---|
protected static ProtectedRegion |
checkExistingRegion(RegionManager regionManager,
java.lang.String id,
boolean allowGlobal)
Get a protected region by a given name, otherwise throw a
CommandException. |
protected static void |
checkRegionDoesNotExist(RegionManager manager,
java.lang.String id,
boolean mayRedefine)
Check that a region with the given ID does not already exist.
|
protected static ProtectedRegion |
checkRegionFromSelection(LocalPlayer player,
java.lang.String id)
Create a
ProtectedRegion from the player's selection. |
protected static java.lang.String |
checkRegionId(java.lang.String id,
boolean allowGlobal)
Validate a region ID.
|
protected static RegionManager |
checkRegionManager(com.sk89q.worldedit.world.World world)
Check that the given region manager is not null.
|
protected static ProtectedRegion |
checkRegionStandingIn(RegionManager regionManager,
LocalPlayer player)
Get the region at the player's location, if possible.
|
protected static ProtectedRegion |
checkRegionStandingIn(RegionManager regionManager,
LocalPlayer player,
boolean allowGlobal)
Get the region at the player's location, if possible.
|
protected static com.sk89q.worldedit.regions.Region |
checkSelection(LocalPlayer player)
Get a WorldEdit selection for a player, or emit an exception if there is none
available.
|
protected static com.sk89q.worldedit.world.World |
checkWorld(com.sk89q.minecraft.util.commands.CommandContext args,
com.sk89q.worldedit.extension.platform.Actor 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,
com.sk89q.worldedit.extension.platform.Actor sender)
Claiming command for users.
|
void |
define(com.sk89q.minecraft.util.commands.CommandContext args,
com.sk89q.worldedit.extension.platform.Actor sender)
Defines a new region.
|
void |
flag(com.sk89q.minecraft.util.commands.CommandContext args,
com.sk89q.worldedit.extension.platform.Actor sender)
Set a flag.
|
protected static RegionPermissionModel |
getPermissionModel(com.sk89q.worldedit.extension.platform.Actor sender)
Get the permission model to lookup permissions.
|
void |
info(com.sk89q.minecraft.util.commands.CommandContext args,
com.sk89q.worldedit.extension.platform.Actor sender)
Get information about a region.
|
protected static void |
informNewUser(com.sk89q.worldedit.extension.platform.Actor sender,
RegionManager manager,
ProtectedRegion region)
Inform a new user about automatic protection.
|
void |
list(com.sk89q.minecraft.util.commands.CommandContext args,
com.sk89q.worldedit.extension.platform.Actor sender)
List regions.
|
void |
load(com.sk89q.minecraft.util.commands.CommandContext args,
com.sk89q.worldedit.extension.platform.Actor sender)
Reload the region database.
|
void |
migrateDB(com.sk89q.minecraft.util.commands.CommandContext args,
com.sk89q.worldedit.extension.platform.Actor sender)
Migrate the region database.
|
void |
migrateUuid(com.sk89q.minecraft.util.commands.CommandContext args,
com.sk89q.worldedit.extension.platform.Actor sender)
Migrate the region databases to use UUIDs rather than name.
|
void |
redefine(com.sk89q.minecraft.util.commands.CommandContext args,
com.sk89q.worldedit.extension.platform.Actor sender)
Re-defines a region with a new selection.
|
void |
remove(com.sk89q.minecraft.util.commands.CommandContext args,
com.sk89q.worldedit.extension.platform.Actor sender)
Remove a region.
|
void |
save(com.sk89q.minecraft.util.commands.CommandContext args,
com.sk89q.worldedit.extension.platform.Actor sender)
Re-save the region database.
|
void |
select(com.sk89q.minecraft.util.commands.CommandContext args,
com.sk89q.worldedit.extension.platform.Actor sender)
Get a WorldEdit selection from a region.
|
protected static <V> void |
setFlag(ProtectedRegion region,
Flag<V> flag,
com.sk89q.worldedit.extension.platform.Actor sender,
java.lang.String value)
Utility method to set a flag.
|
void |
setParent(com.sk89q.minecraft.util.commands.CommandContext args,
com.sk89q.worldedit.extension.platform.Actor sender)
Set the parent of a region.
|
protected static void |
setPlayerSelection(LocalPlayer player,
ProtectedRegion region)
Set a player's selection to a given region.
|
void |
setPriority(com.sk89q.minecraft.util.commands.CommandContext args,
com.sk89q.worldedit.extension.platform.Actor sender)
Set the priority of a region.
|
void |
teleport(com.sk89q.minecraft.util.commands.CommandContext args,
com.sk89q.worldedit.extension.platform.Actor sender)
Teleport to a region
|
protected static void |
warnAboutDimensions(com.sk89q.worldedit.extension.platform.Actor sender,
ProtectedRegion region)
Warn the sender if the dimensions of the given region are worrying.
|
protected static void |
warnAboutSaveFailures(com.sk89q.worldedit.extension.platform.Actor sender)
Warn the region saving is failing.
|
public RegionCommands(WorldGuard worldGuard)
public void define(com.sk89q.minecraft.util.commands.CommandContext args,
com.sk89q.worldedit.extension.platform.Actor 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,
com.sk89q.worldedit.extension.platform.Actor 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,
com.sk89q.worldedit.extension.platform.Actor 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,
com.sk89q.worldedit.extension.platform.Actor 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,
com.sk89q.worldedit.extension.platform.Actor 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,
com.sk89q.worldedit.extension.platform.Actor 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,
com.sk89q.worldedit.extension.platform.Actor 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,
com.sk89q.worldedit.extension.platform.Actor 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,
com.sk89q.worldedit.extension.platform.Actor 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,
com.sk89q.worldedit.extension.platform.Actor 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,
com.sk89q.worldedit.extension.platform.Actor 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,
com.sk89q.worldedit.extension.platform.Actor 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,
com.sk89q.worldedit.extension.platform.Actor 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,
com.sk89q.worldedit.extension.platform.Actor 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,
com.sk89q.worldedit.extension.platform.Actor sender)
throws com.sk89q.minecraft.util.commands.CommandException
args - the argumentssender - the sendercom.sk89q.minecraft.util.commands.CommandException - any errorprotected static RegionPermissionModel getPermissionModel(com.sk89q.worldedit.extension.platform.Actor sender)
sender - the senderprotected static com.sk89q.worldedit.world.World checkWorld(com.sk89q.minecraft.util.commands.CommandContext args,
com.sk89q.worldedit.extension.platform.Actor 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 java.lang.String checkRegionId(java.lang.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, java.lang.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, LocalPlayer 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, LocalPlayer 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.regions.Region checkSelection(LocalPlayer 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, java.lang.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(com.sk89q.worldedit.world.World world) throws com.sk89q.minecraft.util.commands.CommandException
world - the worldcom.sk89q.minecraft.util.commands.CommandException - thrown if the manager is nullprotected static ProtectedRegion checkRegionFromSelection(LocalPlayer player, java.lang.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(com.sk89q.worldedit.extension.platform.Actor sender)
sender - the sender to send the message toprotected static void warnAboutDimensions(com.sk89q.worldedit.extension.platform.Actor sender,
ProtectedRegion region)
sender - the sender to send the message toregion - the regionprotected static void informNewUser(com.sk89q.worldedit.extension.platform.Actor sender,
RegionManager manager,
ProtectedRegion region)
sender - the sender to send the message tomanager - the region managerregion - the regionprotected static void setPlayerSelection(LocalPlayer 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, com.sk89q.worldedit.extension.platform.Actor sender, java.lang.String value) throws InvalidFlagFormat
region - the regionflag - the flagsender - the sendervalue - the valueInvalidFlagFormat - thrown if the value is invalid