1
0
mirror of https://github.com/Zrips/Jobs.git synced 2025-01-09 01:37:46 +01:00

Adjusting permission requirements

This commit is contained in:
Zrips 2020-09-28 16:21:02 +03:00
parent 7715864301
commit b70bd4d49b
7 changed files with 34 additions and 34 deletions

View File

@ -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) {

View File

@ -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);

View File

@ -765,7 +765,7 @@ public class PlayerManager {
for (JobCommands command : job.getCommands()) { for (JobCommands command : job.getCommands()) {
if ((command.getLevelFrom() == 0 && command.getLevelUntil() == 0) || newLevel >= command.getLevelFrom() if ((command.getLevelFrom() == 0 && command.getLevelUntil() == 0) || newLevel >= command.getLevelFrom()
&& newLevel <= command.getLevelUntil()) { && newLevel <= command.getLevelUntil()) {
for (String commandString : new ArrayList<String>(command.getCommands())) { for (String commandString : new ArrayList<String>(command.getCommands())) {
commandString = commandString.replace("[player]", player.getName()); commandString = commandString.replace("[player]", player.getName());
commandString = commandString.replace("[oldlevel]", String.valueOf(oldLevel)); commandString = commandString.replace("[oldlevel]", String.valueOf(oldLevel));
@ -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));
} }

View File

@ -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) {

View File

@ -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<>();
@ -61,21 +62,21 @@ public class GeneralConfigManager {
private ConfigReader c = null; private ConfigReader c = null;
protected boolean economyAsync, isBroadcastingSkillups, isBroadcastingLevelups, payInCreative, payExploringWhenFlying, protected boolean economyAsync, isBroadcastingSkillups, isBroadcastingLevelups, payInCreative, payExploringWhenFlying,
addXpPlayer, hideJobsWithoutPermission, payNearSpawner, modifyChat, saveOnDisconnect, MultiServerCompatability; addXpPlayer, hideJobsWithoutPermission, payNearSpawner, modifyChat, saveOnDisconnect, MultiServerCompatability;
public String modifyChatPrefix, modifyChatSuffix, modifyChatSeparator, FireworkType, SoundLevelupSound, public String modifyChatPrefix, modifyChatSuffix, modifyChatSeparator, FireworkType, SoundLevelupSound,
SoundTitleChangeSound, ServerAccountName, ServertaxesAccountName, localeString = ""; SoundTitleChangeSound, ServerAccountName, ServertaxesAccountName, localeString = "";
private String getSelectionTool, DecimalPlacesMoney, DecimalPlacesExp, DecimalPlacesPoints; private String getSelectionTool, DecimalPlacesMoney, DecimalPlacesExp, DecimalPlacesPoints;
public int jobExpiryTime, BlockProtectionDays, FireworkPower, ShootTime, public int jobExpiryTime, BlockProtectionDays, FireworkPower, ShootTime,
globalblocktimer, CowMilkingTimer, InfoUpdateInterval, JobsTopAmount, PlaceholdersPage, ConfirmExpiryTime, globalblocktimer, CowMilkingTimer, InfoUpdateInterval, JobsTopAmount, PlaceholdersPage, ConfirmExpiryTime,
SegmentCount, BossBarTimer, AutoJobJoinDelay, DBCleaningJobsLvl, DBCleaningUsersDays, BlastFurnacesMaxDefault, SmokersMaxDefault; SegmentCount, BossBarTimer, AutoJobJoinDelay, DBCleaningJobsLvl, DBCleaningUsersDays, BlastFurnacesMaxDefault, SmokersMaxDefault;
protected int savePeriod, maxJobs, economyBatchDelay; protected int savePeriod, maxJobs, economyBatchDelay;
private int ResetTimeHour, ResetTimeMinute, DailyQuestsSkips, FurnacesMaxDefault, BrewingStandsMaxDefault, private int ResetTimeHour, ResetTimeMinute, DailyQuestsSkips, FurnacesMaxDefault, BrewingStandsMaxDefault,
BrowseAmountToShow, JobsGUIRows, JobsGUIBackButton, JobsGUINextButton, JobsGUIStartPosition, JobsGUIGroupAmount, JobsGUISkipAmount; BrowseAmountToShow, JobsGUIRows, JobsGUIBackButton, JobsGUINextButton, JobsGUIStartPosition, JobsGUIGroupAmount, JobsGUISkipAmount;
public double skipQuestCost, MinimumOveralPaymentLimit, MinimumOveralPointsLimit, MonsterDamagePercentage, public double skipQuestCost, MinimumOveralPaymentLimit, MinimumOveralPointsLimit, MonsterDamagePercentage,
DynamicPaymentMaxPenalty, DynamicPaymentMaxBonus, TaxesAmount; DynamicPaymentMaxPenalty, DynamicPaymentMaxBonus, TaxesAmount;
public Double TreeFellerMultiplier, gigaDrillMultiplier, superBreakerMultiplier; public Double TreeFellerMultiplier, gigaDrillMultiplier, superBreakerMultiplier;
@ -90,8 +91,8 @@ public class GeneralConfigManager {
SignsColorizeJobName, ShowToplistInScoreboard, useGlobalTimer, useSilkTouchProtection, UseCustomNames, SignsColorizeJobName, ShowToplistInScoreboard, useGlobalTimer, useSilkTouchProtection, UseCustomNames,
PreventSlimeSplit, PreventMagmaCubeSplit, PreventHopperFillUps, PreventBrewingStandFillUps, PreventSlimeSplit, PreventMagmaCubeSplit, PreventHopperFillUps, PreventBrewingStandFillUps,
BrowseUseNewLook, payExploringWhenGliding, disablePaymentIfMaxLevelReached, disablePaymentIfRiding, BrowseUseNewLook, payExploringWhenGliding, disablePaymentIfMaxLevelReached, disablePaymentIfRiding,
boostedItemsInOffHand, preventCropResizePayment, payItemDurabilityLoss, boostedItemsInOffHand, preventCropResizePayment, payItemDurabilityLoss,
applyToNegativeIncome, useMinimumOveralPayment, useMinimumOveralPoints, useBreederFinder = false, applyToNegativeIncome, useMinimumOveralPayment, useMinimumOveralPoints, useBreederFinder = false,
CancelCowMilking, fixAtMaxLevel, TitleChangeChat, TitleChangeActionBar, LevelChangeChat, CancelCowMilking, fixAtMaxLevel, TitleChangeChat, TitleChangeActionBar, LevelChangeChat,
LevelChangeActionBar, SoundLevelupUse, SoundTitleChangeUse, UseServerAccount, EmptyServerAccountChat, LevelChangeActionBar, SoundLevelupUse, SoundTitleChangeUse, UseServerAccount, EmptyServerAccountChat,
EmptyServerAccountActionBar, ActionBarsMessageByDefault, ShowTotalWorkers, ShowPenaltyBonus, useDynamicPayment, EmptyServerAccountActionBar, ActionBarsMessageByDefault, ShowTotalWorkers, ShowPenaltyBonus, useDynamicPayment,

View File

@ -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);
} }
} }

View File

@ -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;
} }