Fixes #724
Fixes flag remove for non list based flags when player lacks permission.
This commit is contained in:
Jesse Boyd
2015-11-18 10:39:44 +11:00
parent a8140f8cb0
commit 452efc4b08
4 changed files with 20 additions and 10 deletions

View File

@ -158,6 +158,10 @@ public class FlagCmd extends SubCommand {
}
final Flag flag = FlagManager.getPlotFlagAbs(plot, args[1].toLowerCase());
if (!Permissions.hasPermission(player, "plots.set.flag." + args[1].toLowerCase())) {
if (args.length != 2) {
MainUtil.sendMessage(player, C.NO_PERMISSION, "plots.set.flag." + args[1].toLowerCase());
return false;
}
for (final String entry : args[2].split(",")) {
if (!Permissions.hasPermission(player, "plots.set.flag." + args[1].toLowerCase() + "." + entry)) {
MainUtil.sendMessage(player, C.NO_PERMISSION, "plots.set.flag." + args[1].toLowerCase() + "." + entry);

View File

@ -59,6 +59,12 @@ public class Set extends SubCommand {
public Set() {
component = new SetCommand() {
@Override
public String getCommand() {
return "set.component";
}
@Override
public boolean set(PlotPlayer plr, final Plot plot, String value) {
final String world = plr.getLocation().getWorld();
@ -171,7 +177,7 @@ public class Set extends SubCommand {
// components
HashSet<String> components = new HashSet<String>(Arrays.asList(plot.getManager().getPlotComponents(plot.getWorld(), plot.id)));
if (components.contains(args[0].toLowerCase())) {
return component.set(plr, plot, StringMan.join(args, " "));
return component.onCommand(plr, Arrays.copyOfRange(args, 1, args.length));
}
// flag
{