mirror of
https://github.com/dmulloy2/ProtocolLib.git
synced 2024-11-24 03:25:29 +01:00
Adding packet constructors.
This should simplify a lot of code.
This commit is contained in:
parent
7a60c5aac7
commit
fb15ee1b22
@ -25,6 +25,7 @@ import org.bukkit.plugin.Plugin;
|
||||
|
||||
import com.comphenix.protocol.events.PacketContainer;
|
||||
import com.comphenix.protocol.events.PacketListener;
|
||||
import com.comphenix.protocol.injector.PacketConstructor;
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
|
||||
/**
|
||||
@ -124,6 +125,14 @@ public interface ProtocolManager {
|
||||
*/
|
||||
public PacketContainer createPacket(int id, boolean forceDefaults);
|
||||
|
||||
/**
|
||||
* Construct a packet using the special builtin Minecraft constructors.
|
||||
* @param id - the packet ID.
|
||||
* @param argumentTypes - type of each argument to pass to Minecraft.
|
||||
* @return The packet constructor.
|
||||
*/
|
||||
public PacketConstructor createPacketConstructor(int id, Class<?>[] argumentTypes);
|
||||
|
||||
/**
|
||||
* Retrieves a immutable set containing the ID of the sent server packets that will be observed by listeners.
|
||||
* @return Every filtered server packet.
|
||||
|
@ -325,6 +325,11 @@ public final class PacketFilterManager implements ProtocolManager {
|
||||
return packet;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PacketConstructor createPacketConstructor(int id, Class<?>[] argumentTypes) {
|
||||
return PacketConstructor.DEFAUALT.withPacket(id, argumentTypes);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Set<Integer> getSendingFilters() {
|
||||
return ImmutableSet.copyOf(sendingFilters);
|
||||
|
Loading…
Reference in New Issue
Block a user