Help with CitizensAPI (Setting skins, hands, etc.)

Discussion in 'Spigot Plugin Development' started by Demeng7215, Feb 15, 2018.

  1. Hey guys,
    I was just wondering, how do I set the skin and the items the NPC is holding/wearing?
    I am making a plugin that spawns a NPC when the player dies. The NPC should have the exact armor, weapon, and skin as the dead player.
    This is what I have right now (I haven't gotten very far...):
    Code (Java):
    public class NPCUtils {

        public static void spawnNPC(Player p) {

            NPC npc = CitizensAPI.getNPCRegistry().createNPC(EntityType.PLAYER, p.getDisplayName());
    I had a quick peek at the JavaDocs, but I couldn't find anything.
    Any help would be appreciated. Thanks!
  2. Fot setting the skin just cast the NPC#getEntity to SkinnableEntity and set the skin from there

    also, the method is just NPC#data now

    As for setting the hands, it's an entity so use NPC#getEntity and set it in the normal way, I'll check if the API handles this though
  3. I can't find the SkinnableEntity class.
    If this is this difficult, the plugin is obviously not thoroughly documented.
    I would rather just create a custom NPC myself and use NMS stuff.
  4. Pretty sure it got replaced with:
    Code (Text):;
  5. Yes, I found it :)
    But I can't cast to SkinnableEntity. The class does not exist.
  6. Is your Citizens library up to date? I'm using it as well and mine is in:
    Code (Text):
  7. I don't have that, can I see your pom?
  8. I'll try.

    Still don't have it.
    Code (Text):
    #10 Demeng7215, Feb 15, 2018
    Last edited: Feb 17, 2018
  9. That's really weird, I literally have the exact same Maven setup... You can simply cast it to a living entity, if the entity is an instanceof it:
    Code (Text):
    if (entity instanceof LivingEntity) {
        LivingEntity living = (LivingEntity) entity;
  10. Hmm...
    I am so confused right now. What do you have for your <repositories>? I have or something like that.
  11. BUMP, why can't I find SkinnableEntity?
  12. I added the actual citizens jar as dependency, not through any repo (I'm probably an idiot for missing the fact that there's an online repo?).
  13. Oh, so the problem is on their side with the Maven repo. I'll try adding the .jar manually.
  14. @fullwall Do you know anything about this?
  15. SkinnableEntity isn't part of the API but of the plugin itself, change the artifact id to just "citizens" and it should work.

Share This Page