Add /npc skin -s
This commit is contained in:
parent
33955027ff
commit
a42812c4c4
|
@ -2849,6 +2849,17 @@ public class NPCCommands {
|
||||||
trait.setSkinPersistent(args.getString(1), args.getString(3), args.getString(2));
|
trait.setSkinPersistent(args.getString(1), args.getString(3), args.getString(2));
|
||||||
Messaging.sendTr(sender, Messages.SKIN_SET, npc.getName(), args.getString(1));
|
Messaging.sendTr(sender, Messages.SKIN_SET, npc.getName(), args.getString(1));
|
||||||
return;
|
return;
|
||||||
|
} else if (args.hasFlag('s') && npc.getEntity() instanceof Player) {
|
||||||
|
ItemStack is = new ItemStack(Material.PLAYER_HEAD);
|
||||||
|
SkullMeta sm = (SkullMeta) is.getItemMeta();
|
||||||
|
NMS.setProfile(sm, NMS.getProfile((Player) npc.getEntity()));
|
||||||
|
is.setItemMeta(sm);
|
||||||
|
if (sender instanceof Player && ((Player) sender).getInventory().addItem(is).isEmpty()) {
|
||||||
|
} else if (args.getSenderLocation() != null) {
|
||||||
|
args.getSenderLocation().getWorld().dropItem(args.getSenderLocation(), is);
|
||||||
|
} else {
|
||||||
|
throw new ServerCommandException();
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
if (args.argsLength() != 2)
|
if (args.argsLength() != 2)
|
||||||
throw new CommandException(Messages.SKIN_REQUIRED);
|
throw new CommandException(Messages.SKIN_REQUIRED);
|
||||||
|
|
Loading…
Reference in New Issue