Call password objective event on sync to prevent exception

This commit is contained in:
PikaMug 2021-01-01 16:23:46 -05:00
parent 0c4b103db6
commit b313adff9e

View File

@ -2615,6 +2615,7 @@ public class Quester implements Comparable<Quester> {
*/ */
public void sayPassword(final Quest quest, final AsyncPlayerChatEvent evt) { public void sayPassword(final Quest quest, final AsyncPlayerChatEvent evt) {
final ObjectiveType type = ObjectiveType.PASSWORD; final ObjectiveType type = ObjectiveType.PASSWORD;
plugin.getServer().getScheduler().runTask(plugin, () -> {
final QuesterPreUpdateObjectiveEvent preEvent = new QuesterPreUpdateObjectiveEvent(this, quest, final QuesterPreUpdateObjectiveEvent preEvent = new QuesterPreUpdateObjectiveEvent(this, quest,
new Objective(type, 1, 1)); new Objective(type, 1, 1));
plugin.getServer().getPluginManager().callEvent(preEvent); plugin.getServer().getPluginManager().callEvent(preEvent);
@ -2654,6 +2655,7 @@ public class Quester implements Comparable<Quester> {
new Objective(type, 1, 1)); new Objective(type, 1, 1));
plugin.getServer().getPluginManager().callEvent(postEvent); plugin.getServer().getPluginManager().callEvent(postEvent);
} }
});
} }
/** /**