mirror of
https://github.com/PikaMug/Quests.git
synced 2025-02-18 13:31:20 +01:00
Update reach-location objectives asynchronously, fixes #1373
This commit is contained in:
parent
ddc3cf5b07
commit
d878d35d37
@ -878,34 +878,43 @@ public class PlayerListener implements Listener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Checks if uuid is blacklisted. Updates reach-location objectives
|
* Checks if uuid is blacklisted. Updates reach-location objectives<p>
|
||||||
|
*
|
||||||
|
* Runs asynchronously since 3.9.6
|
||||||
*
|
*
|
||||||
* @param uuid The UUID of the Player
|
* @param uuid The UUID of the Player
|
||||||
* @param location The current location of the Player
|
* @param location The current location of the Player
|
||||||
* @since 3.8.2
|
* @since 3.8.2
|
||||||
*/
|
*/
|
||||||
public void playerMove(UUID uuid, Location location) {
|
public void playerMove(UUID uuid, Location location) {
|
||||||
if (plugin.getQuester(uuid) != null) {
|
plugin.getServer().getScheduler().runTaskAsynchronously(plugin, new Runnable() {
|
||||||
if (plugin.canUseQuests(uuid)) {
|
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
final Quester quester = plugin.getQuester(uuid);
|
final Quester quester = plugin.getQuester(uuid);
|
||||||
for (Quest quest : plugin.getQuests()) {
|
if (quester != null) {
|
||||||
if (!quester.meetsCondition(quest, false)) {
|
if (plugin.canUseQuests(uuid)) {
|
||||||
return;
|
for (Quest quest : plugin.getQuests()) {
|
||||||
}
|
// TODO - make sure this can be run asynchronously
|
||||||
|
if (!quester.meetsCondition(quest, false)) {
|
||||||
if (quester.getCurrentQuests().containsKey(quest)) {
|
return;
|
||||||
if (quester.getCurrentStage(quest) != null
|
}
|
||||||
&& quester.getCurrentStage(quest).containsObjective("reachLocation")) {
|
|
||||||
quester.reachLocation(quest, location);
|
if (quester.getCurrentQuests().containsKey(quest)) {
|
||||||
|
if (quester.getCurrentStage(quest) != null
|
||||||
|
&& quester.getCurrentStage(quest).containsObjective("reachLocation")) {
|
||||||
|
quester.reachLocation(quest, location);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
quester.dispatchMultiplayerEverything(quest, "reachLocation", (Quester q) -> {
|
||||||
|
q.reachLocation(quest, location);
|
||||||
|
return null;
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
quester.dispatchMultiplayerEverything(quest, "reachLocation", (Quester q) -> {
|
|
||||||
q.reachLocation(quest, location);
|
|
||||||
return null;
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user