Java 类net.minecraft.command.SyntaxErrorException 实例源码

项目:DecompiledMinecraft    文件:CommandMessageRaw.java   
/**
 * Callback when the command is invoked
 */
public void processCommand(ICommandSender sender, String[] args) throws CommandException
{
    if (args.length < 2)
    {
        throw new WrongUsageException("commands.tellraw.usage", new Object[0]);
    }
    else
    {
        EntityPlayer entityplayer = getPlayer(sender, args[0]);
        String s = buildString(args, 1);

        try
        {
            IChatComponent ichatcomponent = IChatComponent.Serializer.jsonToComponent(s);
            entityplayer.addChatMessage(ChatComponentProcessor.processComponent(sender, ichatcomponent, entityplayer));
        }
        catch (JsonParseException jsonparseexception)
        {
            Throwable throwable = ExceptionUtils.getRootCause(jsonparseexception);
            throw new SyntaxErrorException("commands.tellraw.jsonException", new Object[] {throwable == null ? "" : throwable.getMessage()});
        }
    }
}
项目:DecompiledMinecraft    文件:CommandScoreboard.java   
protected void func_175779_n(ICommandSender p_175779_1_, String[] p_175779_2_, int p_175779_3_) throws CommandException
{
    Scoreboard scoreboard = this.getScoreboard();
    String s = getPlayerName(p_175779_1_, p_175779_2_[p_175779_3_++]);

    if (s.length() > 40)
    {
        throw new SyntaxErrorException("commands.scoreboard.players.name.tooLong", new Object[] {s, Integer.valueOf(40)});
    }
    else
    {
        ScoreObjective scoreobjective = this.getObjective(p_175779_2_[p_175779_3_], false);

        if (scoreobjective.getCriteria() != IScoreObjectiveCriteria.TRIGGER)
        {
            throw new CommandException("commands.scoreboard.players.enable.noTrigger", new Object[] {scoreobjective.getName()});
        }
        else
        {
            Score score = scoreboard.getValueFromObjective(s, scoreobjective);
            score.setLocked(false);
            notifyOperators(p_175779_1_, this, "commands.scoreboard.players.enable.success", new Object[] {scoreobjective.getName(), s});
        }
    }
}
项目:DecompiledMinecraft    文件:CommandPardonIp.java   
/**
 * Callback when the command is invoked
 */
public void processCommand(ICommandSender sender, String[] args) throws CommandException
{
    if (args.length == 1 && args[0].length() > 1)
    {
        Matcher matcher = CommandBanIp.field_147211_a.matcher(args[0]);

        if (matcher.matches())
        {
            MinecraftServer.getServer().getConfigurationManager().getBannedIPs().removeEntry(args[0]);
            notifyOperators(sender, this, "commands.unbanip.success", new Object[] {args[0]});
        }
        else
        {
            throw new SyntaxErrorException("commands.unbanip.invalid", new Object[0]);
        }
    }
    else
    {
        throw new WrongUsageException("commands.unbanip.usage", new Object[0]);
    }
}
项目:DecompiledMinecraft    文件:CommandMessageRaw.java   
/**
 * Callback when the command is invoked
 */
public void processCommand(ICommandSender sender, String[] args) throws CommandException
{
    if (args.length < 2)
    {
        throw new WrongUsageException("commands.tellraw.usage", new Object[0]);
    }
    else
    {
        EntityPlayer entityplayer = getPlayer(sender, args[0]);
        String s = buildString(args, 1);

        try
        {
            IChatComponent ichatcomponent = IChatComponent.Serializer.jsonToComponent(s);
            entityplayer.addChatMessage(ChatComponentProcessor.processComponent(sender, ichatcomponent, entityplayer));
        }
        catch (JsonParseException jsonparseexception)
        {
            Throwable throwable = ExceptionUtils.getRootCause(jsonparseexception);
            throw new SyntaxErrorException("commands.tellraw.jsonException", new Object[] {throwable == null ? "" : throwable.getMessage()});
        }
    }
}
项目:DecompiledMinecraft    文件:CommandScoreboard.java   
protected void func_175779_n(ICommandSender p_175779_1_, String[] p_175779_2_, int p_175779_3_) throws CommandException
{
    Scoreboard scoreboard = this.getScoreboard();
    String s = getPlayerName(p_175779_1_, p_175779_2_[p_175779_3_++]);

    if (s.length() > 40)
    {
        throw new SyntaxErrorException("commands.scoreboard.players.name.tooLong", new Object[] {s, Integer.valueOf(40)});
    }
    else
    {
        ScoreObjective scoreobjective = this.getObjective(p_175779_2_[p_175779_3_], false);

        if (scoreobjective.getCriteria() != IScoreObjectiveCriteria.TRIGGER)
        {
            throw new CommandException("commands.scoreboard.players.enable.noTrigger", new Object[] {scoreobjective.getName()});
        }
        else
        {
            Score score = scoreboard.getValueFromObjective(s, scoreobjective);
            score.setLocked(false);
            notifyOperators(p_175779_1_, this, "commands.scoreboard.players.enable.success", new Object[] {scoreobjective.getName(), s});
        }
    }
}
项目:DecompiledMinecraft    文件:CommandPardonIp.java   
/**
 * Callback when the command is invoked
 */
public void processCommand(ICommandSender sender, String[] args) throws CommandException
{
    if (args.length == 1 && args[0].length() > 1)
    {
        Matcher matcher = CommandBanIp.field_147211_a.matcher(args[0]);

        if (matcher.matches())
        {
            MinecraftServer.getServer().getConfigurationManager().getBannedIPs().removeEntry(args[0]);
            notifyOperators(sender, this, "commands.unbanip.success", new Object[] {args[0]});
        }
        else
        {
            throw new SyntaxErrorException("commands.unbanip.invalid", new Object[0]);
        }
    }
    else
    {
        throw new WrongUsageException("commands.unbanip.usage", new Object[0]);
    }
}
项目:BaseClient    文件:CommandMessageRaw.java   
/**
 * Callback when the command is invoked
 */
public void processCommand(ICommandSender sender, String[] args) throws CommandException
{
    if (args.length < 2)
    {
        throw new WrongUsageException("commands.tellraw.usage", new Object[0]);
    }
    else
    {
        EntityPlayer entityplayer = getPlayer(sender, args[0]);
        String s = buildString(args, 1);

        try
        {
            IChatComponent ichatcomponent = IChatComponent.Serializer.jsonToComponent(s);
            entityplayer.addChatMessage(ChatComponentProcessor.processComponent(sender, ichatcomponent, entityplayer));
        }
        catch (JsonParseException jsonparseexception)
        {
            Throwable throwable = ExceptionUtils.getRootCause(jsonparseexception);
            throw new SyntaxErrorException("commands.tellraw.jsonException", new Object[] {throwable == null ? "" : throwable.getMessage()});
        }
    }
}
项目:BaseClient    文件:CommandScoreboard.java   
protected void func_175779_n(ICommandSender p_175779_1_, String[] p_175779_2_, int p_175779_3_) throws CommandException
{
    Scoreboard scoreboard = this.getScoreboard();
    String s = getPlayerName(p_175779_1_, p_175779_2_[p_175779_3_++]);

    if (s.length() > 40)
    {
        throw new SyntaxErrorException("commands.scoreboard.players.name.tooLong", new Object[] {s, Integer.valueOf(40)});
    }
    else
    {
        ScoreObjective scoreobjective = this.getObjective(p_175779_2_[p_175779_3_], false);

        if (scoreobjective.getCriteria() != IScoreObjectiveCriteria.TRIGGER)
        {
            throw new CommandException("commands.scoreboard.players.enable.noTrigger", new Object[] {scoreobjective.getName()});
        }
        else
        {
            Score score = scoreboard.getValueFromObjective(s, scoreobjective);
            score.setLocked(false);
            notifyOperators(p_175779_1_, this, "commands.scoreboard.players.enable.success", new Object[] {scoreobjective.getName(), s});
        }
    }
}
项目:BaseClient    文件:CommandPardonIp.java   
/**
 * Callback when the command is invoked
 */
public void processCommand(ICommandSender sender, String[] args) throws CommandException
{
    if (args.length == 1 && args[0].length() > 1)
    {
        Matcher matcher = CommandBanIp.field_147211_a.matcher(args[0]);

        if (matcher.matches())
        {
            MinecraftServer.getServer().getConfigurationManager().getBannedIPs().removeEntry(args[0]);
            notifyOperators(sender, this, "commands.unbanip.success", new Object[] {args[0]});
        }
        else
        {
            throw new SyntaxErrorException("commands.unbanip.invalid", new Object[0]);
        }
    }
    else
    {
        throw new WrongUsageException("commands.unbanip.usage", new Object[0]);
    }
}
项目:BaseClient    文件:CommandMessageRaw.java   
/**
 * Callback when the command is invoked
 */
public void processCommand(ICommandSender sender, String[] args) throws CommandException
{
    if (args.length < 2)
    {
        throw new WrongUsageException("commands.tellraw.usage", new Object[0]);
    }
    else
    {
        EntityPlayer entityplayer = getPlayer(sender, args[0]);
        String s = buildString(args, 1);

        try
        {
            IChatComponent ichatcomponent = IChatComponent.Serializer.jsonToComponent(s);
            entityplayer.addChatMessage(ChatComponentProcessor.processComponent(sender, ichatcomponent, entityplayer));
        }
        catch (JsonParseException jsonparseexception)
        {
            Throwable throwable = ExceptionUtils.getRootCause(jsonparseexception);
            throw new SyntaxErrorException("commands.tellraw.jsonException", new Object[] {throwable == null ? "" : throwable.getMessage()});
        }
    }
}
项目:BaseClient    文件:CommandScoreboard.java   
protected void func_175779_n(ICommandSender p_175779_1_, String[] p_175779_2_, int p_175779_3_) throws CommandException
{
    Scoreboard scoreboard = this.getScoreboard();
    String s = getPlayerName(p_175779_1_, p_175779_2_[p_175779_3_++]);

    if (s.length() > 40)
    {
        throw new SyntaxErrorException("commands.scoreboard.players.name.tooLong", new Object[] {s, Integer.valueOf(40)});
    }
    else
    {
        ScoreObjective scoreobjective = this.getObjective(p_175779_2_[p_175779_3_], false);

        if (scoreobjective.getCriteria() != IScoreObjectiveCriteria.TRIGGER)
        {
            throw new CommandException("commands.scoreboard.players.enable.noTrigger", new Object[] {scoreobjective.getName()});
        }
        else
        {
            Score score = scoreboard.getValueFromObjective(s, scoreobjective);
            score.setLocked(false);
            notifyOperators(p_175779_1_, this, "commands.scoreboard.players.enable.success", new Object[] {scoreobjective.getName(), s});
        }
    }
}
项目:BaseClient    文件:CommandPardonIp.java   
/**
 * Callback when the command is invoked
 */
