VillagerShop icon

VillagerShop -----

A shop that uses the villagers' merchant inventory.



Hello, I present a simple plugin with which we can create a shop using villagers trade inventory.


Using the configuration, we can change the appearance of the main gui and add categories in the store.

Code (Text):
# configuration version, do not change this value,
# it is used to verify that the file is appropriate for the plugin version
config-version: 1.1
# debug messages in logs
# it is for plugin testing and locating bugs
# recommended disabled because of spam in logs
debug: false

# Main gui
gui-properties:
  # Title
  name: '&2&lShop'
  # Size
  rows: 3

# An item that fills the blanks in gui
fill-item:
  # material / id (id only in older versions)
  material: AIR
  # name of the item
  name: ''
  # lore of the item (empty in this case)
  lore: []

# after changing the commands it is recommended to restart or reload the server
command:
  shop:
    label: 'shop'
    aliases:
      - 'openshop'
  open:
    label: 'open'
    aliases: []
  edit:
    label: 'edit'
    aliases: []
  reload:
    label: 'reload'
    aliases: []

message:
  # message when player don't use command correctly
  # available variables: {USAGE}
  command-usage: '&cCorrect usage: &7{USAGE}'
  # message when player don't have permission to use command
  # leave blank if you don't want the message
  command-permission: "&cYou don't have permission to use this command"
  # message when player don't have permission to open category
  # leave blank if you don't want the message
  # available variables: {CATEGORY}
  category-permission: "&cYou don't have permission to open category &7{CATEGORY}"
  # message when the player which we want to open category do not have permission to open this category
  # leave blank if you don't want the message
  # available variables: {CATEGORY}, {PLAYER}
  category-others-permission: "&cPlayer &7{PLAYER} &cdon't have permission to open category &7{CATEGORY}"
  # message when the player which we want to open shop do not have permission to this
  # leave blank if you don't want the message
  # available variables: {PLAYER}
  shop-open-others-permission: "&cPlayer &7{PLAYER} &cdon't have permission to open shop"
  # message when sender enter the wrong category name in command
  # available variables: {GIVEN_CATEGORY}
  category-not-found: '&cCategory {GIVEN_CATEGORY} not found'
  # message when sender enter the wrong player name in command
  player-not-found: '&cPlayer {GIVEN_PLAYER_NAME} not found'

# Available categories in the shop
categories:
  # example category
  blocks:
    # category name
    name: blocks
    # item of category in main gui
    item:
      # slot in main gui
      slot: 12
      # material / id (id only in older versions)
      material: STONE
      # name of the item
      name: '&2&lBlocks'
      # lore of the item
      lore:
        - '&7Click to open.'
      # ability to add custom model data, working only on servers >= 1.13
      # if you want add this, just remove comment prefix (#) below
      #custom-model-data: 1234
  # other categories
  # all same as above
  tools:
    name: tools
    item:
      slot: 13
      material: IRON_PICKAXE
      name: '&2&lTools'
      lore:
        - '&7Click to open.'
  resources:
    name: resources
    item:
      slot: 14
      material: DIAMOND
      name: '&2&lResources'
      lore:
        - '&7Click to open.'

 




Commands:

- /shop - open main gui with categories
- /shop open <player> - open shop for other player
- /shop open <player> force - open shop for other player even if target player do not have permission
- /shop <category name> - open a specific category
- /shop <category> <player> - open category for other player
- /shop <category> <player> force - open category even if target player do not have permission for this category
- /shop reload - reload configuration
- /shop edit list - lists of categories
- /shop edit <category name> - opens a gui for editing store content



Permissions:

villagershop.*, villagershop.admin - all permissions

villagershop.cmd.* - permission for all commands
villagershop.cmd.shop - /shop

villagershop.cmd.shop.open.others - /shop open <player>
villagershop.cmd.shop.open.others.force - /shop open <player> force

villagershop.cmd.shop.category - /shop <category>
villagershop.cmd.shop.category.others - /shop <category> <player>
villagershop.cmd.shop.category.others.force - /shop <category> <player> force

villagershop.cmd.shop.reload - reload configuration (/shop reload)
villagershop.cmd.shop.edit - edit categories (/shop edit <category>, /shop edit list)

villagershop.category.* - permission for all categories
villagershop.category.<category> - permission for specific category (<category> in this permission is a path to category in configuration, not to be confused with the name of category)





Sample gui with categories.

Zrzut ekranu 2021-07-29 161321.png


Trade inventory for old versions.

Zrzut ekranu 2021-07-29 161338.png



Trade inventory for new versions


Zrzut ekranu 2021-07-29 161451.png


The content of each category can be edited very easily. After entering the command /shop edit <category name>, a gui opens in which you can edit the contents of the store. Below is an example:

Zrzut ekranu 2022-01-15 195943.png
Resource Information
Author:
----------
Total Downloads: 1,296
First Release: Aug 1, 2021
Last Update: Mar 16, 2022
Category: ---------------
All-Time Rating:
6 ratings
Version -----
Released: --------------------
Downloads: ------
Version Rating:
----------------------
-- ratings