mirror of
https://github.com/EngineHub/WorldGuard.git
synced 2024-11-27 13:07:29 +01:00
Add -g to /rg (re)define to create a global region.
This commit is contained in:
parent
74e64d0641
commit
0ddf56f7f6
@ -56,6 +56,7 @@
|
||||
import com.sk89q.worldguard.protection.managers.migration.UUIDMigration;
|
||||
import com.sk89q.worldguard.protection.managers.storage.DriverType;
|
||||
import com.sk89q.worldguard.protection.managers.storage.RegionDriver;
|
||||
import com.sk89q.worldguard.protection.regions.GlobalProtectedRegion;
|
||||
import com.sk89q.worldguard.protection.regions.ProtectedRegion;
|
||||
import com.sk89q.worldguard.protection.regions.ProtectedRegion.CircularInheritanceException;
|
||||
import com.sk89q.worldguard.util.Enums;
|
||||
@ -94,7 +95,7 @@ public RegionCommands(WorldGuardPlugin plugin) {
|
||||
*/
|
||||
@Command(aliases = {"define", "def", "d", "create"},
|
||||
usage = "<id> [<owner1> [<owner2> [<owners...>]]]",
|
||||
flags = "n",
|
||||
flags = "ng",
|
||||
desc = "Defines a region",
|
||||
min = 1)
|
||||
public void define(CommandContext args, CommandSender sender) throws CommandException {
|
||||
@ -112,9 +113,15 @@ public void define(CommandContext args, CommandSender sender) throws CommandExce
|
||||
|
||||
checkRegionDoesNotExist(manager, id, true);
|
||||
|
||||
ProtectedRegion region = checkRegionFromSelection(player, id);
|
||||
ProtectedRegion region;
|
||||
|
||||
if (args.hasFlag('g')) {
|
||||
region = new GlobalProtectedRegion(id);
|
||||
} else {
|
||||
region = checkRegionFromSelection(player, id);
|
||||
warnAboutDimensions(player, region);
|
||||
informNewUser(player, manager, region);
|
||||
}
|
||||
|
||||
RegionAdder task = new RegionAdder(plugin, manager, region);
|
||||
task.addOwnersFromCommand(args, 2);
|
||||
@ -139,6 +146,7 @@ public void define(CommandContext args, CommandSender sender) throws CommandExce
|
||||
@Command(aliases = {"redefine", "update", "move"},
|
||||
usage = "<id>",
|
||||
desc = "Re-defines the shape of a region",
|
||||
flags = "g",
|
||||
min = 1, max = 1)
|
||||
public void redefine(CommandContext args, CommandSender sender) throws CommandException {
|
||||
warnAboutSaveFailures(sender);
|
||||
@ -157,10 +165,17 @@ public void redefine(CommandContext args, CommandSender sender) throws CommandEx
|
||||
throw new CommandPermissionsException();
|
||||
}
|
||||
|
||||
ProtectedRegion region = checkRegionFromSelection(player, id);
|
||||
region.copyFrom(existing);
|
||||
ProtectedRegion region;
|
||||
|
||||
warnAboutDimensions(sender, region);
|
||||
if (args.hasFlag('g')) {
|
||||
region = new GlobalProtectedRegion(id);
|
||||
} else {
|
||||
region = checkRegionFromSelection(player, id);
|
||||
warnAboutDimensions(player, region);
|
||||
informNewUser(player, manager, region);
|
||||
}
|
||||
|
||||
region.copyFrom(existing);
|
||||
|
||||
RegionAdder task = new RegionAdder(plugin, manager, region);
|
||||
ListenableFuture<?> future = plugin.getExecutorService().submit(task);
|
||||
|
Loading…
Reference in New Issue
Block a user