[OLD] VillagerShops - Set up Mobs of any type as admin shop. Shops will use a Inventory-Menu to buy/sell items

VillagerShops

Download from GitHub

Download from Ore

This plugin requires LangSwitch

Feel free to open an issue on the git to share your translations

Description:

This plugin allows you to set up villagers or other mobs as shops.

They will sell items as admin shop (this means infinite stock), or as player shops if placed above a chest.

The shop will be displayed as two row inventory you can modify with chat commands as admin or if you own the shop.

Buy items from the top row and sell them at the bottom row.

You can also name the shop mobs and set the variant (Villager profession).

Please note that you require any economy Plugin for this to work

Letā€™s just never mention the Bukkit-versionā€¦

Latest Version: 1.9 (2018-08-17)

(Written, compiled and tested for spongevanilla-1.12-7.1.0-BETA-97)

Commands

For every edit command but create, please look at the shop

  • /vshop create [--at <World/X/Y/Z/Rotation>] <EntityType> [--skin <Skin>] [DisplayName]
  • /vshop delete (deletes shop)
  • /vshop add [-l <Limit>] <~|BuyPrice> <~|SellPrice> [Currency] [-o <Index>]
  • /vshop remove <Index> (removes item from shop)
  • /vshop link (connect a playershop to a different chest)
  • /vshop identify or /vshop id
  • /vshop save
  • /vshop reload (reapply skins on sponge:human entities)
  • /vshop ledger [Player] or /vshop log [Player] (display last 100 transactions the players shops made)
  • /vshop list [Player] (list all shops, offer invsee for player shops and tp)
  • /vshop tphere <Shop ID> moves a shop by id (/vshop identify) to your current location

Permissions

  • vshop.edit.admin edit any shop, create admin shops, /vshop save, /vshop reload, /vshop list, /vshop tphere
  • vshop.edit.player is required to create your player shop
  • the add, remove and delete command are always available for shops you own
  • vshop.create.<ENTITYTYPE> is required for each entity type a player should be allowed to create, where colons are replaced with dots and dashed are taken out. so for example minecraft:villagers would require vshop.create.minecraft.villager
  • vshop.edit.identify for /vshop identify
  • vshop.edit.linkchest for /vshop link
  • vshop.edit.move for /vshop tphere
  • vshop.ledger.base for /vshop ledger
  • vshop.ledger.others for /vshop ledger <Player>

Options

With LuckPerms you can set options like /lp user DosMike meta set KEY VALUE

  • vshop.option.playershop.limit Number of player-shops one is allowed to have
  • vshop.option.dailyincome.limit Maximum money a player may earn through admin shops per irl day, reset at 24:00 server time
  • vshop.option.chestlink.distance Maximum distance a player-shop may have to itā€™s stock-container. This affects /vshop link as well as /vshop tphere

Player Shops

In order to create a player shop youā€™ll have to first place a container below the block you want the shop to be. This can either be directly below or with a one block spacing.

The chest should be protected from punching, explosions and is only accessible for the owner. Double chest wont work - The plugin does not care for the other half, neither stock nor protection wise.

On forge this means that a chest has to have at least 27 slots, since I do not want shops to be able to sell / buy into machines.

More Inforamtion

The plugin will create two configs and a h2 database.
None of these files are meant to be edited by you

The vshop.conf will store all shops including their listings. The income per player for the day are stored in incomeLimits.conf to persist over server restarts. All shop transactions are saved in the ledger.db.mv.db - you can inspect them with a h2 database editor. The database is never cleared at the moment so you may want to delete or trim it every now and then.

Chat messages will notify playershop owners about purchases in all their shops every 15 seconds to prevent mass spam.

Shops save with the world now, this means that editing shops via config got extremely unreliable and made the old behaviour of /vshop reload useless. Instead this command will now try to reload skins for sponge:human shops.
Even though I set the skin correctly they sometimes seem to not load/be sent to the player, so /vshop reload will reapply the skin.

(In-)Compatibility

  • Pixelmon will replace various vanilla mobs with Pixelmon versions resulting in VillagerShops spamming mobs
  • InventoryTweaks has to be installed client side only - otherwise item dupes may happen

DosMike

Join my Discord

7 Likes

