Package net.canarymod

Examples of net.canarymod.CanaryDeserializeException


    public static Location fromString(String fields) throws CanaryDeserializeException {
        Location loc = new Location(0, 0, 0);
        String[] split = fields.split(";");

        if (split.length != 7) {
            throw new CanaryDeserializeException("Failed to deserialize Location: Expected fields are 7. Found " + split.length, "CanaryMod");
        }
        try {
            loc.setX(Double.parseDouble(split[0]));
            loc.setY(Double.parseDouble(split[1]));
            loc.setZ(Double.parseDouble(split[2]));
            loc.setPitch(Float.parseFloat(split[3]));
            loc.setRotation(Float.parseFloat(split[4]));
            loc.setType(DimensionType.fromId(Integer.parseInt(split[5])));
            loc.setWorldName(split[6]);
            return loc;
        }
        catch (NumberFormatException e) {
            throw new CanaryDeserializeException("Failed to deserialize Location: " + e.getMessage(), "CanaryMod");
        }
    }
View Full Code Here

TOP

Related Classes of net.canarymod.CanaryDeserializeException

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.