Shopkeepers

Shopkeeper

This plugin allows you to set up custom villager shopkeepers that sell exactly what you want them to sell and for what price. You can set up admin shops, which have infinite supply, and you can also set up player shops, which pull supply from a chest. It will also prevent any other trades with non-shopkeeper villagers if you want it to.

Installation and Configuration

Simply download the file and put it in your plugins folder. When the plugin first loads, it will create a config.yml file in the ShopKeepers folder. There are several configuration options you can customize. See the Configuration Options page for more information.

Note that this plugin is created to work with CraftBukkit. Bukkit does not have an API for some of the things necessary to make this plugin work. This means that other server software (Tekkit, Forge, etc) will not work with this plugin.

Create a Shopkeeper

To create an admin shopkeeper, just use the command /shopkeeper while looking at a block. A villager will be spawned at the block you are looking at.

To create a player shopkeeper, you will need a villager spawn egg (or whatever item is defined in the config file). You must not be in creative mode when creating a shopkeeper. First, you can right-click in air (not on a block) to cycle through the different shop types (normal, book, buying, and trading). You can also hold sneak while right-clicking to cycle through the shopkeeper types (villager, sign, and witch). Then, right click on a chest to select it, then right click on another block to place the shopkeeper at that location.

You can also create a player shopkeeper by using the /shopkeeper command while looking at a chest, but this only allows you to create a normal shopkeeper and will make the villager stand on top of the chest.

Every shopkeeper villager's AI will be overwritten so it doesn't wander away, and it is invulnerable to damage. It will also teleport back to its spawn location after a few seconds if it gets bumped out of place.

Setting Up Trades (Admin Shopkeepers)

To modify the villager's trades, right-click on him while sneaking. This will open a regular-looking chest inventory, but it has a couple special icons on the right.

http://nisovin.com/shopkeepers/shopkeeper_admin_editor.png

Each column in the inventory represents a trade option. The top item is the first cost, the middle item is the second cost, and the bottom item is the item to sell. The top and bottom items are required, but the middle item (the second cost) is optional. You can simply drag your recipes into the inventory. You can input up to eight recipes on a shopkeeper.

Once you are done editing the trades, simply close the inventory window to save. Now just right click on the villager (or other shopkeeper type), and see the trades! It should work with any items, including enchanted items and written books.

To set the shop's name, click the anvil then type the name into the chat. You can cycle through the villager professions by clicking on the wool block. If you want to delete the shopkeeper, you can click on the fire (be careful, there is no undo!).

Setting Up Costs (Player Shopkeepers)

First, the player will need to place items they wish to sell in the chest. In order to sell written books you must use the special book shopkeeper (in this case, you must put the written books you want to sell in the chest, then stock it with book & quill items).

http://nisovin.com/shopkeepers/shopkeeper_player_chest.png

Then, right-click on the villager while sneaking. This will open up the shopkeeper editor. The top row will show the various item types for sale from the chest. The bottom row will show the costs of those items. If no cost has been specified yet, there will be a slimeball. To modify the cost, left-click the emerald (or slimeball) to increase the cost, and right-click to decrease the cost. You can also hold shift while clicking to modify the cost by 10 at a time. You can adjust the item quantity in the same way, with left and right clicks.

http://nisovin.com/shopkeepers/shopkeeper_player_editor.png

Once the costs are all set up, just close the window to save. You can also click the anvil to rename the shopkeeper, click wool block to cycle through the villager professions, and click the fire to delete the shopkeeper.

When a player purchases an item from a player shopkeeper, the item in the chest will be removed and the emeralds used to purchase will be added. Due to limitations in the game, the trades will not update even when a player purchases the final stack of a certain item. However, if a player attempts to make a purchase when the chest is out, the trade will fail and the trade inventory window will close automatically.

For the special "buying" shopkeepers, you must place at least one of each type of item you want to sell in the chest, as well as plenty of currency. Then when you open the editor interface, it works the same except the items are on bottom and the currency is on top. A buying shopkeeper can only buy basic items, not enchanted items, books, or maps.

