Match objective progress by quest ID, fixes #1488

This commit is contained in:
PikaMug 2020-12-05 01:37:00 -05:00
parent 2b6e366669
commit 58f6fb0da0
2 changed files with 14 additions and 10 deletions

View File

@ -239,7 +239,11 @@ public class Quester implements Comparable<Quester> {
public Quester(final Quests plugin, final UUID uuid) {
this.plugin = plugin;
this.id = uuid;
this.lastKnownName = Bukkit.getOfflinePlayer(uuid).getName();
if (getPlayer() != null) {
this.lastKnownName = getPlayer().getName();
} else {
this.lastKnownName = getOfflinePlayer().getName();
}
}
@Override
@ -365,8 +369,10 @@ public class Quester implements Comparable<Quester> {
}
public QuestData getQuestData(final Quest quest) {
if (questData.containsKey(quest)) {
return questData.get(quest);
for (final Quest q : questData.keySet()) {
if (q.getId().equals(quest.getId())) {
return questData.get(q);
}
}
return new QuestData(this);
}

View File

@ -48,7 +48,6 @@ import org.bukkit.DyeColor;
import org.bukkit.Effect;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.OfflinePlayer;
import org.bukkit.World;
import org.bukkit.block.Biome;
import org.bukkit.command.CommandExecutor;
@ -637,15 +636,13 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener
loadConditions();
getLogger().log(Level.INFO, "Loaded " + quests.size() + " Quest(s), " + actions.size() + " Action(s), "
+ conditions.size() + " Condition(s) and " + Lang.size() + " Phrase(s)");
for (final OfflinePlayer p : getServer().getOfflinePlayers()) {
final Quester quester = new Quester(Quests.this, p.getUniqueId());
for (final Player p : getServer().getOnlinePlayers()) {
final Quester quester = new Quester(Quests.this, p.getUniqueId());
if (quester.loadData() == false) {
quester.saveData();
}
if (p.isOnline()) {
// Workaround for issues with the compass on fast join
quester.findCompassTarget();
}
// Workaround for issues with the compass on fast join
quester.findCompassTarget();
questers.add(quester);
}
if (depends.getCitizens() != null) {
@ -1346,6 +1343,7 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener
for (final Quester quester : questers) {
quester.loadData();
for (final Quest q : quester.currentQuests.keySet()) {
System.out.println("current quest is : " + q.getName());
quester.checkQuest(q);
}
}