-
-
Notifications
You must be signed in to change notification settings - Fork 904
Support multi-line MOTDs natively via a string list in the config #1825
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: dev/3.0.0
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,41 @@ | ||
| /* | ||
| * Copyright (C) 2026 Velocity Contributors | ||
| * | ||
| * This program is free software: you can redistribute it and/or modify | ||
| * it under the terms of the GNU General Public License as published by | ||
| * the Free Software Foundation, either version 3 of the License, or | ||
| * (at your option) any later version. | ||
| * | ||
| * This program is distributed in the hope that it will be useful, | ||
| * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| * GNU General Public License for more details. | ||
| * | ||
| * You should have received a copy of the GNU General Public License | ||
| * along with this program. If not, see <https://www.gnu.org/licenses/>. | ||
| */ | ||
|
|
||
| package com.velocitypowered.proxy.config.migration; | ||
|
|
||
| import com.electronwill.nightconfig.core.file.CommentedFileConfig; | ||
| import java.util.List; | ||
| import org.apache.logging.log4j.Logger; | ||
|
|
||
| /** | ||
| * Migrates a single string motd to a multiline (string list) motd. | ||
| */ | ||
| public final class MotdMultilineMigration implements ConfigurationMigration { | ||
|
|
||
| @Override | ||
| public boolean shouldMigrate(CommentedFileConfig config) { | ||
| return configVersion(config) < 2.9; | ||
| } | ||
|
|
||
| @Override | ||
| public void migrate(CommentedFileConfig config, Logger logger) { | ||
| String motd = config.get("motd"); | ||
| config.set("motd", List.of(motd)); | ||
|
|
||
| config.set("config-version", "2.9"); | ||
|
Comment on lines
+36
to
+39
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Since the migration will only happen once, it might be a good idea to migrate the use of
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I agree, though it'll be best-effort and we probably dont want to match every case. Splitting on those 3 delimiters seems reasonable (case insensitive) but afaik minimessage also supports self-closing tags (?), possibly spaces between the tag name and the self-closing |
||
| } | ||
| } | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it would be a good idea to add a validation check in case someone tries to add more than 2 lines