public void processCommand(ICommandSender sender, String[] args) throws CommandException
{
    if (args.length == 1 && args[0].length() > 1)
    {
        Matcher matcher = CommandBanIp.field_147211_a.matcher(args[0]);

        if (matcher.matches())
        {
            MinecraftServer.getServer().getConfigurationManager().getBannedIPs().removeEntry(args[0]);
            notifyOperators(sender, this, "commands.unbanip.success", new Object[] {args[0]});
        }
        else
        {
            throw new SyntaxErrorException("commands.unbanip.invalid", new Object[0]);
        }
    }
    else
    {
        throw new WrongUsageException("commands.unbanip.usage", new Object[0]);
    }
}
项目:Backmemed    文件:CommandScoreboard.java   
protected void enablePlayerTrigger(ICommandSender sender, String[] p_184914_2_, int p_184914_3_, MinecraftServer server) throws CommandException
{
    Scoreboard scoreboard = this.getScoreboard(server);
    String s = getPlayerName(server, sender, p_184914_2_[p_184914_3_++]);

    if (s.length() > 40)
    {
        throw new SyntaxErrorException("commands.scoreboard.players.name.tooLong", new Object[] {s, Integer.valueOf(40)});
    }
    else
    {
        ScoreObjective scoreobjective = this.convertToObjective(p_184914_2_[p_184914_3_], false, server);

        if (scoreobjective.getCriteria() != IScoreCriteria.TRIGGER)
        {
            throw new CommandException("commands.scoreboard.players.enable.noTrigger", new Object[] {scoreobjective.getName()});
        }
        else
        {
            Score score = scoreboard.getOrCreateScore(s, scoreobjective);
            score.setLocked(false);
            notifyCommandListener(sender, this, "commands.scoreboard.players.enable.success", new Object[] {scoreobjective.getName(), s});
        }
    }
}
项目:Backmemed    文件:CommandPardonIp.java   
/**
 * Callback for when the command is executed
 */
public void execute(MinecraftServer server, ICommandSender sender, String[] args) throws CommandException
{
    if (args.length == 1 && args[0].length() > 1)
    {
        Matcher matcher = CommandBanIp.IP_PATTERN.matcher(args[0]);

        if (matcher.matches())
        {
            server.getPlayerList().getBannedIPs().removeEntry(args[0]);
            notifyCommandListener(sender, this, "commands.unbanip.success", new Object[] {args[0]});
        }
        else
        {
            throw new SyntaxErrorException("commands.unbanip.invalid", new Object[0]);
        }
    }
    else
    {
        throw new WrongUsageException("commands.unbanip.usage", new Object[0]);
    }
}
项目:CustomWorldGen    文件:CommandScoreboard.java   
protected void enablePlayerTrigger(ICommandSender sender, String[] p_184914_2_, int p_184914_3_, MinecraftServer server) throws CommandException
{
    Scoreboard scoreboard = this.getScoreboard(server);
    String s = getPlayerName(server, sender, p_184914_2_[p_184914_3_++]);

    if (s.length() > 40)
    {
        throw new SyntaxErrorException("commands.scoreboard.players.name.tooLong", new Object[] {s, Integer.valueOf(40)});
    }
    else
    {
        ScoreObjective scoreobjective = this.convertToObjective(p_184914_2_[p_184914_3_], false, server);

        if (scoreobjective.getCriteria() != IScoreCriteria.TRIGGER)
        {
            throw new CommandException("commands.scoreboard.players.enable.noTrigger", new Object[] {scoreobjective.getName()});
        }
        else
        {
            Score score = scoreboard.getOrCreateScore(s, scoreobjective);
            score.setLocked(false);
            notifyCommandListener(sender, this, "commands.scoreboard.players.enable.success", new Object[] {scoreobjective.getName(), s});
        }
    }
}
项目:CustomWorldGen    文件:CommandPardonIp.java   
/**
 * Callback for when the command is executed
 */
