mirror of
https://github.com/Minestom/Minestom.git
synced 2025-01-31 12:31:28 +01:00
Merge branch 'master' into acquirable
This commit is contained in:
commit
02ceed0563
@ -592,6 +592,8 @@ public abstract class Chunk implements Viewable, Tickable, DataContainer {
|
|||||||
*/
|
*/
|
||||||
protected void unload() {
|
protected void unload() {
|
||||||
this.loaded = false;
|
this.loaded = false;
|
||||||
|
ChunkDataPacket.CACHE.invalidate(getIdentifier());
|
||||||
|
UpdateLightPacket.CACHE.invalidate(getIdentifier());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -33,7 +33,7 @@ import java.util.concurrent.TimeUnit;
|
|||||||
public class ChunkDataPacket implements ServerPacket, CacheablePacket {
|
public class ChunkDataPacket implements ServerPacket, CacheablePacket {
|
||||||
|
|
||||||
private static final BlockManager BLOCK_MANAGER = MinecraftServer.getBlockManager();
|
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 boolean fullChunk;
|
||||||
public Biome[] biomes;
|
public Biome[] biomes;
|
||||||
|
@ -16,7 +16,7 @@ import java.util.concurrent.TimeUnit;
|
|||||||
|
|
||||||
public class UpdateLightPacket implements ServerPacket, CacheablePacket {
|
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 chunkX;
|
||||||
public int chunkZ;
|
public int chunkZ;
|
||||||
|
@ -61,7 +61,6 @@ public class NettyPlayerConnection extends PlayerConnection {
|
|||||||
private UUID bungeeUuid;
|
private UUID bungeeUuid;
|
||||||
private PlayerSkin bungeeSkin;
|
private PlayerSkin bungeeSkin;
|
||||||
|
|
||||||
private final static int INITIAL_BUFFER_SIZE = 65_535; // 2^16-1
|
|
||||||
private final Object tickBufferLock = new Object();
|
private final Object tickBufferLock = new Object();
|
||||||
private volatile ByteBuf tickBuffer = BufUtils.getBuffer(true);
|
private volatile ByteBuf tickBuffer = BufUtils.getBuffer(true);
|
||||||
|
|
||||||
@ -69,8 +68,6 @@ public class NettyPlayerConnection extends PlayerConnection {
|
|||||||
super();
|
super();
|
||||||
this.channel = channel;
|
this.channel = channel;
|
||||||
this.remoteAddress = channel.remoteAddress();
|
this.remoteAddress = channel.remoteAddress();
|
||||||
|
|
||||||
this.tickBuffer.ensureWritable(INITIAL_BUFFER_SIZE);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -41,6 +41,10 @@ public class TemporaryCache<T> {
|
|||||||
this.cache.put(identifier, value);
|
this.cache.put(identifier, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void invalidate(@NotNull UUID identifier) {
|
||||||
|
this.cache.invalidate(identifier);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Retrieves an object from cache.
|
* Retrieves an object from cache.
|
||||||
*
|
*
|
||||||
|
Loading…
Reference in New Issue
Block a user