NPC Shops

NPC Shops

Add-on

The NPC Shops add-on, with placing NPCs that open a shop, their engines and villager trades.

View as Markdown ·

On this page

#Information

The NPC Shops add-on puts a shop on an NPC. Players right-click the NPC to open the shop, with the same permission and currency checks as opening it by command. The NPC can be any entity, and a villager opens a vanilla trade menu instead of the shop menu.

Editor (NPC Shops)

#Installation

To install this add-on, drag and drop the jar file into the PhoenixShop/addons folder, then restart your server.

Without the add-on, its editor screens can still be browsed from the main editor as a locked preview. Nothing in the preview can be changed.

circle-info

The add-on is free, but it requires the Premium edition. On Lite it does not load and the console says why.

circle-exclamation

Without any NPC plugin, NPCs are plain mobs. Citizens, FancyNpcs, ModelEngine and BetterModel add their own engines. An NPC set to an engine that is not installed is not spawned.

#Files

File What it holds
Plugin database Every placed NPC. An old npcs.yml is moved there on first start and renamed npcs.yml.migrated.
PhoenixShop/translations/translations.<lang>.yml The add-on messages, under the npc section.

#Commands

Command Description
/shopnpc create <shop> [engine] [entity] Places an NPC for a shop on the block you are looking at.
/shopnpc remove Removes the NPC you are looking at.
/shopnpc list Lists every placed NPC with its shop, engine and position. An NPC whose shop no longer exists is marked as missing.

/npcshop works as an alias. The commands have to be run by a player.

#Permissions

Permission What it allows
phoenixshop.npcshops.manage Creating, removing and listing shop NPCs.

Using an NPC needs no permission of its own. A shop with a permission only opens for players who have it.

#Creating an NPC

#Placing an NPC

Editor > NPC Shops > New NPC asks for a shop, then spawns the NPC where you stand, facing the way you face. It uses Citizens if it is installed, then FancyNpcs, and otherwise a plain villager.

NPC Shops (New NPC)

The same can be done with a command. Look at the block the NPC should stand on, within 6 blocks, and run:

/shopnpc create <shop> [engine] [entity]
Argument What it does
shop The identifier of the shop the NPC opens.
engine citizens, fancynpcs, entity, modelengine or bettermodel. Citizens when left out.
entity Any living entity type, such as villager or zombie. A player when left out, or a villager on the entity engine.

The NPC spawns on top of that block, facing you, with the shop's display name above it. It is named after the shop with a number, such as shop-1.

#Engines

Engine Requires What it draws
Entity Nothing A real mob with its AI turned off. Any living entity.
Citizens Citizens Any living entity, or a player with a skin.
FancyNpcs FancyNpcs Any living entity, or a player with a skin.
Model Engine ModelEngine 4.0.9+ A model, with an idle and an interaction animation.
BetterModel BetterModel A model, with an idle and an interaction animation.

Edit NPC (Engine)

The add-on keeps its own record of every NPC and spawns them again on each start, so they are not saved in the Citizens or FancyNpcs files. Changes made to them through those plugins are lost on the next restart.

An NPC that is moved or pushed is put back in place.

#Editing an NPC

Editor > NPC Shops lists every NPC, and marks the ones whose shop is gone or whose engine is not installed. Every change respawns the NPC straight away.

NPC Shops (rotating-1)

Field What it does
Shop The shop the NPC opens.
Nameplate The lines shown above the NPC.
Engine Swaps between the installed engines. Its settings are listed below.
Scale Makes the NPC bigger or smaller, 0.1 to 10.
Glow A coloured outline around the NPC.
Position Click a block: the NPC moves on top of it, facing you.

#Engine settings

Setting Engines What it does
Entity Type Entity, Citizens, FancyNpcs What the NPC is. A villager opens the trade menu.
Skin Citizens, FancyNpcs The skin of a player NPC, looked up from a Mineskin link, a player name or a UUID.
Look Close All Turns the NPC towards the nearest player within 8 blocks.
Model Model Engine, BetterModel The model the NPC shows. Until one is picked, nothing spawns.
Idle Animation Model Engine, BetterModel Loops while nobody is clicking.
Interaction Animation Model Engine, BetterModel Plays once each time a player clicks the NPC.

#Removing an NPC

Delete it in the editor, or look at the block the NPC stands on and run /shopnpc remove.

Edit NPC (Delete)

circle-info

Deleting the shop an NPC points at does not remove the NPC. Clicking it tells the player the shop is gone, and /shopnpc list marks it as missing.

#Villager Trades

An NPC with the villager entity type opens the vanilla trade menu instead of the shop menu. Every item of the shop that can be bought is listed as a trade, with the price that player pays, sales and discounts included, added to the bottom of its lore.

Clicking the result buys one purchase of the item, charged in the shop's currency like any other purchase. The cost slot shows a paper named after the currency, since money cannot be a vanilla trade item. The player cannot move items into the menu.

#What is left out

Left out Why
Selling A villager only sells to the player. Items can only be sold through the shop menu or the sell commands.
Disabled categories and items They are hidden from the trade list, as in the shop menu.

When the shop has nothing that can be bought, the menu does not open and the player is told.

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