public void execute(MinecraftServer server, ICommandSender sender, String[] args) throws CommandException
{
    if (args.length == 1 && args[0].length() > 1)
    {
        Matcher matcher = CommandBanIp.IP_PATTERN.matcher(args[0]);

        if (matcher.matches())
        {
            server.getPlayerList().getBannedIPs().removeEntry(args[0]);
            notifyCommandListener(sender, this, "commands.unbanip.success", new Object[] {args[0]});
        }
        else
        {
            throw new SyntaxErrorException("commands.unbanip.invalid", new Object[0]);
        }
    }
    else
    {
        throw new WrongUsageException("commands.unbanip.usage", new Object[0]);
    }
}
项目:CraftStudioAPI    文件:CommandCSList.java   
@Override
public void execute(MinecraftServer server, ICommandSender sender, String[] args) throws CommandException {
    if (args.length >= 1) {
        Set<ResourceLocation> set;
        if (args[0].equals("models"))
            set = GameRegistry.findRegistry(CSReadedModel.class).getKeys();
        else if (args[0].equals("animations"))
            set = GameRegistry.findRegistry(CSReadedAnim.class).getKeys();
        else
            throw new SyntaxErrorException();
        String str = "";
        for (ResourceLocation res : set) {
            if (!str.equals(""))
                str = str + ", ";
            str = str + res.toString();
        }
        sender.sendMessage(new TextComponentString(str));
    }
    else
        throw new WrongUsageException(CommandCSList.usage);
}
项目:TaleCraft    文件:CommandArgumentParser.java   
public int consume_int(String errorText, int min, int max) throws CommandException {
    String str = consume_string(errorText);

    try {
        int l = Integer.parseInt(str);

        if(l > max) {
            throw new NumberFormatException("Given value '"+l+"' is higher than maximum value '"+max+"'.");
        }

        if(l < min) {
            throw new NumberFormatException("Given value '"+l+"' is smaller than minimum value '"+min+"'.");
        }

        return l;
    } catch (NumberFormatException e) {
        throw new SyntaxErrorException(errorText, e);
    }
}
项目:TaleCraft    文件:CommandArgumentParser.java   
public long consume_long(String errorText, long min, long max) throws CommandException {
    String str = consume_string(errorText);

    try {
        long l = Long.parseLong(str);

        if(l > max) {
            throw new NumberFormatException("Given value '"+l+"' is higher than maximum value '"+max+"'.");
        }

        if(l < min) {
            throw new NumberFormatException("Given value '"+l+"' is smaller than minimum value '"+min+"'.");
        }

        return l;
    } catch (NumberFormatException e) {
        throw new SyntaxErrorException(errorText, e);
    }
}
项目:TaleCraft    文件:CommandArgumentParser.java   
public float consume_float(String errorText, float min, float max) throws CommandException {
    String str = consume_string(errorText);

    try {
        float l = Float.parseFloat(str);

        if(l > max) {
            throw new NumberFormatException("Given value '"+l+"' is higher than maximum value '"+max+"'.");
        }

        if(l < min) {
            throw new NumberFormatException("Given value '"+l+"' is smaller than minimum value '"+min+"'.");
        }

        return l;
    } catch (NumberFormatException e) {
        throw new SyntaxErrorException(errorText, e);
    }
}
项目:TaleCraft    文件:CommandArgumentParser.java   
public double consume_double(String errorText, double min, double max) throws CommandException {
    String str = consume_string(errorText);

    try {
        double l = Double.parseDouble(str);

        if(l > max) {
            throw new NumberFormatException("Given value '"+l+"' is higher than maximum value '"+max+"'.");
        }

        if(l < min) {
            throw new NumberFormatException("Given value '"+l+"' is smaller than minimum value '"+min+"'.");
        }

        return l;
    } catch (NumberFormatException e) {
        throw new SyntaxErrorException(errorText, e);
    }
}
项目:Resilience-Client-Source    文件:CommandMessageRaw.java   
public void processCommand(ICommandSender par1ICommandSender, String[] par2ArrayOfStr)
{
    if (par2ArrayOfStr.length < 2)
    {
        throw new WrongUsageException("commands.tellraw.usage", new Object[0]);
    }
    else
    {
        EntityPlayerMP var3 = getPlayer(par1ICommandSender, par2ArrayOfStr[0]);
        String var4 = func_82360_a(par1ICommandSender, par2ArrayOfStr, 1);

        try
        {
            IChatComponent var5 = IChatComponent.Serializer.func_150699_a(var4);
            var3.addChatMessage(var5);
        }
        catch (JsonParseException var6)
        {
            throw new SyntaxErrorException("commands.tellraw.jsonException", new Object[] {ExceptionUtils.getRootCause(var6).getMessage()});
        }
    }
}
项目:Resilience-Client-Source    文件:CommandPardonIp.java   
public void processCommand(ICommandSender par1ICommandSender, String[] par2ArrayOfStr)
{
    if (par2ArrayOfStr.length == 1 && par2ArrayOfStr[0].length() > 1)
    {
        Matcher var3 = CommandBanIp.field_147211_a.matcher(par2ArrayOfStr[0]);

        if (var3.matches())
        {
            MinecraftServer.getServer().getConfigurationManager().getBannedIPs().remove(par2ArrayOfStr[0]);
            notifyAdmins(par1ICommandSender, "commands.unbanip.success", new Object[] {par2ArrayOfStr[0]});
        }
        else
        {
            throw new SyntaxErrorException("commands.unbanip.invalid", new Object[0]);
        }
    }
    else
    {
        throw new WrongUsageException("commands.unbanip.usage", new Object[0]);
    }
}
项目:ExpandedRailsMod    文件:CommandScoreboard.java   
protected void enablePlayerTrigger(ICommandSender sender, String[] p_184914_2_, int p_184914_3_, MinecraftServer server) throws CommandException
{
    Scoreboard scoreboard = this.getScoreboard(server);
    String s = getPlayerName(server, sender, p_184914_2_[p_184914_3_++]);

    if (s.length() > 40)
    {
        throw new SyntaxErrorException("commands.scoreboard.players.name.tooLong", new Object[] {s, Integer.valueOf(40)});
    }
    else
    {
        ScoreObjective scoreobjective = this.convertToObjective(p_184914_2_[p_184914_3_], false, server);

        if (scoreobjective.getCriteria() != IScoreCriteria.TRIGGER)
        {
            throw new CommandException("commands.scoreboard.players.enable.noTrigger", new Object[] {scoreobjective.getName()});
        }
        else
        {
            Score score = scoreboard.getOrCreateScore(s, scoreobjective);
            score.setLocked(false);
            notifyCommandListener(sender, this, "commands.scoreboard.players.enable.success", new Object[] {scoreobjective.getName(), s});
        }
    }
}
项目:ExpandedRailsMod    文件:CommandPardonIp.java   
/**
 * Callback for when the command is executed
 */
