-
Notifications
You must be signed in to change notification settings - Fork 0
Support servers config in ServerRegistrationListener #1
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
Conversation
Co-authored-by: RobotHanzo <36107150+RobotHanzo@users.noreply.github.com>
Co-authored-by: RobotHanzo <36107150+RobotHanzo@users.noreply.github.com>
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.
Pull request overview
Updates ServerRegistrationListener to apply resource pack configuration for dynamically-registered servers by checking direct servers.<serverName> entries (in addition to existing groups matching).
Changes:
- Add direct lookup under
servers.<serverName>when a server registers dynamically - Keep existing
groupspattern/exact matching as a fallback path - Return early after a direct
serversmatch (as implemented)
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| VelocityConfig servers = plugin.getConfig().getConfig("servers"); | ||
| if (servers != null) { | ||
| VelocityConfig serverConfig = servers.getConfig(serverName); |
Copilot
AI
Jan 31, 2026
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.
VelocityConfig servers is declared here, but later in the method (inside the groups loop) there is also a List<String> servers local variable. Java does not allow redeclaring a local variable name in an inner scope, so this will fail to compile. Rename one of them (e.g., serversConfig for the config section, or serverPatterns for the list).
| VelocityConfig servers = plugin.getConfig().getConfig("servers"); | |
| if (servers != null) { | |
| VelocityConfig serverConfig = servers.getConfig(serverName); | |
| VelocityConfig serversConfig = plugin.getConfig().getConfig("servers"); | |
| if (serversConfig != null) { | |
| VelocityConfig serverConfig = serversConfig.getConfig(serverName); |
| plugin.registerResourcePackForServer(config, id, serverName, "server", plugin.getConfig().getBoolean("verify-resource-packs"), serverName, null); | ||
| }); | ||
| return; | ||
| } |
Copilot
AI
Jan 31, 2026
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.
The return; after handling a servers.<serverName> match prevents groups configs from ever being applied to dynamically-registered servers that also have a direct servers entry. ForcePackVelocity.loadResourcePacks() loads both groups and servers (it calls addResourcePacks(..., "groups") and then addResourcePacks(..., "servers")), so this introduces inconsistent behavior between startup/reload and dynamic registration. Consider removing the early return (register server packs, then still check groups), or update the initialization path if servers is meant to override groups.
Addresses feedback from PR SamB440#118.
ServerRegistrationListeneronly checkedgroupsconfig for dynamically-registered servers, missing directserversconfig entries.Changes
serversconfig first - Direct server name lookup before pattern matchinggroupsconfig - Maintains existing pattern-based matching behaviorserverssectionBehavior
When a server registers dynamically:
servers.<server-name>for direct config match → apply packs and returngroups.*for pattern matches (exact-match or contains) → apply packsThis aligns with how
loadResourcePacks()processes both config sections during plugin initialization.Warning
Firewall rules blocked me from connecting to one or more addresses (expand for details)
I tried to connect to the following addresses, but was blocked by firewall rules:
repo.spongepowered.org/usr/lib/jvm/temurin-17-jdk-amd64/bin/java /usr/lib/jvm/temurin-17-jdk-amd64/bin/java --add-opens=java.base/java.lang=ALL-UNNAMED --add-opens=java.base/java.lang.invoke=ALL-UNNAMED --add-opens=java.base/java.util=ALL-UNNAMED --add-opens=java.prefs/java.util.prefs=ALL-UNNAMED --add-exports=jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED --add-exports=jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED --add-opens=java.base/java.util=ALL-UNNAMED --add-opens=java.prefs/java.util.prefs=ALL-UNNAMED --add-opens=java.base/java.nio.charset=ALL-UNNAMED --add-opens=java.base/java.net=ALL-UNNAMED --add-opens=java.base/java.util.concurrent.atomic=ALL-UNNAMED --add-opens=java.xml/javax.xml.namespace=ALL-UNNAMED -XX:MaxMetaspaceSize=384m -XX:+HeapDumpOnOutOfMemoryError -Xms256m -Xmx512m -Dfile.encoding=UTF-8 -Duser.country -Duser.language=en(dns block)If you need me to access, download, or install something from one of these locations, you can either:
Original prompt
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.