From 651581d6777a67ebec4057d9542c4b4d17b1b045 Mon Sep 17 00:00:00 2001 From: "Kristian S. Stangeland" Date: Sun, 13 Jan 2013 15:22:55 +0100 Subject: [PATCH] FIXED: DataWatcher can now clone ItemStacks and ChunkPositions. Due to a oversight, we retrieved the "wrapped" value in the get cloned helper method. This caused it to not clone the chunk position and item stack. --- .../protocol/wrappers/WrappedWatchableObject.java | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/ProtocolLib/src/main/java/com/comphenix/protocol/wrappers/WrappedWatchableObject.java b/ProtocolLib/src/main/java/com/comphenix/protocol/wrappers/WrappedWatchableObject.java index c1b2edb7..1ef3de0f 100644 --- a/ProtocolLib/src/main/java/com/comphenix/protocol/wrappers/WrappedWatchableObject.java +++ b/ProtocolLib/src/main/java/com/comphenix/protocol/wrappers/WrappedWatchableObject.java @@ -218,6 +218,14 @@ public class WrappedWatchableObject { modifier.withType(Object.class).write(0, getUnwrapped(newValue)); } + /** + * Read the underlying value field. + * @return The underlying value. + */ + private Object getNMSValue() { + return modifier.withType(Object.class).read(0); + } + /** * Read the value field. * @return The watched value. @@ -324,7 +332,7 @@ public class WrappedWatchableObject { // Helper Object getClonedValue() throws FieldAccessException { - Object value = getValue(); + Object value = getNMSValue(); // Only a limited set of references types are supported if (MinecraftReflection.isChunkPosition(value)) {