Class PacketHandler

    • Constructor Detail

      • PacketHandler

        public PacketHandler​(DiscordApi api,
                             boolean async,
                             String type)
        Creates a new instance of this class.
        Parameters:
        api - The api.
        async - Whether the packet should be handled in a new thread or in the websocket thread.
        type - The type of packet the class handles.
    • Method Detail

      • handlePacket

        public void handlePacket​(com.fasterxml.jackson.databind.JsonNode packet)
        Handles the packet.
        Parameters:
        packet - The packet (the "d"-object).
      • handle

        protected abstract void handle​(com.fasterxml.jackson.databind.JsonNode packet)
        This method is called by the super class to handle the packet.
        Parameters:
        packet - The packet (the "d"-object).
      • getType

        public String getType​()
        Gets the type of packet the handler handles.
        Returns:
        The type of the packet.
      • hashCode

        public int hashCode​()
        Overrides:
        hashCode in class Object