13
0
geforkt von Mirrors/Paper

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.
Dieser Commit ist enthalten in:
feildmaster 2013-02-06 16:32:19 -06:00
Ursprung efe8e9a7f5
Commit 2e99e02094

Datei anzeigen

@ -9,7 +9,8 @@ import org.bukkit.metadata.MetadataStoreBase;
*/
public class EntityMetadataStore extends MetadataStoreBase<Entity> implements MetadataStore<Entity> {
/**
* 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<Entity> implements Me
*/
@Override
protected String disambiguate(Entity entity, String metadataKey) {
return Integer.toString(entity.getEntityId()) + ":" + metadataKey;
return entity.getUniqueId().toString() + ":" + metadataKey;
}
}