Skip to content

Conversation

@RobotHanzo
Copy link

This PR allows dynamically-added servers to be applied resource pack if they qualify for the groups/servers configs

Copilot AI review requested due to automatic review settings January 20, 2026 17:04
@RobotHanzo RobotHanzo changed the title feat: Support runtime server addition feat: Support runtime server addition for Veloctiy proxy Jan 20, 2026
@RobotHanzo RobotHanzo changed the title feat: Support runtime server addition for Veloctiy proxy feat: Support runtime server addition for Velocity proxy Jan 20, 2026
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 PR adds support for dynamically registering servers at runtime and automatically applying appropriate resource packs to them based on configuration. The implementation introduces a new event listener for server registration events and refactors the resource pack registration logic to support both initial loading and dynamic server addition.

Changes:

  • Added ServerRegistrationListener to handle runtime server registration events
  • Refactored resource pack registration logic into reusable methods (getPackConfigs, processResourcePackConfig, createResourcePack, registerResourcePackForServer)
  • Updated build configuration to set Java 17 compatibility

Reviewed changes

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

File Description
velocity/src/main/java/com/convallyria/forcepack/velocity/listener/ServerRegistrationListener.java New event listener that registers resource packs for dynamically added servers matching group configurations
velocity/src/main/java/com/convallyria/forcepack/velocity/ForcePackVelocity.java Refactored resource pack registration logic into smaller, reusable methods to support both initial load and dynamic server addition; extracted common logic into helper methods
velocity/build.gradle.kts Reorganized task configuration and added Java 17 compatibility settings

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

Comment on lines +20 to +54
@Subscribe
public void onServerRegistered(ServerRegisteredEvent event) {
RegisteredServer registeredServer = event.registeredServer();
String serverName = registeredServer.getServerInfo().getName();
VelocityConfig groups = plugin.getConfig().getConfig("groups");

if (groups == null) return;

// Check if we already have packs for this server
boolean hasPack = plugin.getResourcePacks().stream()
.anyMatch(pack -> pack.getServer().equals(serverName));

if (hasPack) return;

for (String groupName : groups.getKeys()) {
VelocityConfig groupConfig = groups.getConfig(groupName);
List<String> servers = groupConfig.getStringList("servers");
boolean exact = groupConfig.getBoolean("exact-match");

boolean matches = exact ?
servers.contains(serverName) :
servers.stream().anyMatch(serverName::contains);

if (matches) {
plugin.log("New server %s matches group %s, adding resource packs...", serverName, groupName);

final Map<String, VelocityConfig> configs = plugin.getPackConfigs(groupConfig, groupName);

configs.forEach((id, config) -> {
if (config == null) return;
plugin.registerResourcePackForServer(config, id, groupName, "group", plugin.getConfig().getBoolean("verify-resource-packs"), serverName, null);
});
}
}
}
Copy link

Copilot AI Jan 20, 2026

Choose a reason for hiding this comment

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

The ServerRegistrationListener only checks the "groups" configuration but not the "servers" configuration. According to the PR description, dynamic servers should be applied resource packs if they qualify for "groups/servers configs", but this implementation only handles groups. If a dynamically added server should also match entries in the "servers" section of the config, that logic is missing.

Copilot uses AI. Check for mistakes.
Copy link
Author

Choose a reason for hiding this comment

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

@copilot open a new pull request to apply changes based on this feedback

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
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.

1 participant