Merge branch 'master' into acquirable

This commit is contained in:
TheMode 2021-04-23 17:52:41 +02:00
commit 02ceed0563
5 changed files with 8 additions and 5 deletions

View File

@ -592,6 +592,8 @@ public abstract class Chunk implements Viewable, Tickable, DataContainer {
*/
protected void unload() {
this.loaded = false;
ChunkDataPacket.CACHE.invalidate(getIdentifier());
UpdateLightPacket.CACHE.invalidate(getIdentifier());
}
/**

View File

@ -33,7 +33,7 @@ import java.util.concurrent.TimeUnit;
public class ChunkDataPacket implements ServerPacket, CacheablePacket {
private static final BlockManager BLOCK_MANAGER = MinecraftServer.getBlockManager();
private static final TemporaryPacketCache CACHE = new TemporaryPacketCache(5, TimeUnit.MINUTES);
public static final TemporaryPacketCache CACHE = new TemporaryPacketCache(5, TimeUnit.MINUTES);
public boolean fullChunk;
public Biome[] biomes;

View File

@ -16,7 +16,7 @@ import java.util.concurrent.TimeUnit;
public class UpdateLightPacket implements ServerPacket, CacheablePacket {
private static final TemporaryPacketCache CACHE = new TemporaryPacketCache(5, TimeUnit.MINUTES);
public static final TemporaryPacketCache CACHE = new TemporaryPacketCache(5, TimeUnit.MINUTES);
public int chunkX;
public int chunkZ;

View File

@ -61,7 +61,6 @@ public class NettyPlayerConnection extends PlayerConnection {
private UUID bungeeUuid;
private PlayerSkin bungeeSkin;
private final static int INITIAL_BUFFER_SIZE = 65_535; // 2^16-1
private final Object tickBufferLock = new Object();
private volatile ByteBuf tickBuffer = BufUtils.getBuffer(true);
@ -69,8 +68,6 @@ public class NettyPlayerConnection extends PlayerConnection {
super();
this.channel = channel;
this.remoteAddress = channel.remoteAddress();
this.tickBuffer.ensureWritable(INITIAL_BUFFER_SIZE);
}
/**

View File

@ -41,6 +41,10 @@ public class TemporaryCache<T> {
this.cache.put(identifier, value);
}
public void invalidate(@NotNull UUID identifier) {
this.cache.invalidate(identifier);
}
/**
* Retrieves an object from cache.
*