1
0
mirror of https://github.com/Zrips/Jobs.git synced 2025-01-06 16:27:59 +01:00

Allow minus value for petpay

This commit is contained in:
montlikadani 2020-10-02 15:12:26 +02:00
parent d5905519df
commit 0cf52b6362
2 changed files with 5 additions and 7 deletions

View File

@ -117,14 +117,14 @@ public class PermissionManager {
} }
public Double getMaxPermission(JobsPlayer jPlayer, String perm) { public Double getMaxPermission(JobsPlayer jPlayer, String perm) {
return getMaxPermission(jPlayer, perm, false, false); return getMaxPermission(jPlayer, perm, false, false, false);
} }
public Double getMaxPermission(JobsPlayer jPlayer, String perm, boolean force) { public Double getMaxPermission(JobsPlayer jPlayer, String perm, boolean force) {
return getMaxPermission(jPlayer, perm, force, false); return getMaxPermission(jPlayer, perm, force, false, false);
} }
public Double getMaxPermission(JobsPlayer jPlayer, String perm, boolean force, boolean cumulative) { public Double getMaxPermission(JobsPlayer jPlayer, String perm, boolean force, boolean cumulative, boolean allowMinus) {
if (jPlayer == null || jPlayer.getPlayer() == null) if (jPlayer == null || jPlayer.getPlayer() == null)
return 0D; return 0D;
@ -151,12 +151,10 @@ public class PermissionManager {
try { try {
double temp = Double.parseDouble(permission.getKey().replace(perm, "")); double temp = Double.parseDouble(permission.getKey().replace(perm, ""));
if (cumulative) if (cumulative)
amount += temp; amount += temp;
else if (temp > amount) else if (allowMinus || temp > amount)
amount = temp; amount = temp;
} catch (NumberFormatException ignored) { } catch (NumberFormatException ignored) {
} }
} }

View File

@ -963,7 +963,7 @@ public class PlayerManager {
if (ent instanceof Tameable) { if (ent instanceof Tameable) {
Tameable t = (Tameable) ent; Tameable t = (Tameable) ent;
if (t.isTamed() && t.getOwner() instanceof Player) { if (t.isTamed() && t.getOwner() instanceof Player) {
petPay = Jobs.getPermissionManager().getMaxPermission(player, "jobs.petpay"); petPay = Jobs.getPermissionManager().getMaxPermission(player, "jobs.petpay", false, false, true);
if (petPay != null) if (petPay != null)
boost.add(BoostOf.PetPay, new BoostMultiplier().add(petPay)); boost.add(BoostOf.PetPay, new BoostMultiplier().add(petPay));
} }