summaryrefslogtreecommitdiffstats
path: root/EssentialsPermissionsCommands/src/com/earth2me/essentials/permissions/EssentialsPermissionsCommands.java
blob: 14e9a117c99d3a1a8d0415daaa7247c792ebec85 (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.permissions;

import com.earth2me.essentials.IEssentials;
import com.earth2me.essentials.Util;
import com.nijiko.permissions.PermissionHandler;
import com.nijikokun.bukkit.Permissions.Permissions;
import java.util.logging.Level;
import java.util.logging.Logger;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.plugin.Plugin;
import org.bukkit.plugin.PluginManager;
import org.bukkit.plugin.java.JavaPlugin;


public class EssentialsPermissionsCommands extends JavaPlugin
{
	private static PermissionHandler permissionHandler = null;
	private static final Logger LOGGER = Logger.getLogger("Minecraft");
	private IEssentials ess;

	public static PermissionHandler getPermissionHandler()
	{
		return permissionHandler;
	}

	@Override
	public void onEnable()
	{
		final PluginManager pluginManager = getServer().getPluginManager();
		final Plugin permissionsPlugin = pluginManager.getPlugin("Permissions");

		if (permissionsPlugin != null
			&& permissionsPlugin.getDescription().getVersion().charAt(0) == '3')
		{
			permissionHandler = ((Permissions)permissionsPlugin).getHandler();
		}
		ess = (IEssentials)pluginManager.getPlugin("Essentials");

		if (!this.getDescription().getVersion().equals(ess.getDescription().getVersion())) {
			LOGGER.log(Level.WARNING, Util.i18n("versionMismatchAll"));
		}
		LOGGER.info(Util.format("loadinfo", this.getDescription().getName(), this.getDescription().getVersion(), "essentials team"));
		
	}

	@Override
	public boolean onCommand(final CommandSender sender, final Command command, final String label, final String[] args)
	{
		return ess.onCommandEssentials(sender, command, label, args, EssentialsPermissionsCommands.class.getClassLoader(), "com.earth2me.essentials.permissions.Command", "groupmanager.");
	}

	@Override
	public void onDisable()
	{
	}
}