diff --git a/chatty-paper/src/main/kotlin/com/mineinabyss/chatty/helpers/ChatHelpers.kt b/chatty-paper/src/main/kotlin/com/mineinabyss/chatty/helpers/ChatHelpers.kt index 58ed208..dc5ee97 100644 --- a/chatty-paper/src/main/kotlin/com/mineinabyss/chatty/helpers/ChatHelpers.kt +++ b/chatty-paper/src/main/kotlin/com/mineinabyss/chatty/helpers/ChatHelpers.kt @@ -29,7 +29,7 @@ const val ZERO_WIDTH = "\u200B" val ping = chatty.config.ping val getAlternativePingSounds: List = if ("*" in ping.alternativePingSounds || "all" in ping.alternativePingSounds) - Sound.values().map { it.key.toString() }.toList() else ping.alternativePingSounds + Sound.entries.map { it.key.toString() }.toList() else ping.alternativePingSounds val getPingEnabledChannels: List = if ("*" in ping.enabledChannels || "all" in ping.enabledChannels) getAllChannelNames() else ping.enabledChannels diff --git a/chatty-paper/src/main/kotlin/com/mineinabyss/chatty/listeners/PlayerListener.kt b/chatty-paper/src/main/kotlin/com/mineinabyss/chatty/listeners/PlayerListener.kt index de92e6d..52f89cd 100644 --- a/chatty-paper/src/main/kotlin/com/mineinabyss/chatty/listeners/PlayerListener.kt +++ b/chatty-paper/src/main/kotlin/com/mineinabyss/chatty/listeners/PlayerListener.kt @@ -5,11 +5,14 @@ import com.mineinabyss.chatty.components.ChannelData import com.mineinabyss.chatty.components.HideJoinLeave import com.mineinabyss.chatty.helpers.* import com.mineinabyss.geary.papermc.tracking.entities.toGeary +import com.mineinabyss.idofront.items.editItemMeta import com.mineinabyss.idofront.textcomponents.serialize +import org.bukkit.entity.Player import org.bukkit.event.EventHandler import org.bukkit.event.EventPriority import org.bukkit.event.Listener import org.bukkit.event.block.SignChangeEvent +import org.bukkit.event.inventory.PrepareAnvilEvent import org.bukkit.event.player.PlayerEditBookEvent import org.bukkit.event.player.PlayerJoinEvent import org.bukkit.event.player.PlayerQuitEvent @@ -59,4 +62,11 @@ class PlayerListener : Listener { line(index, line.serialize().parseTags(player)) } } + + @EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true) + fun PrepareAnvilEvent.onAnvilRename() { + result = result?.editItemMeta { + displayName(displayName()?.parseTags(viewers.first() as? Player)) + } + } }