diff --git a/src/main/java/net/minestom/server/network/packet/server/play/ChunkDataPacket.java b/src/main/java/net/minestom/server/network/packet/server/play/ChunkDataPacket.java index 0e75291ce..230071f4d 100644 --- a/src/main/java/net/minestom/server/network/packet/server/play/ChunkDataPacket.java +++ b/src/main/java/net/minestom/server/network/packet/server/play/ChunkDataPacket.java @@ -15,7 +15,7 @@ import net.minestom.server.utils.BlockPosition; import net.minestom.server.utils.Utils; import net.minestom.server.utils.binary.BinaryWriter; import net.minestom.server.utils.cache.CacheablePacket; -import net.minestom.server.utils.cache.TemporaryPacketCache; +import net.minestom.server.utils.cache.TemporaryCache; import net.minestom.server.utils.chunk.ChunkUtils; import net.minestom.server.world.biomes.Biome; import org.jetbrains.annotations.NotNull; @@ -27,7 +27,7 @@ import java.util.UUID; public class ChunkDataPacket implements ServerPacket, CacheablePacket { private static final BlockManager BLOCK_MANAGER = MinecraftServer.getBlockManager(); - private static final TemporaryPacketCache CACHE = new TemporaryPacketCache(10000L); + private static final TemporaryCache CACHE = new TemporaryCache<>(10000L); public boolean fullChunk; public Biome[] biomes; @@ -139,7 +139,7 @@ public class ChunkDataPacket implements ServerPacket, CacheablePacket { @NotNull @Override - public TemporaryPacketCache getCache() { + public TemporaryCache getCache() { return CACHE; } diff --git a/src/main/java/net/minestom/server/network/packet/server/play/UpdateLightPacket.java b/src/main/java/net/minestom/server/network/packet/server/play/UpdateLightPacket.java index a98aceb1d..55c2fafe5 100644 --- a/src/main/java/net/minestom/server/network/packet/server/play/UpdateLightPacket.java +++ b/src/main/java/net/minestom/server/network/packet/server/play/UpdateLightPacket.java @@ -1,10 +1,11 @@ package net.minestom.server.network.packet.server.play; +import io.netty.buffer.ByteBuf; import net.minestom.server.network.packet.server.ServerPacket; import net.minestom.server.network.packet.server.ServerPacketIdentifier; import net.minestom.server.utils.binary.BinaryWriter; import net.minestom.server.utils.cache.CacheablePacket; -import net.minestom.server.utils.cache.TemporaryPacketCache; +import net.minestom.server.utils.cache.TemporaryCache; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -13,7 +14,7 @@ import java.util.UUID; public class UpdateLightPacket implements ServerPacket, CacheablePacket { - private static final TemporaryPacketCache CACHE = new TemporaryPacketCache(10000L); + private static final TemporaryCache CACHE = new TemporaryCache<>(10000L); public int chunkX; public int chunkZ; @@ -71,7 +72,7 @@ public class UpdateLightPacket implements ServerPacket, CacheablePacket { @NotNull @Override - public TemporaryPacketCache getCache() { + public TemporaryCache getCache() { return CACHE; } diff --git a/src/main/java/net/minestom/server/utils/cache/CacheablePacket.java b/src/main/java/net/minestom/server/utils/cache/CacheablePacket.java index 38729c77b..b607fb97a 100644 --- a/src/main/java/net/minestom/server/utils/cache/CacheablePacket.java +++ b/src/main/java/net/minestom/server/utils/cache/CacheablePacket.java @@ -1,5 +1,6 @@ package net.minestom.server.utils.cache; +import io.netty.buffer.ByteBuf; import net.minestom.server.network.packet.server.ServerPacket; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -22,14 +23,14 @@ public interface CacheablePacket { * @return the temporary packet cache */ @NotNull - TemporaryPacketCache getCache(); + TemporaryCache getCache(); /** * Gets the identifier of this packet. *

* Used to verify if this packet is already cached or not. * - * @return this packet identifier, null to do not retrieve the cache + * @return this packet identifier, null to prevent caching */ @Nullable UUID getIdentifier(); diff --git a/src/main/java/net/minestom/server/utils/cache/TemporaryPacketCache.java b/src/main/java/net/minestom/server/utils/cache/TemporaryPacketCache.java deleted file mode 100644 index 4e7b975b0..000000000 --- a/src/main/java/net/minestom/server/utils/cache/TemporaryPacketCache.java +++ /dev/null @@ -1,12 +0,0 @@ -package net.minestom.server.utils.cache; - -import io.netty.buffer.ByteBuf; - -/** - * Convenient superclass of {@link TemporaryCache} explicitly for packet to store a {@link ByteBuf}. - */ -public class TemporaryPacketCache extends TemporaryCache { - public TemporaryPacketCache(long keepTime) { - super(keepTime); - } -}