Mirror von
https://github.com/PaperMC/Paper.git
synchronisiert 2024-11-16 13:00:06 +01:00
SPIGOT-1232: CraftServer.getPlayer(String name) returns incorrect results in some cases.
Use the absolute value of the delta to prevent negative values resulting in a better match.
Dieser Commit ist enthalten in:
Ursprung
12698ea5ad
Commit
f4c67a5c32
@ -397,7 +397,7 @@ public final class CraftServer implements Server {
|
||||
int delta = Integer.MAX_VALUE;
|
||||
for (Player player : getOnlinePlayers()) {
|
||||
if (player.getName().toLowerCase().startsWith(lowerName)) {
|
||||
int curDelta = player.getName().length() - lowerName.length();
|
||||
int curDelta = Math.abs(player.getName().length() - lowerName.length());
|
||||
if (curDelta < delta) {
|
||||
found = player;
|
||||
delta = curDelta;
|
||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren