Add Permission Based Shops. Move Shops to shops.yml - MAJOR VERSION RELEASE
NOTE: This is a major breaking change! With this version, the plugin will no longer pull the default TokensPlus shop from the config.yml. You will have to update the 'tokensplus' section in shops.yml to configure the default TokensPlus shop going forward.
I would recommend re-creating your current configuration in shops.yml before removing the 'shop' section from config.yml
With this version of TokensPlus, I've added the ability to create additional shops that players can access using
/token shop <shopname>. These shops are permission protected, meaning the player will need the "
tokensplus.shop.<shopname>" permission to be able to open the specified shop.
Additionally, I resolved an issue that was preventing new players from have their initial token balances establishd when using the flat-file (tokens.yml) approach.
In order to add this Permission-based shops feature, it required me to refactor the structure of how I defined shops previously. Going forward, the default TokensPlus shop (/token shop) and any permission-based shops added, will be defined in a new YAML file (
shops.yml). Furthermore, I removed the 'shop' section from the
config.yml and added additional messaging in
messages.yml
Here are the latest versions of these three YAML files:
Code (YAML):
## TokensPlus - Configuration config: # If enabled, player token balance will be managed through a MySQL database instead of the tokens.yml flat file # I highly recommend restarting the server when switching between MySQL and flat file mode. MySQL:
enabled: false
host: "localhost" port: "3306" database: "tokensplus" username: "root" password: "" useSSL: false
# This defines what the default starting amount of tokens the player will receive defaultTokenAmount: 0
# If enabled, the TokensPlus shop inventory will close on purchase shouldCloseShopOnPurchase: true
# If enabled, checks to see if you are using the latest version of TokensPlus checkForUpdates: true
Code (YAML):
## TokensPlus - Messages messages:
prefix: "&8[&6TokensPlus&8]" reloadPlugin: "%prefix% &aYou successfully reloaded the plugin!" shopDoesNotExist: "%prefix% &c%name% is not a valid shop name!" doesNotHaveShopPermission: "%prefix% &cYou do not have permission to open %name% shop!" addTokens: "%prefix% &aYou received %amount% tokens!" removeTokens: "%prefix% &cYou lost %amount% tokens!" setTokens: "%prefix% &aYour token balance was set to %amount% tokens!" notEnoughTokens: "%prefix% &cYou do not have enough tokens to give that amount!" playerDoesNotExist: "%prefix% &cThat player does not exist!" giveTokens: "%prefix% &aYou gave %amount% tokens to %player%!" receivedTokens: "%prefix% &aYou received %amount% tokens from %player%!" tokenAmountNotAnInteger: "%prefix% &cToken amount entered is not a valid integer!" inventoryFull: "%prefix% &cYour inventory is full!" cannotAfford: "%prefix% &cYou cannot afford %name% &c!" purchaseItem: "%prefix% &aYou purchased %name% &afor %amount% tokens!" playerBalance: "%prefix% &a%name% has %amount% tokens!"
Code (YAML):
## TokensPlus - Shops shop:
# --------------------------------------------------------------------------------- # - TokensPlus - Default Shop Configuration # - Players will see this shop when they use the /token shop command. # - DO NOT MODIFY THE SECTION NAME (TOKENSPLUS) OR REMOVE THE SECTION. OTHERWISE, THE MAIN /TOKEN SHOP COMMAND WILL THROW ERRORS! # --------------------------------------------------------------------------------- # You can create any number of shop pages. Just follow the structure provided and add one to the last page number # For example, if you wanted to add another page to the default config.yml, you would add a page3 section. # The numbers after the 'items' section refers to the slot number in the TokensPlus shop inventory. # All slot numbers are available, starting from 0, with the exception of slots 48, 49 and 50 (0-47, 51-53). # For 'material', refer here for the material names: https://hub.spigotmc.org/javadocs/bukkit/org/bukkit/Material.html # For 'enchants', refer here for the enchantment names: https://hub.spigotmc.org/javadocs/bukkit/org/bukkit/enchantments/Enchantment.html tokensplus:
page0:
items:
21:
material: DIRT
amount: 64
name: "&664 Dirt blocks" lore: -
"&7Build a dirt house!" enchants: -
tokenCost: 10
shouldRemoveNameOnPurchase: true
shouldRemoveLoreOnPurchase: true
commands: -
"experience add %playername% 100" -
"tell %playername% You got 100xp for free!" 22:
material: COBBLESTONE
amount: 16
name: "&716 Cobblestone blocks" lore: -
enchants: -
tokenCost: 20
shouldRemoveNameOnPurchase: true
shouldRemoveLoreOnPurchase: true
commands: -
"experience add %playername% 200" 23:
material: SAND
amount: 8
name: "&d8 Sand blocks" lore: -
"&8Build a TNT sand cannon" -
"&d&lBuild a sand castle" tokenCost: 40
shouldRemoveNameOnPurchase: true
shouldRemoveLoreOnPurchase: true
commands: -
30:
material: CREEPER_SPAWN_EGG
amount: 4
name: "&a4 Creeper Spawn Eggs" lore: -
"&cSpawn creepers anywhere!" enchants: -
tokenCost: 10
shouldRemoveNameOnPurchase: true
shouldRemoveLoreOnPurchase: false
commands: -
31:
material: EXPERIENCE_BOTTLE
amount: 16
name: "&416 XP Bottles" lore: -
"&7Click to buy!" enchants: -
tokenCost: 10
shouldRemoveNameOnPurchase: true
shouldRemoveLoreOnPurchase: true
commands: -
32:
material: TNT
amount: 64
name: "&264 TNT" lore: -
enchants: -
tokenCost: 10
shouldRemoveNameOnPurchase: true
shouldRemoveLoreOnPurchase: true
commands: -
page1:
items:
21:
material: DIAMOND
amount: 64
name: "&b64 Diamonds" lore: -
"&7Click to buy!" enchants: -
tokenCost: 10
shouldRemoveNameOnPurchase: true
shouldRemoveLoreOnPurchase: true
commands: -
page2:
items:
21:
material: DIAMOND_SWORD
amount: 1
name: "&a&lDIAMOND SWORD!!!" lore: -
"&7Click to buy!" enchants: - DAMAGE_ALL:4
tokenCost: 10
shouldRemoveNameOnPurchase: true
shouldRemoveLoreOnPurchase: false
commands: -
# --------------------------------------------------------------------------------- # - TokensPlus - Permission-Based Shop Configuration # - You can create as many shops with any number of pages. Just follow the structure provided and add one to the last page number # - The shop configuration section MUST BE entered in LOWERCASE LETTERS. The 'shopTitle' can be anything, color codes are supported! # - The permission needed to use the /token shop <shopname> command will be 'tokensplus.shop.<shopname>' # - The example below shows two shop configuration sections (example and example2). # - Their commands/permissions would be /token shop <example || example2> / tokensplus.shop.example / tokensplus.shop.example2 # --------------------------------------------------------------------------------- example:
shopTitle: "&4&lVIP SHOP" page0:
items:
22:
material: DIRT
amount: 64
name: "&664 Dirt blocks" lore: -
"&7Build a dirt house!" enchants: -
tokenCost: 10
shouldRemoveNameOnPurchase: true
shouldRemoveLoreOnPurchase: true
commands: -
"experience add %playername% 100" -
"tell %playername% You got 100xp for free!" page1:
items:
31:
material: GOLDEN_APPLE
amount: 16
name: "&b16 Golden Apples" lore: -
tokenCost: 50
shouldRemoveNameOnPurchase: true
shouldRemoveLoreOnPurchase: true
commands: -
example2:
shopTitle: "&6&lSUPER VIP SHOP" page0:
items:
22:
material: ENCHANTED_GOLDEN_APPLE
amount: 64
name: "&664 Golden Apples" lore: -
enchants: -
tokenCost: 50
shouldRemoveNameOnPurchase: true
shouldRemoveLoreOnPurchase: true
commands: -