Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- command /shop:
- trigger:
- if player is in world "eternalgens":
- shop(player)
- else:
- send "&cGo into gens to do this!" to player
- on inventory click:
- if name of player's current inventory contains "&a&l&nShop":
- cancel event
- if clicked inventory != player's inventory:
- if index of event-slot = 9:
- shopGens(player)
- stop
- if index of event-slot = 10:
- shopBlocks(player)
- stop
- if name of player's current inventory contains "&a&l&nBuy Gens" or "&a&l&nBuy Blocks!":
- cancel event
- if clicked inventory != player's inventory:
- if clicked slot != air:
- set {_cost} to uncolored line 1 of lore of event-slot
- replace all "Cost: $" with "" in {_cost}
- replace all "k" with "" in {_cost}
- set {_cost} to ({_cost} parsed as integer)
- if player's balance >= {_cost}:
- remove {_cost} from player's balance
- set {_type} to type of event-slot
- delete line 1 of lore of {_type}
- give player {_type} named name of event-slot
- send "&aYou have bought a %name of event-slot%"
- else:
- close player's inventory
- send "&cYou dont have enough money!"
- function shopGens(P: player):
- open chest inventory with 6 rows named "&a&l&nBuy Gens" to {_P}
- add coarse dirt named "<##9a5f00>&lDead Bush Gen" with lore "&bCost: &2$&a100" and "&2$&a5 &cper Drop" to {_gens::*}
- add hay bale named "&e&lWheat Gen" with lore "&bCost: &2$&a750" and "&2$&a10 &cper Drop" to {_gens::*}
- add melon block named "&a&lMelon &c&lGen" with lore "&bCost: &2$&a8.5k" and "&2$&a22 &cper Drop" to {_gens::*}
- add brown mushroom block named "<##fbb495>&lBrown Mushroom Gen" with lore "&bCost: &2$&a72.5k" and "&2$&a37 &cper Drop" to {_gens::*}
- add red mushroom block named "<##ff5858>&lRed Mushroom Gen" with lore "&bCost: &2$&a450k" and "&2$&a60 &cper Drop" to {_gens::*}
- set {_var} to -1
- loop {_gens::*}:
- add 1 to {_var}
- set slot {_var} of {_P}'s current inventory to loop-value
- function shopBlocks(P: player):
- open chest inventory with 6 rows named "&a&l&nBuy Blocks!" to {_P}
- add dirt named "<##9a5f00>&lDirt" with lore "&bCost: &2$&a1" to {_blocks::*}
- add oak log named "&f&lOak Log" with lore "&bCost: &2$&a2" to {_blocks::*}
- add spruce log named "&f&lSpruce Log" with lore "&bCost: &2$&a2" to {_blocks::*}
- add birch log named "&f&lBirch Log" with lore "&bCost: &2$&a2" to {_blocks::*}
- add jungle log named "&f&lJungle Log" with lore "&bCost: &2$&a2" to {_blocks::*}
- add soul sand named "&f&lSoul Sand" with lore "&bCost: &2$&a5" to {_blocks::*}
- add magma block named "&f&lMagma Block" with lore "&bCost: &2$&a5" to {_blocks::*}
- add diorite named "&f&lDiorite" with lore "&bCost: &2$&a2" to {_blocks::*}
- add stone named "&f&lStone" with lore "&bCost: &2$&a2" to {_blocks::*}
- add cobblestone named "&f&lCobblestone" with lore "&bCost: &2$&a2" to {_blocks::*}
- add grass block named "&f&lGrass Block" with lore "&bCost: &2$&a1" to {_blocks::*}
- add water bucket named "&f&lWater Bucket" with lore "&bCost: &2$&a100" to {_blocks::*}
- add lava bucket named "&f&lLava Bucket" with lore "&bCost: &2$&a100" to {_blocks::*}
- add amethyst block named "&f&lAmethyst Block" with lore "&bCost: &2$&a3" to {_blocks::*}
- set {_var} to -1
- loop {_blocks::*}:
- add 1 to {_var}
- set slot {_var} of {_P}'s current inventory to loop-value
- function shop(P: player):
- open chest inventory with 3 rows named "&a&l&nShop" to {_P}
- set slot integers between 0 and 8 of {_P}'s current inventory to black stained glass pane named "&f"
- set slot integers between 18 and 27 of {_P}'s current inventory to black stained glass pane named "&f"
- set slot 9 of {_P}'s current inventory to hay bale named "&e&lBuy Gens!"
- set slot 10 of {_P}'s current inventory to grass block named "&a&lBuy Blocks!"
Advertisement
Add Comment
Please, Sign In to add comment