feat: add API method for OnlineUser in common module

This commit is contained in:
William committed 2024-12-13 16:39:38 +00:00
1 parent 54560a1f02
commit d952ef7703
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.
*