Class PacketRegistry
java.lang.Object
com.comphenix.protocol.injector.packet.PacketRegistry
Static packet registry in Minecraft.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classRepresents a register we are currently building. -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected static final Class<?> protected static PacketRegistry.Register -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected static voidassociatePackets(PacketRegistry.Register register, Map<Integer, Class<?>> lookup, PacketType.Protocol protocol, PacketType.Sender sender) protected static PacketRegistry.Registerstatic Set<PacketType> Retrieve every known and supported server packet type.static Class<?> Get the packet class associated with a given type.static Class<?> getPacketClassFromType(PacketType type, boolean forceVanilla) Deprecated.forceVanilla no longer has any effectstatic PacketTypegetPacketType(PacketType.Protocol protocol, Class<?> packet) Retrieve the associated packet type for a packet class in the given protocol state.static PacketTypegetPacketType(Class<?> packet) Deprecated.major issues due to packets with shared classes being registered in multiple states.static PacketTypegetPacketType(Class<?> packet, PacketType.Sender sender) Deprecated.sender no longer has any effectstatic Set<PacketType> Retrieve every known and supported server packet type.static WrappedStreamCodecgetStreamCodec(Class<?> packetClass) Returns the wrapped stream codec to de-/serialize the given packet classstatic booleanisSupported(PacketType type) Determine if the given packet type is supported on the current server.static voidEnsure that our local register is up-to-date with Minecraft.tryGetPacketClass(PacketType type)
-
Field Details
-
ENUM_PROTOCOL
-
REGISTER
-
-
Constructor Details
-
PacketRegistry
public PacketRegistry()
-
-
Method Details
-
synchronize
public static void synchronize()Ensure that our local register is up-to-date with Minecraft.This operation may block the calling thread.
-
createOldRegister
-
associatePackets
protected static void associatePackets(PacketRegistry.Register register, Map<Integer, Class<?>> lookup, PacketType.Protocol protocol, PacketType.Sender sender) -
getStreamCodec
Returns the wrapped stream codec to de-/serialize the given packet class- Parameters:
packetClass- - the packet class- Returns:
- wrapped stream codec if existing, otherwise
null
-
isSupported
Determine if the given packet type is supported on the current server.- Parameters:
type- - the type to check.- Returns:
- TRUE if it is, FALSE otherwise.
-
getServerPacketTypes
Retrieve every known and supported server packet type.- Returns:
- Every server packet type.
-
getClientPacketTypes
Retrieve every known and supported server packet type.- Returns:
- Every server packet type.
-
getPacketClassFromType
Deprecated.forceVanilla no longer has any effectRetrieves the correct packet class from a given type.- Parameters:
type- - the packet type.forceVanilla- - whether or not to look for vanilla classes, not injected classes.- Returns:
- The associated class.
-
tryGetPacketClass
-
getPacketClassFromType
Get the packet class associated with a given type. First attempts to read from the type-to-class mapping, and tries- Parameters:
type- the packet type- Returns:
- The associated class
-
getPacketType
Deprecated.major issues due to packets with shared classes being registered in multiple states.Retrieve the packet type of a given packet.- Parameters:
packet- - the class of the packet.- Returns:
- The packet type, or NULL if not found.
-
getPacketType
Retrieve the associated packet type for a packet class in the given protocol state.- Parameters:
protocol- the protocol state to retrieve the packet from.packet- the class identifying the packet type.- Returns:
- the packet type associated with the given class in the given protocol state, or null if not found.
-
getPacketType
Deprecated.sender no longer has any effectRetrieve the packet type of a given packet.- Parameters:
packet- - the class of the packet.sender- - the sender of the packet, or NULL.- Returns:
- The packet type, or NULL if not found.
-