This commit is contained in:
boy0001 2015-02-21 15:34:05 +11:00
parent 6c2bce824c
commit b14b7102b9
5 changed files with 21 additions and 20 deletions

View File

@ -47,6 +47,6 @@ public class CommandPermission {
* @return true of player has the required permission node * @return true of player has the required permission node
*/ */
public boolean hasPermission(final PlotPlayer player) { public boolean hasPermission(final PlotPlayer player) {
return BukkitMain.hasPermission(player, this.permission); return Permissions.hasPermission(BukkitUtil.getPlayer(player), this.permission);
} }
} }

View File

@ -65,13 +65,13 @@ public class FlagCmd extends SubCommand {
sendMessage(player, C.PLOT_NOT_CLAIMED); sendMessage(player, C.PLOT_NOT_CLAIMED);
return false; 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"); MainUtil.sendMessage(BukkitUtil.getPlayer(player), C.NO_PERMISSION, "plots.set.flag.other");
return false; return false;
} }
switch (args[0].toLowerCase()) { switch (args[0].toLowerCase()) {
case "info": { 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"); MainUtil.sendMessage(BukkitUtil.getPlayer(player), C.NO_PERMISSION, "plots.flag.info");
return false; return false;
} }
@ -94,7 +94,7 @@ public class FlagCmd extends SubCommand {
MainUtil.sendMessage(BukkitUtil.getPlayer(player), "&cNot implemented."); MainUtil.sendMessage(BukkitUtil.getPlayer(player), "&cNot implemented.");
} }
case "set": { 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"); MainUtil.sendMessage(BukkitUtil.getPlayer(player), C.NO_PERMISSION, "plots.set.flag");
return false; return false;
} }
@ -107,7 +107,7 @@ public class FlagCmd extends SubCommand {
MainUtil.sendMessage(BukkitUtil.getPlayer(player), C.NOT_VALID_FLAG); MainUtil.sendMessage(BukkitUtil.getPlayer(player), C.NOT_VALID_FLAG);
return false; 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()); MainUtil.sendMessage(BukkitUtil.getPlayer(player), C.NO_PERMISSION, "plots.set.flag." + args[1].toLowerCase());
return false; return false;
} }
@ -128,7 +128,7 @@ public class FlagCmd extends SubCommand {
return true; return true;
} }
case "remove": { 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"); MainUtil.sendMessage(BukkitUtil.getPlayer(player), C.NO_PERMISSION, "plots.flag.remove");
return false; return false;
} }
@ -141,7 +141,7 @@ public class FlagCmd extends SubCommand {
MainUtil.sendMessage(BukkitUtil.getPlayer(player), C.NOT_VALID_FLAG); MainUtil.sendMessage(BukkitUtil.getPlayer(player), C.NOT_VALID_FLAG);
return false; 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()); MainUtil.sendMessage(BukkitUtil.getPlayer(player), C.NO_PERMISSION, "plots.set.flag." + args[1].toLowerCase());
return false; return false;
} }
@ -166,7 +166,7 @@ public class FlagCmd extends SubCommand {
return true; return true;
} }
case "add": { 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"); MainUtil.sendMessage(BukkitUtil.getPlayer(player), C.NO_PERMISSION, "plots.flag.add");
return false; return false;
} }
@ -179,7 +179,7 @@ public class FlagCmd extends SubCommand {
MainUtil.sendMessage(BukkitUtil.getPlayer(player), C.NOT_VALID_FLAG); MainUtil.sendMessage(BukkitUtil.getPlayer(player), C.NOT_VALID_FLAG);
return false; 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()); MainUtil.sendMessage(BukkitUtil.getPlayer(player), C.NO_PERMISSION, "plots.set.flag." + args[1].toLowerCase());
return false; return false;
} }
@ -206,7 +206,7 @@ public class FlagCmd extends SubCommand {
return true; return true;
} }
case "list": { 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"); MainUtil.sendMessage(BukkitUtil.getPlayer(player), C.NO_PERMISSION, "plots.flag.list");
return false; return false;
} }

View File

@ -110,7 +110,7 @@ public class MainCommand {
} }
public boolean onCommand(final PlotPlayer player, final String cmd, final String... args) { 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); return no_permission(player, PlotSquared.MAIN_PERMISSION);
} }
if ((args.length < 1) || ((args.length >= 1) && (args[0].equalsIgnoreCase("help") || args[0].equalsIgnoreCase("he")))) { if ((args.length < 1) || ((args.length >= 1) && (args[0].equalsIgnoreCase("help") || args[0].equalsIgnoreCase("he")))) {

View File

@ -101,6 +101,7 @@ import com.intellectualcrafters.plot.object.PlotPlayer;
import com.intellectualcrafters.plot.object.PlotWorld; import com.intellectualcrafters.plot.object.PlotWorld;
import com.intellectualcrafters.plot.object.StringWrapper; import com.intellectualcrafters.plot.object.StringWrapper;
import com.intellectualcrafters.plot.util.MainUtil; import com.intellectualcrafters.plot.util.MainUtil;
import com.intellectualcrafters.plot.util.Permissions;
import com.intellectualcrafters.plot.util.TaskManager; import com.intellectualcrafters.plot.util.TaskManager;
import com.intellectualcrafters.plot.util.bukkit.BukkitPlayerFunctions; import com.intellectualcrafters.plot.util.bukkit.BukkitPlayerFunctions;
import com.intellectualcrafters.plot.util.bukkit.BukkitUtil; 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) { if (plot.denied.size() > 0) {
final UUID uuid = UUIDHandler.getUUID(player); final UUID uuid = UUIDHandler.getUUID(player);
if (plot.isDenied(uuid)) { 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"); MainUtil.sendMessage(BukkitUtil.getPlayer(player), C.NO_PERMISSION, "plots.admin.entry.denied");
event.setCancelled(true); event.setCancelled(true);
return; return;
@ -262,7 +263,7 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi
return; return;
} }
if (!plot.hasOwner()) { if (!plot.hasOwner()) {
if (BukkitMain.hasPermission(player, "plots.admin.destroy.unowned")) { if (Permissions.hasPermission(BukkitUtil.getPlayer(player), "plots.admin.destroy.unowned")) {
return; return;
} }
MainUtil.sendMessage(BukkitUtil.getPlayer(player), C.NO_PERMISSION, "plots.admin.destroy.unowned"); 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)) { if (isInPlot(loc)) {
final Plot plot = getCurrentPlot(loc); final Plot plot = getCurrentPlot(loc);
if (!plot.hasOwner()) { if (!plot.hasOwner()) {
if (BukkitMain.hasPermission(player, "plots.admin.interact.unowned")) { if (Permissions.hasPermission(BukkitUtil.getPlayer(player), "plots.admin.interact.unowned")) {
return; return;
} }
MainUtil.sendMessage(BukkitUtil.getPlayer(player), C.NO_PERMISSION, "plots.admin.interact.unowned"); 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); final UUID uuid = UUIDHandler.getUUID(player);
if (!plot.isAdded(uuid)) { if (!plot.isAdded(uuid)) {
if (BukkitMain.hasPermission(player, "plots.admin.interact.other")) { if (Permissions.hasPermission(BukkitUtil.getPlayer(player), "plots.admin.interact.other")) {
return; return;
} }
MainUtil.sendMessage(BukkitUtil.getPlayer(player), C.NO_PERMISSION, "plots.admin.interact.other"); 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; return;
} }
if (BukkitMain.hasPermission(player, "plots.admin.interact.road")) { if (Permissions.hasPermission(BukkitUtil.getPlayer(player), "plots.admin.interact.road")) {
return; return;
} }
if (isPlotArea(loc)) { if (isPlotArea(loc)) {
@ -1077,7 +1078,7 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi
if (isInPlot(loc)) { if (isInPlot(loc)) {
final Plot plot = getCurrentPlot(loc); final Plot plot = getCurrentPlot(loc);
if (!plot.hasOwner()) { if (!plot.hasOwner()) {
if (BukkitMain.hasPermission(player, "plots.admin.build.unowned")) { if (Permissions.hasPermission(BukkitUtil.getPlayer(player), "plots.admin.build.unowned")) {
return; return;
} }
MainUtil.sendMessage(BukkitUtil.getPlayer(player), C.NO_PERMISSION, "plots.admin.build.unowned"); 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()))) { if ((place != null) && ((HashSet<PlotBlock>) place.getValue()).contains(new PlotBlock((short) block.getTypeId(), block.getData()))) {
return; 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"); MainUtil.sendMessage(BukkitUtil.getPlayer(player), C.NO_PERMISSION, "plots.admin.build.other");
event.setCancelled(true); event.setCancelled(true);
return; return;
@ -1098,7 +1099,7 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi
} }
return; return;
} }
if (!BukkitMain.hasPermission(player, "plots.admin.build.road")) { if (!Permissions.hasPermission(BukkitUtil.getPlayer(player), "plots.admin.build.road")) {
if (isPlotArea(loc)) { if (isPlotArea(loc)) {
MainUtil.sendMessage(BukkitUtil.getPlayer(player), C.NO_PERMISSION, "plots.admin.build.road"); MainUtil.sendMessage(BukkitUtil.getPlayer(player), C.NO_PERMISSION, "plots.admin.build.road");
event.setCancelled(true); event.setCancelled(true);

View File

@ -85,7 +85,7 @@ public class WorldEditListener implements Listener {
if (!world.equals(player.getWorld().getName())) { if (!world.equals(player.getWorld().getName())) {
return; return;
} }
if (BukkitMain.hasPermission(player, "plots.worldedit.bypass")) { if (Permissions.hasPermission(BukkitUtil.getPlayer(player), "plots.worldedit.bypass")) {
return; return;
} }
PWE.setNoMask(player); PWE.setNoMask(player);