Special Commands

Reload

You can use the "/shopkeepers reload" command to reload the plugin. This will save any changes and reload the config file.

Debug

Use "/shopkeepers debug" to toggle debug mode. This allows you to see sometimes useful information in the console.

Transfer

Use "/shopkeepers transfer playername" to transfer ownership of a shopkeeper to another player. You must use this command while looking at a chest owned by a shopkeeper.

Hire

Use "/shopkeepers setforhire" to set a shopkeeper as for hire. Hold the hire cost in your hand, and look at a chest owned by a shopkeeper when you use this command. This will allow another player to pay the hire cost and gain ownership of that shopkeeper.

Permissions

PermissionDescriptionDefault
shopkeeper.adminCreate and modify admin shops.op-only
shopkeeper.bypassModify player shops that you do not own.op-only
shopkeeper.reloadUse the /shopkeeper reload command.op-only
shopkeeper.transferTransfer a shopkeeper to another player.op-only
shopkeeper.setforhireSets a shopkeeper to be up for hire.op-only
shopkeeper.hireAllows a player to hire a shopkeeper.everyone
shopkeeper.player.normalCreate normal player shops.everyone
shopkeeper.player.bookCreate book-selling player shops.everyone
shopkeeper.player.buyCreate buying player shops.everyone
shopkeeper.player.tradeCreate item trading player shops.everyone
shopkeeper.playerAll player shops.
shopkeeper.villagerCreate a villager shopkeeper.everyone
shopkeeper.signCreate a sign shopkeeper.everyone
shopkeeper.witchCreate a witch shopkeeper.everyone
shopkeeper.creeperCreate a creeper shopkeeper.everyone
shopkeeper.maxshops.<option>Check out the configuration options for this.none

Video

A good tutorial provided by TrowbridgeHD/RyanDT13

Another video by elloc72zomb/elloc72

Frequently Asked Questions

Something's gone wrong! I have a problem! Will you please help me?

Submitting a ticket is the best way to get help or report a problem with the plugin. Please provide the version you are using of both Craftbukkit and Shopkeepers, and thoroughly describe the problem you are having, including step-by-step instructions on how to reproduce the problem.

My shop isn't working! Why can't I buy stuff from my shop?

You cannot buy items from your own player shop. This restriction is in place to help reduce duplication bugs if and when they arise. It doesn't completely prevent them, but it helps keep them from being obvious.

Why don't colors seem to be working? They seem to turn into weird characters!

You should try setting your file-encoding option in the config file. Set it to "UTF-8".

Will you add support for currency plugins (integrate with Vault)?

No, sorry. The trade interface is really designed for item trades only. For example, the purchase item doesn't even show up until you've put in the item cost required. As an alternative, you could use another plugin to create some sort of bank, where you would buy and sell emeralds for virtual currency. In this way players could deposit and withdraw emeralds for shopping. You may also be interested in the plugin GoldIsMoney.

How can I get shopkeepers to spawn when WorldGuard blocks them?

WorldGuard has a configuration option to specify which mob types it blocks from spawning. The option is under mobs, called block-creature-spawn. If it is empty, you will need to add in all of the creature types you wish to block, making sure you leave out Villager. Another option is to set WorldGuard's block-plugin-spawning option (also under mobs) to false, but this may have other side effects.

Can I have more than eight trades on a shopkeeper?

I feel like eight trades is plenty to have on one shopkeeper, and that it would be best to set up multiple shopkeepers if you need to have more items for sale. However, if you insist, it is possible, just more work.

For player shopkeepers, it's actually fairly easy. The cost setup will show the first eight item types in the chest. So, just set up the costs for those items, then rearrange the items in the chest. You will then be able to set up the costs for the other items.

