Repository navigation
Conversation
darbyjack
pushed a commit
that referenced
this pull request
Oct 22, 2026
The coverage inventory is contended between the open pull requests, and the header and the per-section counts have to be the ones the merged file will have whatever order they land in: 160 tests across 14 spec files, 18 in the invite codes section, 21 in the guild lifecycle and membership sections and 8 in the admin commands section. The rows for the tests that #848 and #851 add are in the tables here, since neither of those pull requests touches this file, and the rows for #849's tests were already here. Every test in the merged suite is listed once. The membership section heading said 19 while the spec file holds 20 tests, which is where the 21 comes from.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The bug
/guild createdecides whether a name is free by reducing it to the text a player sees and comparing without regard to case.GuildInputValidator.isNameTakendid that, so a guild called "Raiders" already occupied "raiders" and "&cRaiders" too.The lookup every other command goes through used a different rule.
GuildHandler.getGuild(String)stripped the colour codes from the stored name and compared the result with the typed name exactly:So the server refused to create "raiders" and then said there was no guild called "raiders". A guild whose name carries colour codes could not be found under those codes either. Every command that names a guild resolves its argument through the ACF guild context, which calls this method:
/guild accept,/guild decline,/guild ally,/guild war challenge, and the/guild admincommands that take a guild name.Reproduced before the fix, in
GuildNameLookupTest, where 5 of 7 cases failed:The fix
GuildNameMatcheris a new utility inme.glaremasters.guilds.utils. It holds the one rule: translate the alternate colour codes, strip every colour code, compare without regard to case.GuildInputValidator.isNameTakenandGuildHandler.getGuild(String)both use it, so the two agree about which names are the same name.getGuild(String)resolves in two steps. A guild whose visible name is exactly the typed one wins, which keeps a server that already holds "Raiders" and "raiders" behaving as it did. Failing that, a single guild that matches without regard to case is returned.Two guilds whose visible names differ only by case or only by colour are a state duplicate detection prevents, but legacy or hand-edited data can still hold. Such a name is ambiguous. The old code took whichever of the two the map happened to yield first. The name now resolves to nothing, and the conflict is logged with the ids of the guilds involved. The command answers with the plugin's existing "That Guild does not exist!" message, since saying more would mean a new key in every language file.
GuildHandler.checkGuildNames(String)compared the raw stored name with the typed name, so it disagreed with the lookup for every guild whose name carries colour codes. It uses the same rule now.The tab completion needed no change. It offers the visible name of each guild, and the lookup now matches that name back to the guild it came from.
Tests
GuildNameLookupTest, new, 7 cases: a guild stored as "Raiders" is found by "raiders" and by "RAIDERS"; a guild stored as "§cRaiders" is found by "Raiders", by "§cRaiders" and by "&cRaiders"; an unknown name resolves to nothing; duplicate detection and the lookup agree on the same name; two guilds that differ only by case or only by colour do not resolve by an ambiguous name, while each still answers to the name it carries;checkGuildNamesagrees with the lookup.GuildInputValidatorTest, one case added: duplicate detection andGuildNameMatcherapply the same rule to a list of spellings.membership.spec.ts, one test added: an invited player accepts a guild whose name is typed in a different case.admin.spec.ts, one test added: an admin command finds its guild when the name is typed in a different case.Both end-to-end tests fail against the code as it was before this change and pass with it. The membership one never receives "You joined guild 'E2E000kCaseTest' successfully", and the admin one is answered with "That Guild does not exist!".
Results
Compatibility
No new dependency and no new API. The change is Java code that compiles to Java 11 bytecode, and the 1.8.8 legacy probe still compiles. No
Materialconstant was added, so nothing there needed an XSeries swap.No config key, default or stored format changed. Guild names are stored exactly as before, and only the way a name is matched changed.
GuildHandler.getGuild(String)keeps its signature and still returns null when there is no such guild. TheUUIDandOfflinePlayeroverloads are untouched.Limitations
getNameByIdand the invite list still show the stored name with its colour codes, which is what they showed before.