mirror of
https://github.com/dmulloy2/ProtocolLib.git
synced 2024-11-27 21:26:17 +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.PacketContainer;
|
||||||
import com.comphenix.protocol.events.PacketListener;
|
import com.comphenix.protocol.events.PacketListener;
|
||||||
|
import com.comphenix.protocol.injector.PacketConstructor;
|
||||||
import com.google.common.collect.ImmutableSet;
|
import com.google.common.collect.ImmutableSet;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -124,6 +125,14 @@ public interface ProtocolManager {
|
|||||||
*/
|
*/
|
||||||
public PacketContainer createPacket(int id, boolean forceDefaults);
|
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.
|
* Retrieves a immutable set containing the ID of the sent server packets that will be observed by listeners.
|
||||||
* @return Every filtered server packet.
|
* @return Every filtered server packet.
|
||||||
|
@ -325,6 +325,11 @@ public final class PacketFilterManager implements ProtocolManager {
|
|||||||
return packet;
|
return packet;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public PacketConstructor createPacketConstructor(int id, Class<?>[] argumentTypes) {
|
||||||
|
return PacketConstructor.DEFAUALT.withPacket(id, argumentTypes);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Set<Integer> getSendingFilters() {
|
public Set<Integer> getSendingFilters() {
|
||||||
return ImmutableSet.copyOf(sendingFilters);
|
return ImmutableSet.copyOf(sendingFilters);
|
||||||
|
Loading…
Reference in New Issue
Block a user