Search in sources :

Example 61 with Minigame

use of au.com.mineauz.minigames.minigame.Minigame in project Minigames by AddstarMC.

the class PlayerKillsMechanic method playerSuicide.

@EventHandler
private void playerSuicide(PlayerDeathEvent event) {
    MinigamePlayer ply = pdata.getMinigamePlayer(event.getEntity());
    if (ply == null)
        return;
    if (ply.isInMinigame() && (ply.getPlayer().getKiller() == null || ply.getPlayer().getKiller() == ply.getPlayer()) && ply.getMinigame().hasStarted()) {
        Minigame mgm = ply.getMinigame();
        if (mgm.getMechanicName().equals("kills")) {
            ply.takeScore();
            mgm.setScore(ply, ply.getScore());
            if (mgm.isTeamGame())
                ply.getTeam().setScore(ply.getTeam().getScore() - 1);
        }
    }
}
Also used : MinigamePlayer(au.com.mineauz.minigames.MinigamePlayer) Minigame(au.com.mineauz.minigames.minigame.Minigame) EventHandler(org.bukkit.event.EventHandler)

Example 62 with Minigame

use of au.com.mineauz.minigames.minigame.Minigame in project Minigames by AddstarMC.

the class Main method onDisable.

@Override
public void onDisable() {
    if (plugin == null) {
        return;
    }
    for (Minigame mg : minigames.mdata.getAllMinigames().values()) {
        mg.saveMinigame();
    }
    minigames.mdata.removeModule("Regions", RegionModule.class);
    ToolModes.removeToolMode("REGION");
    ToolModes.removeToolMode("NODE");
    ToolModes.removeToolMode("REGION_AND_NODE_EDITOR");
    display.shutdown();
    getLogger().info("Minigames Regions disabled");
}
Also used : Minigame(au.com.mineauz.minigames.minigame.Minigame)

Example 63 with Minigame

use of au.com.mineauz.minigames.minigame.Minigame in project Minigames by AddstarMC.

the class RegionEvents method playerSpawn.

@EventHandler
private void playerSpawn(PlayerRespawnEvent event) {
    final MinigamePlayer ply = pdata.getMinigamePlayer(event.getPlayer());
    if (ply == null)
        return;
    if (ply.isInMinigame()) {
        final Minigame mg = ply.getMinigame();
        Bukkit.getScheduler().scheduleSyncDelayedTask(plugin, new Runnable() {

            @Override
            public void run() {
                if (!ply.isInMinigame()) {
                    return;
                }
                executeRegionChanges(mg, ply);
                for (Node node : RegionModule.getMinigameModule(ply.getMinigame()).getNodes()) {
                    node.execute(Triggers.getTrigger("RESPAWN"), ply);
                }
                for (Region region : RegionModule.getMinigameModule(ply.getMinigame()).getRegions()) {
                    if (region.hasPlayer(ply))
                        region.execute(Triggers.getTrigger("RESPAWN"), ply);
                }
            }
        });
    }
}
Also used : MinigamePlayer(au.com.mineauz.minigames.MinigamePlayer) Minigame(au.com.mineauz.minigames.minigame.Minigame) EventHandler(org.bukkit.event.EventHandler)

Example 64 with Minigame

use of au.com.mineauz.minigames.minigame.Minigame in project Minigames by AddstarMC.

the class ScoreboardSign method signUse.

@Override
public boolean signUse(Sign sign, MinigamePlayer player) {
    Minigame minigame = plugin.mdata.getMinigame(sign.getLine(2));
    if (minigame == null) {
        return false;
    }
    ScoreboardDisplay display = minigame.getScoreboardData().getDisplay(sign.getBlock());
    if (display == null) {
        return false;
    }
    display.displayMenu(player);
    return false;
}
Also used : ScoreboardDisplay(au.com.mineauz.minigames.minigame.ScoreboardDisplay) Minigame(au.com.mineauz.minigames.minigame.Minigame)

Aggregations

Minigame (au.com.mineauz.minigames.minigame.Minigame)64 MinigamePlayer (au.com.mineauz.minigames.MinigamePlayer)33 EventHandler (org.bukkit.event.EventHandler)29 ArrayList (java.util.ArrayList)19 Player (org.bukkit.entity.Player)16 Team (au.com.mineauz.minigames.minigame.Team)15 List (java.util.List)7 Location (org.bukkit.Location)7 TreasureHuntModule (au.com.mineauz.minigames.minigame.modules.TreasureHuntModule)4 Sign (org.bukkit.block.Sign)4 TeamColor (au.com.mineauz.minigames.minigame.TeamColor)3 Block (org.bukkit.block.Block)3 ItemStack (org.bukkit.inventory.ItemStack)3 PotionEffect (org.bukkit.potion.PotionEffect)3 CTFFlag (au.com.mineauz.minigames.CTFFlag)2 MinigameData (au.com.mineauz.minigames.MinigameData)2 MultiplayerTimer (au.com.mineauz.minigames.MultiplayerTimer)2 ICommand (au.com.mineauz.minigames.commands.ICommand)2 TakeFlagEvent (au.com.mineauz.minigames.events.TakeFlagEvent)2 ScoreboardDisplay (au.com.mineauz.minigames.minigame.ScoreboardDisplay)2