当前位置: 首页>>代码示例>>Java>>正文


Java SocketEvent类代码示例

本文整理汇总了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;
	}
}
 
开发者ID:GoMint,项目名称:Proxy,代码行数:18,代码来源:ClientSocketEventHandler.java

示例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);
}
 
开发者ID:JungleTree,项目名称:JungleTree,代码行数:12,代码来源:BedrockServer.java

示例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);
    }
}
 
开发者ID:JungleTree,项目名称:JungleTree,代码行数:9,代码来源:DisconnectHandler.java

示例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())
    ));
}
 
开发者ID:JungleTree,项目名称:JungleTree,代码行数:13,代码来源:UnconnectedPingHandler.java

示例5: registerSocketEventHandler

import io.gomint.jraknet.SocketEvent; //导入依赖的package包/类
private void registerSocketEventHandler(SocketEvent.Type type, SocketEventHandler handler) {
    handlers.put(type, handler);
}
 
开发者ID:JungleTree,项目名称:JungleTree,代码行数:4,代码来源:BedrockServer.java

示例6: onSocketEvent

import io.gomint.jraknet.SocketEvent; //导入依赖的package包/类
@Override
public void onSocketEvent(Socket socket, SocketEvent socketEvent) {
    connectivityManager.connectClient(new Client(socketEvent.getConnection()));
}
 
开发者ID:JungleTree,项目名称:JungleTree,代码行数:5,代码来源:NewIncomingConnectionHandler.java

示例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" );
}
 
开发者ID:GoMint,项目名称:Proxy,代码行数:5,代码来源:ClientSocketEventHandler.java


注:本文中的io.gomint.jraknet.SocketEvent类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。