Package net.minecraft.command

Examples of net.minecraft.command.ICommand


        }
        else
        {
            if (astring.length > 1)
            {
                ICommand icommand = (ICommand)commandMap.get(s1);

                if (icommand != null)
                {
                    return icommand.addTabCompletionOptions(p_71558_1_, dropFirstString(astring));
                }
            }

            return null;
        }
View Full Code Here


    public static List getPossibleCommands(Map commandSet, ICommandSender p_71557_1_)
    {
        ArrayList arraylist = new ArrayList();

        for (Object o : commandSet.keySet()) {
            ICommand icommand = (ICommand) commandSet.get(o);

            if (icommand != null) {

                if (net.minecraftforge.server.CommandHandlerForge.canUse(icommand, p_71557_1_)) {
                    arraylist.add(icommand);
View Full Code Here

       * [DARKRED] permissions
       * [Black] usage
       */

            // Cast to command
            ICommand cmd = (ICommand) cmdObj;

            // Skip commands for which the user has no permissions
            if (!cmd.canCommandSenderUseCommand(sender))
            {
                continue;
            }

            // Initialize string for page.
            String text = "";

            // List command aliases.
            if (cmd.getCommandAliases() != null && cmd.getCommandAliases().size() != 0)
            {
                text += EnumChatFormatting.GOLD + joinAliases(cmd.getCommandAliases().toArray()) + "\n\n";
            }
            else
            {
                text += EnumChatFormatting.GOLD + "No aliases.\n\n";
            }

            // Display permissions node (If applicable)
            if (cmd instanceof ForgeEssentialsCommandBase)// Was: FEcmdModuleCommands
            {
                text += EnumChatFormatting.DARK_RED + ((ForgeEssentialsCommandBase) cmd).getPermissionNode() + "\n\n";
            }

            // Display usage
            text += EnumChatFormatting.BLACK + cmd.getCommandUsage(sender);

            // Finally post to map
            if (!text.equals(""))
            {
                map.put(EnumChatFormatting.GOLD + "/" + cmd.getCommandName() + "\n" + EnumChatFormatting.RESET, text);
            }
        }

        SortedSet<String> keys = new TreeSet<String>(map.keySet());
        for (String name : keys)
View Full Code Here

        HashMultimap<String, ICommand> duplicates = HashMultimap.create();

        Set<ICommand> cmdList = ReflectionHelper.getPrivateValue(CommandHandler.class, (CommandHandler) server.getCommandManager(), FIELDNAME);
        OutputHandler.felog.finer("commandSet size: " + cmdList.size());

        ICommand keep;
        for (ICommand cmd : cmdList)
        {
          keep = initials.put(cmd.getCommandName(), cmd);
          if (keep != null)
          {
            OutputHandler.felog.finer("Duplicate command found! Name:" + keep.getCommandName());
            duplicates.put(cmd.getCommandName(), cmd);
            duplicates.put(cmd.getCommandName(), keep);
            continue;
          }
          CommandHandlerForge.doPermissionReg(cmd);
        }

        Set<ICommand> toRemove = new HashSet<ICommand>();
        keep = null;
        Class<? extends ICommand> cmdClass;
        int kept = -1, other = -1;
        for (String name : duplicates.keySet())
        {
          keep = null;
          kept = -1;
          other = -1;
          cmdClass = null;

          for (ICommand cmd : duplicates.get(name))
          {
            other = getCommandPriority(cmd);

            if (keep == null)
            {
              kept = other;

              if (kept == -1)
              {
                keep = null;
                duplicates.remove(name, cmd);
              }
              else
              {
                keep = cmd;
              }

              continue;
            }

            if (kept > other)
            {
              toRemove.add(cmd);
              cmdClass = cmd.getClass();
              OutputHandler.felog.finer("Removing command '" + cmd.getCommandName() + "' from class: " + cmdClass.getName());
            }
            else
            {
              toRemove.add(keep);
              cmdClass = keep.getClass();
              OutputHandler.felog.finer("Removing command '" + keep.getCommandName() + "' from class: " + cmdClass.getName());

              keep = cmd;
              kept = other;
            }
View Full Code Here

            try
            {
                Set<?> cmdList = ReflectionHelper
                        .getPrivateValue(CommandHandler.class, (CommandHandler) server.getCommandManager(), CommandSetChecker.FIELDNAME);

                ICommand toRemove = null;
                Class<?> cmdClass = null;
                for (Object cmdObj : cmdList)
                {
                    ICommand cmd = (ICommand) cmdObj;
                    if (cmd.getCommandName().equalsIgnoreCase("tell"))
                    {
                        try
                        {
                            cmdClass = cmd.getClass();
                            Package pkg = cmdClass.getPackage();
                            if (pkg == null || !pkg.getName().contains("ForgeEssentials"))
                            {
                                toRemove = cmd;
                                break;
                            }
                        }
                        catch (Exception e)
                        {
                            OutputHandler.felog.finer("Can't remove " + cmd.getCommandName());
                            OutputHandler.felog.finer("" + e.getLocalizedMessage());
                            e.printStackTrace();
                        }
                    }
                }
View Full Code Here

        String[] temp = message.split(" ");
        String[] args = new String[temp.length - 1];
        String commandName = temp[0];
        System.arraycopy(temp, 1, args, 0, args.length);
        ICommand icommand = (ICommand) getCommands().get(commandName);

        try
        {
            if (icommand == null)
            {
                return 0;
            }

            if (icommand.canCommandSenderUseCommand(sender))
            {
                CommandEvent event = new CommandEvent(icommand, sender, args);
                if (MinecraftForge.EVENT_BUS.post(event))
                {
                    if (event.exception != null)
                    {
                        throw event.exception;
                    }
                    return 0;
                }

                icommand.processCommand(sender, args);
                return 1;
            }
            else
            {
                sender.addChatMessage(format(RED, "commands.generic.permission"));
View Full Code Here

TOP

Related Classes of net.minecraft.command.ICommand

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.