✨ feat(ConnectionMessages): integrate connection message settings for…#117
✨ feat(ConnectionMessages): integrate connection message settings for…#117TheBjoRedCraft wants to merge 3 commits into
Conversation
… join/quit events
…debug print statement
There was a problem hiding this comment.
Pull request overview
This PR updates how join/quit (connection) messages are delivered in the Paper module by integrating per-player settings (via surf-settings-paper) and adjusts the Gradle wrapper/version metadata.
Changes:
- Replace join/quit message handling with manual per-recipient sending gated by a settings hook.
- Remove the connection-spike auto-suppression service/config options.
- Update Gradle wrapper scripts/properties and bump project version.
Reviewed changes
Copilot reviewed 9 out of 10 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| surf-chat-paper/src/main/kotlin/dev/slne/surf/chat/paper/service/ConnectionMessageService.kt | Removes the sliding-window rate-limit service for suppressing connection messages during spikes. |
| surf-chat-paper/src/main/kotlin/dev/slne/surf/chat/paper/listener/ConnectListener.kt | Sends join messages manually to players (intended to respect settings). |
| surf-chat-paper/src/main/kotlin/dev/slne/surf/chat/paper/listener/DisconnectListener.kt | Sends quit messages manually to players (intended to respect settings) and changes event priority. |
| surf-chat-paper/src/main/kotlin/dev/slne/surf/chat/paper/hook/SettingsHook.kt | Adds a settings accessor for connection messages. |
| surf-chat-paper/src/main/kotlin/dev/slne/surf/chat/paper/config/configs/ConnectionMessageConfig.kt | Simplifies connection message config to only an enabled flag (removes spike suppression options). |
| gradlew.bat | Modifies Windows wrapper script control flow and exit handling. |
| gradlew | Updates the referenced Gradle template URL in comments. |
| gradle/wrapper/gradle-wrapper.properties | Bumps Gradle distribution URL and adds retry-related properties. |
| gradle.properties | Bumps project version to 4.3.1. |
Comments suppressed due to low confidence (5)
surf-chat-paper/src/main/kotlin/dev/slne/surf/chat/paper/listener/ConnectListener.kt:58
- In the per-player loop, the settings check is using
event.player.uniqueId(the joining player) instead of the recipient's UUID. This makes the join message visible/hidden for everyone based on the joiner's setting. Also, when the settings hook is not installed, this branch currently sends no message at all; it should fall back to showing the message for everyone (or at least everyone except ignored players) when settings are unavailable.
forEachPlayer {
if (plugin.checkSettingsHook() && SettingsHook.hasConnectionMessagesEnabled(event.player.uniqueId)) {
it.sendText {
append(buildJoinMessage(event))
}
}
}
surf-chat-paper/src/main/kotlin/dev/slne/surf/chat/paper/listener/DisconnectListener.kt:30
- This handler sends a custom quit message but never clears
event.quitMessage(), so Paper will still broadcast the original quit message as well, resulting in duplicates. If you want to handle broadcasting manually per-recipient, setevent.quitMessage(null)(and choose an appropriate priority) to suppress the default broadcast.
@EventHandler(priority = EventPriority.MONITOR)
fun onDisconnect(event: PlayerQuitEvent) {
if (event.quitMessage() == null) {
return
}
if (!plugin.connectionMessageConfig.enabled) {
return
}
surf-chat-paper/src/main/kotlin/dev/slne/surf/chat/paper/listener/DisconnectListener.kt:47
- The settings-based visibility check is using
event.player.uniqueId(the quitting player) instead of the recipient's UUID, so the quit message will be shown/hidden for everyone based on the quitter's setting. Additionally, if the settings hook is not present, this branch currently sends nothing; it should fall back to showing the message for everyone when settings are unavailable.
} else {
forEachPlayer {
if (plugin.checkSettingsHook() && SettingsHook.hasConnectionMessagesEnabled(event.player.uniqueId)) {
it.sendText {
append(buildQuitMessage(event))
}
}
}
surf-chat-paper/src/main/kotlin/dev/slne/surf/chat/paper/hook/SettingsHook.kt:17
- This method logs to stdout on every settings lookup via
println, which is noisy in production and bypasses the plugin logger/configured log levels. Please remove this or switch to the plugin logger at an appropriate level (and avoid logging per-event/per-player lookups).
fun hasConnectionMessagesEnabled(playerUuid: UUID): Boolean =
SurfSettingsApi.getSettingValue(playerUuid, SettingKeys.CONNECTION_MESSAGES)
}
gradlew.bat:69
- Same issue here: after reporting an invalid JAVA_HOME, the script runs
"%COMSPEC%" /c exit 1but then continues into:execute. Replace with an exit that terminates the batch (exit /b 1) or jump to the script's exit label.
echo. 1>&2
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2
echo. 1>&2
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
echo location of your Java installation. 1>&2
"%COMSPEC%" /c exit 1
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
…mproved readability
… join/quit events