mirror of
https://github.com/Zrips/Jobs.git
synced 2025-01-04 23:37:49 +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);
|
||||
|
||||
|
@ -765,7 +765,7 @@ public class PlayerManager {
|
||||
|
||||
for (JobCommands command : job.getCommands()) {
|
||||
if ((command.getLevelFrom() == 0 && command.getLevelUntil() == 0) || newLevel >= command.getLevelFrom()
|
||||
&& newLevel <= command.getLevelUntil()) {
|
||||
&& newLevel <= command.getLevelUntil()) {
|
||||
for (String commandString : new ArrayList<String>(command.getCommands())) {
|
||||
commandString = commandString.replace("[player]", player.getName());
|
||||
commandString = commandString.replace("[oldlevel]", String.valueOf(oldLevel));
|
||||
@ -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<>();
|
||||
@ -61,21 +62,21 @@ public class GeneralConfigManager {
|
||||
private ConfigReader c = null;
|
||||
|
||||
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,
|
||||
SoundTitleChangeSound, ServerAccountName, ServertaxesAccountName, localeString = "";
|
||||
SoundTitleChangeSound, ServerAccountName, ServertaxesAccountName, localeString = "";
|
||||
private String getSelectionTool, DecimalPlacesMoney, DecimalPlacesExp, DecimalPlacesPoints;
|
||||
|
||||
public int jobExpiryTime, BlockProtectionDays, FireworkPower, ShootTime,
|
||||
globalblocktimer, CowMilkingTimer, InfoUpdateInterval, JobsTopAmount, PlaceholdersPage, ConfirmExpiryTime,
|
||||
SegmentCount, BossBarTimer, AutoJobJoinDelay, DBCleaningJobsLvl, DBCleaningUsersDays, BlastFurnacesMaxDefault, SmokersMaxDefault;
|
||||
globalblocktimer, CowMilkingTimer, InfoUpdateInterval, JobsTopAmount, PlaceholdersPage, ConfirmExpiryTime,
|
||||
SegmentCount, BossBarTimer, AutoJobJoinDelay, DBCleaningJobsLvl, DBCleaningUsersDays, BlastFurnacesMaxDefault, SmokersMaxDefault;
|
||||
protected int savePeriod, maxJobs, economyBatchDelay;
|
||||
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,
|
||||
DynamicPaymentMaxPenalty, DynamicPaymentMaxBonus, TaxesAmount;
|
||||
DynamicPaymentMaxPenalty, DynamicPaymentMaxBonus, TaxesAmount;
|
||||
|
||||
public Double TreeFellerMultiplier, gigaDrillMultiplier, superBreakerMultiplier;
|
||||
|
||||
@ -90,8 +91,8 @@ public class GeneralConfigManager {
|
||||
SignsColorizeJobName, ShowToplistInScoreboard, useGlobalTimer, useSilkTouchProtection, UseCustomNames,
|
||||
PreventSlimeSplit, PreventMagmaCubeSplit, PreventHopperFillUps, PreventBrewingStandFillUps,
|
||||
BrowseUseNewLook, payExploringWhenGliding, disablePaymentIfMaxLevelReached, disablePaymentIfRiding,
|
||||
boostedItemsInOffHand, preventCropResizePayment, payItemDurabilityLoss,
|
||||
applyToNegativeIncome, useMinimumOveralPayment, useMinimumOveralPoints, useBreederFinder = false,
|
||||
boostedItemsInOffHand, preventCropResizePayment, payItemDurabilityLoss,
|
||||
applyToNegativeIncome, useMinimumOveralPayment, useMinimumOveralPoints, useBreederFinder = false,
|
||||
CancelCowMilking, fixAtMaxLevel, TitleChangeChat, TitleChangeActionBar, LevelChangeChat,
|
||||
LevelChangeActionBar, SoundLevelupUse, SoundTitleChangeUse, UseServerAccount, EmptyServerAccountChat,
|
||||
EmptyServerAccountActionBar, ActionBarsMessageByDefault, ShowTotalWorkers, ShowPenaltyBonus, useDynamicPayment,
|
||||
|
@ -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