For admin shopkeepers, the only way is to modify the save.yml file and add the options manually. Please note that I do not support doing this. If you try to do this and mess up your save file, you'll have to fix it on your own. In my opinion, you shouldn't do this anyway. It is a lot more user-friendly to have multiple shopkeepers with various categories of items (probably indicated by nearby signs).

Can you instead just rebalance the regular villager trade options, or allow admins to configure what trades are possible with regular villagers?

There is another plugin that offers villager trade rebalancing as well as custom trade options, you can find it here: http://dev.bukkit.org/server-mods/rebalance-villagers/

Oh wise Nisovin, how can I create a successful economy?

I've actually put a bit of thought into this. You can read my opinions here.

Can I see the source code?

Certainly, here it is.

Recent Changes

Complete change log

You must login to post a comment. Don't have an account? Register to get one!

  • Avatar of blablubbabc blablubbabc Nov 23, 2014 at 01:17 UTC - 0 likes

    @Yomsthebomb: Go

    As you can read above the villager trade interface is really only fitting well for item trades. There are other shop plugins out there which fit better if you want shops which exchange items for money.

  • Avatar of Yomsthebomb Yomsthebomb Nov 22, 2014 at 22:42 UTC - 0 likes

    @blablubbabc: Go

    Hey Im looking into your plugin for my server InfectedRPG. Im just wondering (because its not clearly available) if economy can be used as a tradable price. Like have a shopkeeper sell a diamond sword for like 100 tokens (My servers currency). Is this possible? if so, how?

    EDIT: Derp just read your post about this. I would highly recommend that you add economic support. It would make me and many other server owners use your plugin.

    Last edited Nov 22, 2014 by Yomsthebomb
  • Avatar of blablubbabc blablubbabc Nov 21, 2014 at 20:04 UTC - 0 likes

    v1.28 Alpha for MC 1.7.8+

    This is an alpha version:
    While this version seems to work quite well already, there might be some new bugs being introduced due to some internal changes.
    Also there are some issues which still need to be resolved (hopefully no breaking issues though..) and some new features to test out.

    • Reordered the shop types so the normal player shop is by default selected instead of the book shop.
    • The selection of shop type and shop object (mobs, sign) are no longer reset after shop creation, but are kept stored until the player quits or the plugin is reloaded.
    • Added a debug message to inventory clicks.
    • Fixed: The previous version did not proplery block shift-click buying on player shops anymore. This should now be fixed again.


    Also please see the changelog of these previous versions!

  • Avatar of Dillzzzzz Dillzzzzz Nov 21, 2014 at 13:31 UTC - 0 likes

    @andyhan123: Go

    This is impossible with craftbukkit as they're an entity and you can't go through them

    Havoc OP PvP Banner

  • Avatar of blablubbabc blablubbabc Nov 21, 2014 at 02:38 UTC - 0 likes

    v1.27 Alpha for MC 1.7.8+

    This is an alpha version:
    While this version seems to work quite well already, there might be some new bugs being introduced due to some internal changes.
    Also there are some issues which still need to be resolved (hopefully no breaking issues though..) and some new features to test out.

    • Fixed: The first (top-left) slot in a player's inventory was not properly working in editor mode of player shopkeepers.
    • Fixed: The custom item comparison in the last version did skip item meta comparison.
    • Improved the debug output when trading fails: it now displays the reason why the invovled items are not considered similar.
    • Fixed: When the trading slot was clicked and the cursor would not be able to hold the result of the trade (because the cursor already hold an item of different type or the result would exceed the max stack size) minecraft cancles the trade. Shopkeepers however wasn't aware of this and removed and added the invovled items to and from a player's shop chest regardlessly. We now skip our trade-handling as well in this situation: you cannot trade if the cursor cannot hold the resulting items.


    Also please see the changelog of these previous versions!

    Last edited Nov 21, 2014 by blablubbabc
  • Avatar of Premx Premx Nov 20, 2014 at 19:18 UTC - 0 likes

    Great Plugin!

    greetings Premx

    BFAK:90948197,e7bf5163b5bbf2442eabeb7fc20691aec551838d8a70871598fae1173369106b premx_logo

  • Avatar of blablubbabc blablubbabc Nov 20, 2014 at 07:40 UTC - 0 likes

    v1.26 Alpha for MC 1.7.8+

    This is an alpha version:
    While this version seems to work quite well already, there might be some new bugs being introduced due to some internal changes.
    Also there are some issues which still need to be resolved (hopefully no breaking issues though..) and some new features to test out.

    • Changed how item comparison is done: We no longer use bukkit's built-in comparison method. This has the disadvantage that we have to write and update the comparison of all item related data ourselves and probably don't work with modded items that well anymore (I might add a setting in the future which toggles between the new and the old comparison if there is the need for it). However doing the comparison ourselves gives us more control over what aspects of items actually define them as being 'similar': this change allows us to compare item attributes and skull data ourselves, hopefully resolving the issues we had with this in the past.

    Also please see the changelog of these previous versions!

    Last edited Nov 20, 2014 by blablubbabc
  • Avatar of blablubbabc blablubbabc Nov 16, 2014 at 00:47 UTC - 0 likes

    @andyhan123: Go

    Quote:

    Can you please make the shopkeepers unpushable, because on one of my servers they can be pushed and do not teleport back for some reason.

    Unfortunly there is no possibility for this I know of inside bukkit's api.. However normally the shopkeepers should get teleported back to their original location every 10 seconds if necessary. So if that doesn't work for some reason it would make more sense for me trying to find out why it doesn't work for you..
    If you enable debug mode in the config you should get a message in the console everytime a shopkeeper gets teleported back to it's original location. Check if you get those messages after you have pushed a shopkeeper entity around.

    Quote:

    Also with this new worldguard thing I have to make a small region where players can right click the shopkeeper, but people keep pushing them out of that area.

    What worldguard thing are you talking about?
    Generally the shopkeeper can't be interacted with if some other plugin interferes (outside the worldguard region in your case). If you have turned on debug mode you should get a message in the console everytime some player tries to interact with a shopkeeper but gets blocked by some other plugin.
    However there is a setting inside shopkeeper's config which causes the shopkeepers to regardless of other plugins allow interaction with them. So you could either try to find out which of your plugins are causing issues (maybe you have configured worldguard to disallow the interaction by default) and fix it there or try out that setting in the config of shopkeepers.

    Last edited Nov 16, 2014 by blablubbabc
  • Avatar of andyhan123 andyhan123 Nov 16, 2014 at 00:28 UTC - 0 likes

    Can you please make the shopkeepers unpushable, because on one of my servers they can be pushed and do not teleport back for some reason. Also with this new worldguard thing I have to make a small region where players can right click the shopkeeper, but people keep pushing them out of that area.

  • Avatar of blablubbabc blablubbabc Nov 12, 2014 at 23:51 UTC - 0 likes

    @Trustinlies: Go

    Nope, but if the shopkeeper command gets replaced by your buycraft command (do they really have this as official command?) you could take a look into creating command aliases. I think there is some way built into bukkit directly for server admins to create command aliases, alternatively there are plugins out there which try to accomplish command aliasing as well. Note that there also already is a built-in command alias: you can both use 'shopkeeper' and 'shopkeepers' (with the 's' at the end) to create admin shopkeepers.

Facts

Date created
Aug 03, 2012
Categories
Last update
Nov 21, 2014
Development stage
Release
License
GNU General Public License version 3 (GPLv3)
Curse link
Shopkeepers
Downloads
250,373
Recent files
  • A: v1.28 for CB 1.7.9-R0.2 Nov 21, 2014
  • A: v1.27 for CB 1.7.9-R0.2 Nov 21, 2014
  • A: v1.26 for CB 1.7.9-R0.2 Nov 20, 2014
  • A: v1.25 for CB 1.7.9-R0.2 Aug 14, 2014
  • A: v1.24 for CB 1.7.9-R0.2 Aug 04, 2014

Authors