Class AServerReceiver

    • Constructor Detail

      • AServerReceiver

        public AServerReceiver()
    • Method Detail

      • isConnected

        public boolean isConnected​(String client)
        Description copied from interface: ServerReceiver
        Indicate the client is connected to server
        Specified by:
        isConnected in interface ServerReceiver
        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: ServerReceiver
        Get the client by given name
        Specified by:
        getClient in interface ServerReceiver
        Parameters:
        name - the client name
        Returns:
        the client
      • generateToken

        protected static String generateToken()
      • unregisterAll

        public boolean unregisterAll()
        Description copied from interface: Receiver
        Unregister all the packet handlers
        Specified by:
        unregisterAll in interface Receiver
        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: Receiver
        Unregister the packet handlers of the plugin
        Specified by:
        unregister in interface Receiver
        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: ServerReceiver
        Register packet handler for special client
        Specified by:
        register in interface ServerReceiver
        Type Parameters:
        T - the packet type
        Parameters:
        plugin - the plugin
        name - the client name
        c - the packet class
        packHandler - the packet handler