mirror of
https://github.com/Zrips/Jobs.git
synced 2025-01-07 00:38:42 +01:00
Adjusting permission requirements
This commit is contained in:
parent
7715864301
commit
b70bd4d49b
@ -117,7 +117,7 @@ public class PermissionManager {
|
||||
}
|
||||
|
||||
public Double getMaxPermission(JobsPlayer jPlayer, String perm) {
|
||||
return getMaxPermission(jPlayer, perm, false);
|
||||
return getMaxPermission(jPlayer, perm, false, false);
|
||||
}
|
||||
|
||||
public Double getMaxPermission(JobsPlayer jPlayer, String perm, boolean force) {
|
||||
|
@ -554,7 +554,7 @@ public class Placeholder {
|
||||
return convert(true);
|
||||
|
||||
case maxjobs:
|
||||
int max = Jobs.getPermissionManager().getMaxPermission(user, "jobs.max", false, false).intValue();
|
||||
int max = Jobs.getPermissionManager().getMaxPermission(user, "jobs.max", false).intValue();
|
||||
max = max == 0 ? Jobs.getGCManager().getMaxJobs() : max;
|
||||
return Integer.toString(max);
|
||||
|
||||
|
@ -783,7 +783,7 @@ public class PlayerManager {
|
||||
* @return True if he have permission
|
||||
*/
|
||||
public boolean getJobsLimit(JobsPlayer jPlayer, short currentCount) {
|
||||
int max = Jobs.getPermissionManager().getMaxPermission(jPlayer, "jobs.max", false, false).intValue();
|
||||
int max = Jobs.getPermissionManager().getMaxPermission(jPlayer, "jobs.max", false).intValue();
|
||||
max = max == 0 ? Jobs.getGCManager().getMaxJobs() : max;
|
||||
return max > currentCount;
|
||||
}
|
||||
@ -958,19 +958,22 @@ public class PlayerManager {
|
||||
if (HookManager.getMcMMOManager().mcMMOPresent || HookManager.getMcMMOManager().mcMMOOverHaul)
|
||||
boost.add(BoostOf.McMMO, new BoostMultiplier().add(HookManager.getMcMMOManager().getMultiplier(player.getPlayer())));
|
||||
|
||||
Double petPay = null;
|
||||
|
||||
if (ent instanceof Tameable) {
|
||||
Tameable t = (Tameable) ent;
|
||||
if (t.isTamed() && t.getOwner() instanceof Player) {
|
||||
Double amount = Jobs.getPermissionManager().getMaxPermission(player, "jobs.petpay");
|
||||
if (amount != null)
|
||||
boost.add(BoostOf.PetPay, new BoostMultiplier().add(amount));
|
||||
petPay = Jobs.getPermissionManager().getMaxPermission(player, "jobs.petpay");
|
||||
if (petPay != null)
|
||||
boost.add(BoostOf.PetPay, new BoostMultiplier().add(petPay));
|
||||
}
|
||||
}
|
||||
|
||||
if (ent != null && HookManager.getMyPetManager() != null && HookManager.getMyPetManager().isMyPet(ent)) {
|
||||
Double amount = Jobs.getPermissionManager().getMaxPermission(player, "jobs.petpay");
|
||||
if (amount != null)
|
||||
boost.add(BoostOf.PetPay, new BoostMultiplier().add(amount));
|
||||
if (petPay == null)
|
||||
petPay = Jobs.getPermissionManager().getMaxPermission(player, "jobs.petpay");
|
||||
if (petPay != null)
|
||||
boost.add(BoostOf.PetPay, new BoostMultiplier().add(petPay));
|
||||
}
|
||||
|
||||
if (victim != null && victim.hasMetadata(getMobSpawnerMetadata())) {
|
||||
@ -980,10 +983,11 @@ public class PlayerManager {
|
||||
}
|
||||
|
||||
if (getall) {
|
||||
Double amount = Jobs.getPermissionManager().getMaxPermission(player, "jobs.petpay", force);
|
||||
if (amount != null)
|
||||
boost.add(BoostOf.PetPay, new BoostMultiplier().add(amount));
|
||||
amount = Jobs.getPermissionManager().getMaxPermission(player, "jobs.nearspawner", force);
|
||||
if (petPay == null)
|
||||
petPay = Jobs.getPermissionManager().getMaxPermission(player, "jobs.petpay", force);
|
||||
if (petPay != null)
|
||||
boost.add(BoostOf.PetPay, new BoostMultiplier().add(petPay));
|
||||
Double amount = Jobs.getPermissionManager().getMaxPermission(player, "jobs.nearspawner", force);
|
||||
if (amount != null)
|
||||
boost.add(BoostOf.NearSpawner, new BoostMultiplier().add(amount));
|
||||
}
|
||||
|
@ -150,20 +150,17 @@ public class BlockProtectionManager {
|
||||
HashMap<String, BlockProtection> chunk = region.get(locToChunk(loc));
|
||||
if (chunk == null)
|
||||
return null;
|
||||
String v = loc.getBlockX() + ":" + loc.getBlockY() + ":" + loc.getBlockZ();
|
||||
return chunk.get(v);
|
||||
return chunk.get(loc.getBlockX() + ":" + loc.getBlockY() + ":" + loc.getBlockZ());
|
||||
}
|
||||
|
||||
private static String locToChunk(Location loc) {
|
||||
int x = (int) Math.floor(loc.getBlockX() / 16);
|
||||
int z = (int) Math.floor(loc.getBlockZ() / 16);
|
||||
return x + ":" + z;
|
||||
return (int) Math.floor(loc.getBlockX() / 16D) + ":" + (int) Math.floor(loc.getBlockZ() / 16D);
|
||||
}
|
||||
|
||||
private static String locToRegion(Location loc) {
|
||||
int x = (int) Math.floor(loc.getBlockX() / 16);
|
||||
int z = (int) Math.floor(loc.getBlockZ() / 16);
|
||||
return (int) Math.floor(x / 32) + ":" + (int) Math.floor(z / 32);
|
||||
int x = (int) Math.floor(loc.getBlockX() / 16D);
|
||||
int z = (int) Math.floor(loc.getBlockZ() / 16D);
|
||||
return (int) Math.floor(x / 32D) + ":" + (int) Math.floor(z / 32D);
|
||||
}
|
||||
|
||||
public Integer getBlockDelayTime(Block block) {
|
||||
|
@ -50,7 +50,8 @@ public class GeneralConfigManager {
|
||||
/**
|
||||
* @deprecated use {@link ScheduleManager}
|
||||
*/
|
||||
@Deprecated public List<Schedule> BoostSchedule = new ArrayList<>();
|
||||
@Deprecated
|
||||
public List<Schedule> BoostSchedule = new ArrayList<>();
|
||||
|
||||
public final HashMap<CMIMaterial, HashMap<Enchantment, Integer>> whiteListedItems = new HashMap<>();
|
||||
private final HashMap<CurrencyType, CurrencyLimit> currencyLimitUse = new HashMap<>();
|
||||
|
@ -926,8 +926,6 @@ public class JobsPlayer {
|
||||
if (qProgression.containsKey(job.getName())) {
|
||||
qProgression.remove(job.getName());
|
||||
}
|
||||
|
||||
oneQ.getQuest().setObjectives(null);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1776,7 +1776,7 @@ public class JobsPaymentListener implements Listener {
|
||||
return true;
|
||||
|
||||
for (Entry<Enchantment, Integer> oneG : got.entrySet()) {
|
||||
if (!hand.getEnchantments().containsKey(oneG.getKey()) || hand.getEnchantments().get(oneG.getKey()) != oneG.getValue())
|
||||
if (!hand.getEnchantments().containsKey(oneG.getKey()) || hand.getEnchantments().get(oneG.getKey()).equals(oneG.getValue()))
|
||||
return false;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user