Make getNonNullPlayer work with UUIDs too (#43)

* Make getNonNullPlayer work with UUIDs too

* allman
This commit is contained in:
Luna 2022-05-17 14:24:58 -03:00 committed by GitHub
parent 079ea1050e
commit ce9b70bc98
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -566,6 +566,16 @@ public abstract class PlexCommand extends Command implements PluginIdentifiableC
protected Player getNonNullPlayer(String name) protected Player getNonNullPlayer(String name)
{ {
try
{
UUID uuid = UUID.fromString(name);
return Bukkit.getPlayer(uuid);
}
catch (IllegalArgumentException ignored)
{
}
Player player = Bukkit.getPlayer(name); Player player = Bukkit.getPlayer(name);
if (player == null) if (player == null)
{ {