Include the following in your plugin's gradle project:
repositories {
maven("https://repo.fancyplugins.de/releases")
...
}
dependencies {
implementation("de.oliver:FancyNpcs:version")
...
}
You find the current version in the README.md
file.
Npc npc = FancyNpcs.getInstance().getNpcManager().getNpc(npcName);
Npc npc = new Npc(npcName, location);
npc.create();
npc.spawnForAll();
npc.removeForAll();
npc.moveForAll(location);
SkinFetcher skin = new SkinFetcher(UUIDFetcher.getUUID(playerName).toString());
npc.updateSkin(skin);
npc.updateDisplayName(displayName);
npc.addEquipment(equipmentSlot, CraftItemStack.asNMSCopy(item));
npc.removeForAll();
npc.create();
npc.spawnForAll();
npc.setServerCommand(command);
npc.setPlayerCommand(command);
npc.updateShowInTab(shouldShowInTab);
npc.updateGlowing(shouldGlow);
ChatFormatting color = ChatFormatting.getByName("color name");
npc.updateGlowingColor(color);
ChatFormatting color = ChatFormatting.getByName("color name");
npc.updateGlowingColor(ChatFormatting.RED);
npc.setTurnToPlayer(shouldTurnToPlayer);
npc.moveForAll(npc.getLocation()); // initially refreshing (optional)
npc.setOnClick(player -> {
// do something with the player
});
Is fired when a new NPC is being created.
Contains the player who created the NPC and the NPC object.
Is fired when a NPC is being deleted.
Contains the player who removed the NPC and the NPC object.
Is fired when a NPC is being modified.
Contains the player who modified the NPC, the modification and the NPC object.
Is fired when a player interacts with a NPC.
Contains the player who interacted, the NPC and all actions.
Is fired when a NPC is being spawned. This can happen when a player joins, a player switches the world or the NPC is
being modified.
Contains the NPC that is being spawned and the player to whom the spawn packets are being sent.