blob: 2c87ce332076291af0f4f60449fbc0d0f7f5b007 (
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
46
47
48
49
50
51
52
53
54
55
56
57
|
package com.earth2me.essentials.protect;
import static com.earth2me.essentials.I18n._;
import com.earth2me.essentials.IConf;
import net.ess3.api.IEssentials;
import java.util.logging.Level;
import java.util.logging.Logger;
import org.bukkit.plugin.Plugin;
public class EssentialsConnect
{
private static final Logger LOGGER = Logger.getLogger("Minecraft");
private final IEssentials ess;
private final IProtect protect;
public EssentialsConnect(Plugin essPlugin, Plugin essProtect)
{
if (!essProtect.getDescription().getVersion().equals(essPlugin.getDescription().getVersion()))
{
LOGGER.log(Level.WARNING, _("versionMismatchAll"));
}
ess = (IEssentials)essPlugin;
protect = (IProtect)essProtect;
ProtectReloader pr = new ProtectReloader();
pr.reloadConfig();
ess.addReloadListener(pr);
}
public IEssentials getEssentials()
{
return ess;
}
private class ProtectReloader implements IConf
{
@Override
public void reloadConfig()
{
for (ProtectConfig protectConfig : ProtectConfig.values())
{
if (protectConfig.isList())
{
protect.getSettingsList().put(protectConfig, ess.getSettings().getProtectList(protectConfig.getConfigName()));
}
else if (protectConfig.isString())
{
protect.getSettingsString().put(protectConfig, ess.getSettings().getProtectString(protectConfig.getConfigName()));
}
else
{
protect.getSettingsBoolean().put(protectConfig, ess.getSettings().getProtectBoolean(protectConfig.getConfigName(), protectConfig.getDefaultValueBoolean()));
}
}
}
}
}
|