本文整理汇总了Java中protocolsupport.api.events.ConnectionCloseEvent类的典型用法代码示例。如果您正苦于以下问题:Java ConnectionCloseEvent类的具体用法?Java ConnectionCloseEvent怎么用?Java ConnectionCloseEvent使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ConnectionCloseEvent类属于protocolsupport.api.events包,在下文中一共展示了ConnectionCloseEvent类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onDisconnect
import protocolsupport.api.events.ConnectionCloseEvent; //导入依赖的package包/类
@EventHandler
public void onDisconnect(ConnectionCloseEvent event) {
Integer realId = (Integer) event.getConnection().removeMetadata(real_id_key);
if (realId != null) {
idPool.returnId(realId);
}
}
示例2: onDisconnect
import protocolsupport.api.events.ConnectionCloseEvent; //导入依赖的package包/类
@EventHandler
public void onDisconnect(ConnectionCloseEvent event) {
ValidatorInfo info = (ValidatorInfo) event.getConnection().removeMetadata(validator_info_key);
if (info != null) {
info.interrupt();
}
}
示例3: channelInactive
import protocolsupport.api.events.ConnectionCloseEvent; //导入依赖的package包/类
@Override
public void channelInactive(ChannelHandlerContext ctx) throws Exception {
super.channelInactive(ctx);
NetworkManagerWrapper networkmanager = connection.getNetworkManagerWrapper();
String username = networkmanager.getUserName();
if (username != null) {
Bukkit.getPluginManager().callEvent(new PlayerDisconnectEvent(connection, username));
}
Bukkit.getPluginManager().callEvent(new ConnectionCloseEvent(connection));
ProtocolStorage.removeConnection(networkmanager.getRawAddress());
}
示例4: channelInactive
import protocolsupport.api.events.ConnectionCloseEvent; //导入依赖的package包/类
@Override
public void channelInactive(ChannelHandlerContext ctx) throws Exception {
super.channelInactive(ctx);
ProxyServer.getInstance().getPluginManager().callEvent(new ConnectionCloseEvent(connection));
ProtocolStorage.removeConnection(connection.getAddress());
}