Package net.minecraft.command

Examples of net.minecraft.command.CommandException


            {
                command = (ForgeEssentialsCommandBase) cmd;
            }
            else
            {
              throw new CommandException("Error in this shortcut (" + this.name + "). The command sepcified in the config is no FE command.");
            }
        }
    return command;
  }
View Full Code Here


                    arg = sendArgs[i];
                    i++;
                }
                else
                {
                    throw new CommandException("commands.generic.syntax");
                }
            }
            else if (arg.equalsIgnoreCase("$oArg"))
            {
                if (sendArgs.length > i)
View Full Code Here

  public String doCmd(ICommandSender sender, World world, String[] args)
  {
    if (args.length == 0)
    {
      throw new CommandException("Improper syntax. Please try this instead: /weather <rain|storm|default> [on|off]");
    }
    WeatherTimeData wt = CommandDataManager.WTmap.get(world.provider.dimensionId);
    wt.weatherSpecified = true;

    if (args[0].equalsIgnoreCase("rain"))
    {
      if (args.length == 1)
      {
        wt.rain = !wt.rain;
      }
      else
      {
        if (args[1].equalsIgnoreCase("on"))
        {
          wt.rain = true;
          wt.storm = false;
        }
        else if (args[1].equalsIgnoreCase("off"))
        {
          wt.rain = false;
        }
        else
        {
          throw new CommandException("Improper syntax. Please try this instead: [DimID, none for all] <rain|storm> [on|off]");
        }
      }
      CommandDataManager.WTmap.put(wt.dimID, wt);
      return "Rain permanently turned " + (wt.rain ? "on" : "off");
    }
    else if (args[0].equalsIgnoreCase("storm"))
    {
      if (args.length == 1)
      {
        wt.storm = !wt.storm;
      }
      else
      {
        if (args[1].equalsIgnoreCase("on"))
        {
          wt.storm = true;
          wt.rain = false;
        }
        else if (args[1].equalsIgnoreCase("off"))
        {
          wt.storm = false;
        }
        else
        {
          throw new CommandException("Improper syntax. Please try this instead:[DimID, none for all] <rain|storm> [on|off]");
        }
      }
      CommandDataManager.WTmap.put(wt.dimID, wt);
      return "Storms permanently turned " + (wt.storm ? "on" : "off");
    }
    else if (args[0].equalsIgnoreCase("default"))
    {
      wt.weatherSpecified = false;
      CommandDataManager.WTmap.put(wt.dimID, wt);
      return "Wheather reset to default";
    }
    else
    {
      throw new CommandException("Improper syntax. Please try this instead: /weather <rain|storm|default> [on|off]");
    }
  }
View Full Code Here

      return;
    }

    // Check for permissions
    if (!checkCommandPermission(sender))
        throw new CommandException(FEPermissions.MSG_NO_COMMAND_PERM);

    if (args.length > 0 && !rebind) {
      Pair<String, Integer> data = FunctionHelper.parseIdAndMetaFromString(args[0], false);
      wandItem = GameData.getItemRegistry().getObject(data.getLeft());
      wandId = wandItem.getUnlocalizedName();
View Full Code Here

            switch (arg) {
            case "help":
                help(sender);
                break;
            case "info":
                throw new CommandException("Not yet implemented!");
            case "list":
                parseList(sender, worldZone, args);
                break;
            case "define":
            case "redefine":
View Full Code Here

            }
        }

        if (worldZone == null)
        {
            throw new CommandException("No world found");
        }
        if (args.isEmpty())
        {
            throw new CommandException("Missing arguments!");
        }
        if (tabCompleteMode)
        {
            if (!redefine)
                return;
            for (Zone z: APIRegistry.perms.getZones()) {
                if (z instanceof AreaZone) {
                    if (z.getName().startsWith(args.peek()))
                        tabComplete.add(z.getName());
                    if (Integer.toString(z.getId()).startsWith(args.peek()))
                        tabComplete.add(Integer.toString(z.getId()));
                }
            }
            return;
        }
        String zoneName = args.remove();
        AreaZone zone = getAreaZone(worldZone, zoneName);
        if (!redefine && zone != null)
        {
            throw new CommandException(String.format("Area \"%s\" already exists!", zoneName));
        }
        else if (redefine && zone == null)
        {
            throw new CommandException(String.format("Area \"%s\" does not exist!", zoneName));
        }

        if (args.isEmpty())
        {
            if (!(sender instanceof EntityPlayerMP))
            {
                throw new CommandException("Command not usable from console. Try /zone set <name> <coords> instead");
            }
           
            PlayerInfo info = PlayerInfo.getPlayerInfo((EntityPlayerMP) sender);
            AreaBase area = info.getSelection();
            if (area == null)
                throw new CommandException("No selection available. Please select a region first.");

            PermissionContext context = new PermissionContext();
            context.setCommandSender(sender);
            context.setTargetLocationStart(area.getLowPoint().toVec3());
            context.setTargetLocationEnd(area.getHighPoint().toVec3());
            if (!PermissionsManager.checkPermission(context, PERM_DEFINE))
            {
                throw new CommandException("You don't have the permission to define an area.");
            }

            if (redefine)
            {
                zone.setArea(area);
                OutputHandler.chatConfirmation(sender, String.format("Area \"%s\" has been redefined.", zoneName));
            }
            else
            {
                zone = new AreaZone(worldZone, zoneName, area);
                OutputHandler.chatConfirmation(sender, String.format("Area \"%s\" has been defined.", zoneName));
            }
        }
        else if (args.size() >= 3)
        {
            throw new CommandException("Not yet implemented!");
        }
    }
View Full Code Here

            OutputHandler.chatError(sender, FEPermissions.MSG_NO_COMMAND_PERM);
            return;
        }
        if (worldZone == null)
        {
            throw new CommandException("No world found");
        }
        if (args.isEmpty())
        {
            throw new CommandException("Missing arguments!");
        }
        if (tabCompleteMode)
        {
            for (Zone z: APIRegistry.perms.getZones()) {
                if (z instanceof AreaZone) {
View Full Code Here

            return;
        }

        if (worldZone == null)
        {
            throw new CommandException("No world found");
        }
        if (args.isEmpty())
        {
            throw new CommandException("Missing arguments!");
        }
        String zoneName = args.remove();
        AreaZone zone = getAreaZone(worldZone, zoneName);
        if (zone == null)
        {
            throw new CommandException(String.format("Area \"%s\" does not exist!", zoneName));
        }

        if (args.isEmpty())
        {
            zone.getGroupPermission(IPermissionsHelper.GROUP_DEFAULT, isEntry ? FEPermissions.ZONE_ENTRY_MESSAGE : FEPermissions.ZONE_EXIT_MESSAGE);
View Full Code Here

        break;
      case "clear":
        APIRegistry.perms.getServerZone().clearPlayerPermission(ident, FEPermissions.SPAWN);
        break;
      default:
        throw new CommandException("Invalid location argument");
      }
    }
  }
View Full Code Here

  }

  @Override
  public void processCommandConsole(ICommandSender sender, String[] args)
  {
    throw new CommandException("This command cannot be used from console. Use \"/feperm user <USER> spawn\" instead");
  }
View Full Code Here

TOP

Related Classes of net.minecraft.command.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.