本文整理汇总了Java中cn.nukkit.event.HandlerList类的典型用法代码示例。如果您正苦于以下问题:Java HandlerList类的具体用法?Java HandlerList怎么用?Java HandlerList使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
HandlerList类属于cn.nukkit.event包,在下文中一共展示了HandlerList类的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: forceShutdown
import cn.nukkit.event.HandlerList; //导入依赖的package包/类
public void forceShutdown() {
if (this.hasStopped) {
return;
}
try {
if (!this.isRunning) {
//todo sendUsage
}
// clean shutdown of console thread asap
this.console.shutdown();
this.hasStopped = true;
this.shutdown();
if (this.rcon != null) {
this.rcon.close();
}
this.getLogger().debug("Disabling all plugins");
this.pluginManager.disablePlugins();
for (Player player : new ArrayList<>(this.players.values())) {
player.close(player.getLeaveMessage(), (String) this.getConfig("settings.shutdown-message", "Server closed"));
}
this.getLogger().debug("Unloading all levels");
for (Level level : new ArrayList<>(this.getLevels().values())) {
this.unloadLevel(level, true);
}
this.getLogger().debug("Removing event handlers");
HandlerList.unregisterAll();
this.getLogger().debug("Stopping all tasks");
this.scheduler.cancelAllTasks();
this.scheduler.mainThreadHeartbeat(Integer.MAX_VALUE);
this.getLogger().debug("Closing console");
this.console.interrupt();
this.getLogger().debug("Stopping network interfaces");
for (SourceInterface interfaz : this.network.getInterfaces()) {
interfaz.shutdown();
this.network.unregisterInterface(interfaz);
}
this.getLogger().debug("Disabling timings");
Timings.stopServer();
//todo other things
} catch (Exception e) {
this.logger.logException(e); //todo remove this?
this.logger.emergency("Exception happened while shutting down, exit the process");
System.exit(1);
}
}
示例2: getHandlers
import cn.nukkit.event.HandlerList; //导入依赖的package包/类
public static HandlerList getHandlers() {
return handlers;
}