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
a3a9180c51
commit
4226c7f7a4
2 changed files with 40 additions and 0 deletions
|
@ -1374,6 +1374,27 @@ public final class Bukkit {
|
||||||
return server.getOfflinePlayer(name);
|
return server.getOfflinePlayer(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Paper start
|
||||||
|
/**
|
||||||
|
* Gets the player by the given name, regardless if they are offline or
|
||||||
|
* online.
|
||||||
|
* <p>
|
||||||
|
* This will not make a web request to get the UUID for the given name,
|
||||||
|
* thus this method will not block. However this method will return
|
||||||
|
* {@code null} if the player is not cached.
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @param name the name of the player to retrieve
|
||||||
|
* @return an offline player if cached, {@code null} otherwise
|
||||||
|
* @see #getOfflinePlayer(String)
|
||||||
|
* @see #getOfflinePlayer(java.util.UUID)
|
||||||
|
*/
|
||||||
|
@Nullable
|
||||||
|
public static OfflinePlayer getOfflinePlayerIfCached(@NotNull String name) {
|
||||||
|
return server.getOfflinePlayerIfCached(name);
|
||||||
|
}
|
||||||
|
// Paper end
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the player by the given UUID, regardless if they are offline or
|
* Gets the player by the given UUID, regardless if they are offline or
|
||||||
* online.
|
* online.
|
||||||
|
|
|
@ -1161,6 +1161,25 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
|
||||||
@NotNull
|
@NotNull
|
||||||
public OfflinePlayer getOfflinePlayer(@NotNull String name);
|
public OfflinePlayer getOfflinePlayer(@NotNull String name);
|
||||||
|
|
||||||
|
// Paper start
|
||||||
|
/**
|
||||||
|
* Gets the player by the given name, regardless if they are offline or
|
||||||
|
* online.
|
||||||
|
* <p>
|
||||||
|
* This will not make a web request to get the UUID for the given name,
|
||||||
|
* thus this method will not block. However this method will return
|
||||||
|
* {@code null} if the player is not cached.
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @param name the name of the player to retrieve
|
||||||
|
* @return an offline player if cached, {@code null} otherwise
|
||||||
|
* @see #getOfflinePlayer(String)
|
||||||
|
* @see #getOfflinePlayer(java.util.UUID)
|
||||||
|
*/
|
||||||
|
@Nullable
|
||||||
|
public OfflinePlayer getOfflinePlayerIfCached(@NotNull String name);
|
||||||
|
// Paper end
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the player by the given UUID, regardless if they are offline or
|
* Gets the player by the given UUID, regardless if they are offline or
|
||||||
* online.
|
* online.
|
||||||
|
|
Loading…
Reference in a new issue