mirror of
https://github.com/Zrips/Jobs.git
synced 2025-01-02 14:29:07 +01:00
parent
416ad5f8e7
commit
e24dba84a6
@ -156,7 +156,7 @@ public class PermissionManager {
|
||||
else if (amount == 0D || allowMinus || temp > amount)
|
||||
amount = temp;
|
||||
} catch (NumberFormatException ignored) {
|
||||
ignored.printStackTrace();
|
||||
// Should be ignored
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1169,8 +1169,7 @@ public class ConfigManager {
|
||||
desc = sqsection.getStringList("RewardDesc"),
|
||||
areas = sqsection.getStringList("RestrictedAreas");
|
||||
|
||||
if (sqsection.isInt("fromLevel"))
|
||||
quest.setMinLvl(sqsection.getInt("fromLevel"));
|
||||
quest.setMinLvl(sqsection.getInt("fromLevel"));
|
||||
|
||||
if (sqsection.isInt("toLevel"))
|
||||
quest.setMaxLvl(sqsection.getInt("toLevel"));
|
||||
|
@ -304,6 +304,22 @@ public class JobsPlayer {
|
||||
return Boost;
|
||||
}
|
||||
|
||||
public int getPlayerMaxQuest(String jobName) {
|
||||
int m1 = Jobs.getPermissionManager().getMaxPermission(this, "jobs.maxquest." + jobName, false, true, false).intValue();
|
||||
int max = m1;
|
||||
|
||||
m1 = Jobs.getPermissionManager().getMaxPermission(this, "jobs.maxquest.all", false, true, false).intValue();
|
||||
if (m1 != 0 && (m1 > max || m1 < max)) {
|
||||
max = m1;
|
||||
}
|
||||
|
||||
m1 = Jobs.getPermissionManager().getMaxPermission(this, "jobs.maxquest", false, true, false).intValue();
|
||||
if (m1 != 0 && (m1 > max || m1 < max)) {
|
||||
max = m1;
|
||||
}
|
||||
|
||||
return max;
|
||||
}
|
||||
|
||||
/**
|
||||
* Reloads max experience for this job.
|
||||
|
@ -16,8 +16,7 @@ public class Quest {
|
||||
private Job job;
|
||||
private Long validUntil = 0L;
|
||||
|
||||
private int chance = 100;
|
||||
private Integer minLvl = null;
|
||||
private int chance = 100, minLvl = 0;
|
||||
private Integer maxLvl = null;
|
||||
|
||||
private final List<String> rewardCmds = new ArrayList<>(), rewards = new ArrayList<>(), area = new ArrayList<>();
|
||||
@ -126,7 +125,7 @@ public class Quest {
|
||||
this.configName = configName;
|
||||
}
|
||||
|
||||
public Integer getMinLvl() {
|
||||
public int getMinLvl() {
|
||||
return minLvl;
|
||||
}
|
||||
|
||||
@ -146,10 +145,10 @@ public class Quest {
|
||||
if (level == null)
|
||||
return true;
|
||||
|
||||
if (getMinLvl() != null && level < getMinLvl())
|
||||
if (level < minLvl)
|
||||
return false;
|
||||
|
||||
if (getMaxLvl() != null && level > getMaxLvl())
|
||||
if (maxLvl != null && level > maxLvl)
|
||||
return false;
|
||||
|
||||
return true;
|
||||
|
@ -104,6 +104,13 @@ public class QuestProgression {
|
||||
}
|
||||
}
|
||||
|
||||
if (quest.getJob() != null) {
|
||||
int maxQuest = jPlayer.getPlayerMaxQuest(quest.getJob().getName());
|
||||
if (maxQuest > 0 && jPlayer.getDoneQuests() >= maxQuest) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (!isCompleted()) {
|
||||
HashMap<String, QuestObjective> byAction = quest.getObjectives().get(action.getType());
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user