Search in sources :

Example 1 with MinigameData

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

the class DisableAllCommand method onCommand.

@Override
public boolean onCommand(CommandSender sender, Minigame minigame, String label, String[] args) {
    MinigameData mdata = Minigames.plugin.mdata;
    List<Minigame> minigames = new ArrayList<Minigame>(mdata.getAllMinigames().values());
    if (args != null) {
        for (String arg : args) {
            if (mdata.hasMinigame(arg))
                minigames.remove(mdata.getMinigame(arg));
            else
                sender.sendMessage(ChatColor.RED + "No Minigame found by the name \"" + arg + "\"; Ignoring...");
        }
    }
    for (Minigame mg : minigames) {
        mg.setEnabled(false);
    }
    sender.sendMessage(ChatColor.GRAY + String.valueOf(minigames.size()) + " Minigames disabled!");
    return true;
}
Also used : MinigameData(au.com.mineauz.minigames.MinigameData) ArrayList(java.util.ArrayList) Minigame(au.com.mineauz.minigames.minigame.Minigame)

Example 2 with MinigameData

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

the class EnableAllCommand method onCommand.

@Override
public boolean onCommand(CommandSender sender, Minigame minigame, String label, String[] args) {
    MinigameData mdata = Minigames.plugin.mdata;
    List<Minigame> minigames = new ArrayList<Minigame>(mdata.getAllMinigames().values());
    if (args != null) {
        for (String arg : args) {
            if (mdata.hasMinigame(arg))
                minigames.remove(mdata.getMinigame(arg));
            else
                sender.sendMessage(ChatColor.RED + "No Minigame found by the name \"" + arg + "\"; Ignoring...");
        }
    }
    for (Minigame mg : minigames) {
        mg.setEnabled(true);
    }
    sender.sendMessage(ChatColor.GRAY + String.valueOf(minigames.size()) + " Minigames enabled!");
    return true;
}
Also used : MinigameData(au.com.mineauz.minigames.MinigameData) ArrayList(java.util.ArrayList) Minigame(au.com.mineauz.minigames.minigame.Minigame)

Aggregations

MinigameData (au.com.mineauz.minigames.MinigameData)2 Minigame (au.com.mineauz.minigames.minigame.Minigame)2 ArrayList (java.util.ArrayList)2