feat(config): load velocity.yml at startup and reload

Route VelocityServer's startup and reload paths through
ConfigurationLoader.loadConfiguration(), so the proxy now reads velocity.yml
(migrating an existing velocity.toml on first start) instead of reading
velocity.toml directly. LegacyConfigurationLoader is retained behind the
migration path.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
Shane Freeder
2026-06-17 21:31:32 +01:00
parent 64e603c7e0
commit cf4580f159

View File

@@ -46,7 +46,7 @@ import com.velocitypowered.proxy.command.builtin.SendCommand;
import com.velocitypowered.proxy.command.builtin.ServerCommand;
import com.velocitypowered.proxy.command.builtin.ShutdownCommand;
import com.velocitypowered.proxy.command.builtin.VelocityCommand;
import com.velocitypowered.proxy.config.LegacyConfigurationLoader;
import com.velocitypowered.proxy.config.ConfigurationLoader;
import com.velocitypowered.proxy.config.VelocityConfiguration;
import com.velocitypowered.proxy.connection.client.ConnectedPlayer;
import com.velocitypowered.proxy.connection.player.resourcepack.VelocityResourcePackInfo;
@@ -403,8 +403,7 @@ public class VelocityServer implements ProxyServer, ForwardingAudience {
@SuppressFBWarnings("DM_EXIT")
private void doStartupConfigLoad() {
try {
Path configPath = Path.of("velocity.toml");
configuration = LegacyConfigurationLoader.read(configPath);
configuration = ConfigurationLoader.loadConfiguration();
if (!configuration.validate()) {
logger.error("Your configuration is invalid. Velocity will not start up until the errors "
@@ -415,7 +414,7 @@ public class VelocityServer implements ProxyServer, ForwardingAudience {
commandManager.setAnnounceProxyCommands(configuration.isAnnounceProxyCommands());
} catch (Exception e) {
logger.error("Unable to read/load/save your velocity.toml. The server will shut down.", e);
logger.error("Unable to read/load/save your velocity.yml. The server will shut down.", e);
LogManager.shutdown();
System.exit(1);
}
@@ -478,11 +477,10 @@ public class VelocityServer implements ProxyServer, ForwardingAudience {
* Reloads the proxy's configuration.
*
* @return {@code true} if successful, {@code false} if we can't read the configuration
* @throws IOException if we can't read {@code velocity.toml}
* @throws IOException if we can't read {@code velocity.yml}
*/
public boolean reloadConfiguration() throws IOException {
Path configPath = Path.of("velocity.toml");
VelocityConfiguration newConfiguration = LegacyConfigurationLoader.read(configPath);
VelocityConfiguration newConfiguration = ConfigurationLoader.loadConfiguration();
if (!newConfiguration.validate()) {
return false;