mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-30 16:19:03 +01:00
Add getOfflinePlayerIfCached(String)
This commit is contained in:
parent
69fa242c6a
commit
30de939553
1 changed files with 22 additions and 0 deletions
|
@ -1968,6 +1968,28 @@ public final class CraftServer implements Server {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Paper start
|
||||||
|
@Override
|
||||||
|
@Nullable
|
||||||
|
public OfflinePlayer getOfflinePlayerIfCached(String name) {
|
||||||
|
Preconditions.checkArgument(name != null, "Name cannot be null");
|
||||||
|
Preconditions.checkArgument(!name.isEmpty(), "Name cannot be empty");
|
||||||
|
|
||||||
|
OfflinePlayer result = getPlayerExact(name);
|
||||||
|
if (result == null) {
|
||||||
|
GameProfile profile = console.getProfileCache().getProfileIfCached(name);
|
||||||
|
|
||||||
|
if (profile != null) {
|
||||||
|
result = getOfflinePlayer(profile);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
offlinePlayers.remove(result.getUniqueId());
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
// Paper end
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public OfflinePlayer getOfflinePlayer(UUID id) {
|
public OfflinePlayer getOfflinePlayer(UUID id) {
|
||||||
Preconditions.checkArgument(id != null, "UUID id cannot be null");
|
Preconditions.checkArgument(id != null, "UUID id cannot be null");
|
||||||
|
|
Loading…
Reference in a new issue