Groups, Clone & Undo

Groups, Clone & Undo

View as Markdown ·

On this page

circle-info

The group an NPC is in is saved in its own file in the npcs folder. The list of groups is saved in groups.yml.

#Groups

A group is a name you give to as many NPCs as you like, such as event or spawn. A group name follows the id rules. An NPC is in one group at a time, and putting it in another moves it.

Make groups in Editor > Groups, then pick one in the NPC's editor with Group. Opening a group shows its NPCs, where each one can be edited, teleported to or taken out of the group, enables or disables all of them at once, renames the group and puts more NPCs in it. Right-click a group in the list to delete it. Deleting a group keeps its NPCs and takes them out of it. The same from commands:

Command Does
/pnpc group create <group> Creates a group.
/pnpc group delete <group> Deletes the group.
/pnpc group add <group> <id> Puts an NPC in the group.
/pnpc group remove <group> <id> Takes an NPC out of the group.
/pnpc group list [group] Lists the groups, or the NPCs of one.
/pnpc group <enable|disable> <group> Turns every NPC of the group on or off, and says how many changed.

A disabled NPC keeps its settings, see Enabled. Switching a group works well from other plugins' commands or schedules, such as showing event NPCs only during an event. The group filter of the NPC list shows only the NPCs of one group.

NPC files from older versions that listed tags use the first tag as the group.

#Clone

/pnpc clone <id> <new-id> or Clone on the NPC's editor makes a copy of an NPC where you stand. The copy gets everything of the original except its id and location, including actions, dialogue, limits, hidden players and group. Changing the original later does not change the copy.

#Undo

/pnpc undo puts back an NPC the way it was before your last change, from the editor or a command. Each admin has their own history of the last 20 changes, kept until the server restarts or the plugin reloads.

Deleting an NPC counts as a change too: undo brings it back as it was, where it was. Its use counts start again from zero.

#Selectors

Every command that takes an NPC id also takes a selector, and runs once for each NPC it finds.

Selector Picks
@n The NPC nearest to you.
@n[group=shop] The nearest NPC in the group. group=!shop picks NPCs outside it.
@n[distance=..10] NPCs up to 10 blocks away. 5..10 and 5.. work too.
@n[type=villager] NPCs of that type.
@n[limit=3] Up to 3 NPCs, nearest first. Without a limit, @n picks one.
@selected The NPC you last edited or used in a command.

Filters combine, such as /pnpc edit @n[group=event,distance=..20,limit=5] set enabled false. teleport, tphere, movehere, clone, edit, info, moveto, skull and debug only use the first NPC found. @n needs a player; @selected works from the console too.

My Cart
Spider

Your cart is empty

Looks like the spiders padded through here. Pick a plugin and it will show up here. Continue shopping