mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2024-11-26 15:16:45 +01:00
Add permissions for plot list filters. Closes #262
This commit is contained in:
parent
e93634622c
commit
fcb0b084d9
@ -33,6 +33,7 @@ import com.intellectualcrafters.plot.flag.FlagManager;
|
||||
import com.intellectualcrafters.plot.object.Plot;
|
||||
import com.intellectualcrafters.plot.object.PlotPlayer;
|
||||
import com.intellectualcrafters.plot.util.MainUtil;
|
||||
import com.intellectualcrafters.plot.util.Permissions;
|
||||
import com.intellectualcrafters.plot.util.StringComparison;
|
||||
import com.intellectualcrafters.plot.util.bukkit.UUIDHandler;
|
||||
|
||||
@ -112,6 +113,10 @@ public class list extends SubCommand {
|
||||
if (plr == null) {
|
||||
break;
|
||||
}
|
||||
if (!Permissions.hasPermission(plr, "plots.list.mine")) {
|
||||
MainUtil.sendMessage(plr, C.NO_PERMISSION, "plots.list.mine");
|
||||
return false;
|
||||
}
|
||||
plots = PlotSquared.getPlots(plr);
|
||||
break;
|
||||
}
|
||||
@ -119,6 +124,10 @@ public class list extends SubCommand {
|
||||
if (plr == null) {
|
||||
break;
|
||||
}
|
||||
if (!Permissions.hasPermission(plr, "plots.list.shared")) {
|
||||
MainUtil.sendMessage(plr, C.NO_PERMISSION, "plots.list.shared");
|
||||
return false;
|
||||
}
|
||||
plots = new ArrayList<Plot>();
|
||||
for (Plot plot : PlotSquared.getPlots()) {
|
||||
if (plot.helpers.contains(plr.getUUID()) || plot.trusted.contains(plr.getUUID())) {
|
||||
@ -128,14 +137,30 @@ public class list extends SubCommand {
|
||||
break;
|
||||
}
|
||||
case "world": {
|
||||
if (!Permissions.hasPermission(plr, "plots.list.world")) {
|
||||
MainUtil.sendMessage(plr, C.NO_PERMISSION, "plots.list.world");
|
||||
return false;
|
||||
}
|
||||
if (!Permissions.hasPermission(plr, "plots.list.world." + world)) {
|
||||
MainUtil.sendMessage(plr, C.NO_PERMISSION, "plots.list.world." + world);
|
||||
return false;
|
||||
}
|
||||
plots = PlotSquared.getPlots(world).values();
|
||||
break;
|
||||
}
|
||||
case "all": {
|
||||
if (!Permissions.hasPermission(plr, "plots.list.all")) {
|
||||
MainUtil.sendMessage(plr, C.NO_PERMISSION, "plots.list.all");
|
||||
return false;
|
||||
}
|
||||
plots = PlotSquared.getPlots();
|
||||
break;
|
||||
}
|
||||
case "forsale": {
|
||||
if (!Permissions.hasPermission(plr, "plots.list.forsale")) {
|
||||
MainUtil.sendMessage(plr, C.NO_PERMISSION, "plots.list.forsale");
|
||||
return false;
|
||||
}
|
||||
if (PlotSquared.economy == null) {
|
||||
break;
|
||||
}
|
||||
@ -149,6 +174,10 @@ public class list extends SubCommand {
|
||||
break;
|
||||
}
|
||||
case "unowned": {
|
||||
if (!Permissions.hasPermission(plr, "plots.list.unowned")) {
|
||||
MainUtil.sendMessage(plr, C.NO_PERMISSION, "plots.list.unowned");
|
||||
return false;
|
||||
}
|
||||
plots = new HashSet<>();
|
||||
for (Plot plot : PlotSquared.getPlots()) {
|
||||
if (plot.owner == null) {
|
||||
@ -158,6 +187,10 @@ public class list extends SubCommand {
|
||||
break;
|
||||
}
|
||||
case "unknown": {
|
||||
if (!Permissions.hasPermission(plr, "plots.list.unknown")) {
|
||||
MainUtil.sendMessage(plr, C.NO_PERMISSION, "plots.list.unknown");
|
||||
return false;
|
||||
}
|
||||
plots = new HashSet<>();
|
||||
for (Plot plot : PlotSquared.getPlots()) {
|
||||
if (plot.owner == null) {
|
||||
@ -171,11 +204,23 @@ public class list extends SubCommand {
|
||||
}
|
||||
default: {
|
||||
if (PlotSquared.isPlotWorld(args[0])) {
|
||||
if (!Permissions.hasPermission(plr, "plots.list.world")) {
|
||||
MainUtil.sendMessage(plr, C.NO_PERMISSION, "plots.list.world");
|
||||
return false;
|
||||
}
|
||||
if (!Permissions.hasPermission(plr, "plots.list.world." + args[0])) {
|
||||
MainUtil.sendMessage(plr, C.NO_PERMISSION, "plots.list.world." + args[0]);
|
||||
return false;
|
||||
}
|
||||
plots = PlotSquared.getPlots(args[0]).values();
|
||||
break;
|
||||
}
|
||||
UUID uuid = UUIDHandler.getUUID(args[0]);
|
||||
if (uuid != null) {
|
||||
if (!Permissions.hasPermission(plr, "plots.list.player")) {
|
||||
MainUtil.sendMessage(plr, C.NO_PERMISSION, "plots.list.player");
|
||||
return false;
|
||||
}
|
||||
plots = PlotSquared.getPlots(uuid);
|
||||
break;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user