From 71433131380041deb09671640c279fc7dee45cdc Mon Sep 17 00:00:00 2001 From: BuildTools Date: Mon, 11 Jan 2021 01:35:07 -0400 Subject: [PATCH] Potentially fixed class-chosen triggers firing on wrong class, if this breaks class-chosen triggers please let josh know lol --- .../event/trigger/ClassChosenEventTrigger.java | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/src/main/java/net/Indyuce/mmocore/api/player/profess/event/trigger/ClassChosenEventTrigger.java b/src/main/java/net/Indyuce/mmocore/api/player/profess/event/trigger/ClassChosenEventTrigger.java index 1879146a..d221da5b 100644 --- a/src/main/java/net/Indyuce/mmocore/api/player/profess/event/trigger/ClassChosenEventTrigger.java +++ b/src/main/java/net/Indyuce/mmocore/api/player/profess/event/trigger/ClassChosenEventTrigger.java @@ -1,11 +1,12 @@ package net.Indyuce.mmocore.api.player.profess.event.trigger; -import org.bukkit.event.EventHandler; -import org.bukkit.event.EventPriority; - +import net.Indyuce.mmocore.MMOCore; import net.Indyuce.mmocore.api.event.PlayerChangeClassEvent; import net.Indyuce.mmocore.api.player.PlayerData; import net.Indyuce.mmocore.api.player.profess.event.EventTriggerHandler; +import org.bukkit.Bukkit; +import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; public class ClassChosenEventTrigger implements EventTriggerHandler { @@ -17,7 +18,11 @@ public class ClassChosenEventTrigger implements EventTriggerHandler { @EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true) public void a(PlayerChangeClassEvent event) { PlayerData player = event.getData(); - if (event.getNewClass().hasEventTriggers("class-chosen")) - event.getNewClass().getEventTriggers("class-chosen").getTriggers().forEach(trigger -> trigger.apply(player)); + if (event.getNewClass().hasEventTriggers("class-chosen")) { + Bukkit.getScheduler().runTaskLater(MMOCore.plugin, () -> { + event.getNewClass().getEventTriggers("class-chosen").getTriggers().forEach(trigger -> trigger.apply(player)); + }, 1); + + } } }