Package net.minecraft.command

Examples of net.minecraft.command.WrongUsageException


  @Override
  public void processCommand(ICommandSender sender, String[] arguments) {

    if (arguments.length <= 0)
      throw new WrongUsageException(StringUtil.localizeAndFormat("chat.help", this.getCommandUsage(sender)));

    if (arguments[0].matches("list"))
      listModes(sender, arguments);
    else if (arguments[0].matches("info"))
      listModeInfo(sender, arguments);
    else if (arguments[0].matches("set")) {
      if (arguments.length <= 1)
        throw new WrongUsageException("/" + this.getCommandName() + " set [<world-#>] <mode-name>");

      World world = getWorld(sender, arguments);
      String desired = arguments[arguments.length - 1];

      IBeekeepingMode mode = PluginApiculture.beeInterface.getBeekeepingMode(desired);
      if (mode == null)
        throw new CommandException(StringUtil.localize("chat.bees.command.beekeeping.error"), desired);

      PluginApiculture.beeInterface.setBeekeepingMode(world, mode.getName());
      func_152373_a(sender, this, StringUtil.localize("chat.bees.command.beekeeping.set"), mode.getName());

    } else if (arguments[0].matches("save")) {
      if (arguments.length <= 1)
        throw new WrongUsageException("/" + this.getCommandName() + " save <player-name>");

      saveStatistics(sender, arguments);
    } else if (arguments[0].matches("help")) {
      sendChatMessage(sender, StringUtil.localizeAndFormat("chat.bees.command.help.0", this.getCommandName()));
      sendChatMessage(sender, StringUtil.localize("chat.bees.command.help.1"));
View Full Code Here


    return;
  }

  private void listModeInfo(ICommandSender sender, String[] arguments) {
    if (arguments.length <= 1)
      throw new WrongUsageException("/" + this.getCommandName() + " info <mode-name>");

    IBeekeepingMode found = null;
    for (IBeekeepingMode mode : PluginApiculture.beeInterface.getBeekeepingModes())
      if (mode.getName().equalsIgnoreCase(arguments[1])) {
        found = mode;
View Full Code Here

    @Override
    public void processCommandConsole(ICommandSender var1, String[] var2)
    {
        if (var2.length != 3)
        {
            throw new WrongUsageException("/push <X> <Y> <Z>", new Object[0]);
        }
        else
        {
            int var3 = 0;
            int var4 = 0;
View Full Code Here

    public void processCommandPlayer(EntityPlayer sender, String[] args)
    {
        EntityPlayerMP playermp = UserIdent.getPlayerByMatchOrUsername(sender, sender.getCommandSenderName());
        if (args.length != 3)
        {
            throw new WrongUsageException("/push <X> <Y> <Z>", new Object[0]);
        }
        else
        {
            int var3 = 0;
            int var4 = 0;
View Full Code Here

          setGameMode(sender, args[i], gm);
        }
      }
      else
      {
        throw new WrongUsageException("commands.gamemode.usage");
      }
    }
  }
View Full Code Here

  {
    WorldSettings.GameType gm;
    switch (args.length)
    {
    case 0:
      throw new WrongUsageException("commands.gamemode.usage");
    case 1:
      gm = getGameTypeFromString(args[0]);
      if (gm != null)
      {
        throw new WrongUsageException("commands.gamemode.usage");
      }
      else
      {
        setGameMode(sender, args[0]);
      }
      break;
    default:
      gm = getGameTypeFromString(args[0]);
      if (gm != null)
      {
        for (int i = 1; i < args.length; i++)
        {
          setGameMode(sender, args[i], gm);
        }
      }
      else
      {
        throw new WrongUsageException("commands.gamemode.usage");
      }
      break;
    }
  }
View Full Code Here

  }

  @Override
  public void processCommand(ICommandSender sender, String[] arguments) {
    if (arguments.length <= 0)
      throw new WrongUsageException(StringUtil.localizeAndFormat("chat.help", this.getCommandUsage(sender)));

    if (arguments[0].matches("trades")) {
      commandTrades(sender, arguments);
      return;
    } else if (arguments[0].matches("virtualize")) {
      commandVirtualize(sender, arguments);
      return;
    } else if (arguments[0].matches("help")) {
      sendChatMessage(sender, StringUtil.localizeAndFormat("chat.mail.command.help.0", this.getCommandName()));
      sendChatMessage(sender, StringUtil.localize("chat.mail.command.help.1"));
      sendChatMessage(sender, StringUtil.localize("chat.mail.command.help.2"));
      sendChatMessage(sender, StringUtil.localize("chat.mail.command.help.3"));
      return;
    }

    throw new WrongUsageException(this.getCommandUsage(sender));
  }
View Full Code Here

      sendChatMessage(sender, "\u00a7c" + StringUtil.localize("chat.command.noperms"));
      return;
    }

    if (arguments.length <= 1)
      throw new WrongUsageException("/" + getCommandName() + " virtualize <tradestation-name>");

    World world = getWorld(sender, arguments);
    MailAddress address = new MailAddress(arguments[1]);
    ITradeStation trade = PostManager.postRegistry.getTradeStation(world, address);
    if (trade == null) {
View Full Code Here

    if (arguments.length > 2) {
      int dim = 0;
      try {
        dim = Integer.parseInt(arguments[1]);
      } catch (Exception ex) {
        throw new WrongUsageException("/" + getCommandName() + " set [<world-#>] <beekeeping-mode>");
      }

      return MinecraftServer.getServer().worldServerForDimension(dim);
    }
View Full Code Here

  }

  @Override
  public void processCommand(ICommandSender sender, String[] arguments) {
    if (arguments.length <= 0) {
      throw new WrongUsageException("Type '" + this.getCommandUsage(sender) + "' for help.");
    }
    try {
      mainCommand.executeCommand(sender, arguments);
    } catch(LPCommandException e) {
      if(e instanceof PermissionDeniedException) {
        throw new CommandException("You are not allowed to execute that command now.");
      } else if(e instanceof CommandNotFoundException) {
        throw new CommandException("The command was not found");
      } else {
        throw new WrongUsageException(this.getCommandUsage(sender));
      }
    }
  }
View Full Code Here

TOP

Related Classes of net.minecraft.command.WrongUsageException

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.