Skip to content

Added case insensitive lookup (/p v <name>, etc) - #4902

Open
InstantlyMoist wants to merge 1 commit into
IntellectualSites:mainfrom
InstantlyMoist:feat/case-insensitive-lookup
Open

Added case insensitive lookup (/p v <name>, etc)#4902
InstantlyMoist wants to merge 1 commit into
IntellectualSites:mainfrom
InstantlyMoist:feat/case-insensitive-lookup

Conversation

@InstantlyMoist

Copy link
Copy Markdown

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

  • Make sure you are opening from a topic branch (/feature/fix/docs/ branch (right side)) and not your main branch.
  • Ensure that the pull request title represents the desired changelog entry.
  • New public fields and methods are annotated with @since TODO.
  • I read and followed the contribution guidelines.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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 UUIDPipeline to 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 NOCASE in 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();
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.

2 participants