Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- options:
- p: &8[&a&lSell&8]
- function sellGUI(p: player, s: text = true):
- set {_pU} to uuid of {_p}
- loop {SellGui::data::items::*}:
- if {SellGui::data::items::%loop-value%::worth} != 0:
- if {_s} = "true":
- set {_%loop-value%Price} to {SellGui::data::items::%loop-value%::worth} * amount of loop-value parsed as item type of {_p}'s current inventory
- add amount of loop-value parsed as item type of {_p}'s current inventory to {_amount}
- else if {_s} = "sellall" or "autosell":
- set {_%loop-value%Price} to {SellGui::data::items::%loop-value%::worth} * amount of loop-value parsed as item type of {_p}'s inventory
- add amount of loop-value parsed as item type of {_p}'s inventory to {_amount}
- remove all loop-value parsed as item type from {_p}'s inventory
- add {_%loop-value%Price} to {_final}
- if {_final} != 0:
- if {_p} has permission "sell.multiplier.4":
- if {_multiplier} is not set:
- add {_final} * 4 to {_p}'s balance
- if {_itemsAmountFinal.%{_p}%} is set:
- send "{@p} &aSold &f%{_amount}% &aitems for &f$%{_final} * 4% &8(&f&oMultiplier x4&8)" to {_p}
- else:
- send "{@p} &aSold &f%{_amount}% &aitems for &f$%{_final} * 4% &8(&f&oMultiplier x4&8)" to {_p}
- set {_multiplier} to true
- if {_s} = "true":
- clear {SellPlants::data::%{_pU}%::canceled}
- if {_p} has permission "sell.multiplier.3":
- if {_multiplier} is not set:
- add {_final} * 3 to {_p}'s balance
- if {_itemsAmountFinal.%{_p}%} is set:
- send "{@p} &aSold &f%{_amount}% &aitems for &f$%{_final} * 3% &8(&f&oMultiplier x3&8)" to {_p}
- else:
- send "{@p} &aSold &f%{_amount}% &aitems for &f$%{_final} * 3% &8(&f&oMultiplier x3&8)" to {_p}
- set {_multiplier} to true
- if {_s} = "true":
- clear {SellPlants::data::%{_pU}%::canceled}
- if {_p} has permission "sell.multiplier.2":
- if {_multiplier} is not set:
- add {_final} * 2 to {_p}'s balance
- if {_itemsAmountFinal.%{_p}%} is set:
- send "{@p} &aSold &f%{_amount}% &aitems for &f$%{_final} * 2% &8(&f&oMultiplier x2&8)" to {_p}
- else:
- send "{@p} &aSold &f%{_amount}% &aitems for &f$%{_final} * 2% &8(&f&oMultiplier x2&8)" to {_p}
- set {_multiplier} to true
- if {_s} = "true":
- clear {SellPlants::data::%{_pU}%::canceled}
- else if {_p} doesn't have permission "sell.multiplier.2" or "sell.multiplier.3" or "sell.multiplier.4":
- add {_final} to {_p}'s balance
- if {_itemsAmountFinal.%{_p}%} is set:
- send "{@p} &aSold &f%{_amount}% &aitems for &f$%{_final}%" to {_p}
- else:
- send "{@p} &aSold &f%{_amount}% &aitems for &f$%{_final}%" to {_p}
- if {_s} = "true":
- clear {SellPlants::data::%{_pU}%::canceled}
- play "ENTITY_EXPERIENCE_ORB_PICKUP" to {_p}
- else:
- if {_s} = "true" or "sellall":
- send "{@p} &cThere is no items to sell." to {_p}
- function sellCalc(p: player):
- set {_pU} to uuid of {_p}
- clear {SellCalc.%{_pU}%}
- if {_p} has permission "sell.multiplier.4":
- if {_multiState} is not set:
- set {_multi} to 4
- set {_multiState} to true
- if {_p} has permission "sell.multiplier.3":
- if {_multiState} is not set:
- set {_multi} to 3
- set {_multiState} to true
- if {_p} has permission "sell.multiplier.2":
- if {_multiState} is not set:
- set {_multi} to 2
- set {_multiState} to true
- if {_p} doesn't have permission "sell.multiplier.2", "sell.multiplier.3" or "sell.multiplier.4":
- if {_multiState} is not set:
- set {_multi} to 1
- set {_multiState} to true
- loop {SellGui::data::items::*}:
- if {SellGui::data::items::%loop-value%::worth} != 0:
- set {_%loop-value%Price} to {SellGui::data::items::%loop-value%::worth} * {_multi} * amount of loop-value parsed as item type of {_p}'s current inventory
- add {_%loop-value%Price} to {SellCalc.%{_pU}%}
- if {SellCalc.%{_pU}%} is set:
- if {_multi} != 1:
- format gui slot 49 of {_p} with sunflower named "&7Total Price: &a$%{SellCalc.%{_pU}%}% &8(&f&oMultiplier x%{_multi}%&8)" to run function sellCalc({_p})
- set lore of slot 49 of {_p}'s current inventory to "&7Click to refresh"
- else:
- format gui slot 49 of {_p} with sunflower named "&7Total Price: &a$%{SellCalc.%{_pU}%}%" to run function sellCalc({_p})
- set lore of slot 49 of {_p}'s current inventory to "&7Click to refresh"
- on break:
- if player's inventory doesn't have enough space for 1 of event-item:
- if "%{AutoSell::players::*}%" contains "%uuid of player%":
- sellGUI(player, "autosell")
- #if player's inventory doesn't have enough space for 64 of event-block:
- #cancel event
- #wait a tick
- #send player title "&cInventory full" with subtitle "&7Sell your items using &f/sell." for 3 seconds
- #play "BLOCK_NOTE_BASS" to player
- command /sellall:
- permission: sellall.use
- permission message: &cYou don't have enough permissions to do that.
- trigger:
- sellGUI(player, "sellall")
- stop
- command /autosell [<text=help>] [<text>]:
- permission: autosell.use
- permission message: &cYou don't have enough permissions to do that.
- aliases: autos, asell, autosell
- trigger:
- if arg-1 is "help":
- send " &a&lAutoSell &7- &a&lHelp"
- send ""
- send " &a/autosell on &8- &7To turn on autoselling."
- send " &a/autosell off &8- &7To turn off autoselling."
- if player has permission "autosell.list":
- send " &e/autosell list &8- &7To see all players with AutoSell ON."
- send ""
- stop
- if arg-1 is "list":
- if player has permission "autosell.list":
- if {AutoSell::players::*} is set:
- loop {AutoSell::players::*}:
- add "%offline player from uuid loop-value%" to {_list::*}
- send " &a&lAutoSell &7- &a&lList"
- send " "
- send " &a%{_list::*}%"
- send " "
- stop
- else:
- send "{@p} &cThere is no one with AutoSell ON."
- stop
- else:
- send "{@p} &cAre you allowed to do that?"
- stop
- if arg-1 is "on":
- if "%{AutoSell::players::*}%" doesn't contain "%uuid of player%":
- add uuid of player to {AutoSell::players::*}
- send "{@p} &aAutoSell has been turned ON."
- stop
- else:
- send "{@p} &eAutoSell is already ON."
- stop
- if arg-1 is "off":
- if "%{AutoSell::players::*}%" contains "%uuid of player%":
- remove uuid of player from {AutoSell::players::*}
- send "{@p} &cAutoSell has been turned OFF."
- stop
- else:
- send "{@p} &eAutoSell is already OFF."
- stop
- else:
- send "{@p} &cNo such argument."
- stop
- command /sell [<text>] [<text>]:
- permission: sell.use
- permission message: &cYou don't have enough permissions to do that.
- trigger:
- if arg-1 is "list":
- if player has permission "sell.%arg-1%":
- if {SellGui::data::items::*} is set:
- send " &a&lItems &7- &a&llist"
- send ""
- loop {SellGui::data::items::*}:
- if {SellGui::data::items::%loop-value%::name} is set:
- json("%player%", " &f&l##%loop-index% &a%loop-value%||ttp:&7Name: &a%colored {SellGui::data::items::%loop-value%::name}%%nl%&7Worth: &a$%{SellGui::data::items::%loop-value%::worth}%%nl%&7Material: &a%loop-value%")
- else:
- json("%player%", " &f&l##%loop-index% &a%loop-value%||ttp:&7Worth: &a$%{SellGui::data::items::%loop-value%::worth}%%nl%&7Material: &a%loop-value%")
- send ""
- stop
- else:
- send "{@p} &cThere is no items set yet."
- stop
- else:
- send "{@p} &cNo enough permissions to do that."
- stop
- if arg-1 is "remove":
- if player has permission "sell.%arg-1%":
- if arg-2 is not set:
- if player's tool is not air:
- set {_item} to "%type of player's tool%"
- if {SellGui::data::items::%{_item}%::worth} is set:
- clear {SellGui::data::items::%{_item}%::worth}
- remove "%{_item}%" from {SellGui::data::items::*}
- send "{@p} &f%{_item}% &aitem worth has been removed from the list."
- stop
- else:
- send "{@p} &cCould not find this item the the list."
- stop
- else:
- send "{@p} &cYou must hold an item to do that."
- stop
- else if arg-2 is "all":
- if {SellGui::data::items::*} is not set:
- send "{@p} &cNo items in sell list."
- stop
- loop {SellGui::data::items::*}:
- delete {SellGui::data::items::%loop-value%::worth}
- remove loop-value from {SellGui::data::items::*}
- send "{@p} &fAll items have been removed from sell list."
- stop
- else:
- send "{@p} &cNo enough permissions to do that."
- stop
- if arg-1 is "worth":
- if player has permission "sell.%arg-1%":
- if arg-2 parsed as number is set:
- if player's tool is not air:
- set {_item} to "%type of player's tool%"
- if {SellGui::data::items::%{_item}%::worth} is not set:
- add "%{_item}%" to {SellGui::data::items::*}
- set {SellGui::data::items::%{_item}%::worth} to arg-2 parsed as number
- send "{@p} &aAdded &f%type of player's tool% &aitem to items list and worths &f%arg-2%&a."
- stop
- else:
- set {SellGui::data::items::%{_item}%::worth} to arg-2 parsed as number
- send "{@p} &f%type of player's tool% &aitem worth has been set to &f%arg-2%&a."
- stop
- else:
- send "{@p} &cYou must hold an item to do that."
- stop
- else:
- send "{@p} &cWorth must be set."
- stop
- else:
- send "{@p} &cNo enough permissions to do that."
- stop
- if arg-1 is "help":
- if player has permission "sell.help":
- send " &a&lSell &7- &a&lHelp"
- send ""
- send " &a/sell &8- &7Open the sell GUI."
- send " &a/sell help &8- &7Show this message."
- send " &a/sell remove &8- &7While holding a named/unnamed and listed item to remove the worth of it."
- send " &a/sell worth <cost> &8- &7While holding a named/unnamed item to register it or change the cost of it."
- send " &a/sell list &8- &7Shows a list of all registered items with worths."
- send " &a/sellall &8- &7Sell all your items without a gui (quick way)."
- send " &a/autosell on/off/list &8- &7Toggle AutoSell feature."
- send ""
- stop
- else:
- send "{@p} &cNo enough permissions to do that."
- stop
- if arg-1 is not set:
- clear {SellCalc.%uuid of player%}
- set {SellPlants::data::%uuid of player%::canceled} to "return"
- open virtual chest with 6 rows named "&a&lSell GUI" to player
- format gui slot 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 17, 18, 26, 27, 35, 36, 44, 45, 46, 47, 51, 52 and 53 of player with gray stained glass pane named " "
- format gui slot 48 of player with redstone dust named "&c&lCancel" to run:
- close player's inventory
- set lore of slot 48 of player's current inventory to "&7Return all items!"
- format gui slot 49 of player with sunflower named "&7Total Price: &a$0" to run function sellCalc(player)
- set lore of slot 49 of player's current inventory to "&7Click to refresh"
- format gui slot 50 of player with paper named "&a&lConfirm" to run:
- sellGUI(player)
- loop integers between 9 and 44:
- loop {SellGui::data::items::*}:
- if slot loop-number-1 of gui-inventory = loop-value-2 parsed as item type:
- format gui slot loop-number-1 of player with air
- unformat gui slot loop-number-1 of player
- set lore of slot 50 of player's current inventory to "&7Sell all imported items."
- else:
- send "{@p} &cNo such argument."
- stop
- on inventory close:
- if name of current inventory of player is "&a&lSell GUI":
- if {SellPlants::data::%uuid of player%::canceled} is "return":
- clear {SellPlants::data::%uuid of player%::canceled}
- loop integers between 10 and 44:
- if loop-number is not 17, 18, 19, 26, 27, 35, 36 or 44:
- if slot loop-number of player's current inventory is not air:
- set {_item} to slot loop-number of player's current inventory
- set {_true} to true
- if player's inventory has enough space for {_item}:
- give player {_item}
- else:
- drop {_item} at player
- if {_true} is true:
- send "{@p} &aAll Your items has been given back to you." to player
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement