Fix reloading.
This commit is contained in:
		| @@ -10,6 +10,12 @@ import java.util.Map; | ||||
| public interface ConfigurationAdapter | ||||
| { | ||||
|  | ||||
|     /** | ||||
|      * Reload all the possible values, and if necessary cache them for | ||||
|      * individual getting. | ||||
|      */ | ||||
|     public void load(); | ||||
|  | ||||
|     /** | ||||
|      * Gets an integer from the specified path. | ||||
|      * | ||||
|   | ||||
| @@ -48,6 +48,7 @@ public class Configuration | ||||
|     public void load() | ||||
|     { | ||||
|         ConfigurationAdapter adapter = ProxyServer.getInstance().getConfigurationAdapter(); | ||||
|         adapter.load(); | ||||
|  | ||||
|         timeout = adapter.getInt( "timeout", timeout ); | ||||
|         uuid = adapter.getString( "stats", uuid ); | ||||
|   | ||||
| @@ -25,11 +25,11 @@ import org.yaml.snakeyaml.Yaml; | ||||
| public class YamlConfig implements ConfigurationAdapter | ||||
| { | ||||
|  | ||||
|     private boolean loaded; | ||||
|     private Yaml yaml; | ||||
|     private Map config; | ||||
|     private final File file = new File( "config.yml" ); | ||||
|  | ||||
|     @Override | ||||
|     public void load() | ||||
|     { | ||||
|         try | ||||
| @@ -48,8 +48,6 @@ public class YamlConfig implements ConfigurationAdapter | ||||
|             { | ||||
|                 config = new HashMap(); | ||||
|             } | ||||
|  | ||||
|             loaded = true; | ||||
|         } catch ( IOException ex ) | ||||
|         { | ||||
|             throw new RuntimeException( "Could not load configuration!", ex ); | ||||
| @@ -77,21 +75,12 @@ public class YamlConfig implements ConfigurationAdapter | ||||
|  | ||||
|     private <T> T get(String path, T def) | ||||
|     { | ||||
|         if ( !loaded ) | ||||
|         { | ||||
|             load(); | ||||
|         } | ||||
|         return get( path, def, config ); | ||||
|     } | ||||
|  | ||||
|     @SuppressWarnings("unchecked") | ||||
|     private <T> T get(String path, T def, Map submap) | ||||
|     { | ||||
|         if ( !loaded ) | ||||
|         { | ||||
|             load(); | ||||
|         } | ||||
|  | ||||
|         int index = path.indexOf( '.' ); | ||||
|         if ( index == -1 ) | ||||
|         { | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 md_5
					md_5