mirror of
https://github.com/PikaMug/Quests.git
synced 2024-11-24 19:46:34 +01:00
Delay quest command to retain order
This commit is contained in:
parent
4d451474a9
commit
d1ecedebca
@ -44,22 +44,28 @@ public class BukkitQuestCommandHandler {
|
||||
final Player player = (Player) cs;
|
||||
final Quester quester = plugin.getQuester(player.getUniqueId());
|
||||
if (!quester.getCurrentQuests().isEmpty()) {
|
||||
final int[] ticks = {1};
|
||||
for (final Quest q : quester.getCurrentQuests().keySet()) {
|
||||
final Stage stage = quester.getCurrentStage(q);
|
||||
q.updateCompass(quester, stage);
|
||||
if (plugin.getQuester(player.getUniqueId()).getQuestProgressOrDefault(q).getDelayStartTime() == 0
|
||||
|| plugin.getQuester(player.getUniqueId()).getStageTime(q) < 0L) {
|
||||
if (quester.getQuestProgressOrDefault(q).getDelayStartTime() == 0
|
||||
|| quester.getStageTime(q) < 0L) {
|
||||
final String msg = BukkitLang.get(player, "questObjectivesTitle")
|
||||
.replace("<quest>", q.getName());
|
||||
plugin.getServer().getScheduler().runTaskLater(plugin, () -> {
|
||||
BukkitLang.send(player, ChatColor.GOLD + msg);
|
||||
quester.showCurrentObjectives(q, quester, false);
|
||||
ticks[0]++;
|
||||
}, ticks[0]);
|
||||
} else {
|
||||
final long time = plugin.getQuester(player.getUniqueId()).getStageTime(q);
|
||||
String msg = ChatColor.YELLOW + "(" + BukkitLang.get(player, "delay") + ") " + ChatColor.RED
|
||||
+ BukkitLang.get(player, "plnTooEarly");
|
||||
msg = msg.replace("<quest>", q.getName());
|
||||
msg = msg.replace("<time>", BukkitMiscUtil.getTime(time));
|
||||
final long time = quester.getStageTime(q);
|
||||
final String msg = ChatColor.YELLOW + "(" + BukkitLang.get(player, "delay") + ") "
|
||||
+ ChatColor.RED + BukkitLang.get(player, "plnTooEarly")
|
||||
.replace("<quest>", q.getName().replace("<time>", BukkitMiscUtil.getTime(time)));
|
||||
plugin.getServer().getScheduler().runTaskLater(plugin, () -> {
|
||||
BukkitLang.send(player, msg);
|
||||
ticks[0]++;
|
||||
}, ticks[0]);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
Loading…
Reference in New Issue
Block a user