Class MemberCommands
java.lang.Object
com.sk89q.worldguard.commands.region.MemberCommands
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
addMember
(com.sk89q.minecraft.util.commands.CommandContext args, com.sk89q.worldedit.extension.platform.Actor sender) void
addOwner
(com.sk89q.minecraft.util.commands.CommandContext args, com.sk89q.worldedit.extension.platform.Actor sender) protected static ProtectedRegion
checkExistingRegion
(RegionManager regionManager, String id, boolean allowGlobal) Get a protected region by a given name, otherwise throw aCommandException
.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
(com.sk89q.worldedit.extension.platform.Actor actor, String id) Create aProtectedRegion
from the actor's selection.protected static String
checkRegionId
(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, boolean allowGlobal, String rgCmd) Get the region at the player's location, if possible.protected static ProtectedRegion
checkRegionStandingIn
(RegionManager regionManager, LocalPlayer player, String rgCmd) Get the region at the player's location, if possible.protected static com.sk89q.worldedit.regions.Region
checkSelection
(com.sk89q.worldedit.extension.platform.Actor actor) Get a WorldEdit selection for an actor, or emit an exception if there is none available.protected static boolean
checkSpawnOverlap
(com.sk89q.worldedit.extension.platform.Actor sender, com.sk89q.worldedit.world.World world, ProtectedRegion region) Inform a user if the region overlaps spawn protection.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.protected static com.sk89q.worldedit.world.World
checkWorld
(com.sk89q.minecraft.util.commands.CommandContext args, com.sk89q.worldedit.extension.platform.Actor sender, char flag, boolean allowWorldEditOverride) protected static RegionPermissionModel
getPermissionModel
(com.sk89q.worldedit.extension.platform.Actor sender) Get the permission model to lookup permissions.protected static void
informNewUser
(com.sk89q.worldedit.extension.platform.Actor sender, RegionManager manager, ProtectedRegion region) Inform a new user about automatic protection.void
removeMember
(com.sk89q.minecraft.util.commands.CommandContext args, com.sk89q.worldedit.extension.platform.Actor sender) void
removeOwner
(com.sk89q.minecraft.util.commands.CommandContext args, com.sk89q.worldedit.extension.platform.Actor sender) protected static <V> V
setFlag
(ProtectedRegion region, Flag<V> flag, com.sk89q.worldedit.extension.platform.Actor sender, String value) Utility method to set a flag.protected static void
setPlayerSelection
(com.sk89q.worldedit.extension.platform.Actor actor, ProtectedRegion region, com.sk89q.worldedit.world.World world) Set an actor's selection to a given 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.
-
Constructor Details
-
MemberCommands
-
-
Method Details
-
addMember
public void addMember(com.sk89q.minecraft.util.commands.CommandContext args, com.sk89q.worldedit.extension.platform.Actor sender) throws com.sk89q.minecraft.util.commands.CommandException - Throws:
com.sk89q.minecraft.util.commands.CommandException
-
addOwner
public void addOwner(com.sk89q.minecraft.util.commands.CommandContext args, com.sk89q.worldedit.extension.platform.Actor sender) throws com.sk89q.minecraft.util.commands.CommandException - Throws:
com.sk89q.minecraft.util.commands.CommandException
-
removeMember
public void removeMember(com.sk89q.minecraft.util.commands.CommandContext args, com.sk89q.worldedit.extension.platform.Actor sender) throws com.sk89q.minecraft.util.commands.CommandException - Throws:
com.sk89q.minecraft.util.commands.CommandException
-
removeOwner
public void removeOwner(com.sk89q.minecraft.util.commands.CommandContext args, com.sk89q.worldedit.extension.platform.Actor sender) throws com.sk89q.minecraft.util.commands.CommandException - Throws:
com.sk89q.minecraft.util.commands.CommandException
-
getPermissionModel
protected static RegionPermissionModel getPermissionModel(com.sk89q.worldedit.extension.platform.Actor sender) Get the permission model to lookup permissions.- Parameters:
sender
- the sender- Returns:
- the permission model
-
checkWorld
protected 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 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.- Parameters:
args
- the argumentssender
- the senderflag
- the flag (such as 'w')- Returns:
- a world
- Throws:
com.sk89q.minecraft.util.commands.CommandException
- on error
-
checkWorld
protected static com.sk89q.worldedit.world.World checkWorld(com.sk89q.minecraft.util.commands.CommandContext args, com.sk89q.worldedit.extension.platform.Actor sender, char flag, boolean allowWorldEditOverride) throws com.sk89q.minecraft.util.commands.CommandException - Throws:
com.sk89q.minecraft.util.commands.CommandException
-
checkRegionId
protected static String checkRegionId(String id, boolean allowGlobal) throws com.sk89q.minecraft.util.commands.CommandException Validate a region ID.- Parameters:
id
- the idallowGlobal
- whether __global__ is allowed- Returns:
- the id given
- Throws:
com.sk89q.minecraft.util.commands.CommandException
- thrown on an error
-
checkExistingRegion
protected static ProtectedRegion checkExistingRegion(RegionManager regionManager, String id, boolean allowGlobal) throws com.sk89q.minecraft.util.commands.CommandException Get a protected region by a given name, otherwise throw aCommandException
.This also validates the region ID.
- Parameters:
regionManager
- the region managerid
- the name to searchallowGlobal
- true to allow selecting __global__- Throws:
com.sk89q.minecraft.util.commands.CommandException
- thrown if no region is found by the given name
-
checkRegionStandingIn
protected static ProtectedRegion checkRegionStandingIn(RegionManager regionManager, LocalPlayer player, String rgCmd) throws com.sk89q.minecraft.util.commands.CommandException Get the region at the player's location, if possible.If the player is standing in several regions, an error will be raised and a list of regions will be provided.
- Parameters:
regionManager
- the region managerplayer
- the player- Returns:
- a region
- Throws:
com.sk89q.minecraft.util.commands.CommandException
- thrown if no region was found
-
checkRegionStandingIn
protected static ProtectedRegion checkRegionStandingIn(RegionManager regionManager, LocalPlayer player, boolean allowGlobal, String rgCmd) throws com.sk89q.minecraft.util.commands.CommandException Get the region at the player's location, if possible.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.
- Parameters:
regionManager
- the region managerplayer
- the playerallowGlobal
- whether to search for a global region if no others are found- Returns:
- a region
- Throws:
com.sk89q.minecraft.util.commands.CommandException
- thrown if no region was found
-
checkSelection
protected static com.sk89q.worldedit.regions.Region checkSelection(com.sk89q.worldedit.extension.platform.Actor actor) throws com.sk89q.minecraft.util.commands.CommandException Get a WorldEdit selection for an actor, or emit an exception if there is none available.- Parameters:
actor
- the actor- Returns:
- the selection
- Throws:
com.sk89q.minecraft.util.commands.CommandException
- thrown on an error
-
checkRegionDoesNotExist
protected static void checkRegionDoesNotExist(RegionManager manager, String id, boolean mayRedefine) throws com.sk89q.minecraft.util.commands.CommandException Check that a region with the given ID does not already exist.- Parameters:
manager
- the managerid
- the ID- Throws:
com.sk89q.minecraft.util.commands.CommandException
- thrown if the ID already exists
-
checkRegionManager
protected static RegionManager checkRegionManager(com.sk89q.worldedit.world.World world) throws com.sk89q.minecraft.util.commands.CommandException Check that the given region manager is not null.- Parameters:
world
- the world- Throws:
com.sk89q.minecraft.util.commands.CommandException
- thrown if the manager is null
-
checkRegionFromSelection
protected static ProtectedRegion checkRegionFromSelection(com.sk89q.worldedit.extension.platform.Actor actor, String id) throws com.sk89q.minecraft.util.commands.CommandException Create aProtectedRegion
from the actor's selection.- Parameters:
actor
- the actorid
- the ID of the new region- Returns:
- a new region
- Throws:
com.sk89q.minecraft.util.commands.CommandException
- thrown on an error
-
warnAboutSaveFailures
protected static void warnAboutSaveFailures(com.sk89q.worldedit.extension.platform.Actor sender) Warn the region saving is failing.- Parameters:
sender
- the sender to send the message to
-
warnAboutDimensions
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.- Parameters:
sender
- the sender to send the message toregion
- the region
-
informNewUser
protected static void informNewUser(com.sk89q.worldedit.extension.platform.Actor sender, RegionManager manager, ProtectedRegion region) Inform a new user about automatic protection.- Parameters:
sender
- the sender to send the message tomanager
- the region managerregion
- the region
-
checkSpawnOverlap
protected static boolean checkSpawnOverlap(com.sk89q.worldedit.extension.platform.Actor sender, com.sk89q.worldedit.world.World world, ProtectedRegion region) Inform a user if the region overlaps spawn protection.- Parameters:
sender
- the sender to send the message toworld
- the world the region is inregion
- the region
-
setPlayerSelection
protected static void setPlayerSelection(com.sk89q.worldedit.extension.platform.Actor actor, ProtectedRegion region, com.sk89q.worldedit.world.World world) throws com.sk89q.minecraft.util.commands.CommandException Set an actor's selection to a given region.- Parameters:
actor
- the actorregion
- the region- Throws:
com.sk89q.minecraft.util.commands.CommandException
- thrown on a command error
-
setFlag
protected static <V> V setFlag(ProtectedRegion region, Flag<V> flag, com.sk89q.worldedit.extension.platform.Actor sender, String value) throws InvalidFlagFormat Utility method to set a flag.- Parameters:
region
- the regionflag
- the flagsender
- the sendervalue
- the value- Throws:
InvalidFlagFormat
- thrown if the value is invalid
-