Search in sources :

Example 1 with StopGlobalMinigameEvent

use of au.com.mineauz.minigames.events.StopGlobalMinigameEvent in project Minigames by AddstarMC.

the class MinigameData method stopGlobalMinigame.

public void stopGlobalMinigame(Minigame minigame, MinigamePlayer caller) {
    if (minigame.getType() == MinigameType.GLOBAL) {
        StopGlobalMinigameEvent ev = new StopGlobalMinigameEvent(minigame, caller);
        Bukkit.getPluginManager().callEvent(ev);
        minigame.getMechanic().stopMinigame(minigame, caller);
        minigame.setEnabled(false);
        minigame.saveMinigame();
    }
}
Also used : StopGlobalMinigameEvent(au.com.mineauz.minigames.events.StopGlobalMinigameEvent)

Example 2 with StopGlobalMinigameEvent

use of au.com.mineauz.minigames.events.StopGlobalMinigameEvent in project Minigames by AddstarMC.

the class MinigameManager method stopGlobalMinigame.

public void stopGlobalMinigame(final Minigame minigame, final MinigamePlayer caller) {
    if (minigame.getType() == MinigameType.GLOBAL) {
        final StopGlobalMinigameEvent ev = new StopGlobalMinigameEvent(minigame, caller);
        Bukkit.getPluginManager().callEvent(ev);
        minigame.getMechanic().stopMinigame(minigame, caller);
        minigame.setEnabled(false);
        final ResourcePackModule module = (ResourcePackModule) minigame.getModule("ResourcePack");
        if (module != null) {
            if (module.isEnabled()) {
                final ResourcePack pack = PLUGIN.getResourceManager().getResourcePack("empty");
                if (pack.isValid()) {
                    for (final MinigamePlayer player : minigame.getPlayers()) {
                        player.applyResourcePack(pack);
                    }
                }
            }
        }
        minigame.saveMinigame();
    }
}
Also used : MinigamePlayer(au.com.mineauz.minigames.objects.MinigamePlayer) ResourcePack(au.com.mineauz.minigames.objects.ResourcePack) StopGlobalMinigameEvent(au.com.mineauz.minigames.events.StopGlobalMinigameEvent)

Aggregations

StopGlobalMinigameEvent (au.com.mineauz.minigames.events.StopGlobalMinigameEvent)2 MinigamePlayer (au.com.mineauz.minigames.objects.MinigamePlayer)1 ResourcePack (au.com.mineauz.minigames.objects.ResourcePack)1