From 66ee0ba701012a80e9c6ea25cb183aad20dd952f Mon Sep 17 00:00:00 2001 From: Logan Gorence Date: Mon, 24 Jan 2022 17:22:46 -0800 Subject: [PATCH] Persist all entities that have been leashed. --- .../foundation/core/features/gameplay/GameplayFeature.kt | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/foundation-core/src/main/kotlin/cloud/kubelet/foundation/core/features/gameplay/GameplayFeature.kt b/foundation-core/src/main/kotlin/cloud/kubelet/foundation/core/features/gameplay/GameplayFeature.kt index ec35df1..56901c1 100644 --- a/foundation-core/src/main/kotlin/cloud/kubelet/foundation/core/features/gameplay/GameplayFeature.kt +++ b/foundation-core/src/main/kotlin/cloud/kubelet/foundation/core/features/gameplay/GameplayFeature.kt @@ -69,8 +69,10 @@ class GameplayFeature : Feature() { // Something to do with Bukkit, leashes must happen after the event. Bukkit.getScheduler().runTask(plugin) { -> // If the entity is already leashed, don't do anything. - if (livingEntity.isLeashed - ) return@runTask + if (livingEntity.isLeashed) return@runTask + + // Interacted with the entity, don't despawn it. + livingEntity.removeWhenFarAway = false val leashSuccess = livingEntity.setLeashHolder(event.player)