summaryrefslogtreecommitdiffstats
path: root/EssentialsChat/src/com/earth2me/essentials/chat/EssentialsChat.java
blob: 266bd104e016f289df9fd80106a51a8620db578e (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
package com.earth2me.essentials.chat;

import com.earth2me.essentials.Essentials;
import java.util.logging.Level;
import java.util.logging.Logger;
import org.bukkit.event.Event.Priority;
import org.bukkit.event.Event.Type;
import org.bukkit.plugin.Plugin;
import org.bukkit.plugin.PluginManager;
import org.bukkit.plugin.java.JavaPlugin;


public class EssentialsChat extends JavaPlugin
{
	private static final Logger logger = Logger.getLogger("Minecraft");

	public EssentialsChat()
	{
		super();
	}

	public void onEnable()
	{
		Plugin p = this.getServer().getPluginManager().getPlugin("Essentials");
            if (p != null) {
                if (!this.getServer().getPluginManager().isPluginEnabled(p)) {
                    this.getServer().getPluginManager().enablePlugin(p);
                }
		}
		PluginManager pm = getServer().getPluginManager();
		EssentialsChatPlayerListener playerListener = new EssentialsChatPlayerListener(getServer());
		pm.registerEvent(Type.PLAYER_JOIN, playerListener, Priority.Monitor, this);
		pm.registerEvent(Type.PLAYER_CHAT, playerListener, Priority.Highest, this);
		if (!this.getDescription().getVersion().equals(Essentials.getStatic().getDescription().getVersion())) {
			logger.log(Level.WARNING, "Version mismatch! Please update all Essentials jars to the same version.");
		}
		logger.info("Loaded " + this.getDescription().getName() + " build " + this.getDescription().getVersion() + " by " + Essentials.AUTHORS);
	}

	public void onDisable()
	{
	}
}