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
1 changed files with 10 additions and 0 deletions

View File

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