From 54ef43fae83bad8be7cda7f2326b9919b516253e Mon Sep 17 00:00:00 2001 From: "Kristian S. Stangeland" Date: Sat, 7 Dec 2013 17:30:59 +0100 Subject: [PATCH] Added more constructors to PacketAdapter. --- .../protocol/events/PacketAdapter.java | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/ProtocolLib/src/main/java/com/comphenix/protocol/events/PacketAdapter.java b/ProtocolLib/src/main/java/com/comphenix/protocol/events/PacketAdapter.java index fcb5eb47..7631a7e3 100644 --- a/ProtocolLib/src/main/java/com/comphenix/protocol/events/PacketAdapter.java +++ b/ProtocolLib/src/main/java/com/comphenix/protocol/events/PacketAdapter.java @@ -30,6 +30,7 @@ import com.comphenix.protocol.PacketType; import com.comphenix.protocol.injector.GamePhase; import com.comphenix.protocol.injector.packet.PacketRegistry; import com.google.common.base.Preconditions; +import com.google.common.collect.Iterables; import com.google.common.collect.Lists; /** @@ -65,6 +66,25 @@ public abstract class PacketAdapter implements PacketListener { this(plugin, ListenerPriority.NORMAL, types); } + /** + * Initialize a packet listener with the given parameters. + * @param plugin - the plugin. + * @param types - the packet types. + */ + public PacketAdapter(Plugin plugin, Iterable types) { + this(params(plugin, Iterables.toArray(types, PacketType.class))); + } + + /** + * Initialize a packet listener with the given parameters. + * @param plugin - the plugin. + * @param listenerPriority - the priority. + * @param types - the packet types. + */ + public PacketAdapter(Plugin plugin, ListenerPriority listenerPriority, Iterable types) { + this(params(plugin, Iterables.toArray(types, PacketType.class)).listenerPriority(listenerPriority)); + } + /** * Initialize a packet listener with the given parameters. * @param plugin - the plugin.