本文整理汇总了Java中io.gomint.jraknet.SocketEvent类的典型用法代码示例。如果您正苦于以下问题:Java SocketEvent类的具体用法?Java SocketEvent怎么用?Java SocketEvent使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
SocketEvent类属于io.gomint.jraknet包,在下文中一共展示了SocketEvent类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onSocketEvent
import io.gomint.jraknet.SocketEvent; //导入依赖的package包/类
@Override
public void onSocketEvent( Socket socket, SocketEvent event ) {
switch ( event.getType() ) {
case NEW_INCOMING_CONNECTION:
this.connectionManager.prepareIncomingConnection( event.getConnection() );
break;
case CONNECTION_CLOSED:
case CONNECTION_DISCONNECTED:
this.connectionManager.notifyClientDisconnected( event.getConnection() );
break;
case UNCONNECTED_PING:
this.handleUnconnectedPing( event );
break;
}
}
示例2: BedrockServer
import io.gomint.jraknet.SocketEvent; //导入依赖的package包/类
public BedrockServer() {
Security.addProvider(new BouncyCastleProvider());
registerSocketEventHandler(SocketEvent.Type.UNCONNECTED_PING, new UnconnectedPingHandler(this));
registerSocketEventHandler(SocketEvent.Type.NEW_INCOMING_CONNECTION, new NewIncomingConnectionHandler());
DisconnectHandler disconnectHandler = new DisconnectHandler();
registerSocketEventHandler(SocketEvent.Type.CONNECTION_CLOSED, disconnectHandler);
registerSocketEventHandler(SocketEvent.Type.CONNECTION_ATTEMPT_FAILED, disconnectHandler);
registerSocketEventHandler(SocketEvent.Type.CONNECTION_DISCONNECTED, disconnectHandler);
}
示例3: onSocketEvent
import io.gomint.jraknet.SocketEvent; //导入依赖的package包/类
@Override
public void onSocketEvent(Socket socket, SocketEvent event) {
try {
connectivityManager.disconnectClient(event.getConnection());
} catch (Exception ex) {
log.error("Failed to disconnect:", ex);
}
}
示例4: onSocketEvent
import io.gomint.jraknet.SocketEvent; //导入依赖的package包/类
@Override
public void onSocketEvent(Socket socket, SocketEvent socketEvent) {
socketEvent.getPingPongInfo().setMotd(String.format(
"MCPE;%s;%d;%s;%d;%d;%s",
server.getMotd(),
server.getProtocolVersion(),
server.getProtocolVersionName(),
connectivityManager.getOnlinePlayers(),
server.getMaxPlayers(),
Long.toUnsignedString(server.getServerUuid().getLeastSignificantBits())
));
}
示例5: registerSocketEventHandler
import io.gomint.jraknet.SocketEvent; //导入依赖的package包/类
private void registerSocketEventHandler(SocketEvent.Type type, SocketEventHandler handler) {
handlers.put(type, handler);
}
示例6: onSocketEvent
import io.gomint.jraknet.SocketEvent; //导入依赖的package包/类
@Override
public void onSocketEvent(Socket socket, SocketEvent socketEvent) {
connectivityManager.connectClient(new Client(socketEvent.getConnection()));
}
示例7: handleUnconnectedPing
import io.gomint.jraknet.SocketEvent; //导入依赖的package包/类
private void handleUnconnectedPing( SocketEvent event ) {
// Fire ping event so plugins can modify the motd and player amounts
event.getPingPongInfo().setMotd( "MCPE;MITM Proxy;113;1.1.0.55;0;1" );
}