use of net.citizensnpcs.npc.skin.SkinnableEntity in project Citizens2 by CitizensDev.
the class HumanController method remove.
@Override
public void remove() {
Player entity = getBukkitEntity();
if (entity != null) {
NMS.removeFromWorld(entity);
SkinnableEntity npc = entity instanceof SkinnableEntity ? (SkinnableEntity) entity : null;
npc.getSkinTracker().onRemoveNPC();
}
super.remove();
}
use of net.citizensnpcs.npc.skin.SkinnableEntity in project Citizens2 by CitizensDev.
the class NPCCommands method skin.
@Command(aliases = { "npc" }, usage = "skin (-c -l(atest)) [name]", desc = "Sets an NPC's skin name. Use -l to set the skin to always update to the latest", modifiers = { "skin" }, min = 1, max = 2, flags = "cl", permission = "citizens.npc.skin")
@Requirements(types = EntityType.PLAYER, selected = true, ownership = true)
public void skin(final CommandContext args, final CommandSender sender, final NPC npc) throws CommandException {
String skinName = npc.getName();
if (args.hasFlag('c')) {
npc.data().remove(NPC.PLAYER_SKIN_UUID_METADATA);
} else {
if (args.argsLength() != 2)
throw new CommandException(Messages.SKIN_REQUIRED);
npc.data().setPersistent(NPC.PLAYER_SKIN_UUID_METADATA, args.getString(1));
if (args.hasFlag('l')) {
npc.data().setPersistent(NPC.PLAYER_SKIN_USE_LATEST, true);
}
skinName = args.getString(1);
}
Messaging.sendTr(sender, Messages.SKIN_SET, npc.getName(), skinName);
if (npc.isSpawned()) {
SkinnableEntity skinnable = npc.getEntity() instanceof SkinnableEntity ? (SkinnableEntity) npc.getEntity() : null;
if (skinnable != null) {
skinnable.setSkinName(skinName, true);
}
}
}
use of net.citizensnpcs.npc.skin.SkinnableEntity in project Citizens2 by CitizensDev.
the class HumanController method remove.
@Override
public void remove() {
Player entity = getBukkitEntity();
if (entity != null) {
NMS.removeFromWorld(entity);
SkinnableEntity npc = entity instanceof SkinnableEntity ? (SkinnableEntity) entity : null;
npc.getSkinTracker().onRemoveNPC();
}
super.remove();
}
use of net.citizensnpcs.npc.skin.SkinnableEntity in project Citizens2 by CitizensDev.
the class SkinLayers method setFlags.
private void setFlags() {
if (!npc.isSpawned())
return;
SkinnableEntity skinnable = npc.getEntity() instanceof SkinnableEntity ? (SkinnableEntity) npc.getEntity() : null;
if (skinnable == null)
return;
int flags = 0xFF;
for (Layer layer : Layer.values()) {
if (!isVisible(layer)) {
flags &= ~layer.flag;
}
}
skinnable.setSkinFlags((byte) flags);
}
use of net.citizensnpcs.npc.skin.SkinnableEntity in project Citizens2 by CitizensDev.
the class HumanController method remove.
@Override
public void remove() {
Player entity = getBukkitEntity();
if (entity != null) {
NMS.removeFromWorld(entity);
SkinnableEntity npc = entity instanceof SkinnableEntity ? (SkinnableEntity) entity : null;
npc.getSkinTracker().onRemoveNPC();
}
super.remove();
}
Aggregations