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>
voidregister(Plugin plugin, String name, Class<T> c, PackHandler<T> packHandler)Register packet handler for special clientvoidunregister(Plugin plugin)Unregister the packet handlers of the pluginbooleanunregisterAll()Unregister all the packet handlers-
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()
-
unregisterAll
public boolean unregisterAll()
Description copied from interface:ReceiverUnregister all the packet handlers- Specified by:
unregisterAllin interfaceReceiver- Returns:
- true if there are some packet-handlers not belonging to MainPlugin not been unregistered, false otherwise
-
unregister
public void unregister(Plugin plugin)
Description copied from interface:ReceiverUnregister the packet handlers of the plugin- Specified by:
unregisterin interfaceReceiver- Parameters:
plugin- the plugin
-
register
public <T extends Packet> void register(Plugin plugin, String name, Class<T> c, PackHandler<T> packHandler)
Description copied from interface:ServerReceiverRegister packet handler for special client- Specified by:
registerin interfaceServerReceiver- Type Parameters:
T- the packet type- Parameters:
plugin- the pluginname- the client namec- the packet classpackHandler- the packet handler
-
-