Class CachedPacket
java.lang.Object
net.minestom.server.network.packet.server.CachedPacket
- All Implemented Interfaces:
SendablePacket
Represents a packet that is only computed when required (either due to memory demand or invalidated data)
The cache is stored in a SoftReference
and is invalidated when invalidate()
is called.
Packet supplier must be thread-safe.
-
Constructor Summary
ConstructorDescriptionCachedPacket
(@NotNull Supplier<@NotNull ServerPacket> packetSupplier) CachedPacket
(@NotNull ServerPacket packet) -
Method Summary
Modifier and TypeMethodDescription@Nullable NetworkBuffer
body
(@NotNull ConnectionState state) void
boolean
isValid()
@NotNull ServerPacket
packet
(@NotNull ConnectionState state) toString()