Skip to content

Conversation

@TheBjoRedCraft
Copy link
Member

This pull request updates the project to use the new surf-maintenance naming and structure, removes legacy template code, and upgrades build tooling. The most important changes include renaming the project and modules, cleaning up obsolete files, and updating build configurations.

Project renaming and restructuring:

  • Renamed the project and all modules from surf-cloud-plugin-template to surf-maintenance in settings.gradle.kts, README.md, and related include statements. [1] [2]
  • Updated the module list in .idea/gradle.xml to reflect the new surf-maintenance modules.

Cleanup of legacy template files:

  • Removed old template-specific build scripts and code files, including several build.gradle.kts files and Kotlin source files for the deprecated template modules. [1] [2] [3] [4] [5] [6]

Build tooling and configuration updates:

  • Upgraded Gradle wrapper version from 8.12 to 8.14.3 in gradle/wrapper/gradle-wrapper.properties.
  • Updated project version to 1.21.10-1.0.0-SNAPSHOT in gradle.properties.
  • Added IDE configuration files for Kotlin and VCS settings: .idea/kotlinc.xml and .idea/vcs.xml. [1] [2]

@TheBjoRedCraft TheBjoRedCraft self-assigned this Nov 13, 2025
Copilot AI review requested due to automatic review settings November 13, 2025 17:36
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This pull request migrates the project from a template structure (surf-cloud-plugin-template) to a functional maintenance plugin (surf-maintenance), implementing maintenance mode functionality across Velocity proxy and Paper/server platforms, updating the version to 1.21.10, and upgrading the Gradle wrapper to 8.14.3.

  • Comprehensive renaming of all modules, packages, and references from template to maintenance
  • Implementation of maintenance mode features including server/group toggling, status checking, and player kick functionality
  • Upgrade of Gradle wrapper from 8.12 to 8.14.3 and project version to 1.21.10-1.0.0-SNAPSHOT

Reviewed Changes

