From 8f2de990010114b36c1df167c8cb1834e0dde33e Mon Sep 17 00:00:00 2001 From: boy0001 Date: Thu, 23 Oct 2014 18:23:09 +1100 Subject: [PATCH] Finished updating to new permissions system. --- PlotSquared/src/com/intellectualcrafters/plot/Plot.java | 2 +- .../src/com/intellectualcrafters/plot/commands/Auto.java | 2 +- .../src/com/intellectualcrafters/plot/commands/Claim.java | 2 +- .../src/com/intellectualcrafters/plot/commands/Clear.java | 3 ++- .../src/com/intellectualcrafters/plot/commands/Copy.java | 2 +- .../src/com/intellectualcrafters/plot/commands/Delete.java | 2 +- .../src/com/intellectualcrafters/plot/commands/Kick.java | 3 ++- .../src/com/intellectualcrafters/plot/commands/Paste.java | 2 +- .../src/com/intellectualcrafters/plot/commands/Set.java | 4 ++-- .../src/com/intellectualcrafters/plot/commands/Unlink.java | 2 +- PlotSquared/src/plugin.yml | 3 ++- 11 files changed, 15 insertions(+), 12 deletions(-) diff --git a/PlotSquared/src/com/intellectualcrafters/plot/Plot.java b/PlotSquared/src/com/intellectualcrafters/plot/Plot.java index f6c87a98a..ddcf159f0 100644 --- a/PlotSquared/src/com/intellectualcrafters/plot/Plot.java +++ b/PlotSquared/src/com/intellectualcrafters/plot/Plot.java @@ -152,7 +152,7 @@ public class Plot implements Cloneable { * @return true if the player is added as a helper or is the owner */ public boolean hasRights(Player player) { - return player.hasPermission("plots.admin") + return PlotMain.hasPermission(player, "plots.admin") || ((this.helpers != null) && this.helpers.contains(DBFunc.everyone)) || ((this.helpers != null) && this.helpers.contains(player.getUniqueId())) || ((this.owner != null) && this.owner.equals(player.getUniqueId())) diff --git a/PlotSquared/src/com/intellectualcrafters/plot/commands/Auto.java b/PlotSquared/src/com/intellectualcrafters/plot/commands/Auto.java index 935648038..20dabba21 100644 --- a/PlotSquared/src/com/intellectualcrafters/plot/commands/Auto.java +++ b/PlotSquared/src/com/intellectualcrafters/plot/commands/Auto.java @@ -99,7 +99,7 @@ public class Auto extends SubCommand { sendMessage(plr, C.SCHEMATIC_INVALID, "non-existent: " + schematic); return true; } - if (!plr.hasPermission("plots.claim." + schematic) && !plr.hasPermission("plots.admin")) { + if (!PlotMain.hasPermission(plr,"plots.claim." + schematic) && !plr.hasPermission("plots.admin")) { PlayerFunctions.sendMessage(plr, C.NO_SCHEMATIC_PERMISSION, schematic); return true; } diff --git a/PlotSquared/src/com/intellectualcrafters/plot/commands/Claim.java b/PlotSquared/src/com/intellectualcrafters/plot/commands/Claim.java index 4d0c4455b..b8be5e421 100644 --- a/PlotSquared/src/com/intellectualcrafters/plot/commands/Claim.java +++ b/PlotSquared/src/com/intellectualcrafters/plot/commands/Claim.java @@ -70,7 +70,7 @@ public class Claim extends SubCommand { sendMessage(plr, C.SCHEMATIC_INVALID, "non-existent: " + schematic); return true; } - if (!plr.hasPermission("plots.claim." + schematic) && !plr.hasPermission("plots.admin")) { + if (!PlotMain.hasPermission(plr,"plots.claim." + schematic) && !plr.hasPermission("plots.admin")) { PlayerFunctions.sendMessage(plr, C.NO_SCHEMATIC_PERMISSION, schematic); return true; } diff --git a/PlotSquared/src/com/intellectualcrafters/plot/commands/Clear.java b/PlotSquared/src/com/intellectualcrafters/plot/commands/Clear.java index 9295bdb34..9407dd994 100644 --- a/PlotSquared/src/com/intellectualcrafters/plot/commands/Clear.java +++ b/PlotSquared/src/com/intellectualcrafters/plot/commands/Clear.java @@ -13,6 +13,7 @@ import org.bukkit.entity.Player; import com.intellectualcrafters.plot.C; import com.intellectualcrafters.plot.PlayerFunctions; import com.intellectualcrafters.plot.Plot; +import com.intellectualcrafters.plot.PlotMain; /** * Created by Citymonstret on 2014-08-01. @@ -38,7 +39,7 @@ public class Clear extends SubCommand { return false; } if (((plot == null) || !plot.hasOwner() || !plot.getOwner().equals(plr.getUniqueId())) - && !plr.hasPermission("plots.admin")) { + && !PlotMain.hasPermission(plr,"plots.admin")) { PlayerFunctions.sendMessage(plr, C.NO_PLOT_PERMS); return false; } diff --git a/PlotSquared/src/com/intellectualcrafters/plot/commands/Copy.java b/PlotSquared/src/com/intellectualcrafters/plot/commands/Copy.java index 32c8ad4b2..fa2266286 100644 --- a/PlotSquared/src/com/intellectualcrafters/plot/commands/Copy.java +++ b/PlotSquared/src/com/intellectualcrafters/plot/commands/Copy.java @@ -29,7 +29,7 @@ public class Copy extends SubCommand { } Plot plot = PlayerFunctions.getCurrentPlot(plr); if (((plot == null) || !plot.hasOwner() || !plot.getOwner().equals(plr.getUniqueId())) - && !plr.hasPermission("plots.admin")) { + && !PlotMain.hasPermission(plr,"plots.admin")) { PlayerFunctions.sendMessage(plr, C.NO_PLOT_PERMS); return false; } diff --git a/PlotSquared/src/com/intellectualcrafters/plot/commands/Delete.java b/PlotSquared/src/com/intellectualcrafters/plot/commands/Delete.java index de2569746..f285e71ff 100644 --- a/PlotSquared/src/com/intellectualcrafters/plot/commands/Delete.java +++ b/PlotSquared/src/com/intellectualcrafters/plot/commands/Delete.java @@ -41,7 +41,7 @@ public class Delete extends SubCommand { return false; } if ((((plot == null) || !plot.hasOwner() || !plot.getOwner().equals(plr.getUniqueId()))) - && !plr.hasPermission("plots.admin")) { + && !PlotMain.hasPermission(plr,"plots.admin")) { PlayerFunctions.sendMessage(plr, C.NO_PLOT_PERMS); return false; } diff --git a/PlotSquared/src/com/intellectualcrafters/plot/commands/Kick.java b/PlotSquared/src/com/intellectualcrafters/plot/commands/Kick.java index d4c315096..7ea50291e 100644 --- a/PlotSquared/src/com/intellectualcrafters/plot/commands/Kick.java +++ b/PlotSquared/src/com/intellectualcrafters/plot/commands/Kick.java @@ -14,6 +14,7 @@ import org.bukkit.entity.Player; import com.intellectualcrafters.plot.C; import com.intellectualcrafters.plot.PlayerFunctions; import com.intellectualcrafters.plot.Plot; +import com.intellectualcrafters.plot.PlotMain; /** * Created by Citymonstret on 2014-08-01. @@ -32,7 +33,7 @@ public class Kick extends SubCommand { } Plot plot = PlayerFunctions.getCurrentPlot(plr); if (((plot == null) || !plot.hasOwner() || !plot.getOwner().equals(plr.getUniqueId())) - && !plr.hasPermission("plots.admin")) { + && !PlotMain.hasPermission(plr,"plots.admin")) { PlayerFunctions.sendMessage(plr, C.NO_PLOT_PERMS); return false; } diff --git a/PlotSquared/src/com/intellectualcrafters/plot/commands/Paste.java b/PlotSquared/src/com/intellectualcrafters/plot/commands/Paste.java index f01b2673b..f92126236 100644 --- a/PlotSquared/src/com/intellectualcrafters/plot/commands/Paste.java +++ b/PlotSquared/src/com/intellectualcrafters/plot/commands/Paste.java @@ -21,7 +21,7 @@ public class Paste extends SubCommand { } Plot plot = PlayerFunctions.getCurrentPlot(plr); if (((plot == null) || !plot.hasOwner() || !plot.getOwner().equals(plr.getUniqueId())) - && !plr.hasPermission("plots.admin")) { + && !PlotMain.hasPermission(plr,"plots.admin")) { PlayerFunctions.sendMessage(plr, C.NO_PLOT_PERMS); return false; } diff --git a/PlotSquared/src/com/intellectualcrafters/plot/commands/Set.java b/PlotSquared/src/com/intellectualcrafters/plot/commands/Set.java index 52139d7c3..6b788fca1 100644 --- a/PlotSquared/src/com/intellectualcrafters/plot/commands/Set.java +++ b/PlotSquared/src/com/intellectualcrafters/plot/commands/Set.java @@ -50,7 +50,7 @@ public class Set extends SubCommand { sendMessage(plr, C.PLOT_NOT_CLAIMED); return false; } - if (!plot.hasRights(plr) && !plr.hasPermission("plots.admin")) { + if (!plot.hasRights(plr) && !PlotMain.hasPermission(plr,"plots.admin")) { PlayerFunctions.sendMessage(plr, C.NO_PLOT_PERMS); return false; } @@ -70,7 +70,7 @@ public class Set extends SubCommand { /* TODO: Implement option */ boolean advanced_permissions = true; if (advanced_permissions) { - if (!plr.hasPermission("plots.set." + args[0].toLowerCase())) { + if (!PlotMain.hasPermission(plr,"plots.set." + args[0].toLowerCase())) { PlayerFunctions.sendMessage(plr, C.NO_PERMISSION, "plots.set."+args[0].toLowerCase()); return false; } diff --git a/PlotSquared/src/com/intellectualcrafters/plot/commands/Unlink.java b/PlotSquared/src/com/intellectualcrafters/plot/commands/Unlink.java index a08112156..fa7831265 100644 --- a/PlotSquared/src/com/intellectualcrafters/plot/commands/Unlink.java +++ b/PlotSquared/src/com/intellectualcrafters/plot/commands/Unlink.java @@ -43,7 +43,7 @@ public class Unlink extends SubCommand { } Plot plot = PlayerFunctions.getCurrentPlot(plr); if (((plot == null) || !plot.hasOwner() || !plot.getOwner().equals(plr.getUniqueId())) - && !plr.hasPermission("plots.admin")) { + && !PlotMain.hasPermission(plr,"plots.admin")) { PlayerFunctions.sendMessage(plr, C.NO_PLOT_PERMS); return true; } diff --git a/PlotSquared/src/plugin.yml b/PlotSquared/src/plugin.yml index 89f617c73..1a27cbd72 100644 --- a/PlotSquared/src/plugin.yml +++ b/PlotSquared/src/plugin.yml @@ -10,8 +10,9 @@ database: false commands: plots: description: PlotMain PlotSquared command. - aliases: [p,plotme,plot,ps] + aliases: [p,plotme,plot,ps,plotsquared,p2] permission: plots.use + permission-message: "You are lacking the permission node 'plots.use'" permissions: plots.use: default: op