Search in sources :

Example 26 with Listener

use of org.bukkit.event.Listener in project Essentials by drtshock.

the class Essentials method handleCrash.

private void handleCrash(Throwable exception) {
    final PluginManager pm = getServer().getPluginManager();
    LOGGER.log(Level.SEVERE, exception.toString());
    exception.printStackTrace();
    pm.registerEvents(new Listener() {

        @EventHandler(priority = EventPriority.LOW)
        public void onPlayerJoin(final PlayerJoinEvent event) {
            event.getPlayer().sendMessage("Essentials failed to load, read the log file.");
        }
    }, this);
    for (Player player : getOnlinePlayers()) {
        player.sendMessage("Essentials failed to load, read the log file.");
    }
    this.setEnabled(false);
}
Also used : PluginManager(org.bukkit.plugin.PluginManager) PlayerJoinEvent(org.bukkit.event.player.PlayerJoinEvent) Player(org.bukkit.entity.Player) SignBlockListener(com.earth2me.essentials.signs.SignBlockListener) SignEntityListener(com.earth2me.essentials.signs.SignEntityListener) SignPlayerListener(com.earth2me.essentials.signs.SignPlayerListener) Listener(org.bukkit.event.Listener) EventHandler(org.bukkit.event.EventHandler)

Aggregations

Listener (org.bukkit.event.Listener)26 EventHandler (org.bukkit.event.EventHandler)10 Event (org.bukkit.event.Event)8 EventExecutor (org.bukkit.plugin.EventExecutor)7 RegisteredListener (org.bukkit.plugin.RegisteredListener)7 Player (org.bukkit.entity.Player)6 EventException (org.bukkit.event.EventException)6 EventPriority (org.bukkit.event.EventPriority)6 PluginManager (org.bukkit.plugin.PluginManager)6 PlayerJoinEvent (org.bukkit.event.player.PlayerJoinEvent)5 Method (java.lang.reflect.Method)4 HandlerList (org.bukkit.event.HandlerList)4 Field (java.lang.reflect.Field)2 ArrayList (java.util.ArrayList)2 PlayerPortalEvent (org.bukkit.event.player.PlayerPortalEvent)2 AuthorNagException (org.bukkit.plugin.AuthorNagException)2 Plugin (org.bukkit.plugin.Plugin)2 PacketReceiveEvent (com.bergerkiller.bukkit.common.events.PacketReceiveEvent)1 PacketSendEvent (com.bergerkiller.bukkit.common.events.PacketSendEvent)1 BukkitWorldSupplier (com.bergerkiller.bukkit.common.offline.OfflineWorld.BukkitWorldSupplier)1