Package com.khorn.terraincontrol.exception

Examples of com.khorn.terraincontrol.exception.InvalidConfigException


                return maxValue;
            }
            return number;
        } catch (NumberFormatException e)
        {
            throw new InvalidConfigException("Incorrect number: " + string);
        }
    }
View Full Code Here


                return maxValue;
            }
            return number;
        } catch (NumberFormatException e)
        {
            throw new InvalidConfigException("Incorrect number: " + string);
        }
    }
View Full Code Here

                return maxValue;
            }
            return number;
        } catch (NumberFormatException e)
        {
            throw new InvalidConfigException("Incorrect number: " + string);
        }
    }
View Full Code Here

            {
                String keyWithoutBraces = key.substring(start + 1, end);
                instructions.add(new ReplacedBlocksInstruction(keyWithoutBraces, maxHeight));
            } else
            {
                throw new InvalidConfigException("One of the parts is missing braces around it.");
            }

        }

        // Set
View Full Code Here

                values = new String[] {values[0], values[1] + ":" + values[2], values[3], "" + (Integer.parseInt(values[4]) - 1)};
            }

            if (values.length != 2 && values.length != 4)
            {
                throw new InvalidConfigException("Replace parts must be in the format (from,to) or (from,to,minHeight,maxHeight)");
            }

            from = TerrainControl.readMaterial(values[0]).withBlockData(0);
            to = TerrainControl.readMaterial(values[1]);
View Full Code Here

    public SimpleSurfaceGenerator(String[] args) throws InvalidConfigException
    {
        if (args.length < 2)
        {
            throw new InvalidConfigException("Needs at least two arguments");
        }
       
        layerChoices = new ArrayList<LayerChoice>();
        for (int i = 0; i < args.length - 2; i += 3)
        {
View Full Code Here

        for (String arg : args)
        {
            CustomObject object = getHolder().worldConfig.worldObjects.parseCustomObject(arg);
            if (object == null || !object.canSpawnAsObject())
            {
                throw new InvalidConfigException("No custom object found with the name " + arg);
            }
            objects.add(object);
            objectNames.add(arg);
        }
    }
View Full Code Here

     */
    protected final void assureSize(int size, List<String> args) throws InvalidConfigException
    {
        if (args.size() < size)
        {
            throw new InvalidConfigException("Too few arguments supplied");
        }
    }
View Full Code Here

            if (enumValue.name().equalsIgnoreCase(string))
            {
                return enumValue;
            }
        }
        throw new InvalidConfigException(string + " is not an acceptable value");
    }
View Full Code Here

        for (String option : groupParts)
        {
            String[] optionParts = option.split(":");
            if (optionParts.length != 2)
            {
                throw new InvalidConfigException("Invalid JSON structure near " + option);
            }
            String key = optionParts[0].trim();
            String value = optionParts[1].trim();

            if (key.equalsIgnoreCase("\"mob\""))
            {
                // Remove the quotes from the mob name
                mobName = removeFirstAndLastChar(value);
            }
            if (key.equalsIgnoreCase("\"weight\""))
            {
                weight = StringHelper.readInt(value, 0, 1000);
            }
            if (key.equalsIgnoreCase("\"min\""))
            {
                min = StringHelper.readInt(value, 0, 1000);
            }
            if (key.equalsIgnoreCase("\"max\""))
            {
                max = StringHelper.readInt(value, 0, 1000);
            }
        }

        // Check if data is complete and valid
        if (mobName == null || min == -1 || max == -1 || weight == -1)
        {
            throw new InvalidConfigException("Excepted mob, weight, min and max, but one or more were missing in mob group " + json);
        }
        if (min > max)
        {
            throw new InvalidConfigException("Minimum group size may not be larger that maximum group size for mob group " + json);
        }

        return new WeightedMobSpawnGroup(mobName, weight, min, max);
    }
View Full Code Here

TOP

Related Classes of com.khorn.terraincontrol.exception.InvalidConfigException

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.