mirror of
https://github.com/PikaMug/Quests.git
synced 2024-12-19 15:48:10 +01:00
Always fire events synchronously, fixes #366
This commit is contained in:
parent
ce485ae1ea
commit
a7838b8184
@ -230,19 +230,7 @@ public class Event {
|
|||||||
}
|
}
|
||||||
if (commands.isEmpty() == false) {
|
if (commands.isEmpty() == false) {
|
||||||
for (String s : commands) {
|
for (String s : commands) {
|
||||||
if (!Bukkit.isPrimaryThread()) {
|
|
||||||
new BukkitRunnable() {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void run() {
|
|
||||||
quester.plugin.getServer().dispatchCommand(quester.plugin.getServer().getConsoleSender(), s.replaceAll("<player>", quester.getPlayer().getName()));
|
quester.plugin.getServer().dispatchCommand(quester.plugin.getServer().getConsoleSender(), s.replaceAll("<player>", quester.getPlayer().getName()));
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}.runTask(this.plugin);
|
|
||||||
} else {
|
|
||||||
quester.plugin.getServer().dispatchCommand(quester.plugin.getServer().getConsoleSender(), s.replaceAll("<player>", quester.getPlayer().getName()));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (potionEffects.isEmpty() == false) {
|
if (potionEffects.isEmpty() == false) {
|
||||||
|
@ -59,6 +59,7 @@ import org.bukkit.event.player.PlayerRespawnEvent;
|
|||||||
import org.bukkit.event.player.PlayerShearEntityEvent;
|
import org.bukkit.event.player.PlayerShearEntityEvent;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
import org.bukkit.projectiles.ProjectileSource;
|
import org.bukkit.projectiles.ProjectileSource;
|
||||||
|
import org.bukkit.scheduler.BukkitRunnable;
|
||||||
|
|
||||||
import com.sk89q.worldguard.protection.managers.RegionManager;
|
import com.sk89q.worldguard.protection.managers.RegionManager;
|
||||||
import com.sk89q.worldguard.protection.regions.ProtectedRegion;
|
import com.sk89q.worldguard.protection.regions.ProtectedRegion;
|
||||||
@ -307,7 +308,13 @@ public class PlayerListener implements Listener {
|
|||||||
for (String s : currentStage.chatEvents.keySet()) {
|
for (String s : currentStage.chatEvents.keySet()) {
|
||||||
if (s.equalsIgnoreCase(chat)) {
|
if (s.equalsIgnoreCase(chat)) {
|
||||||
if (quester.getQuestData(quest).eventFired.get(s) == null || quester.getQuestData(quest).eventFired.get(s) == false) {
|
if (quester.getQuestData(quest).eventFired.get(s) == null || quester.getQuestData(quest).eventFired.get(s) == false) {
|
||||||
|
new BukkitRunnable() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
currentStage.chatEvents.get(s).fire(quester, quest);
|
currentStage.chatEvents.get(s).fire(quester, quest);
|
||||||
|
}
|
||||||
|
|
||||||
|
}.runTask(this.plugin);
|
||||||
quester.getQuestData(quest).eventFired.put(s, true);
|
quester.getQuestData(quest).eventFired.put(s, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user