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 ByteBuffer
body()
void
@NotNull ServerPacket
packet()
-
Constructor Details
-
CachedPacket
-
CachedPacket
-
-
Method Details
-
invalidate
public void invalidate() -
packet
-
body
-