Search in sources :

Example 6 with TreasureHuntModule

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

the class SetMaxHeightCommand method onCommand.

@Override
public boolean onCommand(CommandSender sender, Minigame minigame, String label, String[] args) {
    if (args != null) {
        if (args[0].matches("[0-9]+")) {
            int num = Integer.parseInt(args[0]);
            TreasureHuntModule thm = TreasureHuntModule.getMinigameModule(minigame);
            thm.setMaxHeight(num);
            sender.sendMessage(ChatColor.GRAY + "Maximum height variance for " + minigame + " has been set to " + num);
            return true;
        }
    }
    return false;
}
Also used : TreasureHuntModule(au.com.mineauz.minigames.minigame.modules.TreasureHuntModule)

Example 7 with TreasureHuntModule

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

the class HintCommand method onCommand.

@Override
public boolean onCommand(CommandSender sender, Minigame minigame, String label, String[] args) {
    MinigamePlayer player = plugin.pdata.getMinigamePlayer((Player) sender);
    if (args != null) {
        Minigame mgm = plugin.mdata.getMinigame(args[0]);
        if (mgm != null && mgm.getMinigameTimer() != null && mgm.getType() == MinigameType.GLOBAL && mgm.getMechanicName().equals("treasure_hunt")) {
            TreasureHuntModule thm = TreasureHuntModule.getMinigameModule(mgm);
            if (thm.hasTreasureLocation() && !thm.isTreasureFound()) {
                thm.getHints(player);
            } else {
                player.sendMessage(ChatColor.GRAY + mgm.getName(false) + " is currently not running.");
            }
        } else if (mgm == null || mgm.getType() != MinigameType.GLOBAL) {
            player.sendMessage(ChatColor.RED + "There is no treasure hunt running by the name \"" + args[0] + "\"");
        }
    } else {
        List<Minigame> mgs = new ArrayList<Minigame>();
        for (Minigame mg : plugin.mdata.getAllMinigames().values()) {
            if (mg.getType() == MinigameType.GLOBAL && mg.getMechanicName().equals("treasure_hunt")) {
                mgs.add(mg);
            }
        }
        if (!mgs.isEmpty()) {
            if (mgs.size() > 1) {
                player.sendMessage(ChatColor.LIGHT_PURPLE + "Currently running Treasure Hunts:");
                String treasures = "";
                for (int i = 0; i < mgs.size(); i++) {
                    treasures += mgs.get(i).getName(false);
                    if (i != mgs.size() - 1) {
                        treasures += ", ";
                    }
                }
                player.sendMessage(ChatColor.GRAY + treasures);
            } else {
                TreasureHuntModule thm = TreasureHuntModule.getMinigameModule(mgs.get(0));
                if (thm.hasTreasureLocation() && !thm.isTreasureFound()) {
                    thm.getHints(player);
                } else {
                    player.sendMessage(ChatColor.GRAY + mgs.get(0).getName(false) + " is currently not running.");
                }
            }
        } else if (mgs.isEmpty()) {
            player.sendMessage(ChatColor.LIGHT_PURPLE + "There are no Treasure Hunt minigames currently running.");
        }
    }
    return true;
}
Also used : TreasureHuntModule(au.com.mineauz.minigames.minigame.modules.TreasureHuntModule) MinigamePlayer(au.com.mineauz.minigames.MinigamePlayer) ArrayList(java.util.ArrayList) Minigame(au.com.mineauz.minigames.minigame.Minigame)

Example 8 with TreasureHuntModule

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

the class SetMaxRadiusCommand method onCommand.

@Override
public boolean onCommand(CommandSender sender, Minigame minigame, String label, String[] args) {
    if (args != null) {
        if (args[0].matches("[0-9]+")) {
            int max = Integer.parseInt(args[0]);
            TreasureHuntModule thm = TreasureHuntModule.getMinigameModule(minigame);
            thm.setMaxRadius(max);
            sender.sendMessage(ChatColor.GRAY + "Maximum treasure spawn radius has been set to " + max + " for " + minigame.getName(false));
            return true;
        }
    }
    return false;
}
Also used : TreasureHuntModule(au.com.mineauz.minigames.minigame.modules.TreasureHuntModule)

Example 9 with TreasureHuntModule

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

the class SetMaxTreasureCommand method onCommand.

@Override
public boolean onCommand(CommandSender sender, Minigame minigame, String label, String[] args) {
    if (args != null) {
        if (args[0].matches("[0-9]+")) {
            int amount = Integer.parseInt(args[0]);
            TreasureHuntModule thm = TreasureHuntModule.getMinigameModule(minigame);
            thm.setMaxTreasure(amount);
            sender.sendMessage(ChatColor.GRAY + "Maximum items has been set to " + amount + " for " + minigame);
            return true;
        }
    }
    return false;
}
Also used : TreasureHuntModule(au.com.mineauz.minigames.minigame.modules.TreasureHuntModule)

Example 10 with TreasureHuntModule

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

the class SetMinTreasureCommand method onCommand.

@Override
public boolean onCommand(CommandSender sender, Minigame minigame, String label, String[] args) {
    if (args != null) {
        if (args[0].matches("[0-9]+")) {
            int amount = Integer.parseInt(args[0]);
            TreasureHuntModule thm = TreasureHuntModule.getMinigameModule(minigame);
            thm.setMinTreasure(amount);
            sender.sendMessage(ChatColor.GRAY + "Minimum items has been set to " + amount + " for " + minigame);
            return true;
        }
    }
    return false;
}
Also used : TreasureHuntModule(au.com.mineauz.minigames.minigame.modules.TreasureHuntModule)

Aggregations

TreasureHuntModule (au.com.mineauz.minigames.minigame.modules.TreasureHuntModule)12 Minigame (au.com.mineauz.minigames.minigame.Minigame)4 Location (org.bukkit.Location)4 Chest (org.bukkit.block.Chest)3 EventHandler (org.bukkit.event.EventHandler)3 MinigameTimer (au.com.mineauz.minigames.MinigameTimer)2 MinigamePlayer (au.com.mineauz.minigames.MinigamePlayer)1 ItemReward (au.com.mineauz.minigames.minigame.reward.ItemReward)1 RewardType (au.com.mineauz.minigames.minigame.reward.RewardType)1 RewardsModule (au.com.mineauz.minigames.minigame.reward.RewardsModule)1 StandardRewardScheme (au.com.mineauz.minigames.minigame.reward.scheme.StandardRewardScheme)1 ArrayList (java.util.ArrayList)1 Random (java.util.Random)1 Chunk (org.bukkit.Chunk)1 Block (org.bukkit.block.Block)1