From bd2074a93ddf3ada4f698a4c795402d46a6cc6d5 Mon Sep 17 00:00:00 2001 From: Bukkit/Spigot Date: Thu, 14 Jun 2018 19:28:41 +0200 Subject: [PATCH] SPIGOT-227: Add entity persistent flag Non-persistent entities won't get saved when the chunk saves the entities. Entities that are passengers of a non-persistent entity won't get saved. Players won't save their vehicle, if the player is directly or indirectly riding a non-persistent entity. By: blablubbabc --- .../main/java/org/bukkit/entity/Entity.java | 30 +++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/paper-api/src/main/java/org/bukkit/entity/Entity.java b/paper-api/src/main/java/org/bukkit/entity/Entity.java index 9d96976d3..62bf70f56 100644 --- a/paper-api/src/main/java/org/bukkit/entity/Entity.java +++ b/paper-api/src/main/java/org/bukkit/entity/Entity.java @@ -189,6 +189,36 @@ public interface Entity extends Metadatable, CommandSender, Nameable { */ public Server getServer(); + /** + * Returns true if the entity gets persisted. + *

+ * By default all entities are persistent. An entity will also not get + * persisted, if it is riding an entity that is not persistent. + *

+ * The persistent flag has no effect on players. If a player is directly or + * indirectly riding a non-persistent entity, the vehicle at the root and + * all its passengers won't get persisted. + *

+ * This should not be confused with + * {@link LivingEntity#setRemoveWhenFarAway(boolean)} which controls + * despawning of living entities. + * + * @return true if this entity is persistent + * @deprecated draft API + */ + @Deprecated + public boolean isPersistent(); + + /** + * Sets whether or not the entity gets persisted. + * + * @param persistent the persistence status + * @see #isPersistent() + * @deprecated draft API + */ + @Deprecated + public void setPersistent(boolean persistent); + /** * Gets the primary passenger of a vehicle. For vehicles that could have * multiple passengers, this will only return the primary passenger.