Copilot reviewed 40 out of 53 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
settings.gradle.kts Updated root project name and module structure to reflect maintenance plugin (contains duplicate includes)
surf-maintenance-velocity/* New Velocity plugin implementation with maintenance service, listeners, and commands
surf-maintenance-server/* New server-side plugin with configuration management and packet handling
surf-maintenance-paper/* New Paper plugin bootstrap with maintenance mode tracking
surf-maintenance-core/* Core maintenance logic including Spring application, context holder, and network packets
surf-maintenance-api/* API layer defining internal maintenance interfaces and annotations
gradle.properties Updated version to 1.21.10-1.0.0-SNAPSHOT
gradle/wrapper/* Upgraded Gradle wrapper to 8.14.3
build.gradle.kts Updated surf-api-gradle-plugin dependency to 1.21.10+
README.md Updated title (description needs update)
.gitignore Simplified to modern IntelliJ IDEA structure
.idea/* Added IDE configuration files for Gradle modules, VCS, and Kotlin
surf-cloud-plugin-template-* Removed all legacy template files
Files not reviewed (3)
  • .idea/gradle.xml: Language not supported
  • .idea/kotlinc.xml: Language not supported
  • .idea/vcs.xml: Language not supported
Comments suppressed due to low confidence (1)

surf-maintenance-core/src/main/kotlin/dev/slne/surf/maintenance/MaintenanceApplication.kt:6

  • The class MaintenanceApplication is missing its body braces. While Kotlin allows empty classes to omit the body, this is inconsistent with the previous implementation which had explicit braces. Add {} after the class name for consistency and clarity.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copilot AI review requested due to automatic review settings November 13, 2025 17:46
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

Copilot reviewed 40 out of 53 changed files in this pull request and generated 1 comment.

Files not reviewed (3)
  • .idea/gradle.xml: Language not supported
  • .idea/kotlinc.xml: Language not supported
  • .idea/vcs.xml: Language not supported

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines 9 to 10
var maintenanceMotd: String = "<#6fa8dc> CASTCRAFTER.DE </#6fa8dc><gray>- </gray><red><b>WARTUNGSARBEITEN</red><gray> - </gray><white>[</white><light_purple>1.21.10</light_purple><white>]\n" +
"</white><#5ACFF5> Weitere Informationen findest du im Discord.",
Copy link

Copilot AI Nov 13, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The default maintenance MOTD contains a hardcoded server-specific name 'CASTCRAFTER.DE'. This should be a generic placeholder or template variable to make the configuration reusable across different server deployments without requiring code changes.

Copilot uses AI. Check for mistakes.
Copilot AI review requested due to automatic review settings December 20, 2025 20:41
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 33 out of 45 changed files in this pull request and generated 8 comments.

Files not reviewed (3)
  • .idea/gradle.xml: Language not supported
  • .idea/kotlinc.xml: Language not supported
  • .idea/vcs.xml: Language not supported

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

val pluginContainer: PluginContainer,
val suspendingPluginContainer: SuspendingPluginContainer
) {
var enabled: Boolean = true
Copy link

Copilot AI Dec 20, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The enabled property is accessed and modified from multiple places (command handlers, event listeners) without synchronization. In a multi-threaded Velocity environment, this could lead to race conditions where the state changes between check and use. Consider using an AtomicBoolean or proper synchronization for thread-safe access.

Copilot uses AI. Check for mistakes.
val pluginContainer: PluginContainer,
val suspendingPluginContainer: SuspendingPluginContainer
) {
var enabled: Boolean = true
Copy link

Copilot AI Dec 20, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The maintenance mode state is initialized as true by default, which means the server will start in maintenance mode. This could prevent legitimate access if the configuration file doesn't exist yet or fails to load. Consider initializing to false for safety, or ensure the config loads before this initialization.

Copilot uses AI. Check for mistakes.
})
})
}
} No newline at end of file
Copy link

Copilot AI Dec 20, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's trailing whitespace at the end of this line. This should be removed to maintain code cleanliness and avoid unnecessary whitespace in version control.

Copilot uses AI. Check for mistakes.
Comment on lines 12 to 28
fun onProxyPing(event: ProxyPingEvent) {
event.ping = event.ping.asBuilder().apply {
description(
MiniMessage.miniMessage().deserialize(configuration.config.maintenanceMotd)
)

version(
ServerPing.Version(
1,
LegacyComponentSerializer.legacySection().serialize(
MiniMessage.miniMessage()
.deserialize(configuration.config.versionMessage)
)
)
)
}.build()
}
Copy link

Copilot AI Dec 20, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The ProxyPingListener unconditionally modifies all ping responses regardless of whether maintenance mode is enabled. It should check plugin.enabled before applying the maintenance MOTD and version message, otherwise the maintenance message will always be shown even when maintenance is disabled.

Copilot uses AI. Check for mistakes.
<option name="linkedExternalProjectsSettings">
<GradleProjectSettings>
<option name="externalProjectPath" value="$PROJECT_DIR$" />
<option name="gradleHome" value="C:\Gradle\gradle-8.13" />
Copy link

Copilot AI Dec 20, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The gradleHome path is hardcoded to a Windows-specific absolute path "C:\Gradle\gradle-8.13". This IDE configuration file should not contain user-specific or platform-specific paths as it will not work for other developers or on different operating systems. Consider removing this line or ensuring it's in .gitignore.

Suggested change
<option name="gradleHome" value="C:\Gradle\gradle-8.13" />

Copilot uses AI. Check for mistakes.

val plugin get() = VelocityMain.instance
val proxy get() = plugin.proxy
val configuration = MaintenanceConfiguration() No newline at end of file
Copy link

Copilot AI Dec 20, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The global configuration is initialized before the plugin instance is set. Since configuration uses plugin.dataPath in its initialization (line 13 in MaintenanceConfiguration.kt), this may cause a lateinit access error because the assignment instance = this happens after configuration is initialized at the top level. The initialization order should be verified to ensure plugin is available when configuration is created.

Copilot uses AI. Check for mistakes.
Comment on lines 12 to 27
fun onPreConnect(event: LoginEvent) {
val player = event.player
if (player.hasPermission(MaintenancePermissions.MAINTENANCE_BYPASS)) {
return
}

event.result = ResultedEvent.ComponentResult.denied(buildText {
appendDisconnectMessage("DER SERVER BEFINDET SICH IM WARTUNGSMODUS", {
variableValue("Zurzeit werden Wartungen am Server durchgeführt.")
appendNewline()
spacer("Weitere Informationen findest du in unserem Discord.")
}, {
append(CommonComponents.RETRY_LATER_FOOTER)
})
})
}
Copy link

Copilot AI Dec 20, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The ProxyConnectionsListener unconditionally denies all connections for players without bypass permission, regardless of whether maintenance mode is enabled. It should check plugin.enabled before denying connections, otherwise all players without bypass permission will be kicked even when maintenance mode is disabled.

Copilot uses AI. Check for mistakes.
Copilot AI review requested due to automatic review settings December 20, 2025 21:05
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 33 out of 45 changed files in this pull request and generated 5 comments.

Files not reviewed (3)
  • .idea/gradle.xml: Language not supported
  • .idea/kotlinc.xml: Language not supported
  • .idea/vcs.xml: Language not supported
Comments suppressed due to low confidence (1)

surf-maintenance-velocity/src/main/kotlin/dev/slne/surf/maintenance/velocity/VelocityMain.kt:65

  • The configuration is initialized as a top-level property before the plugin instance is fully initialized. This creates a potential initialization order issue where 'configuration.config.enabled' is accessed in loadFromConfig() before the MaintenanceConfiguration constructor may have completed. Consider moving the configuration initialization into the VelocityMain constructor or a proper initialization method.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +8 to +11
<option name="gradleHome" value="C:\Gradle\gradle-8.13" />
<option name="gradleJvm" value="21" />
<option name="modules">
<set>
Copy link

Copilot AI Dec 20, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The gradleHome path is hardcoded to a Windows-specific path "C:\Gradle\gradle-8.13". This should be removed or changed to use the Gradle wrapper to ensure cross-platform compatibility. Additionally, this references Gradle 8.13 while the wrapper uses 8.14.3, creating a version mismatch.

Suggested change
<option name="gradleHome" value="C:\Gradle\gradle-8.13" />
<option name="gradleJvm" value="21" />
<option name="modules">
<set>
<option name="gradleJvm" value="21" />
<option name="modules">
<set>
<set>

Copilot uses AI. Check for mistakes.
})
})
}
} No newline at end of file
Copy link

Copilot AI Dec 20, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are trailing whitespace characters at the end of this line. Remove the trailing spaces to maintain code cleanliness.

Copilot uses AI. Check for mistakes.
var enabled: Boolean = false,
var maintenanceMotd: String = "<#6fa8dc> CASTCRAFTER.DE </#6fa8dc><gray>- </gray><red><b>WARTUNGSARBEITEN</b></red><gray> - </gray><white>[</white><light_purple>1.21.10</light_purple><white>]\n" +
"</white><#5ACFF5> Weitere Informationen findest du im Discord.",
var versionMessage: String = "ᴡᴀʀᴛᴜɴɢѕᴀʀʙᴇɪᴛᴇɴ"
Copy link

Copilot AI Dec 20, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The word "Wartungѕarbeiten" contains a Cyrillic character 'ѕ' (U+0455) instead of the Latin 's'. This should be corrected to use the standard Latin alphabet: "Wartungsarbeiten".

Copilot uses AI. Check for mistakes.
Comment on lines +25 to +28
appendDisconnectMessage("DER SERVER BEFINDET SICH IM WARTUNGSMODUS", {
variableValue("Zurzeit werden Wartungen am Server durchgeführt.")
appendNewline()
spacer("Weitere Informationen findest du in unserem Discord.")
Copy link

Copilot AI Dec 20, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The disconnect message contains hardcoded German text that should be moved to the configuration file for better maintainability and internationalization support. Consider adding these messages to MaintenanceConfig alongside the existing maintenanceMotd and versionMessage fields.

Copilot uses AI. Check for mistakes.
Copilot AI review requested due to automatic review settings December 26, 2025 21:56
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 37 out of 50 changed files in this pull request and generated 3 comments.

Files not reviewed (3)
  • .idea/gradle.xml: Language not supported
  • .idea/kotlinc.xml: Language not supported
  • .idea/vcs.xml: Language not supported

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

val eventManager: EventManager,
suspendingPluginContainer: SuspendingPluginContainer
) {
var enabled: Boolean = true
Copy link

Copilot AI Dec 26, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The property enabled is initialized to true by default, but the intended behavior based on the configuration loading logic in loadFromConfig() is to load this value from the config file. This creates an inconsistency where maintenance mode would be active by default before the configuration is loaded during initialization. Consider initializing this to false or to the default value from the configuration class to ensure consistent behavior.

Copilot uses AI. Check for mistakes.
Comment on lines +24 to +31
event.result = ResultedEvent.ComponentResult.denied(buildText {
appendDisconnectMessage("DER SERVER BEFINDET SICH IM WARTUNGSMODUS", {
variableValue("Zurzeit werden Wartungen am Server durchgeführt.")
appendNewline()
spacer("Weitere Informationen findest du in unserem Discord.")
}, {
append(CommonComponents.RETRY_LATER_FOOTER)
})
Copy link

Copilot AI Dec 26, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The disconnect and kick messages contain hardcoded German text that appears to be server-specific (mentions "unserem Discord"). For a reusable maintenance plugin, these messages should be configurable to allow different servers to customize them according to their needs.

Copilot uses AI. Check for mistakes.
Comment on lines +119 to +126
it.disconnect(buildText {
appendDisconnectMessage("DER SERVER BEFINDET SICH IM WARTUNGSMODUS", {
variableValue("Es werden nun Wartungen am Server durchgeführt.")
appendNewline()
spacer("Weitere Informationen findest du in unserem Discord.")
}, {
append(CommonComponents.RETRY_LATER_FOOTER)
})
Copy link

Copilot AI Dec 26, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The disconnect message in the kick command contains hardcoded German text that should be configurable, similar to other user-facing messages in the plugin.

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants