Merge pull request #191 from romanalexander/master

Fixed plot permissions never working.
This commit is contained in:
boy0001 2015-03-14 21:31:38 +11:00
commit 6075de6460
5 changed files with 7 additions and 7 deletions

View File

@ -120,7 +120,7 @@ public class Auto extends SubCommand {
return false; return false;
} }
final int currentPlots = MainUtil.getPlayerPlotCount(world, plr); final int currentPlots = MainUtil.getPlayerPlotCount(world, plr);
final int diff = currentPlots - MainUtil.getAllowedPlots(plr, currentPlots); final int diff = currentPlots - MainUtil.getAllowedPlots(plr);
if ((diff + (size_x * size_z)) > 0) { if ((diff + (size_x * size_z)) > 0) {
if (diff < 0) { if (diff < 0) {
MainUtil.sendMessage(plr, C.CANT_CLAIM_MORE_PLOTS_NUM, (-diff) + ""); MainUtil.sendMessage(plr, C.CANT_CLAIM_MORE_PLOTS_NUM, (-diff) + "");

View File

@ -68,7 +68,7 @@ public class Buy extends SubCommand {
return sendMessage(plr, C.NOT_IN_PLOT); return sendMessage(plr, C.NOT_IN_PLOT);
} }
final int currentPlots = MainUtil.getPlayerPlotCount(world, plr); final int currentPlots = MainUtil.getPlayerPlotCount(world, plr);
if (currentPlots >= MainUtil.getAllowedPlots(plr, currentPlots)) { if (currentPlots >= MainUtil.getAllowedPlots(plr)) {
return sendMessage(plr, C.CANT_CLAIM_MORE_PLOTS); return sendMessage(plr, C.CANT_CLAIM_MORE_PLOTS);
} }
if (!plot.hasOwner()) { if (!plot.hasOwner()) {

View File

@ -91,7 +91,7 @@ public class Claim extends SubCommand {
return sendMessage(plr, C.NOT_IN_PLOT); return sendMessage(plr, C.NOT_IN_PLOT);
} }
final int currentPlots = MainUtil.getPlayerPlotCount(loc.getWorld(), plr); final int currentPlots = MainUtil.getPlayerPlotCount(loc.getWorld(), plr);
if (currentPlots >= MainUtil.getAllowedPlots(plr, currentPlots)) { if (currentPlots >= MainUtil.getAllowedPlots(plr)) {
return sendMessage(plr, C.CANT_CLAIM_MORE_PLOTS); return sendMessage(plr, C.CANT_CLAIM_MORE_PLOTS);
} }
if (plot.hasOwner()) { if (plot.hasOwner()) {

View File

@ -1110,8 +1110,8 @@ public class MainUtil {
* @param p * @param p
* @return int * @return int
*/ */
public static int getAllowedPlots(final PlotPlayer p, final int current) { public static int getAllowedPlots(final PlotPlayer p) {
return Permissions.hasPermissionRange(p, "plots.plot", Settings.MAX_PLOTS, current); return Permissions.hasPermissionRange(p, "plots.plot", Settings.MAX_PLOTS);
} }
public static Plot getPlot(final Location loc) { public static Plot getPlot(final Location loc) {

View File

@ -36,14 +36,14 @@ public class Permissions {
return false; return false;
} }
public static int hasPermissionRange(final PlotPlayer player, final String stub, final int range, final int min) { public static int hasPermissionRange(final PlotPlayer player, final String stub, final int range) {
if ((player == null) || player.isOp() || player.hasPermission(ADMIN)) { if ((player == null) || player.isOp() || player.hasPermission(ADMIN)) {
return Byte.MAX_VALUE; return Byte.MAX_VALUE;
} }
if (player.hasPermission(stub + ".*")) { if (player.hasPermission(stub + ".*")) {
return Byte.MAX_VALUE; return Byte.MAX_VALUE;
} }
for (int i = min; i < range; i++) { for (int i = range; i > 0; i--) {
if (player.hasPermission(stub + "." + i)) { if (player.hasPermission(stub + "." + i)) {
return i; return i;
} }