mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2024-11-26 15:16:45 +01:00
Fixed plot permissions never working.
This commit is contained in:
parent
044abeaee9
commit
e016cb5c85
@ -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) + "");
|
||||||
|
@ -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()) {
|
||||||
|
@ -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()) {
|
||||||
|
@ -1101,8 +1101,8 @@ public class MainUtil {
|
|||||||
* @param p
|
* @param p
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
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) {
|
||||||
|
@ -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;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user