mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2024-11-22 21:26:45 +01:00
Merge pull request #191 from romanalexander/master
Fixed plot permissions never working.
This commit is contained in:
commit
6075de6460
@ -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) + "");
|
||||
|
@ -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()) {
|
||||
|
@ -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()) {
|
||||
|
@ -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) {
|
||||
|
@ -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;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user