Package com.sk89q.minecraft.util.commands

Examples of com.sk89q.minecraft.util.commands.CommandException


                    }
                }
            }

            if (item == null) {
                throw new CommandException("Something went wrong parsing the item info!");
            }
            giveItem(sender, item, amt, targets, InventoryComponent.this, args.hasFlag('d'), args.hasFlag('o'));
        }
View Full Code Here


                    CommandBook.inst().checkPermission(sender, "commandbook.give");
                }
            }

            if (item == null) {
                throw new CommandException("Something went wrong parsing the item info!");
            }
            giveItem(sender, item, amt, targets, InventoryComponent.this, args.hasFlag('d'), args.hasFlag('o'));
        }
View Full Code Here

            } else {
                CommandBook.inst().checkPermission(sender, "commandbook.take");
            }

            if (item == null) {
                throw new CommandException("Something went wrong parsing the item info!");
            }
            takeItem(sender, item, amt, target);
        }
View Full Code Here

                CommandBook.inst().checkPermission(sender, "commandbook.kit.list");

                Map<String, Kit> kits = getKitManager().getKits();

                if (kits.size() == 0) {
                    throw new CommandException("No kits are configured.");
                }

                StringBuilder str = new StringBuilder();
                int count = 0;

                for (String id : kits.keySet()) {
                    if (!CommandBook.inst().hasPermission(sender,
                            "commandbook.kit.kits." + id.replace(".", ""))) {
                        continue;
                    }

                    if (str.length() != 0) {
                        str.append(", ");
                    }

                    str.append(id);
                    count++;
                }

                if (count == 0) {
                    throw new CommandException("You have access to no kits.");
                }

                sender.sendMessage(ChatColor.YELLOW + "Kits (" + count + "): "
                        + ChatColor.WHITE + str.toString());
                sender.sendMessage(ChatColor.YELLOW + "Use /kit kitname to get a kit.");

            // Give a kit
            } else {
                Iterable<Player> targets;
                String id = args.getString(0).toLowerCase();
                boolean included = false;

                if (args.argsLength() == 2) {
                    targets = InputUtil.PlayerParser.matchPlayers(sender, args.getString(1));
                } else {
                    targets = Lists.newArrayList(PlayerUtil.checkPlayer(sender));
                }

                for (Player player : targets) {
                    if (player != sender) {
                        // Check permissions!
                        CommandBook.inst().checkPermission(sender, "commandbook.kit.other");
                    }
                }

                Kit kit = getKitManager().getKit(id);

                if (kit == null) {
                    throw new CommandException("No kit by that name exists.");
                }

                CommandBook.inst().checkPermission(sender, "commandbook.kit.kits." + id.replace(".", ""));

                for (Player player : targets) {
View Full Code Here

                desc = "Confirm an action",
                max = 0, flags = "vc")
        public void confirm(CommandContext args, CommandSender sender) throws CommandException {
            UserSession session = getSession(UserSession.class, sender);
            final String cmd = session.getCommandToConfirm(false);
            if (cmd == null) throw new CommandException("No command to confirm!");
            if (args.hasFlag('v')) {
                sender.sendMessage(ChatColor.YELLOW + "Current command to confirm: " + cmd);
            } else if (args.hasFlag('c')) {
                session.getCommandToConfirm(true);
                sender.sendMessage(ChatColor.YELLOW + "Cleared command to confirm");
View Full Code Here

TOP

Related Classes of com.sk89q.minecraft.util.commands.CommandException

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.