Skip to content

Commit

Permalink
/npc owner [name] supported again
Browse files Browse the repository at this point in the history
  • Loading branch information
fullwall committed Oct 13, 2021
1 parent 4ecf090 commit 25f341e
Showing 1 changed file with 7 additions and 1 deletion.
Expand Up @@ -1430,7 +1430,13 @@ public void owner(CommandContext args, CommandSender sender, NPC npc) throws Com
Messaging.sendTr(sender, Messages.NPC_OWNER, npc.getName(), ownerTrait.getOwnerId());
return;
}
UUID uuid = args.getString(1).equals("SERVER") ? null : UUID.fromString(args.getString(1));
OfflinePlayer p = Bukkit.getOfflinePlayer(args.getString(1));
UUID uuid;
if (p != null) {
uuid = p.getUniqueId();
} else {
uuid = args.getString(1).equals("SERVER") ? null : UUID.fromString(args.getString(1));
}
if (ownerTrait.isOwnedBy(uuid))
throw new CommandException(Messages.ALREADY_OWNER, uuid, npc.getName());
ownerTrait.setOwner(uuid);
Expand Down

0 comments on commit 25f341e

Please sign in to comment.