Will it work on sponge api5?

well itā€™ll have to.
afaik api4 does not yet fully support the inventory api.

Hi,

I always get an error:

No values matching pattern ā€˜Villagerā€™ present for EntityType!

I used this command: /vshop create Villager VillagerShop

You need to also specify a skin (For villagers itā€™s their profession). You can also use ā€œnoneā€ to get the default skin. Skins are not fully implemented yet.

/vshop create Villager none VillagerShop

The name defaults to ā€œVillagerShopā€, so you donā€™t need to write that argument.

/vshop create Villager none

Hello thank you for your reply

But still the same error. Using SpongeForge for MC 1.10.2.

Same error still and I used your arguments.

/vshop create Villager none

ah, i think you need to type Minecraft:Villager, but you should be able to autocomplete that argument

Thank you.

Now I was able to create a Shop/Spawn/Mob but now there isnt any Mobā€¦

I am unable to spawn them. No more errors used this command:

/vshop create Minecraft:Villager 0 Test

then

/vshop save

Config file will be created with correct coordinates and settings but there isnt any Mob/Shop (it seems to be invisible).

I know this topic is really old but since I just picked it back up I think itā€™s just as good as creating a new topicā€¦

Soā€¦ Iā€™m working on this again :smiley:
Just updated the last state to work with API 7 and looking forward to implement the inventory stuff! (Can anyone recommend a good economy plugin for API 7 for testing?)

Now Iā€™ll have some fun figuring out what Iā€™ve done in my very undocumented code from like a year ago :roll_eyes:

2 Likes

Version 1.0

The plugin is done so far, running on API 7.
Got everything I want implemented

1 Like

Tell me please what you compiled your plugin. If this was done in Eclipse, what jar files do I need to provide it for compilation. I would like to translate it into Russian. Since you do not have a language file, the best option is to edit the source code.

@semenkovsky_ivan I just used the sponge api 7 beta 303 in eclipse neon. if you can edit the antfile compile.xml to prevent eclipse from shading the api into the plugin jar.

But Iā€™ll try to add in translation files within the nex days (currently busy with a big project)

edit: I think I used SpongeAPI 7.0.0-20170722.205534-23 but the latest experimental should work as well

Iā€™ve created a shop, however when i try to set items in it, it gives me ā€œThe BuyPrice was not ā€˜-ā€™ or a decimalā€ no matter what i do. How can i fix this?

You need to give to prices, one for buying, one for selling the item, see /help vshop. keep in mind that java is international, so use a dot for decimals, not a comma e.g. 1*10-1 = 0.1 - not 0,1

also donā€™t forget to save your shops after you set them up with /vshop save

Iā€™m still getting the same problem after looking at /help vshop. Maybe things just arenā€™t clicking for me. Can you give me an example of a command for /vshop add?

/vshop add 100 - only buy this
/vshop add - 32.99 only sell this
/vshop add 64.5 50 buy this for 64.5, sell for 50
/vshop add 30 15 Euro if your economy plugin supports multiple currencies, do not use the default, but euro for this item (you need to set up other currencies first)

Does this work with TotalEconomy? im getting this msg

I wrote this using Total Economy but that should totally not do anything as Iā€™m only using the service functions provided by sponge.

In order to tell you more or be able to fix that Iā€™d need a bit more information (like any dev with any bug):

  • What sponge version do you use (type sponge version into the server console)
  • What plugin version do you use (probably the latestā€¦, ok)
  • Please take a look at the server log and send me the fill stacktrace (what you got is only one or two lines that do not really help)
  • How and when did that error occur, is it repeatable (you donā€™t need to go all the way and test all possible combination of actions, but something like ā€œevery time i try to do this and thatā€ is a pretty good start)

If you got all that, you can either post it here or (what i perfer) open an issue over on GitHub (just post it here if you donā€™t have an account)

After that I can start to take a look at your problem with the plugin.

SpongeVanilla (donno which one, but I got it about 3 days ago tops updated 1.10.2)

it was downloaded soon before i made my comment, so latest :slight_smile:

the error occured when i was holding a steak and trying to add it to a villager NPC. (Which also doubles itself, but the other is a normal villager). I was holding one steak while typing near the shopkeeper /vshop add 12 6