From ce219e208c8fcf1e8fe69c27974975b6abcb5328 Mon Sep 17 00:00:00 2001 From: mmxw11 Date: Sun, 24 Sep 2017 21:17:07 +0300 Subject: [PATCH] Check the right type --- .../src/main/java/us/myles/ViaVersion/api/PacketWrapper.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/common/src/main/java/us/myles/ViaVersion/api/PacketWrapper.java b/common/src/main/java/us/myles/ViaVersion/api/PacketWrapper.java index 6182d5d92..6421495e8 100644 --- a/common/src/main/java/us/myles/ViaVersion/api/PacketWrapper.java +++ b/common/src/main/java/us/myles/ViaVersion/api/PacketWrapper.java @@ -149,10 +149,11 @@ public class PacketWrapper { } } else { Pair read = readableObjects.poll(); - if (read.getKey().equals(type) || (type.getBaseClass().equals(read.getKey().getBaseClass()) && type.getOutputClass().equals(read.getKey().getOutputClass()))) { + Type rtype = read.getKey(); + if (rtype.equals(type) || (type.getBaseClass().equals(rtype.getBaseClass()) && type.getOutputClass().equals(rtype.getOutputClass()))) { return (T) read.getValue(); } else { - if (type == Type.NOTHING) { + if (rtype == Type.NOTHING) { return read(type); // retry } else { Exception e = new IOException("Unable to read type " + type.getTypeName() + ", found " + read.getKey().getTypeName());