Added case insensitive lookup (/p v <name>, etc) - #4902
Open
InstantlyMoist wants to merge 1 commit into
Open
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This pull request adjusts UUID/username resolution so that username-based lookups (e.g. /p v <name>) behave case-insensitively by default, while preserving case-sensitive behavior in the specific offline-mode scenario where username casing affects derived UUIDs.
Changes:
- Introduces a shared
UUIDService.usernamesCaseSensitive()helper to centralize the “must be case-sensitive” decision. - Updates
UUIDPipelineto compare/remove pending username requests using a case-aware equality check and to deduplicate requests under that same rule. - Makes cache and SQLite-backed username lookups case-insensitive when appropriate (normalized cache keys;
COLLATE NOCASEin SQLite).
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| Core/src/main/java/com/plotsquared/core/uuid/UUIDService.java | Adds a central helper for deciding when username matching must remain case-sensitive. |
| Core/src/main/java/com/plotsquared/core/uuid/UUIDPipeline.java | Uses case-aware username equality for request dedupe and completion/removal in the pipeline. |
| Core/src/main/java/com/plotsquared/core/uuid/CacheUUIDService.java | Normalizes username cache keys when case-insensitive matching is allowed. |
| Bukkit/src/main/java/com/plotsquared/bukkit/uuid/SQLiteUUIDService.java | Uses a case-aware SQLite query and returns the stored username casing from the DB. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+360
to
+366
| final List<String> remainingRequests = new ArrayList<>(requests.size()); | ||
| for (final String request : requests) { | ||
| if (remainingRequests.stream().noneMatch(existing -> usernamesEqual(existing, request))) { | ||
| remainingRequests.add(request); | ||
| } | ||
| } | ||
| final int totalRequests = remainingRequests.size(); |
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.
Overview
Description
This pull request changes the logic behind username lookups, specifically ensuring commands like '/p v ' can behave as case-insensitive commands. With a larger playerbase remembering exact case-sensitive usernames is near impossible, this pull request tries to mitigate that.
I'm not sure if there are any other implications to this change, feel free to let me know.
Submitter Checklist
@since TODO.