1
0
mirror of https://github.com/Zrips/Jobs.git synced 2025-01-02 14:29:07 +01:00

Fixed quest actions does not worked on lower case names

Now we replaces the material names to upper cased one for better match.

Fixes #1091
Fixes #967
This commit is contained in:
montlikadani 2021-03-29 15:07:21 +02:00
parent 21305dcc7e
commit 5337e2c36d
4 changed files with 19 additions and 24 deletions

View File

@ -963,10 +963,7 @@ public class Jobs extends JavaPlugin {
// no job
if (numjobs == 0) {
if (noneJob == null)
return;
if (noneJob.isWorldBlackListed(block) || noneJob.isWorldBlackListed(block, ent) || noneJob.isWorldBlackListed(victim))
if (noneJob == null || noneJob.isWorldBlackListed(block) || noneJob.isWorldBlackListed(block, ent) || noneJob.isWorldBlackListed(victim))
return;
JobInfo jobinfo = noneJob.getJobInfo(info, 1);

View File

@ -1141,11 +1141,10 @@ public class ConfigManager {
if (sqsection.isString("Target")) {
ActionType actionType = ActionType.getByName(sqsection.getString("Action"));
KeyValues kv = getKeyValue(sqsection.getString("Target"), actionType, jobFullName);
KeyValues kv = getKeyValue(sqsection.getString("Target").toUpperCase(), actionType, jobFullName);
if (kv != null) {
int amount = sqsection.getInt("Amount", 1);
QuestObjective objective = new QuestObjective(actionType, kv.getId(), kv.getMeta(), kv.getType() + kv.getSubType(), amount);
quest.addObjective(objective);
quest.addObjective(new QuestObjective(actionType, kv.getId(), kv.getMeta(), (kv.getType() + kv.getSubType()).toUpperCase(), amount));
}
}
@ -1159,7 +1158,7 @@ public class ConfigManager {
try {
ActionType actionType = ActionType.getByName(split[0]);
String mats = split[1];
String mats = split[1].toUpperCase();
String[] co = mats.split(",");
int amount = 1;
@ -1175,14 +1174,14 @@ public class ConfigManager {
}
QuestObjective objective = new QuestObjective(actionType, kv.getId(), kv.getMeta(),
kv.getType() + kv.getSubType(), amount);
(kv.getType() + kv.getSubType()).toUpperCase(), amount);
quest.addObjective(objective);
}
} else {
KeyValues kv = getKeyValue(mats, actionType, jobFullName);
if (kv != null) {
QuestObjective objective = new QuestObjective(actionType, kv.getId(), kv.getMeta(),
kv.getType() + kv.getSubType(), amount);
(kv.getType() + kv.getSubType()).toUpperCase(), amount);
quest.addObjective(objective);
}
}

View File

@ -1083,8 +1083,7 @@ public class JobsPlayer {
if (qProg != null)
g = new HashMap<>(qProg);
Map<String, QuestProgression> tmp = new HashMap<>();
for (Entry<String, QuestProgression> one : (new HashMap<>(g)).entrySet()) {
for (Entry<String, QuestProgression> one : new HashMap<>(g).entrySet()) {
QuestProgression qp = one.getValue();
if (qp.isEnded()) {
@ -1098,8 +1097,7 @@ public class JobsPlayer {
while (i <= job.getQuests().size()) {
++i;
List<String> currentQuests = new ArrayList<>(g.keySet());
Quest q = job.getNextQuest(currentQuests, getJobProgression(job).getLevel());
Quest q = job.getNextQuest(new ArrayList<>(g.keySet()), getJobProgression(job).getLevel());
if (q == null)
continue;
@ -1126,6 +1124,7 @@ public class JobsPlayer {
qProgression.put(job.getName(), g);
Map<String, QuestProgression> tmp = new HashMap<>();
for (QuestProgression oneJ : g.values()) {
Quest q = oneJ.getQuest();
if (q == null) {
@ -1219,13 +1218,13 @@ public class JobsPlayer {
if (action == null || oneA.length() < prog.length() + 1)
continue;
oneA = oneA.substring(prog.length() + 1);
String target = oneA.split(";")[0];
Map<String, QuestObjective> old = quest.getObjectives().get(action);
if (old == null)
continue;
oneA = oneA.substring(prog.length() + 1);
String target = oneA.split(";")[0];
QuestObjective obj = old.get(target);
if (obj == null)
continue;

View File

@ -92,21 +92,21 @@ public class QuestProgression {
if (quest.isStopped() || !quest.hasAction(action.getType()))
return;
if (!quest.getObjectives().containsKey(action.getType()) || !quest.getObjectives().get(action.getType()).containsKey(action.getNameWithSub()) && !quest.getObjectives().get(action.getType())
.containsKey(action.getName()))
Map<String, QuestObjective> map = quest.getObjectives().get(action.getType());
if (map == null || (!map.containsKey(action.getNameWithSub()) && !map.containsKey(action.getName())))
return;
for (String area : quest.getRestrictedAreas()) {
for (Entry<String, RestrictedArea> a : Jobs.getRestrictedAreaManager().getRestrictedAres().entrySet()) {
if (quest.getRestrictedAreas().contains(a.getKey()) && a.getKey().equalsIgnoreCase(area)
&& a.getValue().inRestrictedArea(jPlayer.getPlayer().getLocation())) {
if (a.getKey().equalsIgnoreCase(area) && a.getValue().inRestrictedArea(jPlayer.getPlayer().getLocation())) {
return;
}
}
}
if (quest.getJob() != null) {
int maxQuest = jPlayer.getPlayerMaxQuest(quest.getJob().getName());
Job questJob = quest.getJob();
if (questJob != null) {
int maxQuest = jPlayer.getPlayerMaxQuest(questJob.getName());
if (maxQuest > 0 && jPlayer.getDoneQuests() >= maxQuest) {
return;
}
@ -135,7 +135,7 @@ public class QuestProgression {
givenReward = true;
jPlayer.addDoneQuest(quest.getJob());
jPlayer.addDoneQuest(questJob);
for (String one : quest.getRewardCmds()) {
ServerCommandEvent ev = new ServerCommandEvent(Bukkit.getConsoleSender(), one.replace("[playerName]", jPlayer.getPlayer().getName()));