blob: fa404d5ea2a400fd0c9ba47b662f668a9f2c68be (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
|
package com.earth2me.essentials.anticheat.config;
import com.earth2me.essentials.anticheat.ConfigItem;
import java.util.HashMap;
import java.util.Map;
/**
* A class to keep all configurables of the plugin associated with a world
*
*/
public class ConfigurationCacheStore
{
public final LoggingConfig logging;
private final Map<String, ConfigItem> configMap = new HashMap<String, ConfigItem>();
private final NoCheatConfiguration data;
/**
* Instantiate a config cache and populate it with the data of a Config tree (and its parent tree)
*/
public ConfigurationCacheStore(NoCheatConfiguration data)
{
logging = new LoggingConfig(data);
this.data = data;
}
@SuppressWarnings("unchecked")
public <T extends ConfigItem> T get(String id)
{
return (T)configMap.get(id);
}
public void set(String id, ConfigItem config)
{
configMap.put(id, config);
}
public NoCheatConfiguration getConfiguration()
{
return this.data;
}
}
|