Class CommunicationKit
java.lang.Object
com.iohao.net.framework.communication.CommunicationKit
Utility class providing static access to the global communication infrastructure.
Holds the singleton CommunicationAggregation and Communication instances,
and offers convenience methods for common cross-server operations such as forced user
offline and user existence checks.
- Since:
- 25.1
- Author:
- 渔民小镇
- date:
- 2025-09-28
-
Method Summary
Modifier and TypeMethodDescriptionstatic booleanexistUser(long userId) Check whether a user is currently connected to any external server.static voidforcedOffline(long userId) Force a user offline by broadcasting a forced-offline request to all external servers.static Communicationstatic CommunicationAggregationstatic voidsetCommunicationAggregation(CommunicationAggregation communicationAggregation) Set the global communication aggregation and initialize the communication instance.static voidsetCommunicationSupplier(Supplier<Communication> communicationSupplier)
-
Method Details
-
setCommunicationAggregation
Set the global communication aggregation and initialize the communication instance.- Parameters:
communicationAggregation- the aggregation implementation to use
-
forcedOffline
public static void forcedOffline(long userId) Force a user offline by broadcasting a forced-offline request to all external servers.- Parameters:
userId- the ID of the user to disconnect
-
existUser
public static boolean existUser(long userId) Check whether a user is currently connected to any external server.- Parameters:
userId- the ID of the user to check- Returns:
trueif the user exists on at least one external server
-
getCommunicationAggregation
-
getCommunication
-
setCommunicationSupplier
-