package com.elmakers.mine.bukkit.magic.listener;

import com.elmakers.mine.bukkit.api.magic.Mage;
import com.elmakers.mine.bukkit.api.magic.MageController;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import au.com.mineauz.minigames.events.JoinMinigameEvent;

public class MinigamesListener implements Listener {

    private MageController controller;

    public MinigamesListener(MageController controller) {
        this.controller = controller;
    }

    @EventHandler
    public void onJoinMinigame(JoinMinigameEvent event) {
        Player player = event.getPlayer();
        if (player == null) return;

        Mage mage = controller.getRegisteredMage(player.getUniqueId().toString());
        if (mage == null) return;

        mage.deactivate();
    }
}

@@ -43,16 +43,74 @@
 tener;%0A%0A
+import au.com.mineauz.minigames.events.QuitMinigameEvent;%0A
 import c
@@ -834,32 +834,340 @@
  null) return;%0A%0A
+        mage.deactivate();%0A    %7D%0A%0A    @EventHandler%0A    public void onQuitMinigame(QuitMinigameEvent event) %7B%0A        Player player = event.getPlayer();%0A        if (player == null) return;%0A%0A        Mage mage = controller.getRegisteredMage(player.getUniqueId().toString());%0A        if (mage == null) return;%0A%0A
         mage.dea

Handle Minigame quit event