public void execute(MinecraftServer server, ICommandSender sender, String[] args) throws CommandException
{
    if (args.length == 1 && args[0].length() > 1)
    {
        Matcher matcher = CommandBanIp.IP_PATTERN.matcher(args[0]);

        if (matcher.matches())
        {
            server.getPlayerList().getBannedIPs().removeEntry(args[0]);
            notifyCommandListener(sender, this, "commands.unbanip.success", new Object[] {args[0]});
        }
        else
        {
            throw new SyntaxErrorException("commands.unbanip.invalid", new Object[0]);
        }
    }
    else
    {
        throw new WrongUsageException("commands.unbanip.usage", new Object[0]);
    }
}
项目:Cauldron    文件:CommandMessageRaw.java   
public void processCommand(ICommandSender p_71515_1_, String[] p_71515_2_)
{
    if (p_71515_2_.length < 2)
    {
        throw new WrongUsageException("commands.tellraw.usage", new Object[0]);
    }
    else
    {
        EntityPlayerMP entityplayermp = getPlayer(p_71515_1_, p_71515_2_[0]);
        String s = func_82360_a(p_71515_1_, p_71515_2_, 1);

        try
        {
            IChatComponent ichatcomponent = IChatComponent.Serializer.func_150699_a(s);
            entityplayermp.addChatMessage(ichatcomponent);
        }
        catch (JsonParseException jsonparseexception)
        {
            Throwable throwable = ExceptionUtils.getRootCause(jsonparseexception);
            throw new SyntaxErrorException("commands.tellraw.jsonException", new Object[] {throwable == null ? "" : throwable.getMessage()});
        }
    }
}
项目:Cauldron    文件:CommandPardonIp.java   
public void processCommand(ICommandSender p_71515_1_, String[] p_71515_2_)
{
    if (p_71515_2_.length == 1 && p_71515_2_[0].length() > 1)
    {
        Matcher matcher = CommandBanIp.field_147211_a.matcher(p_71515_2_[0]);

        if (matcher.matches())
        {
            MinecraftServer.getServer().getConfigurationManager().getBannedIPs().func_152684_c(p_71515_2_[0]);
            func_152373_a(p_71515_1_, this, "commands.unbanip.success", new Object[] {p_71515_2_[0]});
        }
        else
        {
            throw new SyntaxErrorException("commands.unbanip.invalid", new Object[0]);
        }
    }
    else
    {
        throw new WrongUsageException("commands.unbanip.usage", new Object[0]);
    }
}
项目:Cauldron    文件:CommandMessageRaw.java   
public void processCommand(ICommandSender p_71515_1_, String[] p_71515_2_)
{
    if (p_71515_2_.length < 2)
    {
        throw new WrongUsageException("commands.tellraw.usage", new Object[0]);
    }
    else
    {
        EntityPlayerMP entityplayermp = getPlayer(p_71515_1_, p_71515_2_[0]);
        String s = func_82360_a(p_71515_1_, p_71515_2_, 1);

        try
        {
            IChatComponent ichatcomponent = IChatComponent.Serializer.func_150699_a(s);
            entityplayermp.addChatMessage(ichatcomponent);
        }
        catch (JsonParseException jsonparseexception)
        {
            Throwable throwable = ExceptionUtils.getRootCause(jsonparseexception);
            throw new SyntaxErrorException("commands.tellraw.jsonException", new Object[] {throwable == null ? "" : throwable.getMessage()});
        }
    }
}
项目:Cauldron    文件:CommandPardonIp.java   
public void processCommand(ICommandSender p_71515_1_, String[] p_71515_2_)
{
    if (p_71515_2_.length == 1 && p_71515_2_[0].length() > 1)
    {
        Matcher matcher = CommandBanIp.field_147211_a.matcher(p_71515_2_[0]);

        if (matcher.matches())
        {
            MinecraftServer.getServer().getConfigurationManager().getBannedIPs().func_152684_c(p_71515_2_[0]);
            func_152373_a(p_71515_1_, this, "commands.unbanip.success", new Object[] {p_71515_2_[0]});
        }
        else
        {
            throw new SyntaxErrorException("commands.unbanip.invalid", new Object[0]);
        }
    }
    else
    {
        throw new WrongUsageException("commands.unbanip.usage", new Object[0]);
    }
}
项目:OpenModsLib    文件:CommandSource.java   
@Override
public void execute(MinecraftServer server, ICommandSender sender, String[] args) throws CommandException {
    if (args.length < 1) throw new SyntaxErrorException();

    final String subCommand = args[0];

    if (subCommand.equals(COMMAND_CLASS)) {
        if (args.length < 2) throw new SyntaxErrorException();
        final String clsName = args[1];
        final ClassMeta meta = getMeta(clsName);

        sender.sendMessage(new TextComponentTranslation("openmodslib.command.class_source", meta.cls.getName(), meta.source()));

        final ApiInfo api = meta.api;
        if (api != null) {
            sender.sendMessage(new TextComponentTranslation("openmodslib.command.api_class",
                    api.api, api.owner, api.version));
        }

        for (Map.Entry<File, Set<String>> e : meta.providerMods.entrySet())
            sender.sendMessage(new TextComponentTranslation("openmodslib.command.class_provider",
                    e.getKey().getAbsolutePath(),
                    Joiner.on(',').join(e.getValue())));
    }
}
项目:DecompiledMinecraft    文件:CommandScoreboard.java   
protected void func_175781_o(ICommandSender p_175781_1_, String[] p_175781_2_, int p_175781_3_) throws CommandException
{
    Scoreboard scoreboard = this.getScoreboard();
    String s = getEntityName(p_175781_1_, p_175781_2_[p_175781_3_++]);

    if (s.length() > 40)
    {
        throw new SyntaxErrorException("commands.scoreboard.players.name.tooLong", new Object[] {s, Integer.valueOf(40)});
    }
    else
    {
        ScoreObjective scoreobjective = this.getObjective(p_175781_2_[p_175781_3_++], false);

        if (!scoreboard.entityHasObjective(s, scoreobjective))
        {
            throw new CommandException("commands.scoreboard.players.test.notFound", new Object[] {scoreobjective.getName(), s});
        }
        else
        {
            int i = p_175781_2_[p_175781_3_].equals("*") ? Integer.MIN_VALUE : parseInt(p_175781_2_[p_175781_3_]);
            ++p_175781_3_;
            int j = p_175781_3_ < p_175781_2_.length && !p_175781_2_[p_175781_3_].equals("*") ? parseInt(p_175781_2_[p_175781_3_], i) : Integer.MAX_VALUE;
            Score score = scoreboard.getValueFromObjective(s, scoreobjective);

            if (score.getScorePoints() >= i && score.getScorePoints() <= j)
            {
                notifyOperators(p_175781_1_, this, "commands.scoreboard.players.test.success", new Object[] {Integer.valueOf(score.getScorePoints()), Integer.valueOf(i), Integer.valueOf(j)});
            }
            else
            {
                throw new CommandException("commands.scoreboard.players.test.failed", new Object[] {Integer.valueOf(score.getScorePoints()), Integer.valueOf(i), Integer.valueOf(j)});
            }
        }
    }
}
项目:DecompiledMinecraft    文件:CommandScoreboard.java   
protected void func_175781_o(ICommandSender p_175781_1_, String[] p_175781_2_, int p_175781_3_) throws CommandException
{
    Scoreboard scoreboard = this.getScoreboard();
    String s = getEntityName(p_175781_1_, p_175781_2_[p_175781_3_++]);

    if (s.length() > 40)
    {
        throw new SyntaxErrorException("commands.scoreboard.players.name.tooLong", new Object[] {s, Integer.valueOf(40)});
    }
    else
    {
        ScoreObjective scoreobjective = this.getObjective(p_175781_2_[p_175781_3_++], false);

        if (!scoreboard.entityHasObjective(s, scoreobjective))
        {
            throw new CommandException("commands.scoreboard.players.test.notFound", new Object[] {scoreobjective.getName(), s});
        }
        else
        {
            int i = p_175781_2_[p_175781_3_].equals("*") ? Integer.MIN_VALUE : parseInt(p_175781_2_[p_175781_3_]);
            ++p_175781_3_;
            int j = p_175781_3_ < p_175781_2_.length && !p_175781_2_[p_175781_3_].equals("*") ? parseInt(p_175781_2_[p_175781_3_], i) : Integer.MAX_VALUE;
            Score score = scoreboard.getValueFromObjective(s, scoreobjective);

            if (score.getScorePoints() >= i && score.getScorePoints() <= j)
            {
                notifyOperators(p_175781_1_, this, "commands.scoreboard.players.test.success", new Object[] {Integer.valueOf(score.getScorePoints()), Integer.valueOf(i), Integer.valueOf(j)});
            }
            else
            {
                throw new CommandException("commands.scoreboard.players.test.failed", new Object[] {Integer.valueOf(score.getScorePoints()), Integer.valueOf(i), Integer.valueOf(j)});
            }
        }
    }
}
项目:BaseClient    文件:CommandScoreboard.java   
protected void func_175781_o(ICommandSender p_175781_1_, String[] p_175781_2_, int p_175781_3_) throws CommandException
{
    Scoreboard scoreboard = this.getScoreboard();
    String s = getEntityName(p_175781_1_, p_175781_2_[p_175781_3_++]);

    if (s.length() > 40)
    {
        throw new SyntaxErrorException("commands.scoreboard.players.name.tooLong", new Object[] {s, Integer.valueOf(40)});
    }
    else
    {
        ScoreObjective scoreobjective = this.getObjective(p_175781_2_[p_175781_3_++], false);

        if (!scoreboard.entityHasObjective(s, scoreobjective))
        {
            throw new CommandException("commands.scoreboard.players.test.notFound", new Object[] {scoreobjective.getName(), s});
        }
        else
        {
            int i = p_175781_2_[p_175781_3_].equals("*") ? Integer.MIN_VALUE : parseInt(p_175781_2_[p_175781_3_]);
            ++p_175781_3_;
            int j = p_175781_3_ < p_175781_2_.length && !p_175781_2_[p_175781_3_].equals("*") ? parseInt(p_175781_2_[p_175781_3_], i) : Integer.MAX_VALUE;
            Score score = scoreboard.getValueFromObjective(s, scoreobjective);

            if (score.getScorePoints() >= i && score.getScorePoints() <= j)
            {
                notifyOperators(p_175781_1_, this, "commands.scoreboard.players.test.success", new Object[] {Integer.valueOf(score.getScorePoints()), Integer.valueOf(i), Integer.valueOf(j)});
            }
            else
            {
                throw new CommandException("commands.scoreboard.players.test.failed", new Object[] {Integer.valueOf(score.getScorePoints()), Integer.valueOf(i), Integer.valueOf(j)});
            }
        }
    }
}
项目:BaseClient    文件:CommandScoreboard.java   
protected void func_175781_o(ICommandSender p_175781_1_, String[] p_175781_2_, int p_175781_3_) throws CommandException
{
    Scoreboard scoreboard = this.getScoreboard();
    String s = getEntityName(p_175781_1_, p_175781_2_[p_175781_3_++]);

    if (s.length() > 40)
    {
        throw new SyntaxErrorException("commands.scoreboard.players.name.tooLong", new Object[] {s, Integer.valueOf(40)});
    }
    else
    {
        ScoreObjective scoreobjective = this.getObjective(p_175781_2_[p_175781_3_++], false);

        if (!scoreboard.entityHasObjective(s, scoreobjective))
        {
            throw new CommandException("commands.scoreboard.players.test.notFound", new Object[] {scoreobjective.getName(), s});
        }
        else
        {
            int i = p_175781_2_[p_175781_3_].equals("*") ? Integer.MIN_VALUE : parseInt(p_175781_2_[p_175781_3_]);
            ++p_175781_3_;
            int j = p_175781_3_ < p_175781_2_.length && !p_175781_2_[p_175781_3_].equals("*") ? parseInt(p_175781_2_[p_175781_3_], i) : Integer.MAX_VALUE;
            Score score = scoreboard.getValueFromObjective(s, scoreobjective);

            if (score.getScorePoints() >= i && score.getScorePoints() <= j)
            {
                notifyOperators(p_175781_1_, this, "commands.scoreboard.players.test.success", new Object[] {Integer.valueOf(score.getScorePoints()), Integer.valueOf(i), Integer.valueOf(j)});
            }
            else
            {
                throw new CommandException("commands.scoreboard.players.test.failed", new Object[] {Integer.valueOf(score.getScorePoints()), Integer.valueOf(i), Integer.valueOf(j)});
            }
        }
    }
}
项目:Backmemed    文件:CommandScoreboard.java   
protected void testPlayerScore(ICommandSender sender, String[] p_184907_2_, int p_184907_3_, MinecraftServer server) throws CommandException
{
    Scoreboard scoreboard = this.getScoreboard(server);
    String s = getEntityName(server, sender, p_184907_2_[p_184907_3_++]);

    if (s.length() > 40)
    {
        throw new SyntaxErrorException("commands.scoreboard.players.name.tooLong", new Object[] {s, Integer.valueOf(40)});
    }
    else
    {
        ScoreObjective scoreobjective = this.convertToObjective(p_184907_2_[p_184907_3_++], false, server);

        if (!scoreboard.entityHasObjective(s, scoreobjective))
        {
            throw new CommandException("commands.scoreboard.players.test.notFound", new Object[] {scoreobjective.getName(), s});
        }
        else
        {
            int i = p_184907_2_[p_184907_3_].equals("*") ? Integer.MIN_VALUE : parseInt(p_184907_2_[p_184907_3_]);
            ++p_184907_3_;
            int j = p_184907_3_ < p_184907_2_.length && !p_184907_2_[p_184907_3_].equals("*") ? parseInt(p_184907_2_[p_184907_3_], i) : Integer.MAX_VALUE;
            Score score = scoreboard.getOrCreateScore(s, scoreobjective);

            if (score.getScorePoints() >= i && score.getScorePoints() <= j)
            {
                notifyCommandListener(sender, this, "commands.scoreboard.players.test.success", new Object[] {Integer.valueOf(score.getScorePoints()), Integer.valueOf(i), Integer.valueOf(j)});
            }
            else
            {
                throw new CommandException("commands.scoreboard.players.test.failed", new Object[] {Integer.valueOf(score.getScorePoints()), Integer.valueOf(i), Integer.valueOf(j)});
            }
        }
    }
}
项目:CustomWorldGen    文件:CommandScoreboard.java   
protected void testPlayerScore(ICommandSender sender, String[] p_184907_2_, int p_184907_3_, MinecraftServer server) throws CommandException
{
    Scoreboard scoreboard = this.getScoreboard(server);
    String s = getEntityName(server, sender, p_184907_2_[p_184907_3_++]);

    if (s.length() > 40)
    {
        throw new SyntaxErrorException("commands.scoreboard.players.name.tooLong", new Object[] {s, Integer.valueOf(40)});
    }
    else
    {
        ScoreObjective scoreobjective = this.convertToObjective(p_184907_2_[p_184907_3_++], false, server);

        if (!scoreboard.entityHasObjective(s, scoreobjective))
        {
            throw new CommandException("commands.scoreboard.players.test.notFound", new Object[] {scoreobjective.getName(), s});
        }
        else
        {
            int i = p_184907_2_[p_184907_3_].equals("*") ? Integer.MIN_VALUE : parseInt(p_184907_2_[p_184907_3_]);
            ++p_184907_3_;
            int j = p_184907_3_ < p_184907_2_.length && !p_184907_2_[p_184907_3_].equals("*") ? parseInt(p_184907_2_[p_184907_3_], i) : Integer.MAX_VALUE;
            Score score = scoreboard.getOrCreateScore(s, scoreobjective);

            if (score.getScorePoints() >= i && score.getScorePoints() <= j)
            {
                notifyCommandListener(sender, this, "commands.scoreboard.players.test.success", new Object[] {Integer.valueOf(score.getScorePoints()), Integer.valueOf(i), Integer.valueOf(j)});
            }
            else
            {
                throw new CommandException("commands.scoreboard.players.test.failed", new Object[] {Integer.valueOf(score.getScorePoints()), Integer.valueOf(i), Integer.valueOf(j)});
            }
        }
    }
}
项目:TaleCraft    文件:AttackCommand.java   
@Override
public void execute(MinecraftServer server, ICommandSender sender, String[] args) throws CommandException {
    // check if we have all needed parameters
    // If not throw a syntax error.
    if(args.length != 3) {
        throw new SyntaxErrorException("Syntax: " + getUsage(sender));
    }

    // fetch
    String str_selector = args[0];
    String str_dmgtype = args[1];
    String str_dmgamount = args[2];

    // parse all parameters
    List<EntityLivingBase> entities = EntitySelector.matchEntities(sender, str_selector, EntityLivingBase.class);
    DamageSource damage_type = AttackCommand.getDamageSource(str_dmgtype);//AttackCommand.parseDamageType(str_dmgtype);
    double damage_amount = CommandBase.parseDouble(str_dmgamount, 0, 1000);

    // check entities
    if(entities.size() == 0) {
        throw new CommandException("No entities found: " + str_selector);
    }

    // check damage type
    if(damage_type == null) {
        throw new CommandException("Unknown damage type: " + str_dmgtype);
    }

    // Attack the entities with the given damage type and amount.
    for(EntityLivingBase living : entities) {
        if(living instanceof EntityPlayerMP && ((EntityPlayerMP)living).capabilities.isCreativeMode) {
            continue;
        }

        living.attackEntityFrom(damage_type, (float) damage_amount);
    }
}
项目:TaleCraft    文件:CommandArgumentParser.java   
public String consume_string(String errorText) throws CommandException {
    if(outbounds(index)) {
        throw new SyntaxErrorException(errorText, new RuntimeException("Index out of bounds!"));
    } else {
        return arguments[index++];
    }
}
项目:TaleCraft    文件:CommandArgumentParser.java   
public int consume_int(String errorText) throws CommandException {
    String str = consume_string(errorText);

    try {
        return Integer.parseInt(str);
    } catch (NumberFormatException e) {
        throw new SyntaxErrorException(errorText, e);
    }
}
项目:TaleCraft    文件:CommandArgumentParser.java   
public int consume_int(String errorText, int max) throws CommandException {
    String str = consume_string(errorText);

    try {
        int l = Integer.parseInt(str);

        if(l > max) {
            throw new NumberFormatException("Given value '"+l+"' is higher than maximum value '"+max+"'.");
        }

        return l;
    } catch (NumberFormatException e) {
        throw new SyntaxErrorException(errorText, e);
    }
}