Package me.neatmonster.spacebukkit.utilities

Examples of me.neatmonster.spacebukkit.utilities.PropertiesFile


     */
    @Action(
            aliases = {"editPropertiesFile", "propertiesFile"})
    public boolean editPropertiesFile(final String name, final String type, final String key, final String value) {
        if (new File(name + ".properties").exists()) {
            final PropertiesFile file = new PropertiesFile(name + ".properties");
            if (type.toLowerCase().equals("boolean"))
                file.setBoolean(key, Boolean.valueOf(value.toString()));
            else if (type.toLowerCase().equals("long"))
                file.setLong(key, Long.valueOf(value.toString()));
            else if (type.toLowerCase().equals("int"))
                file.setInt(key, Integer.valueOf(value.toString()));
            else if (type.toLowerCase().equals("string"))
                file.setString(key, value.toString());
            else if (type.toLowerCase().equals("double"))
                file.setDouble(key, Double.valueOf(value.toString()));
            file.save();
            return true;
        }
        return false;
    }
View Full Code Here


     * @param playerName Player to get
     * @return Modified name of the player
     */
    public static String getCase(final String playerName) {
        try {
            final PropertiesFile propertiesFile = new PropertiesFile(
                    new File("SpaceModule", "players.properties").getPath());
            propertiesFile.load();
            final String savedPlayerName = propertiesFile.getString(playerName.toLowerCase());
            propertiesFile.save();
            if (savedPlayerName != null && !savedPlayerName.equals(""))
                return savedPlayerName;
        } catch (IOException e) {
            e.printStackTrace();
        }
View Full Code Here

     * Sets the case of a player
     * @param playerName Player's new case
     */
    public static void setCase(final String playerName) {
        try {
            final PropertiesFile propertiesFile = new PropertiesFile(
                    new File("SpaceModule", "players.properties").getPath());
            propertiesFile.load();
            propertiesFile.setString(playerName.toLowerCase(), playerName);
            propertiesFile.save();
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
View Full Code Here

TOP

Related Classes of me.neatmonster.spacebukkit.utilities.PropertiesFile

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.