Configuration- Advanced options
-
How to set up different kinds of actions?
That's easy! Simply copy your price-, reward- and lore-lines and modify the path:
Add the name of the clicktype you want to use to the end of the path.
Examples:
Reward -> Reward_right
Message -> Message_middle
Possible Clicktypes:
- left
- right
- middle
- shift_left
- shift_right
Code (Text):Diamonds:
MenuItem:
- type:DIAMOND
- amount:5
- name:&95 Diamonds
- 'lore1:&eClick &2left &eto buy &c%reward% &efor &c%price%&e.'
- 'lore2:&eClick &2right &eto sell &c%price_right% &efor &c%reward_right%&e.'
RewardType: ITEM
Reward:
- - type:DIAMOND
- amount:5
PriceType: MONEY
Price: 5000
Message: '&eYou bought %reward%! Money left: &c%left%'
RewardType_right: MONEY
Reward_right: 2500
PriceType_right: ITEM
Price_right:
- - type:DIAMOND
- amount:5
Message_right: '&eYou just sold %price_right%!'
ExtraPermission: ''
InventoryLocation: 3
You can use the placeholders %reward_<clicktype>% and %price_<clicktype>% to display reward and price of the action.
Optionally you can add independent extrapermissions to the different clicktypes by adding "ExtraPermission_<clicktype>" to your shopitem. For example "ExtraPermission_right: BossShop.itemshop.apple.rightclick".
Other possible settings
There are following settings that you can add to the main config.yml, any shop and any shopitem:
- "HideItemsPlayersDoNotHavePermissionsFor: true/false" - Should be clear, effect can be replaced with conditions
- "AllowUnsafeEnchantments: true/false" - If enabled players can use every Enchantment reward on any item
- "CanPlayersSellItemsWithGreaterEnchants: true/false" - If enabled players can sell items with greater enchants than needed to a shop that allows to sell items. That might be helpful when dealing with items with bad enchants, but also might lead to accidently selling items below their worth.
- "CloseShopAfterPurchase: true/false" - If enabled the inventory GUI will be closed after a successful purchase
Sound settings can be inherited aswell. You can add following properties to any shop or shopitem in order to make them and their children use new sounds:
Code (Text):Sound:
Shopitem:
Click: 'UI_BUTTON_CLICK:1:1'
Purchase: 'ENTITY_PLAYER_LEVELUP:1:1.8'
NoPermission: 'ENTITY_BLAZE_DEATH:1:1'
NotEnoughMoney: 'ENTITY_SHULKER_HURT:1:0.8'
Code (Text):Sound:
Shop:
ChangePage: 'UI_BUTTON_CLICK:0.2:1'
ChangeShop: 'BLOCK_CHEST_OPEN:0.2:1'
Open: 'ENTITY_ELDER_GUARDIAN_CURSE:1:1.8'
Close: ''
Following optional settings can be added to any shop (but not shopitem):
- InventoryRows: <amount of rows> - This setting allows increasing the size of an inventory without needing to add a shopitem to the bottom row
Player input
You can force players to input their own text or to select an online player. The input is stored and can be accessed using the "%input%" placeholder. Possible applications:
- Player menu: Select a player and then execute a certain action like kick/mute/ban/promote
- Command "completion": When players click a certain shopitem a command is executed which uses the player input
- Allow players to name the items they buy (by setting "name:%input%")
- Many more
In order to force player input, simply add following lines to your shopitem:
Code (Text):ForceInput: PLAYER/TEXT
ForceInputMessage: 'any message'
An other possiblity for players to enter input is by adding it as additional argument when they enter a shop open command (only one word without whitespaces supported). For example the command "/bs AdminCommands Herobrine" will open the shop "AdminCommands" using the input "Herobrine".
While players could manually enter input when they open a shop, that functionality can be used to create more intuitive systems: For example create the commandalias "/admin" that will open the "AdminCommands" shop. Now players can execute "/admin Herobrine" to directly open the right shop and having valid input selected.
You can either add those lines to any shopitems which use playerinput to make sure they enter new input before the action is performed, or force the player to select input and then provide a shop where all items use the same input.
If you allow players to enter input once and then give them access to shopitems which use input but do not force new input, you need to make sure the players already have entered input.
Here's an example for the approach where input only needs to be entered once:
Section of main menu.
Code (Text):playercommandsmenu:
MenuItem:
- lore:&8Commands to manage other players.
- name:&e&lPlayer Commands
- type:paper
ForceInput: PLAYER
ForceInputMessage: '&8Enter the name of a player you want to select.'
RewardType: SHOP
Reward: playercommandssecret
PriceType: NOTHING
Message: ''
ExtraPermission: ''
InventoryLocation: 40
PlayerCommands shop.
Code (Text):#Note: In order for commands to work properly players need to open the shop via main menu where they are forced to select a target.
#Because of that simply do not give your players direct permissions to this shop.
ShopName: PlayerCommandsSecret
DisplayName: '&6&l%input% &0&lCommands'
shop:
reselecttarget:
MenuItem:
- name:&f&lSelect other player
- lore:&8Click to select an other player.
- amount:1
- type:SKULL_ITEM
- durability:3
RewardType: SHOP
ForceInput: PLAYER
ForceInputMessage: '&8Enter the name of a player you want to select.'
Reward: PlayerCommandsSecret
PriceType: NOTHING
Message: ''
ExtraPermission: ''
InventoryLocation: 1
gamemode:
MenuItem:
- name:&f&lAdventure mode
- lore:&8Set the gamemode of &l&6%input% &8to adventure mode.
- amount:1
- type:TORCH
RewardType: PLAYERCOMMAND
Reward:
- 'gamemode 2 %input%'
PriceType: NOTHING
Message: ''
ExtraPermission: ''
InventoryLocation: 2
msgtest:
MenuItem:
- name:&f&lTest message
- lore:&8Send &l&6%input% &8a test message.
- amount:1
- type:PAPER
RewardType: PLAYERCOMMAND
Reward:
- 'msg %input% this is a test'
PriceType: NOTHING
Message: ''
ExtraPermission: ''
InventoryLocation: 3
kick:
MenuItem:
- name:&f&lKick
- lore:&8Kick &l&6%input% &8from the server.
- amount:1
- type:DIAMOND_SWORD
- itemflag:all
RewardType: PLAYERCOMMAND
Reward:
- 'kick %input%'
PriceType: NOTHING
Message: ''
ExtraPermission: ''
InventoryLocation: 4
Configuration tricks
There are several tricks that make setting shops up easier. For example if you sell items you normally would create an item as Reward and you would create an other item up as MenuItem, right? There is a simple way to avoid creating two items that are the same: You can use the placeholders '%rewarditem_<id>%' and '%priceitem_<id>%' in order to make your MenuItem import the look of the given item.
Example 1:
Code (Text):GodApple:
MenuItem:
- '%rewarditem_1%'
- 'lore:&cPrice: %price%'
RewardType: ITEM
Reward:
- - type:GOLDEN_APPLE
- amount:1
- durability:1
PriceType: MONEY
Price: 10000
Message: '&eYou bought 1 %itemname%! &eMoney left: &c%left%'
ExtraPermission: ''
Example 2:
Code (Text):bow_ranger:
MenuItem:
- '%rewarditem_2%'
- lore:&cCosts %price%.
RewardType: ITEM
Reward:
- - amount:16
- type:ARROW
- - name:&2&lRanger Bow
- amount:1
- type:BOW
- enchantment:ARROW_DAMAGE#7
- enchantment:ARROW_KNOCKBACK#10
PriceType: EXP
Price: 30
Message: '&2You have bought a new weapon for &c%price%&2.'
ExtraPermission: ''
InventoryLocation: 14
If you want more tricks like this one I recommend checking out the Addon TrickyShops.
Different RewardTypes/Pricetypes for one item
That's possible using one or more of following types:
- RewardType AND: Gives all defined rewards to the player
- PriceType AND: Requires the player to pay all defined prices
- PriceType OR: Requires the player to pay one of the defined prices
RewardType AND
Code (Text):DifferentRewardTypesAND:
MenuItem:
- 'lore:&aReward: %reward% #&cPrice: %price%'
- name:&9Money, Items and Exp
- amount:1
- type:TNT
RewardType: AND
Reward:
RewardType1: ITEM
Reward1:
- - amount:7
- type:TNT
RewardType2: money
Reward2: 50
RewardType3: exp
Reward3: 20
PriceType: NOTHING
Message: '&eYou received %reward%.'
ExtraPermission: ''
InventoryLocation: 0
Code (Text):DifferentPriceTypesAND:
MenuItem:
- type:DIAMOND
- amount:5
- name:&95 Diamonds
- 'lore1:&eBuy %reward% for %price%.'
RewardType: ITEM
Reward:
- - type:DIAMOND
- amount:5
PriceType: AND
Price:
PriceType1: MONEY
Price1: 50.0
PriceType2: POINTS
Price2: 10
Message: '&eYou bought %reward%! Balances left: &c%left%'
InventoryLocation: 0
Code (Text):DifferentPriceTypesOR:
MenuItem:
- type:DIAMOND
- amount:5
- name:&95 Diamonds
- 'lore1:&eBuy %reward% for %price%.'
RewardType: ITEM
Reward:
- - type:DIAMOND
- amount:5
PriceType: OR
Price:
PriceType1: MONEY
Price1: 50.0
PriceType2: POINTS
Price2: 10
Message: '&eYou bought %reward%! Balance left: &c%left%'
InventoryLocation: 0
- PriceType: AND
- Price:
- PriceType1: ITEM
- Price1: diamond
- PriceType2: OR
- Price2:
- PriceType1: MONEY
- Price1: 1000
- PriceType2: POINTS
- Price2: 50
That's a tricky thing to do but actually possible using the simulate command:
Obviously a dirty workaround which works in most cases would be simply using rewardtype "command" and set up a list of commands which directly execute all needed actions, like giving items to the player, add permissions to the player or execute commands of other plugins. - Loading...
- Loading...
XenCarta PRO
© Jason Axelrod from 8WAYRUN.COM