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