diff --git a/eco-core/core-plugin/src/main/kotlin/com/willfp/ecopets/pets/PetDisplay.kt b/eco-core/core-plugin/src/main/kotlin/com/willfp/ecopets/pets/PetDisplay.kt index c50126d..f291752 100644 --- a/eco-core/core-plugin/src/main/kotlin/com/willfp/ecopets/pets/PetDisplay.kt +++ b/eco-core/core-plugin/src/main/kotlin/com/willfp/ecopets/pets/PetDisplay.kt @@ -10,7 +10,7 @@ import org.bukkit.entity.Player import org.bukkit.event.EventHandler import org.bukkit.event.Listener import org.bukkit.event.player.PlayerQuitEvent -import java.util.* +import java.util.UUID import kotlin.math.PI import kotlin.math.abs @@ -44,10 +44,18 @@ class PetDisplay( location.y += NumberUtils.fastSin(tick / (2 * PI) * 0.5) * 0.15 - try { - stand.teleport(location) - } catch (_: Exception) { - + if (location.world != null) { + try { + stand.teleport(location) + } catch (_: Throwable) { + /* + For anyone reading - I KNOW TO NEVER CATCH THROWABLE + but NMS is really stupid and does this sometimes: + java.lang.Throwable: null + at net.minecraft.world.entity.Entity.teleportTo(Entity.java:3336) ~[paper-1.19.2.jar:git-Paper-186] + so I guess that's what has to be done. Not sure what the actual cause is. + */ + } } if (!pet.entityTexture.contains(":")) { diff --git a/gradle.properties b/gradle.properties index d21c87c..7c96bf9 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,4 +1,4 @@ #libreforge-updater #Mon Oct 10 21:05:04 BST 2022 -version=1.50.1 +version=1.50.2 plugin-name=EcoPets