Skip to content
This repository was archived by the owner on May 18, 2020. It is now read-only.

NPC API

jaime29010 edited this page Nov 13, 2016 · 3 revisions
NPC npc = new NPC("identifier"); //If no identifier is passed a random one will be assigned
npc.setName("§aThis is a test"); //Set the display name (max. length 48)
npc.setLocation(new Location(0,0,0));//Set the location
npc.addListener(new InteractListener() {
        @Override
        public void rightClick(Player player) {
            player.sendMessage("rightClick");
        }
                               
        @Override
        public void leftClick(Player player) {
            player.sendMessage("leftClick");
        }
});
npc.setPing(2000); //Set the ping shown in tab
npc.setTabListed(true); //Set it to true if you want the NPC to be shown in tab
npc.setPlayerListName(ChatSerializer.fromMessage("§7[NCP] §bEntityID: §a"+c.getEntityID())); //Set the name shown in tab

npc.getEquipment().setItemInHand(new dev.wolveringer.BungeeUtil.item.Item(Material.DIAMOND_SWORD)); //Set the item in hand
npc.getEquipment().setHelmet(new dev.wolveringer.BungeeUtil.item.Item(Material.LEATHER_HELMET)); //Set the helmet

Player player = ...
npc.setVisible(player, true); //If the second argument is false then the NPC won't be visible to the player.

Clone this wiki locally