mirror of
https://github.com/EngineHub/WorldGuard.git
synced 2024-12-19 15:48:10 +01:00
Added -a flag to region remove owner/member commands to remove all.
This commit is contained in:
parent
ae158742f6
commit
b7d38e94c8
@ -174,9 +174,9 @@ public void addOwner(CommandContext args, CommandSender sender) throws CommandEx
|
||||
|
||||
@Command(aliases = {"removemember", "remmember", "removemem", "remmem"},
|
||||
usage = "<id> <owners...>",
|
||||
flags = "w:",
|
||||
flags = "aw:",
|
||||
desc = "Remove an owner to a region",
|
||||
min = 2)
|
||||
min = 1)
|
||||
public void removeMember(CommandContext args, CommandSender sender) throws CommandException {
|
||||
final World world;
|
||||
Player player = null;
|
||||
@ -216,7 +216,14 @@ public void removeMember(CommandContext args, CommandSender sender) throws Comma
|
||||
}
|
||||
}
|
||||
|
||||
RegionDBUtil.removeFromDomain(region.getMembers(), args.getPaddedSlice(2, 0), 0);
|
||||
if (args.hasFlag('a')) {
|
||||
region.getMembers().removaAll();
|
||||
} else {
|
||||
if (args.argsLength() < 2) {
|
||||
throw new CommandException("List some names to remove, or use -a to remove all.");
|
||||
}
|
||||
RegionDBUtil.removeFromDomain(region.getMembers(), args.getPaddedSlice(2, 0), 0);
|
||||
}
|
||||
|
||||
sender.sendMessage(ChatColor.YELLOW
|
||||
+ "Region '" + id + "' updated.");
|
||||
@ -231,9 +238,9 @@ public void removeMember(CommandContext args, CommandSender sender) throws Comma
|
||||
|
||||
@Command(aliases = {"removeowner", "remowner"},
|
||||
usage = "<id> <owners...>",
|
||||
flags = "w:",
|
||||
flags = "aw:",
|
||||
desc = "Remove an owner to a region",
|
||||
min = 2)
|
||||
min = 1)
|
||||
public void removeOwner(CommandContext args,
|
||||
CommandSender sender) throws CommandException {
|
||||
final World world;
|
||||
@ -274,7 +281,14 @@ public void removeOwner(CommandContext args,
|
||||
}
|
||||
}
|
||||
|
||||
RegionDBUtil.removeFromDomain(region.getOwners(), args.getPaddedSlice(2, 0), 0);
|
||||
if (args.hasFlag('a')) {
|
||||
region.getOwners().removaAll();
|
||||
} else {
|
||||
if (args.argsLength() < 2) {
|
||||
throw new CommandException("List some names to remove, or use -a to remove all.");
|
||||
}
|
||||
RegionDBUtil.removeFromDomain(region.getOwners(), args.getPaddedSlice(2, 0), 0);
|
||||
}
|
||||
|
||||
sender.sendMessage(ChatColor.YELLOW
|
||||
+ "Region '" + id + "' updated.");
|
||||
|
@ -30,8 +30,8 @@
|
||||
import com.sk89q.worldguard.LocalPlayer;
|
||||
|
||||
public class DefaultDomain implements Domain {
|
||||
private Set<String> groups;
|
||||
private Set<String> players;
|
||||
private final Set<String> groups;
|
||||
private final Set<String> players;
|
||||
|
||||
public DefaultDomain() {
|
||||
this.groups = new LinkedHashSet<String>();
|
||||
@ -135,4 +135,9 @@ public String toUserFriendlyString() {
|
||||
|
||||
return str.toString();
|
||||
}
|
||||
|
||||
public void removaAll() {
|
||||
groups.clear();
|
||||
players.clear();
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user