diff --git a/common/src/main/java/net/william278/huskhomes/api/BaseHuskHomesAPI.java b/common/src/main/java/net/william278/huskhomes/api/BaseHuskHomesAPI.java index c8892a89..ae46db6e 100644 --- a/common/src/main/java/net/william278/huskhomes/api/BaseHuskHomesAPI.java +++ b/common/src/main/java/net/william278/huskhomes/api/BaseHuskHomesAPI.java @@ -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 this server. + * @since 4.8.3 + */ + @NotNull + public Optional 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. *