Package org.javacord.core.util.gateway
Class PacketHandler
- java.lang.Object
-
- org.javacord.core.util.gateway.PacketHandler
-
- Direct Known Subclasses:
ChannelCreateHandler
,ChannelDeleteHandler
,ChannelPinsUpdateHandler
,ChannelUpdateHandler
,GuildBanAddHandler
,GuildBanRemoveHandler
,GuildCreateHandler
,GuildDeleteHandler
,GuildEmojisUpdateHandler
,GuildMemberAddHandler
,GuildMemberRemoveHandler
,GuildMembersChunkHandler
,GuildMemberUpdateHandler
,GuildRoleCreateHandler
,GuildRoleDeleteHandler
,GuildRoleUpdateHandler
,GuildUpdateHandler
,InviteCreateHandler
,InviteDeleteHandler
,MessageCreateHandler
,MessageDeleteBulkHandler
,MessageDeleteHandler
,MessageReactionAddHandler
,MessageReactionRemoveAllHandler
,MessageReactionRemoveHandler
,MessageUpdateHandler
,PresencesReplaceHandler
,PresenceUpdateHandler
,ReadyHandler
,ResumedHandler
,TypingStartHandler
,UserUpdateHandler
,VoiceServerUpdateHandler
,VoiceStateUpdateHandler
,WebhooksUpdateHandler
public abstract class PacketHandler extends Object
This class is extended by all PacketHandlers.
-
-
Field Summary
Fields Modifier and Type Field Description protected DiscordApiImpl
api
-
Constructor Summary
Constructors Constructor Description PacketHandler(DiscordApi api, boolean async, String type)
Creates a new instance of this class.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description boolean
equals(Object obj)
String
getType()
Gets the type of packet the handler handles.protected abstract void
handle(com.fasterxml.jackson.databind.JsonNode packet)
This method is called by the super class to handle the packet.void
handlePacket(com.fasterxml.jackson.databind.JsonNode packet)
Handles the packet.int
hashCode()
-
-
-
Field Detail
-
api
protected final DiscordApiImpl api
-
-
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.
-
-