Package net.minecraft.command

Examples of net.minecraft.command.CommandException


        }
    }

    public void processCommandPlayer(EntityPlayer sender, String[] args)
    {
        throw new CommandException(String.format("Command %s is not implemented for players", getCommandName()));
    }
View Full Code Here


        throw new CommandException(String.format("Command %s is not implemented for players", getCommandName()));
    }

    public void processCommandConsole(ICommandSender sender, String[] args)
    {
        throw new CommandException(String.format("Command %s is not implemented for console", getCommandName()));
    }
View Full Code Here

        final String methodName = "executeCommand";
        for (StackTraceElement s : Thread.currentThread().getStackTrace())
            if (s.getClassName().equals(className))
            {
                if (s.getClassName().equals(methodName))
                    throw new CommandException(msg);
                break;
            }
        // Just return false instead of an exception
        return false;
    }
View Full Code Here

    /**
     * Prints an error message to the sender of the command.
     */
    public void error(String message)
    {
        throw new CommandException(message);
    }
View Full Code Here

  {
    if (args.length >= 1)
    {
      if (!PermissionsManager.checkPermission(sender, TeleportModule.PERM_SPAWN_OTHERS))
      {
        throw new CommandException(FEPermissions.MSG_NO_COMMAND_PERM);
      }
      EntityPlayerMP player = UserIdent.getPlayerByMatchOrUsername(sender, args[0]);
      if (player == null)
      {
        throw new CommandException(String.format("Player %s does not exist, or is not online.", args[0]));
      }

      WarpPoint point = RespawnHandler.getPlayerSpawn(player, null);
      if (point == null)
      {
        throw new CommandException("There is no spawnpoint set for that player.");
      }

      PlayerInfo.getPlayerInfo(player.getPersistentID()).setLastTeleportOrigin(new WarpPoint(player));
      OutputHandler.chatNotification(player, "Teleporting to spawn.");
      TeleportCenter.teleport(point, player);
    }
    else if (args.length == 0)
    {
      EntityPlayerMP player = (EntityPlayerMP) sender;

      WarpPoint point = RespawnHandler.getPlayerSpawn(player, null);
      if (point == null)
      {
        throw new CommandException("There is no spawnpoint set for that player.");
      }

      PlayerInfo.getPlayerInfo(player.getPersistentID()).setLastTeleportOrigin(new WarpPoint(player));
      OutputHandler.chatConfirmation(player, "Teleporting to spawn.");
      TeleportCenter.teleport(point, player);
View Full Code Here

  @Override
  public void processCommandConsole(ICommandSender sender, String[] args)
  {
    if (args.length < 1)
    {
      throw new CommandException(FEPermissions.MSG_NOT_ENOUGH_ARGUMENTS);
    }

    if (!PermissionsManager.checkPermission(new PermissionContext().setCommandSender(sender).setCommand(this), TeleportModule.PERM_SPAWN_OTHERS))
    {
      throw new CommandException(FEPermissions.MSG_NO_COMMAND_PERM);
    }
    EntityPlayerMP player = UserIdent.getPlayerByMatchOrUsername(sender, args[0]);
    if (player == null)
    {
      throw new CommandException(String.format("Player %s does not exist, or is not online.", args[0]));
    }

    WarpPoint point = RespawnHandler.getPlayerSpawn(player, null);
    if (point == null)
    {
      throw new CommandException("There is no spawnpoint set for that player.");
    }

    PlayerInfo.getPlayerInfo(player.getPersistentID()).setLastTeleportOrigin(new WarpPoint(player));
    OutputHandler.chatNotification(player, "Teleporting to spawn.");
    TeleportCenter.teleport(point, player);
View Full Code Here

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

      ITreekeepingMode mode = PluginArboriculture.treeInterface.getTreekeepingMode(desired);
      if (mode == null)
        throw new CommandException(StringUtil.localize("chat.trees.command.treekeeping.error"), desired);

      PluginArboriculture.treeInterface.setTreekeepingMode(world, mode.getName());
      func_152373_a(sender, this, StringUtil.localize("chat.trees.command.treekeeping.set"), mode.getName());

    } else if (arguments[0].matches("save")) {
View Full Code Here

        found = mode;
        break;
      }

    if (found == null)
      throw new CommandException("No treekeeping mode called '%s' is available.", arguments[1]);

    sendChatMessage(sender, "\u00A7aMode: " + found.getName());
    for (String desc : found.getDescription())
      sendChatMessage(sender, StringUtil.localize(desc));
  }
View Full Code Here

        break;
      }
    }

    if (found == null)
      throw new CommandException(StringUtil.localizeAndFormat("chat.plugins.error", arguments[2]));

    String entry = "\u00A7c";
    if (found.isAvailable())
      entry = "\u00A7a";
    Plugin info = found.getClass().getAnnotation(Plugin.class);
View Full Code Here

      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")) {
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.