Package net.minecraft.command

Examples of net.minecraft.command.CommandException


                            data.getAllowedPlayers().remove(str);
                            data.markDirty();
                        }
                        else
                        {
                            throw new CommandException(GCCoreUtil.translateWithFormat("commands.ssuninvite.noPlayer", "\"" + var3 + "\""), new Object[0]);
                        }
                    }
                }
            }
            catch (final Exception var6)
            {
                throw new CommandException(var6.getMessage(), new Object[0]);
            }

        }
        else
        {
View Full Code Here


                    }
                }
            }
            catch (final Exception var6)
            {
                throw new CommandException(var6.getMessage(), new Object[0]);
            }

        }
        else
        {
View Full Code Here

                    throw new Exception("Could not find player with name: " + astring[0]);
                }
            }
            catch (final Exception var6)
            {
                throw new CommandException(var6.getMessage(), new Object[0]);
            }
        }
        else
        {
            throw new WrongUsageException(GCCoreUtil.translateWithFormat("commands.joinrace.noTeam", this.getCommandUsage(icommandsender)), new Object[0]);
View Full Code Here

                    }
                }
            }
            catch (final Exception var6)
            {
                throw new CommandException(var6.getMessage(), new Object[0]);
            }
        }
    }
View Full Code Here

                    throw new Exception("Could not find player with name: " + astring[0]);
                }
            }
            catch (final Exception var6)
            {
                throw new CommandException(var6.getMessage(), new Object[0]);
            }
        }
        else
        {
            throw new WrongUsageException(GCCoreUtil.translateWithFormat("commands.dimensiontp.tooMany", this.getCommandUsage(icommandsender)), new Object[0]);
View Full Code Here

      int id = CommandBase.parseIntBounded(sender, args[i++], 0, Enchantment.enchantmentsList.length - 1);
      int level = 1;
      ItemStack itemstack = player.getCurrentEquippedItem();

      if (itemstack == null) {
        throw new CommandException("commands.enchant.noItem", new Object[0]);
      } else {
        Enchantment enchantment = Enchantment.enchantmentsList[id];

        if (enchantment == null) {
          throw new NumberInvalidException("commands.enchant.notFound", new Object[] { Integer.valueOf(id) });
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: [dimID, none for all] <freeze|lock|set|add> <time (number)|day|night>");
    }

    switch (args[0]) {
    case "set":
    {
      if (args[1].equalsIgnoreCase("day")) {
        CommandsEventHandler.makeWorldTimeHours(world, WeatherTimeData.dayTimeStart);
      } else if (args[1].equalsIgnoreCase("night")) {
        CommandsEventHandler.makeWorldTimeHours(world, WeatherTimeData.nightTimeStart);
      } else {
        world.setWorldTime(parseInt(sender, args[1]));
      }
            WeatherTimeData wt = CommandDataManager.WTmap.get(world.provider.dimensionId);
            wt.freezeTime = world.getWorldTime();
      return String.format("Set time to %s.", args[1]);
    }
    case "add":
    {
      if (args.length == 1) {
        throw new CommandException("Improper syntax. Please try this instead: [dimID, none for all] <freeze|lock|set|add> <time (number)|day|night>");
      }
      world.setWorldTime(world.getWorldTime() + parseInt(sender, args[1]));
            WeatherTimeData wt = CommandDataManager.WTmap.get(world.provider.dimensionId);
            wt.freezeTime = world.getWorldTime();
      return String.format("Added %d to the current time.", args[1]);

    }
    case "freeze":
    {
      WeatherTimeData wt = CommandDataManager.WTmap.get(world.provider.dimensionId);
      wt.freezeTime = world.getWorldTime();
      wt.timeFreeze = !wt.timeFreeze;
      return "Time freeze" + (wt.timeFreeze ? "on" : "off");
    }
    case "lock":
    {
      WeatherTimeData wt = CommandDataManager.WTmap.get(world.provider.dimensionId);
      if (args.length == 1) {
        wt.timeSpecified = !wt.timeSpecified;
      } else {
        wt.timeSpecified = true;
        if (args[1].equalsIgnoreCase("day")) {
          wt.day = true;
        } else if (args[1].equalsIgnoreCase("night")) {
          wt.day = false;
        } else {
          throw new CommandException("Improper syntax. Please try this instead: [dimID, none for all] <freeze|lock|set|add> <time (number)|day|night>");
        }
      }
      return String.format("Locked time to %s.", args[1]);
    }
    default:
    {
      throw new CommandException("Improper syntax. Please try this instead: [dimID, none for all] <freeze|lock|set|add> <time (number)|day|night>");
    }
    }
  }
View Full Code Here

                }
            }
        }
        else
        {
            throw new CommandException("No viable Container found to put item in");
        }
        if (var9 > 0)
        {
            throw new CommandException("Not enough Room for Items");
        }
        OutputHandler.chatConfirmation(var1, "Items Droped into container");
    }
View Full Code Here

    private void parseUserSpawn(UserIdent ident, Zone zone)
    {
        if (!tabCompleteMode && !PermissionsManager.checkPermission(new PermissionContext().setCommandSender(sender), PERM_USER_SPAWN))
        {
            throw new CommandException(FEPermissions.MSG_NO_COMMAND_PERM);
        }
        if (args.isEmpty())
        {
            info("/feperm user " + ident.getUsernameOrUUID() + " spawn (here|bed|clear|<x> <y> <z> <dim>) [zone] : Set spawn");
            return;
        }
        if (tabCompleteMode && args.size() == 1)
        {
            tabComplete = CommandBase.getListOfStringsMatchingLastWord(new String[] { args.peek() }, parseSpawnArgs);
            return;
        }

        String loc = args.remove().toLowerCase();
        WorldPoint point = null;
        boolean isBed = false;
        switch (loc)
        {
        case "here":
            point = new WorldPoint(senderPlayer);
            break;
        case "bed":
            isBed = true;
            break;
        case "clear":
            break;
        default:
            if (args.size() < 3)
                throw new CommandException("Too few arguments!");
            try
            {
                int x = CommandBase.parseInt(sender, loc);
                int y = CommandBase.parseInt(sender, args.remove());
                int z = CommandBase.parseInt(sender, args.remove());
View Full Code Here

            break;
        case "clear":
            break;
        default:
            if (args.size() < 3)
                throw new CommandException("Too few arguments!");
            try
            {
                int x = CommandBase.parseInt(sender, loc);
                int y = CommandBase.parseInt(sender, args.remove());
                int z = CommandBase.parseInt(sender, args.remove());
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.