Skip to content

Commit

Permalink
Add /npc skin -s
Browse files Browse the repository at this point in the history
  • Loading branch information
fullwall committed Nov 4, 2023
1 parent 3395502 commit a42812c
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions main/src/main/java/net/citizensnpcs/commands/NPCCommands.java
Original file line number Diff line number Diff line change
Expand Up @@ -2849,6 +2849,17 @@ public void skin(final CommandContext args, final CommandSender sender, final NP
trait.setSkinPersistent(args.getString(1), args.getString(3), args.getString(2));
Messaging.sendTr(sender, Messages.SKIN_SET, npc.getName(), args.getString(1));
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 {
if (args.argsLength() != 2)
throw new CommandException(Messages.SKIN_REQUIRED);
Expand Down

0 comments on commit a42812c

Please sign in to comment.