summaryrefslogtreecommitdiffstats
path: root/EssentialsSigns/src/net/ess3/signs/EssentialsSignsPlugin.java
blob: 2ac464f88a57a5fcad7552d4139fbc2dc1fa8033 (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
58
59
package net.ess3.signs;

import static net.ess3.I18n._;
import java.util.logging.Level;
import java.util.logging.Logger;
import org.bukkit.Bukkit;
import org.bukkit.plugin.PluginManager;
import org.bukkit.plugin.java.JavaPlugin;
import net.ess3.api.IEssentials;
import net.ess3.api.IPlugin;
import net.ess3.signs.listeners.SignBlockListener;
import net.ess3.signs.listeners.SignEntityListener;
import net.ess3.signs.listeners.SignPlayerListener;


public class EssentialsSignsPlugin extends JavaPlugin implements ISignsPlugin
{
	private static final transient Logger LOGGER = Bukkit.getLogger();
	private transient SignsConfigHolder config;

	@Override
	public void onEnable()
	{
		final PluginManager pluginManager = getServer().getPluginManager();
		final IPlugin plugin = (IPlugin)pluginManager.getPlugin("Essentials-3");
		final IEssentials ess = (IEssentials)plugin.getEssentials();
		if (!this.getDescription().getVersion().equals(plugin.getDescription().getVersion()))
		{
			LOGGER.log(Level.WARNING, _("versionMismatchAll"));
		}
		if (!plugin.isEnabled())
		{
			this.setEnabled(false);
			return;
		}

		final SignBlockListener signBlockListener = new SignBlockListener(ess, this);
		pluginManager.registerEvents(signBlockListener, this);

		final SignPlayerListener signPlayerListener = new SignPlayerListener(ess, this);
		pluginManager.registerEvents(signPlayerListener, this);

		final SignEntityListener signEntityListener = new SignEntityListener(ess, this);
		pluginManager.registerEvents(signEntityListener, this);

		config = new SignsConfigHolder(ess, this);
	}

	@Override
	public void onDisable()
	{
	}

	@Override
	public SignsConfigHolder getSettings()
	{
		return config;
	}
}