ShopGUIPlus/Installation & configuration

From brc plugins wiki
Revision as of 20:12, 24 June 2020 by Brc (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search
ShopGUIPlus Logo


Installation

  1. Purchase (thanks!) and download the plugin
  2. Stop your server, put the .jar file in your server's /plugins/ directory
  3. Start the server, plugin will generate all necessary config files
  4. Fill in config.yml and shops.yml with desired settings
  5. Restart the server
  6. Done!


Configuration

All configuration files are easy to edit. If any of them lacks a feature you wish to be added, please contact us.


Adding shops

First, open the /plugins/ShopGUIPlus/shops/ directory. You can find all previously added shops in there. Each file is responsible for single shop. Here's an example of armor.yml file:

armor:
  name: "&4&lArmor (page %page%)"
  fillItem:
    material: STAINED_GLASS_PANE
    damage: 15
    name: " "
  items:
    1:
      type: item
      item:
        material: LEATHER_HELMET
        quantity: 1
      buyPrice: 40
      sellPrice: 8
      slot: 10
    2:
      type: item
      item:
        material: GOLD_HELMET
        quantity: 1
      buyPrice: 160
      sellPrice: 32
      slot: 11


As you can see, first of all you have to define the id of the shop (has to be unique, you will refer to it later in the main config). This name must also match the file's name (armor.yml and armor in here):

armor:


Now you have to set the displayed name of the shop which will be visible in the GUI:

armor:
  name: "&4&lArmor (page %page%)"

You can also set fill item for the entire shop, a gray glass pane in this case:

armor:
  name: "&4&lArmor (page %page%)"
  fillItem:
    material: STAINED_GLASS_PANE
    damage: 15
    name: " "


Then you can proceed to adding new items. You need items section with the same indentation as previously added name.

armor:
  name: "&4&lArmor (page %page%)"
  fillItem:
    material: STAINED_GLASS_PANE
    damage: 15
    name: " "
  items:


Now, to add an item you have to create another section with higher indentation. Name it whatever you want (only alphanumeric characters), just remember the names have to be unique for each item. Then you have to add the type of the shop item. Valid types are item, permission, enchantment, command or dummy.

armor:
  name: "&4&lArmor (page %page%)"
  fillItem:
    material: STAINED_GLASS_PANE
    damage: 15
    name: " "
  items:
    1:
      type: item


Next you have to add the item meta like material, quantity etc. For more information on item meta please refer to this page.

armor:
  name: "&4&lArmor (page %page%)"
  fillItem:
    material: STAINED_GLASS_PANE
    damage: 15
    name: " "
  items:
    1:
      type: item
      item:
        material: LEATHER_HELMET


Finally, you can proceed to basic information like buy/sell price and GUI slot number. Setting buyPrice or sellPrice to -1 will result in unbuyable/unsellable item. Remember that slot numbers go from 0 to 53.

armor:
  name: "&4&lArmor (page %page%)"
  fillItem:
    material: STAINED_GLASS_PANE
    damage: 15
    name: " "
  items:
    1:
      type: item
      item:
        material: LEATHER_HELMET
        quantity: 1
      buyPrice: 40
      sellPrice: 8
      slot: 10


Now you have to add the shop to the main menu, otherwise players couldn't access it. Open the config.yml and proceed to shopMenuItems section. You can see there all previously added shops.

shopMenuItems:
  # Has to be unique, value doesn't matter
  1:
    item:
      # The same rules apply for material, amount, damage and lore as for goBackButton
      material: DIAMOND_CHESTPLATE
      quantity: 1
      name: "&4&lArmor"
    # Shop ID from shops.yml
    shop: "armor"
    # Slot in shops menu, counting from 0 to 53
    slot: 15


We're done with our first shop. If you have any questions or errors please contact me via PM on SpigotMC or at our discord.

Setting per-shop economy

In order to use another economy within a single shop, set the economy field in shop's yml to the economy name:

armor:
  name: "&4&lArmor (page %page%)"
  economy: EXP
  fillItem:
    material: BLACK_STAINED_GLASS_PANE
    name: " "
  items:
    1:
      type: item
      item:
        material: LEATHER_HELMET
        quantity: 1
      buyPrice: 40
      sellPrice: 8
      slot: 10

Make sure all of used economies are enabled in config.yml:

economyTypes:
  - VAULT
  - EXP

Adding items to shops

Now we want to add some more items to previously created shop. Let's start from what we've got at the end of the previous tutorial section.

food:
  #Shop inventory name
  name: "&5Food Shop" 
  items:
    #Has to be unique for each of items, value doesn't matter
    1: 
      type: item
      item:
        #Material name, full list can be found here: http://wiki.brcdev.net/Materials
        material: BREAD 
        #(optional) Quantity of the item
        quantity: 32
        #(optional) Data value, for example 1 for WOOD:1 means spruce wood planks
        damage: 0 
        #(optional) Custom name
        name: "&aYummy bread"
        #(optional) Lore, can contain multiple lines
        lore: 
          - "&3<3"
      #Buy price, lower than 0 means you can't buy it, 0 mean free, higher than 0 is regular value
      buyPrice: -1
      #Same as above but sell price
      sellPrice: 25 
      #Slot in shop's inventory, counting from 0 to 53
      slot: 0


In order to add more items, you have to add more sections as section named 1 in this case. Remember all sections have to have unique names, so you can just call them 1, 2, 3, 4... etc.

food:
  #Shop inventory name
  name: "&5Food Shop" 
  items:
    #Has to be unique for each of items, value doesn't matter
    1: 
      type: item
      item:
        #Material name, full list can be found here: http://wiki.brcdev.net/Materials
        material: BREAD 
        #(optional) Quantity of the item
        quantity: 32
        #(optional) Data value, for example 1 for WOOD:1 means spruce wood planks
        damage: 0 
        #(optional) Custom name
        name: "&aYummy bread"
        #(optional) Lore, can contain multiple lines
        lore: 
          - "&3<3"
      #Buy price, lower than 0 means you can't buy it, 0 mean free, higher than 0 is regular value
      buyPrice: -1
      #Same as above but sell price
      sellPrice: 25 
      #Slot in shop's inventory, counting from 0 to 53
      slot: 0
    2:


Then just repeat steps from the previous tutorial section, add the type, item, prices and slot number:

food:
  #Shop inventory name
  name: "&5Food Shop" 
  items:
    #Has to be unique for each of items, value doesn't matter
    1: 
      type: item
      item:
        #Material name, full list can be found here: http://wiki.brcdev.net/Materials
        material: BREAD 
        #(optional) Quantity of the item
        quantity: 32
        #(optional) Data value, for example 1 for WOOD:1 means spruce wood planks
        damage: 0 
        #(optional) Custom name
        name: "&aYummy bread"
        #(optional) Lore, can contain multiple lines
        lore: 
          - "&3<3"
      #Buy price, lower than 0 means you can't buy it, 0 mean free, higher than 0 is regular value
      buyPrice: -1
      #Same as above but sell price
      sellPrice: 25 
      #Slot in shop's inventory, counting from 0 to 53
      slot: 0
    2:
      type: item
      item:
        material: COOKED_RABBIT
        quantity: 10
        damage: 0
      buyPrice: 75.5
      sellPrice: -1
      slot: 1

We're done with the second item. You can add that way up to 54 (or 53 when using the go back button) items to each shop.

Items

Pickaxe with custom name & Efficiency I

      1:
        type: item
        item:
          material: STONE_PICKAXE
          quantity: 1
          name: "&8Crappy Pickaxe"
          enchantments:
            - EFFICIENCY:1
        buyPrice: 50
        sellPrice: 25
        slot: 0


Firework

      1:
        type: item
        item:
          material: FIREWORK
          quantity: 32
          damage: 0
          fireworkPower: 2
          fireworkEffects:
            1:
              type: BALL_LARGE
              colors:
               - YELLOW
               - ORANGE
            2:
              type: CREEPER
              colors:
               - YELLOW
               - ORANGE
        buyPrice: 10
        sellPrice: -1
        slot: 0


Mob spawners

"mob" has to be a valid entity name. List of all entity types

Note: Remember to use valid material name corresponding to your Spigot version (SPAWNER or MOB_SPAWNER)

Pig spawner with a custom name

      1:
        type: item
        item:
          material: SPAWNER
          mob: PIG
          name: "&dPig spawner"
          quantity: 1
        buyPrice: 10
        sellPrice: -1
        slot: 0

5 blaze spawners

      2:
        type: item
        item:
          material: SPAWNER
          mob: BLAZE
          quantity: 5
        buyPrice: 10
        sellPrice: -1
        slot: 1

Enchantments

Fortune II

      1:
        type: enchantment
        enchantment: FORTUNE
        enchantmentLevel: 2
        item:
          material: DIAMOND_PICKAXE
          quantity: 1
          name: "&8Fortune II"
          enchantments:
            - FORTUNE:2
        buyPrice: 50
        slot: 0


Knockback I

      1:
        type: enchantment
        enchantment: KNOCKBACK
        enchantmentLevel: 1
        item:
          material: DIAMOND_SWORD
          quantity: 1
          name: "&6Knockback I"
        buyPrice: 1000
        slot: 1


Permissions

Single permission essentials.msg valid in all worlds

      1:
        type: permission
        permission: "essentials.msg"
        item:
          material: STONE_PICKAXE
          quantity: 1
          name: "&8/msg permission"
          enchantments:
            - EFFICIENCY:1
            - FORTUNE:2
        buyPrice: 50
        sellPrice: 25
        slot: 0

Multiple permissions essentials.msg and essentials.afk valid in all worlds

      2:
        type: permission
        permissions: 
          - "essentials.me"
          - "essentials.afk"
        item:
          material: DIAMOND_PICKAXE
          quantity: 1
          name: "&aPermission to use /me"
        buyPrice: 1000
        sellPrice: 500
        slot: 1

Multiple permissions essentials.balance and essentials.balance.others valid only in specific worlds

      2:
        type: permission
        permissions: 
          1:
            permission: "essentials.balance"
            world: "world"
          2:
            permission: "essentials.balance.others"
            world: "world_nether"
        item:
          material: DIAMOND_PICKAXE
          quantity: 1
          name: "&aPermission to use /me"
        buyPrice: 1000
        sellPrice: 500
        slot: 1


Commands

/say Hello [player name]!

    items:
      1:
        type: command
        item:
          material: WOOL
          quantity: 32
          damage: 0
        commands: 
          - "say Hello, %PLAYER%!"
        buyPrice: 500
        slot: 0


/say Good bye [player name]! /msg [player name] See you later!

      2:
        type: command
        item:
          material: WOOL
          quantity: 32
          damage: 1
        commands: 
          - "say Good bye, %PLAYER%!"
          - "msg %PLAYER% See you later!"
        buyPrice: 100
        slot: 1


Amount selection GUI customization

You can change every part of the amount selection GUI in the config. You can change items/slots, hide buttons etc.

All necessary settings are included in the amountSelectionGUI section of config.yml:

amountSelectionGUI:
  #Size of the GUI, valid values are 9, 18, 27, 36, 45 and 54
  size: 54
  #Slot of the item being bought/sold
  itemSlot: 22
  #Buttons
  buttons:
    #"Set to 1" button
    set1:
      item:
        material: STAINED_GLASS_PANE
        quantity: 1
        damage: 14
        name: "&c&lSet to 1"
      slot: 18
    #"Remove 10" button
    remove10:
      item:
        material: STAINED_GLASS_PANE
        quantity: 10
        damage: 14
        name: "&c&lRemove 10"
      slot: 19
    #"Remove 1" button
    remove1:
      item:
        material: STAINED_GLASS_PANE
        quantity: 1
        damage: 14
        name: "&c&lRemove 1"
      slot: 20
    #"Add 1" button
    add1:
      item:
        material: STAINED_GLASS_PANE
        quantity: 1
        damage: 5
        name: "&a&lAdd 1"
      slot: 24
    #"Add 10" button
    add10:
      item:
        material: STAINED_GLASS_PANE
        quantity: 10
        damage: 5
        name: "&a&lAdd 10"
      slot: 25
    #"Set to 64" button
    set64:
      item:
        material: STAINED_GLASS_PANE
        quantity: 64
        damage: 5
        name: "&c&lSet to 64"
      slot: 26
    #"Confirm" button
    confirm:
      item:
        material: STAINED_GLASS
        quantity: 1
        damage: 5
        name: "&a&lConfirm"   
      slot: 39
    #"Sell all" button
    sellAll:
      item:
        material: STAINED_GLASS
        quantity: 1
        damage: 5
        name: "&a&lSell all"      
      slot: 40
    #"Cancel" button      
    cancel:
      item:
        material: STAINED_GLASS
        quantity: 1
        damage: 14
        name: "&c&lCancel"  
      slot: 41


In order to change the button item you have to edit the appropriate entry.

Setting the slot to -1 will result in the button being hidden.


Changing sizes/buttons of shops

You can change the size of any shop as well as next/previous page/go back button slots.

Just change/add the "size" value for any shop in shops.yml:

food:
  #Shop inventory name
  name: "&5Food Shop (page %page%)" 
  #(Optional) Shop inventory size (valid values are 9, 18, 27, 36, 45 and 54)
  size: 45

Remember to change manually button slots for specific shops or they won't appear in the GUI.


These global settings from config.yml apply to every shop unless you change the item/slot/both for a specific shop:

buttons:
  #"Go back button"
  goBack:
    item:
      #Material name, full list can be found here: http://wiki.brcdev.net/Materials
      material: NETHER_STAR 
      #Amount of the item
      amount: 1 
      #(optional) Data value, for example 1 for WOOD:1 means spruce wood planks
      damage: 0 
      #(optional) Custom name
      name: "&cBack to categories" 
      #(optional) Lore, can contain multiple lines
      lore: 
        - "&aClick here to return to the main menu"
    #Slot in each shop's GUI
    slot: 49 
  #"Previous page" button
  previousPage:
    item:
      material: PAPER
      quantity: 1
      name: "&e&lPrevious page"
    slot: 45
  #"Next page" button
  nextPage:
    item:
      material: PAPER
      quantity: 1
      name: "&e&lNext page"
    slot: 53

You can edit them for any shop using the same entry names/indentation:

food:
  #Shop inventory name
  name: "&5Food Shop (page %page%)" 
  #(Optional) Shop inventory size (valid values are 9, 18, 27, 36, 45 and 54)
  size: 45
  #(Optional) Changed button types/slots
  buttons:
    goBack:
      #Slot -1 means it's hidden
      slot: 40
    previousPage:
      #You can change the item as well
      item:
        material: INK_SACK
        quantity: 1
        damage: 15
      slot: 36
    nextPage:
      slot: 44


You can edit only the item or slot or both as well.

Using per item permissions

First, you have to add the enablePerItemPermissions entry to your shop in shops.yml:

mining:
  name: "&2Mining Shop (page %page%)"
  enablePerItemPermissions: true
  items:
    1:
      type: item
      item:
        material: STONE_PICKAXE
        quantity: 1
        name: "&8Crappy Pickaxe"
        enchantments:
          - EFFICIENCY:1
      buyPrice: 50
      sellPrice: 25
      slot: 0
    2:
      type: item
      item:
        material: DIAMOND_PICKAXE
        quantity: 5
      buyPrice: 1000
      sellPrice: 500
      slot: 1
      unstack: true
    3:
      type: item
      item:
        material: IRON_SPADE
        damage: 125
        quantity: 1
        enchantments:
          - EFFICIENCY:1
      buyPrice: 750
      sellPrice: 111.11
      slot: 2

Then you have to give your players appropriate permissions.

The format of permissions is shopguiplus.item.<shop id>.<item id>.

The item ID is this number:

    items:
      1:


For instance, permissions for these three items in shop above are shopguiplus.item.mining.1, shopguiplus.item.mining.2 and shopguiplus.item.mining.3.

You can use shopguiplus.item.<shop id>.* (eg. shopguiplus.item.mining.*) to give access to all items within particular shop (or you can just set enablePerItemPermissions to false or remove it).


Changing currency names

Every economy has a default prefix and suffix for its currency. These can be always overwritten in config.yml. The used keys are the same as used in economyTypes section.

You can set only prefix or suffix, it's not mandatory to set both.

If you want to disable the default prefix/suffix set the value to an empty string.

Examples:

currencies:
  prefixes:
    VAULT: ""
    TOKEN_ENCHANT: "Tokens: "
  suffixes:
    VAULT: " USD"
    TOKEN_ENCHANT: ""
currencies:
  suffixes:
    PLAYER_POINTS: " puntos"


Controlling the stack size

There are several options which allow you to alter the purchased item's stack size.

unstack

When an item with this option is purchased, it's going to be unstacked to 1 item per stack. This allows you to sell unstacked blocks, armor etc.


With unstack: true:

lPuSy07.png


With unstack: false or none set:

C4bM24E.png

Example:

    4:
      type: item
      item:
        material: DIAMOND_HELMET
        quantity: 1
      unstack: true
      buyPrice: 800
      sellPrice: 160
      slot: 13


stacked

When an item with this option is purchased, it's going to preserve the amount from the shop or the selection GUI. This allows you to sell stacked items which don't stack by default, such as potions.


With stacked: true:

Ej1bneT.png

With stacked: false or none set:

J7RBH27.png


Example:

    1:
      type: item
      item:
        material: SPLASH_POTION
        quantity: 3
        potion:
          type: SPEED
          level: 1
          extended: true
      stacked: true
      buyPrice: 40
      sellPrice: 8
      slot: 10