Adding packet constructors.
This should simplify a lot of code.
Dieser Commit ist enthalten in:
Ursprung
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);
|
||||
|
In neuem Issue referenzieren
Einen Benutzer sperren