Class PacketDispatcher
java.lang.Object
net.joseplay.allianceutils.api.pluginComunicate.packets.PacketDispatcher
Responsible for dispatching
UniPacket instances across the system.
This class handles:
- Local packet execution
- Redis-based cross-server communication
- Event triggering for send/receive lifecycle
Behavior depends on configuration:
- If Redis is enabled → packets are sent through Redis
- If disabled → packets execute locally
-
Constructor Summary
ConstructorsConstructorDescriptionPacketDispatcher(PacketRegistry registry, PacketExecutorRegistry executorRegistry) Creates a new dispatcher. -
Method Summary
-
Constructor Details
-
PacketDispatcher
Creates a new dispatcher.- Parameters:
registry- packet registry for serialization/deserializationexecutorRegistry- executor registry for handling packets
-
-
Method Details
-
send
Sends a packet.- Parameters:
packet- the packet to sendexecuteLocal- whether to execute locally before/without sending to Redis
-
send
Sends a packet and executes it locally by default. -
receiveFromRedis
Handles packets received from Redis.- Parameters:
jsonMessage- serialized packet data
-