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;
}
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 < 0) {
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);
}
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);
}
if (!plot.hasOwner()) {

View File

@ -91,7 +91,7 @@ public class Claim extends SubCommand {
return sendMessage(plr, C.NOT_IN_PLOT);
}
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);
}
if (plot.hasOwner()) {

View File

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

View File

@ -36,14 +36,14 @@ public class Permissions {
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)) {
return Byte.MAX_VALUE;
}
if (player.hasPermission(stub + ".*")) {
return Byte.MAX_VALUE;
}
for (int i = min; i < range; i++) {
for (int i = range; i > 0; i--) {
if (player.hasPermission(stub + "." + i)) {
return i;
}