diff options
| author | Sho Sakuma <me@m1sk9.dev> | 2026-03-17 22:14:51 +0900 |
|---|---|---|
| committer | Sho Sakuma <me@m1sk9.dev> | 2026-03-17 22:19:24 +0900 |
| commit | a9ecc3170b3a647773775ffb19bf73e518fcb5d6 (patch) | |
| tree | 2bc45bc6798c395f373b03807dc1fae0a1b901ba | |
| parent | 2bc07010e32a2c1313d44d7d313d2317531971ff (diff) | |
| download | LunaticChat-a9ecc3170b3a647773775ffb19bf73e518fcb5d6.tar.gz LunaticChat-a9ecc3170b3a647773775ffb19bf73e518fcb5d6.tar.bz2 LunaticChat-a9ecc3170b3a647773775ffb19bf73e518fcb5d6.zip | |
fix: delay channel login notification to avoid being buried by other join messages
| -rw-r--r-- | CHANGELOG.md | 3 | ||||
| -rw-r--r-- | platform-paper/src/main/kotlin/dev/m1sk9/lunaticChat/paper/listener/PlayerPresenceListener.kt | 9 |
2 files changed, 9 insertions, 3 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md index fe764ea..ec0507c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -25,7 +25,8 @@ #### Feature Improvements - Optimization of internal logic. -- We have improved the notification message that appears when you login to the server while in a channel. +- We have improved the notification message that appears when you log in to the server while in a channel. +- Added a delay to prevent other plugins from interfering with login notifications. ### v0.10.1 diff --git a/platform-paper/src/main/kotlin/dev/m1sk9/lunaticChat/paper/listener/PlayerPresenceListener.kt b/platform-paper/src/main/kotlin/dev/m1sk9/lunaticChat/paper/listener/PlayerPresenceListener.kt index 9ed3cb2..03d49e2 100644 --- a/platform-paper/src/main/kotlin/dev/m1sk9/lunaticChat/paper/listener/PlayerPresenceListener.kt +++ b/platform-paper/src/main/kotlin/dev/m1sk9/lunaticChat/paper/listener/PlayerPresenceListener.kt @@ -12,6 +12,7 @@ import org.bukkit.event.EventHandler import org.bukkit.event.Listener import org.bukkit.event.player.PlayerJoinEvent import org.bukkit.event.player.PlayerQuitEvent +import java.util.concurrent.TimeUnit import java.util.concurrent.atomic.AtomicBoolean class PlayerPresenceListener( @@ -34,7 +35,7 @@ class PlayerPresenceListener( ) } - // Send channel notification if in a channel + // Send channel notification if in a channel (delayed to avoid being buried by other plugins' join messages) channelManager?.let { manager -> val context = manager.getPlayerChannelContext(player.uniqueId) context?.let { @@ -48,7 +49,11 @@ class PlayerPresenceListener( ).clickEvent( ClickEvent.runCommand("/lc channel status"), ) - player.sendMessage(notification) + lunaticChat.server.asyncScheduler.runDelayed(lunaticChat, { _ -> + if (player.isOnline) { + player.sendMessage(notification) + } + }, 5, TimeUnit.SECONDS) } } } |
