From a0b3156610ee944acfe1ae68662445c59b58ba39 Mon Sep 17 00:00:00 2001 From: BuildTools Date: Mon, 19 Oct 2015 14:04:54 +0200 Subject: [PATCH] Cancel teleport on leave --- .../teleport/EngineScheduledTeleport.java | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/com/massivecraft/massivecore/teleport/EngineScheduledTeleport.java b/src/com/massivecraft/massivecore/teleport/EngineScheduledTeleport.java index fef04de9..d381c78b 100644 --- a/src/com/massivecraft/massivecore/teleport/EngineScheduledTeleport.java +++ b/src/com/massivecraft/massivecore/teleport/EngineScheduledTeleport.java @@ -14,6 +14,7 @@ import org.bukkit.plugin.Plugin; import com.massivecraft.massivecore.EngineAbstract; import com.massivecraft.massivecore.MassiveCore; +import com.massivecraft.massivecore.event.EventMassiveCorePlayerLeave; import com.massivecraft.massivecore.mixin.Mixin; import com.massivecraft.massivecore.util.IdUtil; import com.massivecraft.massivecore.util.MUtil; @@ -143,4 +144,15 @@ public class EngineScheduledTeleport extends EngineAbstract this.cancelTeleport(player); } + @EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true) + public void cancelTeleport(EventMassiveCorePlayerLeave event) + { + // If a player quits ... + if (Mixin.isActualLeave(event)) return; + + // ... cancel teleport! + Player player = event.getPlayer(); + this.cancelTeleport(player); + } + }