mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2024-11-23 12:06:15 +01:00
perms
This commit is contained in:
parent
6c2bce824c
commit
b14b7102b9
@ -47,6 +47,6 @@ public class CommandPermission {
|
||||
* @return true of player has the required permission node
|
||||
*/
|
||||
public boolean hasPermission(final PlotPlayer player) {
|
||||
return BukkitMain.hasPermission(player, this.permission);
|
||||
return Permissions.hasPermission(BukkitUtil.getPlayer(player), this.permission);
|
||||
}
|
||||
}
|
||||
|
@ -65,13 +65,13 @@ public class FlagCmd extends SubCommand {
|
||||
sendMessage(player, C.PLOT_NOT_CLAIMED);
|
||||
return false;
|
||||
}
|
||||
if (!plot.hasRights(player) && !BukkitMain.hasPermission(player, "plots.set.flag.other")) {
|
||||
if (!plot.hasRights(player) && !Permissions.hasPermission(BukkitUtil.getPlayer(player), "plots.set.flag.other")) {
|
||||
MainUtil.sendMessage(BukkitUtil.getPlayer(player), C.NO_PERMISSION, "plots.set.flag.other");
|
||||
return false;
|
||||
}
|
||||
switch (args[0].toLowerCase()) {
|
||||
case "info": {
|
||||
if (!BukkitMain.hasPermission(player, "plots.set.flag")) {
|
||||
if (!Permissions.hasPermission(BukkitUtil.getPlayer(player), "plots.set.flag")) {
|
||||
MainUtil.sendMessage(BukkitUtil.getPlayer(player), C.NO_PERMISSION, "plots.flag.info");
|
||||
return false;
|
||||
}
|
||||
@ -94,7 +94,7 @@ public class FlagCmd extends SubCommand {
|
||||
MainUtil.sendMessage(BukkitUtil.getPlayer(player), "&cNot implemented.");
|
||||
}
|
||||
case "set": {
|
||||
if (!BukkitMain.hasPermission(player, "plots.set.flag")) {
|
||||
if (!Permissions.hasPermission(BukkitUtil.getPlayer(player), "plots.set.flag")) {
|
||||
MainUtil.sendMessage(BukkitUtil.getPlayer(player), C.NO_PERMISSION, "plots.set.flag");
|
||||
return false;
|
||||
}
|
||||
@ -107,7 +107,7 @@ public class FlagCmd extends SubCommand {
|
||||
MainUtil.sendMessage(BukkitUtil.getPlayer(player), C.NOT_VALID_FLAG);
|
||||
return false;
|
||||
}
|
||||
if (!BukkitMain.hasPermission(player, "plots.set.flag." + args[1].toLowerCase())) {
|
||||
if (!Permissions.hasPermission(BukkitUtil.getPlayer(player), "plots.set.flag." + args[1].toLowerCase())) {
|
||||
MainUtil.sendMessage(BukkitUtil.getPlayer(player), C.NO_PERMISSION, "plots.set.flag." + args[1].toLowerCase());
|
||||
return false;
|
||||
}
|
||||
@ -128,7 +128,7 @@ public class FlagCmd extends SubCommand {
|
||||
return true;
|
||||
}
|
||||
case "remove": {
|
||||
if (!BukkitMain.hasPermission(player, "plots.flag.remove")) {
|
||||
if (!Permissions.hasPermission(BukkitUtil.getPlayer(player), "plots.flag.remove")) {
|
||||
MainUtil.sendMessage(BukkitUtil.getPlayer(player), C.NO_PERMISSION, "plots.flag.remove");
|
||||
return false;
|
||||
}
|
||||
@ -141,7 +141,7 @@ public class FlagCmd extends SubCommand {
|
||||
MainUtil.sendMessage(BukkitUtil.getPlayer(player), C.NOT_VALID_FLAG);
|
||||
return false;
|
||||
}
|
||||
if (!BukkitMain.hasPermission(player, "plots.set.flag." + args[1].toLowerCase())) {
|
||||
if (!Permissions.hasPermission(BukkitUtil.getPlayer(player), "plots.set.flag." + args[1].toLowerCase())) {
|
||||
MainUtil.sendMessage(BukkitUtil.getPlayer(player), C.NO_PERMISSION, "plots.set.flag." + args[1].toLowerCase());
|
||||
return false;
|
||||
}
|
||||
@ -166,7 +166,7 @@ public class FlagCmd extends SubCommand {
|
||||
return true;
|
||||
}
|
||||
case "add": {
|
||||
if (!BukkitMain.hasPermission(player, "plots.flag.add")) {
|
||||
if (!Permissions.hasPermission(BukkitUtil.getPlayer(player), "plots.flag.add")) {
|
||||
MainUtil.sendMessage(BukkitUtil.getPlayer(player), C.NO_PERMISSION, "plots.flag.add");
|
||||
return false;
|
||||
}
|
||||
@ -179,7 +179,7 @@ public class FlagCmd extends SubCommand {
|
||||
MainUtil.sendMessage(BukkitUtil.getPlayer(player), C.NOT_VALID_FLAG);
|
||||
return false;
|
||||
}
|
||||
if (!BukkitMain.hasPermission(player, "plots.set.flag." + args[1].toLowerCase())) {
|
||||
if (!Permissions.hasPermission(BukkitUtil.getPlayer(player), "plots.set.flag." + args[1].toLowerCase())) {
|
||||
MainUtil.sendMessage(BukkitUtil.getPlayer(player), C.NO_PERMISSION, "plots.set.flag." + args[1].toLowerCase());
|
||||
return false;
|
||||
}
|
||||
@ -206,7 +206,7 @@ public class FlagCmd extends SubCommand {
|
||||
return true;
|
||||
}
|
||||
case "list": {
|
||||
if (!BukkitMain.hasPermission(player, "plots.flag.list")) {
|
||||
if (!Permissions.hasPermission(BukkitUtil.getPlayer(player), "plots.flag.list")) {
|
||||
MainUtil.sendMessage(BukkitUtil.getPlayer(player), C.NO_PERMISSION, "plots.flag.list");
|
||||
return false;
|
||||
}
|
||||
|
@ -110,7 +110,7 @@ public class MainCommand {
|
||||
}
|
||||
|
||||
public boolean onCommand(final PlotPlayer player, final String cmd, final String... args) {
|
||||
if (!BukkitMain.hasPermission(player, PlotSquared.MAIN_PERMISSION)) {
|
||||
if (!Permissions.hasPermission(BukkitUtil.getPlayer(player), PlotSquared.MAIN_PERMISSION)) {
|
||||
return no_permission(player, PlotSquared.MAIN_PERMISSION);
|
||||
}
|
||||
if ((args.length < 1) || ((args.length >= 1) && (args[0].equalsIgnoreCase("help") || args[0].equalsIgnoreCase("he")))) {
|
||||
|
@ -101,6 +101,7 @@ import com.intellectualcrafters.plot.object.PlotPlayer;
|
||||
import com.intellectualcrafters.plot.object.PlotWorld;
|
||||
import com.intellectualcrafters.plot.object.StringWrapper;
|
||||
import com.intellectualcrafters.plot.util.MainUtil;
|
||||
import com.intellectualcrafters.plot.util.Permissions;
|
||||
import com.intellectualcrafters.plot.util.TaskManager;
|
||||
import com.intellectualcrafters.plot.util.bukkit.BukkitPlayerFunctions;
|
||||
import com.intellectualcrafters.plot.util.bukkit.BukkitUtil;
|
||||
@ -198,7 +199,7 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi
|
||||
if (plot.denied.size() > 0) {
|
||||
final UUID uuid = UUIDHandler.getUUID(player);
|
||||
if (plot.isDenied(uuid)) {
|
||||
if (!BukkitMain.hasPermission(player, "plots.admin.entry.denied")) {
|
||||
if (!Permissions.hasPermission(BukkitUtil.getPlayer(player), "plots.admin.entry.denied")) {
|
||||
MainUtil.sendMessage(BukkitUtil.getPlayer(player), C.NO_PERMISSION, "plots.admin.entry.denied");
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
@ -262,7 +263,7 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi
|
||||
return;
|
||||
}
|
||||
if (!plot.hasOwner()) {
|
||||
if (BukkitMain.hasPermission(player, "plots.admin.destroy.unowned")) {
|
||||
if (Permissions.hasPermission(BukkitUtil.getPlayer(player), "plots.admin.destroy.unowned")) {
|
||||
return;
|
||||
}
|
||||
MainUtil.sendMessage(BukkitUtil.getPlayer(player), C.NO_PERMISSION, "plots.admin.destroy.unowned");
|
||||
@ -526,7 +527,7 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi
|
||||
if (isInPlot(loc)) {
|
||||
final Plot plot = getCurrentPlot(loc);
|
||||
if (!plot.hasOwner()) {
|
||||
if (BukkitMain.hasPermission(player, "plots.admin.interact.unowned")) {
|
||||
if (Permissions.hasPermission(BukkitUtil.getPlayer(player), "plots.admin.interact.unowned")) {
|
||||
return;
|
||||
}
|
||||
MainUtil.sendMessage(BukkitUtil.getPlayer(player), C.NO_PERMISSION, "plots.admin.interact.unowned");
|
||||
@ -539,7 +540,7 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi
|
||||
}
|
||||
final UUID uuid = UUIDHandler.getUUID(player);
|
||||
if (!plot.isAdded(uuid)) {
|
||||
if (BukkitMain.hasPermission(player, "plots.admin.interact.other")) {
|
||||
if (Permissions.hasPermission(BukkitUtil.getPlayer(player), "plots.admin.interact.other")) {
|
||||
return;
|
||||
}
|
||||
MainUtil.sendMessage(BukkitUtil.getPlayer(player), C.NO_PERMISSION, "plots.admin.interact.other");
|
||||
@ -548,7 +549,7 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi
|
||||
}
|
||||
return;
|
||||
}
|
||||
if (BukkitMain.hasPermission(player, "plots.admin.interact.road")) {
|
||||
if (Permissions.hasPermission(BukkitUtil.getPlayer(player), "plots.admin.interact.road")) {
|
||||
return;
|
||||
}
|
||||
if (isPlotArea(loc)) {
|
||||
@ -1077,7 +1078,7 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi
|
||||
if (isInPlot(loc)) {
|
||||
final Plot plot = getCurrentPlot(loc);
|
||||
if (!plot.hasOwner()) {
|
||||
if (BukkitMain.hasPermission(player, "plots.admin.build.unowned")) {
|
||||
if (Permissions.hasPermission(BukkitUtil.getPlayer(player), "plots.admin.build.unowned")) {
|
||||
return;
|
||||
}
|
||||
MainUtil.sendMessage(BukkitUtil.getPlayer(player), C.NO_PERMISSION, "plots.admin.build.unowned");
|
||||
@ -1090,7 +1091,7 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi
|
||||
if ((place != null) && ((HashSet<PlotBlock>) place.getValue()).contains(new PlotBlock((short) block.getTypeId(), block.getData()))) {
|
||||
return;
|
||||
}
|
||||
if (!BukkitMain.hasPermission(player, "plots.admin.build.other")) {
|
||||
if (!Permissions.hasPermission(BukkitUtil.getPlayer(player), "plots.admin.build.other")) {
|
||||
MainUtil.sendMessage(BukkitUtil.getPlayer(player), C.NO_PERMISSION, "plots.admin.build.other");
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
@ -1098,7 +1099,7 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi
|
||||
}
|
||||
return;
|
||||
}
|
||||
if (!BukkitMain.hasPermission(player, "plots.admin.build.road")) {
|
||||
if (!Permissions.hasPermission(BukkitUtil.getPlayer(player), "plots.admin.build.road")) {
|
||||
if (isPlotArea(loc)) {
|
||||
MainUtil.sendMessage(BukkitUtil.getPlayer(player), C.NO_PERMISSION, "plots.admin.build.road");
|
||||
event.setCancelled(true);
|
||||
|
@ -85,7 +85,7 @@ public class WorldEditListener implements Listener {
|
||||
if (!world.equals(player.getWorld().getName())) {
|
||||
return;
|
||||
}
|
||||
if (BukkitMain.hasPermission(player, "plots.worldedit.bypass")) {
|
||||
if (Permissions.hasPermission(BukkitUtil.getPlayer(player), "plots.worldedit.bypass")) {
|
||||
return;
|
||||
}
|
||||
PWE.setNoMask(player);
|
||||
|
Loading…
Reference in New Issue
Block a user