From fc993809d6412c0949283c3a1a83f9cae4ad2ce5 Mon Sep 17 00:00:00 2001 From: Matsv Date: Sat, 17 Sep 2016 11:32:35 +0200 Subject: [PATCH] Patch for LibsDisguises, they are sending too big chunks. :'( Fix #3 --- .../protocol1_9_4to1_10/chunks/Chunk1_10Type.java | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/main/java/nl/matsv/viabackwards/protocol/protocol1_9_4to1_10/chunks/Chunk1_10Type.java b/src/main/java/nl/matsv/viabackwards/protocol/protocol1_9_4to1_10/chunks/Chunk1_10Type.java index 84db3f83..243c1b55 100644 --- a/src/main/java/nl/matsv/viabackwards/protocol/protocol1_9_4to1_10/chunks/Chunk1_10Type.java +++ b/src/main/java/nl/matsv/viabackwards/protocol/protocol1_9_4to1_10/chunks/Chunk1_10Type.java @@ -22,6 +22,7 @@ import io.netty.buffer.ByteBuf; import io.netty.buffer.Unpooled; import org.apache.commons.lang.IllegalClassException; import org.bukkit.World; +import us.myles.ViaVersion.api.ViaVersion; import us.myles.ViaVersion.api.minecraft.chunks.Chunk; import us.myles.ViaVersion.api.minecraft.chunks.ChunkSection; import us.myles.ViaVersion.api.type.PartialType; @@ -77,6 +78,14 @@ public class Chunk1_10Type extends PartialType { List nbtData = Arrays.asList(Type.NBT_ARRAY.read(input)); + // Temp patch for plugins that sent wrong too big chunks TODO find the issue in LibsDisguise and PR it. + if (input.readableBytes() > 0) { + byte[] array = new byte[input.readableBytes()]; + input.readBytes(array); + if (ViaVersion.getInstance().isDebug()) + System.out.println("Found " + array.length + " more bytes than expected while reading the chunk"); + } + return new Chunk1_10(chunkX, chunkZ, groundUp, primaryBitmask, sections, biomeData, nbtData); }