mirror of
https://github.com/darksaid98/HuskHomes.git
synced 2026-12-02 06:28:49 +00:00
feat: add API method for OnlineUser in common module
This commit is contained in:
1 file changed
+16
@@ -87,6 +87,22 @@ public class BaseHuskHomesAPI {
|
||||
return plugin.getServerName();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get an {@link OnlineUser} by their UUID
|
||||
*
|
||||
* @param uuid the UUID of the user to get
|
||||
* @return The {@link OnlineUser} wrapped in an optional, if they are online on <i>this</i> server.
|
||||
* @since 4.8.3
|
||||
*/
|
||||
@NotNull
|
||||
public Optional<OnlineUser> getOnlineUser(@NotNull UUID uuid) {
|
||||
try {
|
||||
return Optional.of(plugin.getOnlineUser(uuid));
|
||||
} catch (IllegalArgumentException e) {
|
||||
return Optional.empty();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns saved {@link SavedUser} for the given player's account {@link UUID}, if they exist.
|
||||
*
|
||||
|
||||
Reference in new issue
Block a user