From 56aae6d737aa523f23160256b5022b8cce8fe9c5 Mon Sep 17 00:00:00 2001 From: fatpigsarefat Date: Mon, 2 Jul 2018 19:29:43 +0100 Subject: Made sure reward commands are run on main thread --- .../quests/player/questprogressfile/QuestProgressFile.java | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'src/me/fatpigsarefat/quests/player/questprogressfile/QuestProgressFile.java') diff --git a/src/me/fatpigsarefat/quests/player/questprogressfile/QuestProgressFile.java b/src/me/fatpigsarefat/quests/player/questprogressfile/QuestProgressFile.java index 95473e8d..144093e6 100644 --- a/src/me/fatpigsarefat/quests/player/questprogressfile/QuestProgressFile.java +++ b/src/me/fatpigsarefat/quests/player/questprogressfile/QuestProgressFile.java @@ -34,9 +34,11 @@ public class QuestProgressFile { questProgress.setCompletionDate(System.currentTimeMillis()); if (Bukkit.getPlayer(player) != null) { Player player = Bukkit.getPlayer(this.player); - for (String s : quest.getRewards()) { - Bukkit.getServer().dispatchCommand(Bukkit.getConsoleSender(), s.replace("{player}", player.getName())); - } + Bukkit.getServer().getScheduler().runTask(Quests.getInstance(), () -> { + for (String s : quest.getRewards()) { + Bukkit.getServer().dispatchCommand(Bukkit.getConsoleSender(), s.replace("{player}", player.getName())); + } + }); player.sendMessage(Messages.QUEST_COMPLETE.getMessage().replace("{quest}", quest.getDisplayNameStripped())); if (Options.TITLES_ENABLED.getBooleanValue()) { Quests.getTitle().sendTitle(player, Messages.TITLE_QUEST_COMPLETE_TITLE.getMessage().replace("{quest}", quest -- cgit v1.2.3-70-g09d2