perm requirement for add/trust *

This commit is contained in:
Jesse Boyd 2016-04-13 03:35:14 +10:00 committed by MattBDev
parent 40e063e702
commit 7c12a20a2b
4 changed files with 10 additions and 4 deletions

View File

@ -43,7 +43,7 @@ public class Add extends SubCommand {
return true; return true;
} }
UUID uuid; UUID uuid;
if (args[0].equalsIgnoreCase("*")) { if (args[0].equalsIgnoreCase("*") && (Permissions.hasPermission(plr, "plots.add.everyone") || Permissions.hasPermission(plr, "plots.admin.command.add"))) {
uuid = DBFunc.everyone; uuid = DBFunc.everyone;
} else { } else {
// TODO have a runnable for fetch // TODO have a runnable for fetch

View File

@ -287,7 +287,12 @@ public class ListCmd extends SubCommand {
C.COMMAND_SYNTAX.send(plr, "/plot list fuzzy <search...> [#]"); C.COMMAND_SYNTAX.send(plr, "/plot list fuzzy <search...> [#]");
return false; return false;
} }
String term = StringMan.join(Arrays.copyOfRange(args, 1, args.length - 2), " "); String term;
if (MathMan.isInteger(args[args.length - 1])) {
term = StringMan.join(Arrays.copyOfRange(args, 1, args.length - 1), " ");
} else {
term = StringMan.join(Arrays.copyOfRange(args, 1, args.length), " ");
}
plots = MainUtil.getPlotsBySearch(term); plots = MainUtil.getPlotsBySearch(term);
sort = false; sort = false;
break; break;

View File

@ -42,7 +42,7 @@ public class Trust extends SubCommand {
return true; return true;
} }
UUID uuid; UUID uuid;
if (args[0].equalsIgnoreCase("*")) { if (args[0].equalsIgnoreCase("*") && (Permissions.hasPermission(plr, "plots.trust.everyone") || Permissions.hasPermission(plr, "plots.admin.command.trust"))) {
uuid = DBFunc.everyone; uuid = DBFunc.everyone;
} else { } else {
uuid = UUIDHandler.getUUID(args[0], null); uuid = UUIDHandler.getUUID(args[0], null);

View File

@ -18,6 +18,7 @@ import com.intellectualcrafters.plot.object.RunnableVal2;
import java.util.HashSet; import java.util.HashSet;
import java.util.Iterator; import java.util.Iterator;
import java.util.Objects;
import java.util.Set; import java.util.Set;
import java.util.UUID; import java.util.UUID;
import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentHashMap;
@ -259,7 +260,7 @@ public class ExpireManager {
} }
public boolean isExpired(Plot plot) { public boolean isExpired(Plot plot) {
if (!plot.hasOwner() || DBFunc.everyone.equals(plot.owner) || UUIDHandler.getPlayer(plot.owner) != null || plot.getRunning() > 0) { if (!plot.hasOwner() || Objects.equals(DBFunc.everyone, plot.owner) || UUIDHandler.getPlayer(plot.owner) != null || plot.getRunning() > 0) {
return false; return false;
} }
Flag keep = plot.getFlag("keep"); Flag keep = plot.getFlag("keep");