Finished updating to new permissions system.

This commit is contained in:
boy0001 2014-10-23 18:23:09 +11:00
parent d2df275000
commit 8f2de99001
11 changed files with 15 additions and 12 deletions

View File

@ -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()))

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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