Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
public class DomainInputResolver implements Callable<DefaultDomain> {

private static final Pattern GROUP_PATTERN = Pattern.compile("(?i)^[G]:(.+)$");
private static final int MAX_PLAYER_NAME_LENGTH = 16;

/**
* The policy for locating users.
Expand Down Expand Up @@ -119,9 +120,14 @@ public DefaultDomain call() throws UnresolvedNamesException {
}
}

if (!namesToQuery.isEmpty()) {
// Paper rejects longer names with an exception, so leave them unresolved.
List<String> validNames = namesToQuery.stream()
.filter(name -> name.length() <= MAX_PLAYER_NAME_LENGTH)
.toList();

if (!validNames.isEmpty()) {
try {
for (Profile profile : profileService.findAllByName(namesToQuery)) {
for (Profile profile : profileService.findAllByName(validNames)) {
namesToQuery.remove(profile.getName().toLowerCase());
domain.addPlayer(profile.getUniqueId());
}
Expand Down