From 3d6b5fe1c6298963fd5aed24e8aab18eebaeb9e4 Mon Sep 17 00:00:00 2001 From: Tobias Ottenweller Date: Sun, 13 May 2012 17:01:58 +0200 Subject: [PATCH] start of refactoring: removed Conf.java --- src/org/mcteam/ancientgates/Conf.java | 75 --------------------------- 1 file changed, 75 deletions(-) delete mode 100644 src/org/mcteam/ancientgates/Conf.java diff --git a/src/org/mcteam/ancientgates/Conf.java b/src/org/mcteam/ancientgates/Conf.java deleted file mode 100644 index a708cdf..0000000 --- a/src/org/mcteam/ancientgates/Conf.java +++ /dev/null @@ -1,75 +0,0 @@ -package org.mcteam.ancientgates; - -import java.io.File; -import java.io.IOException; - -import org.bukkit.ChatColor; -import org.mcteam.ancientgates.util.DiscUtil; - - -public class Conf { - public static transient File file = new File(Plugin.instance.getDataFolder(), "conf.json"); - - // Colors - public static ChatColor colorMember = ChatColor.GREEN; - public static ChatColor colorAlly = ChatColor.LIGHT_PURPLE; - public static ChatColor colorNeutral = ChatColor.WHITE; - public static ChatColor colorEnemy = ChatColor.RED; - - public static ChatColor colorSystem = ChatColor.YELLOW; - public static ChatColor colorChrome = ChatColor.GOLD; - public static ChatColor colorCommand = ChatColor.AQUA; - public static ChatColor colorParameter = ChatColor.DARK_AQUA; - - private static double gateSearchRadius = 10.0; - - static { - - } - - public static double getGateSearchRadius() { - return gateSearchRadius; - } - - public static int getGateMaxArea() { - return (int)gateSearchRadius * 7; - } - - // -------------------------------------------- // - // Persistance - // -------------------------------------------- // - - public static boolean save() { - //Factions.log("Saving config to disk."); - - try { - DiscUtil.write(file, Plugin.gson.toJson(new Conf())); - } catch (IOException e) { - e.printStackTrace(); - Plugin.log("Failed to save the config to disk."); - return false; - } - return true; - } - - public static boolean load() { - Plugin.log("Loading conf from disk"); - - if ( ! file.exists()) { - Plugin.log("No conf to load from disk. Creating new file."); - save(); - return true; - } - - try { - Plugin.gson.fromJson(DiscUtil.read(file), Conf.class); - } catch (IOException e) { - e.printStackTrace(); - Plugin.log("Failed to load the config from disk."); - return false; - } - - return true; - } -} -