Search in sources :

Example 11 with PluginManager

use of org.bukkit.plugin.PluginManager in project Essentials by drtshock.

the class EssentialsProtect method onEnable.

@Override
public void onEnable() {
    final PluginManager pm = this.getServer().getPluginManager();
    final Plugin essPlugin = pm.getPlugin("Essentials");
    if (essPlugin == null || !essPlugin.isEnabled()) {
        enableEmergencyMode(pm);
        return;
    }
    ess = new EssentialsConnect(essPlugin, this);
    final EssentialsProtectBlockListener blockListener = new EssentialsProtectBlockListener(this);
    pm.registerEvents(blockListener, this);
    final EssentialsProtectEntityListener entityListener = new EssentialsProtectEntityListener(this);
    pm.registerEvents(entityListener, this);
    final EssentialsProtectWeatherListener weatherListener = new EssentialsProtectWeatherListener(this);
    pm.registerEvents(weatherListener, this);
}
Also used : PluginManager(org.bukkit.plugin.PluginManager) Plugin(org.bukkit.plugin.Plugin) JavaPlugin(org.bukkit.plugin.java.JavaPlugin)

Example 12 with PluginManager

use of org.bukkit.plugin.PluginManager in project Essentials by drtshock.

the class EssentialsChat method onEnable.

@Override
public void onEnable() {
    final PluginManager pluginManager = getServer().getPluginManager();
    final IEssentials ess = (IEssentials) pluginManager.getPlugin("Essentials");
    if (!this.getDescription().getVersion().equals(ess.getDescription().getVersion())) {
        LOGGER.log(Level.WARNING, tl("versionMismatchAll"));
    }
    if (!ess.isEnabled()) {
        this.setEnabled(false);
        return;
    }
    final Map<AsyncPlayerChatEvent, ChatStore> chatStore = Collections.synchronizedMap(new HashMap<AsyncPlayerChatEvent, ChatStore>());
    final EssentialsChatPlayerListenerLowest playerListenerLowest = new EssentialsChatPlayerListenerLowest(getServer(), ess, chatStore);
    final EssentialsChatPlayerListenerNormal playerListenerNormal = new EssentialsChatPlayerListenerNormal(getServer(), ess, chatStore);
    final EssentialsChatPlayerListenerHighest playerListenerHighest = new EssentialsChatPlayerListenerHighest(getServer(), ess, chatStore);
    pluginManager.registerEvents(playerListenerLowest, this);
    pluginManager.registerEvents(playerListenerNormal, this);
    pluginManager.registerEvents(playerListenerHighest, this);
}
Also used : PluginManager(org.bukkit.plugin.PluginManager) IEssentials(net.ess3.api.IEssentials) AsyncPlayerChatEvent(org.bukkit.event.player.AsyncPlayerChatEvent)

Example 13 with PluginManager

use of org.bukkit.plugin.PluginManager in project Essentials by drtshock.

the class EssentialsAntiBuild method onEnable.

@Override
public void onEnable() {
    final PluginManager pm = this.getServer().getPluginManager();
    final Plugin essPlugin = pm.getPlugin("Essentials");
    if (essPlugin == null || !essPlugin.isEnabled()) {
        return;
    }
    ess = new EssentialsConnect(essPlugin, this);
    final EssentialsAntiBuildListener blockListener = new EssentialsAntiBuildListener(this);
    pm.registerEvents(blockListener, this);
}
Also used : PluginManager(org.bukkit.plugin.PluginManager) Plugin(org.bukkit.plugin.Plugin) JavaPlugin(org.bukkit.plugin.java.JavaPlugin)

Example 14 with PluginManager

use of org.bukkit.plugin.PluginManager in project Essentials by drtshock.

the class Jails method registerListeners.

private void registerListeners() {
    enabled = true;
    final PluginManager pluginManager = ess.getServer().getPluginManager();
    final JailListener blockListener = new JailListener();
    pluginManager.registerEvents(blockListener, ess);
    if (ess.getSettings().isDebug()) {
        LOGGER.log(Level.INFO, "Registering Jail listener");
    }
}
Also used : PluginManager(org.bukkit.plugin.PluginManager)

Example 15 with PluginManager

use of org.bukkit.plugin.PluginManager in project Essentials by drtshock.

the class EssentialsSpawn method onEnable.

@Override
public void onEnable() {
    final PluginManager pluginManager = getServer().getPluginManager();
    ess = (IEssentials) pluginManager.getPlugin("Essentials");
    if (!this.getDescription().getVersion().equals(ess.getDescription().getVersion())) {
        LOGGER.log(Level.WARNING, tl("versionMismatchAll"));
    }
    if (!ess.isEnabled()) {
        this.setEnabled(false);
        return;
    }
    spawns = new SpawnStorage(ess);
    ess.addReloadListener(spawns);
    final EssentialsSpawnPlayerListener playerListener = new EssentialsSpawnPlayerListener(ess, spawns);
    pluginManager.registerEvent(PlayerRespawnEvent.class, playerListener, ess.getSettings().getRespawnPriority(), new EventExecutor() {

        @Override
        public void execute(final Listener ll, final Event event) throws EventException {
            ((EssentialsSpawnPlayerListener) ll).onPlayerRespawn((PlayerRespawnEvent) event);
        }
    }, this);
    pluginManager.registerEvent(PlayerJoinEvent.class, playerListener, ess.getSettings().getRespawnPriority(), new EventExecutor() {

        @Override
        public void execute(final Listener ll, final Event event) throws EventException {
            ((EssentialsSpawnPlayerListener) ll).onPlayerJoin((PlayerJoinEvent) event);
        }
    }, this);
}
Also used : PluginManager(org.bukkit.plugin.PluginManager) PlayerJoinEvent(org.bukkit.event.player.PlayerJoinEvent) EventExecutor(org.bukkit.plugin.EventExecutor) Listener(org.bukkit.event.Listener) EventException(org.bukkit.event.EventException) PlayerRespawnEvent(org.bukkit.event.player.PlayerRespawnEvent) PlayerJoinEvent(org.bukkit.event.player.PlayerJoinEvent) Event(org.bukkit.event.Event) PlayerRespawnEvent(org.bukkit.event.player.PlayerRespawnEvent)

Aggregations

PluginManager (org.bukkit.plugin.PluginManager)32 Test (org.junit.Test)12 World (org.bukkit.World)5 Plugin (org.bukkit.plugin.Plugin)5 MultiverseWorld (com.onarandombox.MultiverseCore.api.MultiverseWorld)3 Location (org.bukkit.Location)3 Listener (org.bukkit.event.Listener)3 Essentials (com.earth2me.essentials.Essentials)2 MultiverseCore (com.onarandombox.MultiverseCore.MultiverseCore)2 MVWorldManager (com.onarandombox.MultiverseCore.api.MVWorldManager)2 LavaCheck (com.wasteofplastic.acidisland.listeners.LavaCheck)2 File (java.io.File)2 Method (java.lang.reflect.Method)2 IEssentials (net.ess3.api.IEssentials)2 Event (org.bukkit.event.Event)2 EventException (org.bukkit.event.EventException)2 EventExecutor (org.bukkit.plugin.EventExecutor)2 JavaPlugin (org.bukkit.plugin.java.JavaPlugin)2 User (com.earth2me.essentials.User)1 Metrics (com.earth2me.essentials.metrics.Metrics)1