use of org.bukkit.event.EventException in project Essentials by EssentialsX.
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);
EventPriority respawnPriority = ess.getSettings().getRespawnPriority();
if (respawnPriority != null) {
pluginManager.registerEvent(PlayerRespawnEvent.class, playerListener, respawnPriority, new EventExecutor() {
@Override
public void execute(final Listener ll, final Event event) throws EventException {
((EssentialsSpawnPlayerListener) ll).onPlayerRespawn((PlayerRespawnEvent) event);
}
}, this);
}
EventPriority joinPriority = ess.getSettings().getSpawnJoinPriority();
if (joinPriority != null) {
pluginManager.registerEvent(PlayerJoinEvent.class, playerListener, joinPriority, new EventExecutor() {
@Override
public void execute(final Listener ll, final Event event) throws EventException {
((EssentialsSpawnPlayerListener) ll).onPlayerJoin((PlayerJoinEvent) event);
}
}, this);
}
}
Aggregations