Created
March 27, 2021 05:11
-
-
Save Magnum97/9b4e3f9ba89a6d3575143b4cbe7d1158 to your computer and use it in GitHub Desktop.
Minecraft UUID fetcher
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import org.bukkit.Bukkit; | |
import org.bukkit.OfflinePlayer; | |
import java.util.Optional; | |
import java.util.UUID; | |
public class FetchUUID { | |
public FetchUUID() { | |
} | |
public static Optional<UUID> getID(String user) { | |
OfflinePlayer p = Bukkit.getOfflinePlayer(user); | |
return Optional.of(p.getUniqueId()); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
A safe UUID fetcher - it will never return null but it might be empty. My typical use is: