Package com.garbagemule.MobArena

Examples of com.garbagemule.MobArena.ArenaClass


        }

        // Require a class name
        if (args.length != 1) return false;

        ArenaClass ac = am.getClasses().get(args[0].toLowerCase());
        if (ac == null) {
            Messenger.tell(sender, "Class not found.");
            return true;
        }

        Player p = (Player) sender;
        Block b = p.getTargetBlock(null, 10);

        switch (b.getType()) {
            case CHEST:
            case LOCKED_CHEST:
            case ENDER_CHEST:
            case TRAPPED_CHEST:
                break;
            default:
                Messenger.tell(sender, "You must look at a chest.");
                return true;
        }

        setLocation(am.getPlugin().getConfig(), "classes." + ac.getConfigName() + ".classchest", b.getLocation());
        am.saveConfig();
        Messenger.tell(sender, "Class chest updated for class " + ac.getConfigName());
        am.loadClasses();
        return true;
    }
View Full Code Here


        // Grab the argument, if any.
        String arg1 = args[0];
        String arg2 = (args.length > 1 ? args[1] : "");

        // Grab the class.
        ArenaClass ac = am.getClasses().get(arg1);
        if (ac == null) {
            Messenger.tell(sender, "No class named '" + arg1 + "'.");
            return true;
        }

        // Config-file value to set, and message to print
        String value;
        String msg;

        if (!arg2.equals("")) {
            // Strip the dollar sign, if it's there
            if (arg2.startsWith("$")) {
                arg2 = arg2.substring(1);
            }

            // Not a valid number? Bail!
            if (!arg2.matches("([1-9]\\d*)|(\\d*.\\d\\d?)")) {
                Messenger.tell(sender, "Could not parse price '" + arg2 + "'. Expected e.g. $10 or $2.50 or $.25");
                return true;
            }
            double price = Double.parseDouble(arg2);

            value = "$" + arg2;
            msg = "Price for class '" + ac.getConfigName() + "' was set to " + am.getPlugin().economyFormat(price);
        } else {
            value = null;
            msg = "Price for class '" + ac.getConfigName() + "' was removed. The class is now free!";
        }

        // Set the value, save and reload config
        am.getPlugin().getConfig().set("classes." + ac.getConfigName() + ".price", value);
        am.getPlugin().saveConfig();
        am.loadClasses();
        Messenger.tell(sender, msg);
        return true;
    }
View Full Code Here

            return true;
        }

        // Grab the ArenaClass, if it exists
        String lowercase = args[0].toLowerCase();
        ArenaClass ac = am.getClasses().get(lowercase);
        if (ac == null) {
            Messenger.tell(p, Msg.LOBBY_NO_SUCH_CLASS, lowercase);
            return true;
        }

        // Check for permission.
        if (!am.getPlugin().has(p, "mobarena.classes." + lowercase) && !lowercase.equals("random")) {
            Messenger.tell(p, Msg.LOBBY_CLASS_PERMISSION);
            return true;
        }

        // Grab the old ArenaClass, if any, same => ignore
        ArenaClass oldAC = arena.getArenaPlayer(p).getArenaClass();
        if (ac.equals(oldAC)) return true;

        // If the new class is full, inform the player.
        ClassLimitManager clm = arena.getClassLimitManager();
        if (!clm.canPlayerJoinClass(ac)) {
View Full Code Here

TOP

Related Classes of com.garbagemule.MobArena.ArenaClass

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.