Class DefaultPacketListenerRegistry
java.lang.Object
eu.cloudnetservice.driver.impl.network.protocol.DefaultPacketListenerRegistry
- All Implemented Interfaces:
eu.cloudnetservice.driver.network.protocol.PacketListenerRegistry
public class DefaultPacketListenerRegistry
extends Object
implements eu.cloudnetservice.driver.network.protocol.PacketListenerRegistry
The default implementation of the packet listener registry.
- Since:
- 4.0
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionConstructs a new packet listener registry instance with no parent packet listener given.DefaultPacketListenerRegistry(@Nullable eu.cloudnetservice.driver.network.protocol.PacketListenerRegistry parent) Constructs a new packet listener registry instance. -
Method Summary
Modifier and TypeMethodDescriptionvoidaddListener(int channel, @NonNull eu.cloudnetservice.driver.network.protocol.PacketListener listener) voidaddListener(int channel, @NonNull Class<? extends eu.cloudnetservice.driver.network.protocol.PacketListener> listenerClass) channels()booleanhandlePacket(@NonNull eu.cloudnetservice.driver.network.NetworkChannel channel, @NonNull eu.cloudnetservice.driver.network.protocol.Packet packet) booleanhasListeners(int channel) @NonNull @UnmodifiableView Collection<eu.cloudnetservice.driver.network.protocol.PacketListener> @NonNull @UnmodifiableView Map<Integer, Collection<eu.cloudnetservice.driver.network.protocol.PacketListener>> @Nullable eu.cloudnetservice.driver.network.protocol.PacketListenerRegistryparent()voidremoveListener(int channel, @NonNull eu.cloudnetservice.driver.network.protocol.PacketListener listener) voidvoidremoveListeners(int channel) voidremoveListeners(@NonNull ClassLoader classLoader)
-
Field Details
-
parent
private final eu.cloudnetservice.driver.network.protocol.PacketListenerRegistry parent -
listeners
private final com.google.common.collect.Multimap<Integer, eu.cloudnetservice.driver.network.protocol.PacketListener> listeners
-
-
Constructor Details
-
DefaultPacketListenerRegistry
public DefaultPacketListenerRegistry()Constructs a new packet listener registry instance with no parent packet listener given. This call is equivalent tonew DefaultPacketListenerRegistry(null). -
DefaultPacketListenerRegistry
-
-
Method Details
-
parent
-
addListener
-
addListener
-
removeListener
-
removeListeners
public void removeListeners(int channel) - Specified by:
removeListenersin interfaceeu.cloudnetservice.driver.network.protocol.PacketListenerRegistry
-
removeListeners
- Specified by:
removeListenersin interfaceeu.cloudnetservice.driver.network.protocol.PacketListenerRegistry
-
hasListeners
public boolean hasListeners(int channel) - Specified by:
hasListenersin interfaceeu.cloudnetservice.driver.network.protocol.PacketListenerRegistry
-
removeListeners
public void removeListeners()- Specified by:
removeListenersin interfaceeu.cloudnetservice.driver.network.protocol.PacketListenerRegistry
-
channels
- Specified by:
channelsin interfaceeu.cloudnetservice.driver.network.protocol.PacketListenerRegistry
-
listeners
@NonNull public @NonNull @UnmodifiableView Collection<eu.cloudnetservice.driver.network.protocol.PacketListener> listeners()- Specified by:
listenersin interfaceeu.cloudnetservice.driver.network.protocol.PacketListenerRegistry
-
packetListeners
@NonNull public @NonNull @UnmodifiableView Map<Integer, Collection<eu.cloudnetservice.driver.network.protocol.PacketListener>> packetListeners()- Specified by:
packetListenersin interfaceeu.cloudnetservice.driver.network.protocol.PacketListenerRegistry
-
handlePacket
-