From 2e99e02094f51f581f7f98411e47a0f29cdeb3d6 Mon Sep 17 00:00:00 2001 From: feildmaster Date: Wed, 6 Feb 2013 16:32:19 -0600 Subject: [PATCH] Use entity UUID instead of EntityID for metadata. Fixes BUKKIT-3582 The entity id is a non-unique, non-persistent value, and will cause entities to lose their respective meta data on chunk unloading, and teleportation. --- .../org/bukkit/craftbukkit/metadata/EntityMetadataStore.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/main/java/org/bukkit/craftbukkit/metadata/EntityMetadataStore.java b/src/main/java/org/bukkit/craftbukkit/metadata/EntityMetadataStore.java index d592b9a531..35c484f46c 100644 --- a/src/main/java/org/bukkit/craftbukkit/metadata/EntityMetadataStore.java +++ b/src/main/java/org/bukkit/craftbukkit/metadata/EntityMetadataStore.java @@ -9,7 +9,8 @@ import org.bukkit.metadata.MetadataStoreBase; */ public class EntityMetadataStore extends MetadataStoreBase implements MetadataStore { /** - * Generates a unique metadata key for an {@link Entity} entity ID. + * Generates a unique metadata key for an {@link Entity} UUID. + * * @see MetadataStoreBase#disambiguate(Object, String) * @param entity the entity * @param metadataKey The name identifying the metadata value @@ -17,6 +18,6 @@ public class EntityMetadataStore extends MetadataStoreBase implements Me */ @Override protected String disambiguate(Entity entity, String metadataKey) { - return Integer.toString(entity.getEntityId()) + ":" + metadataKey; + return entity.getUniqueId().toString() + ":" + metadataKey; } }