Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- options:
- ver: 1.0
- sellmultiplier: 0.4
- sellwand: 1 blaze rod named "&8[&a&lSell&2&lWand&8]"
- command /sellwand:
- trigger:
- give player 1 blaze rod named "&8[&a&lSell&2&lWand&8]"
- on right click:
- if name of player's tool = "&8[&a&lSell&2&lWand&8]":
- cancel event
- if target block = chest:
- if distance between player's location and location of target block is less than 5.1:
- if player's tool = blaze rod:
- set {_a} to line 5 of player's tool's lore
- set {_level::*} to {_a} split at "&8> &fDurability: &e"
- set {_level} to {_level::2} parsed as a number
- set {_amount} to 0
- set {_sold} to 0
- set {_value} to 0
- loop all items in target block's inventory:
- set {_item} to 1 of loop-item
- if {grow::item::%{_item}%::sell} is set:
- if {_level} < 0:
- delete player's tool
- play sound "item.shield.break" with volume 1 at player for player
- stop loop
- set {_bashed} to true
- if {_bashed} != true:
- if {_level} < {_amount}:
- set {_amount} to {_level}
- set {_break} to true
- set {_amount} to amount of item loop-item
- remove loop-item from target block's inventory
- add {_amount}*(a rounded {grow::item::%{_item}%::price}*{@sellmultiplier}) to player's balance
- add {_amount}*(a rounded {grow::item::%{_item}%::price}*{@sellmultiplier}) to {_value}
- add {_amount} to {_sold}
- remove {_amount} from {_level}
- if {_break} is true:
- delete player's tool
- play sound "item.shield.break" with volume 1 at player for player
- stop loop
- else:
- add 1 to {_invalid}
- if {_sold} > 0:
- message "%prefix()% Sold &a%easyRead({_sold})% &7items worth &e$%easyRead(a rounded {_value})%"
- if {_break} != true:
- play sound "entity.player.levelup" with volume 1 at player for player
- set line 5 of player's tool's lore to "&8> &fDurability: &e%{_level}%"
- else:
- message "%prefix()% There is nothing you can sell in that chest"
- play sound "entity.villager.hurt" with volume 1 at player for player
- function easyRead(n: number) :: string:
- set {_n} to "%a rounded {_n}%"
- set {_var::*} to {_n} split at ""
- set {_i} to -1
- set {_stuff} to 0
- loop {_var::*}:
- add 1 to {_i}
- set {_lol} to (size of {_var::*}) - {_stuff}
- add 1 to {_stuff}
- add {_var::%{_lol}%} to {_rtr::*}
- if {_i} = 3:
- if {_lol} != 1:
- add "." to {_rtr::*}
- set {_i} to 0
- set {_stuff} to 0
- loop size of {_rtr::*}+1 times:
- set {_lol} to (size of {_rtr::*})-{_stuff}
- add {_rtr::%{_lol}%} to {_rts::*}
- add 1 to {_stuff}
- return join {_rts::*}
- function prefix() :: string:
- return "&2&lGardens"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement