Package top.focess.qq.core.net
Class AServerReceiver
- java.lang.Object
-
- top.focess.qq.core.net.AServerReceiver
-
- All Implemented Interfaces:
Receiver,ServerReceiver
- Direct Known Subclasses:
FocessReceiver,FocessSidedReceiver,FocessUDPMultiReceiver,FocessUDPReceiver
public abstract class AServerReceiver extends Object implements ServerReceiver
-
-
Field Summary
Fields Modifier and Type Field Description protected Map<Integer,SimpleClient>clientInfosprotected intdefaultClientIdprotected Map<Integer,Long>lastHeartprotected Map<Plugin,Map<String,Map<Class<?>,List<PackHandler>>>>packHandlers
-
Constructor Summary
Constructors Constructor Description AServerReceiver()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected static StringgenerateToken()ClientgetClient(String name)Get the client by given namebooleanisConnected(String client)Indicate the client is connected to server<T extends Packet>
voidregisterPackHandler(Plugin plugin, String name, Class<T> c, PackHandler<T> packHandler)Register packet handler for special client-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface top.focess.qq.api.net.ServerReceiver
sendPacket
-
-
-
-
Method Detail
-
isConnected
public boolean isConnected(String client)
Description copied from interface:ServerReceiverIndicate the client is connected to server- Specified by:
isConnectedin interfaceServerReceiver- Parameters:
client- the client name- Returns:
- true if the client is connected to server, false otherwise
-
getClient
@Nullable public Client getClient(String name)
Description copied from interface:ServerReceiverGet the client by given name- Specified by:
getClientin interfaceServerReceiver- Parameters:
name- the client name- Returns:
- the client
-
generateToken
protected static String generateToken()
-
registerPackHandler
public <T extends Packet> void registerPackHandler(Plugin plugin, String name, Class<T> c, PackHandler<T> packHandler)
Description copied from interface:ServerReceiverRegister packet handler for special client- Specified by:
registerPackHandlerin interfaceServerReceiver- Type Parameters:
T- the packet type- Parameters:
plugin- the pluginname- the client namec- the packet classpackHandler- the packet handler
-
-