diff --git a/core/src/main/kotlin/com/mineinabyss/emojy/EmojyListener.kt b/core/src/main/kotlin/com/mineinabyss/emojy/EmojyListener.kt index 4903bf5..8a8309a 100644 --- a/core/src/main/kotlin/com/mineinabyss/emojy/EmojyListener.kt +++ b/core/src/main/kotlin/com/mineinabyss/emojy/EmojyListener.kt @@ -34,7 +34,7 @@ class EmojyListener : Listener { @EventHandler fun PrepareAnvilEvent.onAnvil() { val inventory = inventory as? AnvilInventory ?: return - val displayName = (inventory.renameText?.miniMsg() ?: inventory.firstItem?.itemMeta?.displayName())?.transform(inventory.viewers.first() as? Player, false) + val displayName = (inventory.renameText?.miniMsg() ?: inventory.firstItem?.itemMeta?.displayName())?.transform(inventory.viewers.firstOrNull() as? Player, false) result = result?.editItemMeta { displayName(displayName) }