mirror of
https://github.com/PikaMug/Quests.git
synced 2024-11-13 22:25:50 +01:00
QuesterPreCompleteQuestEvent can also be triggered sync, fixes #1662
This commit is contained in:
parent
58213cec1d
commit
92412a89ff
@ -524,10 +524,25 @@ public class Quest implements Comparable<Quest> {
|
||||
public void completeQuest(final Quester q, final boolean allowMultiplayer) {
|
||||
final OfflinePlayer player = q.getOfflinePlayer();
|
||||
if (player.isOnline()) {
|
||||
final QuesterPreCompleteQuestEvent preEvent = new QuesterPreCompleteQuestEvent(q, this, true);
|
||||
plugin.getServer().getPluginManager().callEvent(preEvent);
|
||||
if (preEvent.isCancelled()) {
|
||||
return;
|
||||
if (Bukkit.isPrimaryThread()) {
|
||||
final QuesterPreCompleteQuestEvent preEvent = new QuesterPreCompleteQuestEvent(q, this, false);
|
||||
plugin.getServer().getPluginManager().callEvent(preEvent);
|
||||
if (preEvent.isCancelled()) {
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
Bukkit.getScheduler().runTask(plugin, new Runnable() {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
final QuesterPreCompleteQuestEvent preEvent
|
||||
= new QuesterPreCompleteQuestEvent(q, Quest.this, true);
|
||||
plugin.getServer().getPluginManager().callEvent(preEvent);
|
||||
if (preEvent.isCancelled()) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
q.hardQuit(this);
|
||||
|
Loading…
Reference in New Issue
Block a user