Package com.sk89q.craftbook.state

Examples of com.sk89q.craftbook.state.StateHolder


        WorldInterface world = main.getWorld();
        if (!main.pathToGlobalState.exists()) main.pathToGlobalState.mkdirs();
        if (!main.pathToWorldState.exists()) main.pathToGlobalState.mkdirs();
        for (String name : stateHolders.keySet()) {
            StateHolder h = stateHolders.get(name);
            DataInputStream in = null;
            try {
                File f = new File(main.pathToGlobalState, name);
                if (!f.exists()) h.resetCommonData();
                else {
                    in = new DataInputStream(new FileInputStream(f));
                    h.readCommonData(in);
                }
            } finally {
                if (in != null) in.close();
            }
            try {
                File f = new File(main.pathToGlobalState, name);
                if (!f.exists()) h.resetWorldData(world);
                else {
                    in = new DataInputStream(new FileInputStream(f));
                    h.readWorldData(world, in);
                }
            } finally {
                if (in != null) in.close();
            }
        }
View Full Code Here


        WorldInterface world = main.getWorld();
        if (!main.pathToGlobalState.exists()) main.pathToGlobalState.mkdirs();
        if (!main.pathToWorldState.exists()) main.pathToGlobalState.mkdirs();
        for (String name : stateHolders.keySet()) {
            StateHolder h = stateHolders.get(name);
            DataOutputStream out = null;
            try {
                out = new DataOutputStream(new FileOutputStream(
                        new File(main.pathToGlobalState, name)));
                h.writeCommonData(out);
            } finally {
                if (out != null) out.close();
            }
            try {
                out = new DataOutputStream(new FileOutputStream(
                        new File(main.pathToWorldState, name)));
                h.writeWorldData(world, out);
            } finally {
                if (out != null) out.close();
            }
        }
    }
View Full Code Here

TOP

Related Classes of com.sk89q.craftbook.state.StateHolder

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.