Skip to content

Commit

Permalink
feat: ensure anvil-renaming parses permissions
Browse files Browse the repository at this point in the history
  • Loading branch information
Boy0000 committed Dec 19, 2023
1 parent 23bcb95 commit 21aa3af
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ const val ZERO_WIDTH = "\u200B"
val ping = chatty.config.ping
val getAlternativePingSounds: List<String> =
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<String> =
if ("*" in ping.enabledChannels || "all" in ping.enabledChannels) getAllChannelNames() else ping.enabledChannels
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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))
}
}
}

0 comments on commit 21aa3af

Please sign in to comment.