Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function bankItems(viewer:text,account:text="<none>",page:integer=0,search:text="all"):
- set {_viewer} to {_viewer} parsed as player
- if {_account} is "<none>":
- set {_account} to {_viewer}
- else:
- set {_account} to {_account} parsed as offline player
- set {_loop} to 0
- set {_all_pages} to 0
- set {_next_page} to {_page} + 1
- delete {x-bankwithdraw::%{uuid::%{_account}%}%::%{_next_page}%::*}
- delete {x-bankwithdraw::%{uuid::%{_account}%}%::%{_all_pages}%::*}
- loop {sql_bank-items::%{uuid::%{_account}%}%::*}:
- delete {_lore::*}
- delete {_lore}
- if {sql_bank-items::%{uuid::%{_account}%}%::%loop-index%::item} is not set:
- delete {sql_bank-items::%{uuid::%{_account}%}%::%loop-index%}
- delete {sql_bank-items::%{uuid::%{_account}%}%::%loop-index%::*}
- continue
- if {_search} is not "all":
- name of {sql_bank-items::%{uuid::%{_account}%}%::%loop-index%::item} does not contain "%{_search}%"
- set {_lore::*} to lore of {sql_bank-items::%{uuid::%{_account}%}%::%loop-index%::item}
- set {_lore} to ""
- loop {_lore::*}:
- set {_lore} to "%{_lore}% %loop-value-2%"
- replace all ", " and " and " with "" in {_lore::*}
- {_lore} does not contain "%{_search}%"
- "%{sql_bank-items::%{uuid::%{_account}%}%::%loop-index%::item}%" does not contain "%{_search}%"
- set {_enchantments} to "%enchantments of {sql_bank-items::%{uuid::%{_account}%}%::%loop-index%::item}%"
- replace all ", " and " and " with " " in {_enchantments}
- {_enchantments} does not contain "%{_search}%"
- continue
- set {x-bankwithdraw::%{uuid::%{_account}%}%::%{_all_pages}%::%{_loop}%} to loop-index
- add 1 to {_loop}
- if {_loop} is greater than 44:
- set {_loop} to 0
- add 1 to {_all_pages}
- delete {x-bankwithdraw::%{uuid::%{_account}%}%::%{_all_pages}%::*}
- if {_search} is "all":
- set {_searchtag} to ""
- else:
- set {_searchtag} to " ""%{_search}%"""
- if {_account} is not {_viewer}:
- open "CHEST" with 6 rows named "%{_account}%'s Bank (Page: %{_page} +1%/%{_all_pages} +1%)%{_searchtag}%" to {_viewer}
- else:
- open "CHEST" with 6 rows named "Bank (Page: %{_page} +1%/%{_all_pages} +1%)%{_searchtag}%" to {_viewer}
- wait 2 ticks
- set {x-inventory::%{uuid::%{_viewer}%}%::interactive_menu} to "Bank>%{_account}%>Withdraw>%{_page}%>Search>%{_search}%"
- if {_page} is not 0:
- set slot 45 of {_viewer}'s current inventory to paper named "&r&4&r&6<- Previous" with lore "&7Click to go to the previous" and "&7page"
- set slot 47 of {_viewer}'s current inventory to chest named "&r&4&r&9&lDeposit" with lore "&7Click to deposit items into" and "&7your bank"
- if {_search} is not "all":
- set slot 49 of {_viewer}'s current inventory to barrier named "&r&4&r&c&lCancel Search" with lore "&7Click to cancel search"
- set slot 51 of {_viewer}'s current inventory to compass named "&r&4&r&9&lSearch" with lore "&7Click to search for items in" and "&7your bank"
- if {x-bankwithdraw::%{uuid::%{_account}%}%::%{_next_page}%::*} is set:
- set slot 53 of {_viewer}'s current inventory to paper named "&r&4&r&6Next ->" with lore "&7Click to go to the next page"
- set {_slot} to 0
- loop {x-bankwithdraw::%{uuid::%{_account}%}%::%{_page}%::*}:
- delete {_lore::*}
- set {_amount} to 0
- set {_item::*} to {sql_bank-items::%{uuid::%{_account}%}%::%loop-value%} split at "||"
- set {_amount} to {_item::1} parsed as integer
- if {_amount} is 0:
- delete {sql_bank-items::%{uuid::%{_account}%}%::%loop-value%}
- delete {sql_bank-items::%{uuid::%{_account}%}%::%loop-value%::item}
- continue
- set {_lore::*} to lore of {sql_bank-items::%{uuid::%{_account}%}%::%loop-value%::item}
- if max stack size of {sql_bank-items::%{uuid::%{_account}%}%::%loop-value%::item} is 1:
- add "&r&4&r", "&7&m-&f&m-&7[&b&l Bank Information &7]&f&m-&7&m-", "&9 &lAmount: &2%{_amount}%", "&7 Left click to: &btake &7(&b1&7)&b" and "&7 Right click to: &bstore &7(&b1&7)&b" to {_lore::*}
- else:
- add "&r&4&r", "&7&m-&f&m-&7[&b&l Bank Information &7]&f&m-&7&m-", "&9 &lAmount: &2%{_amount}%", "&7 Left click to: &btake &7(&b1&7)&b", "&7 Right click to: &bstore &7(&b1&7)&b", "&7 Shift-Left click to: &btake &7(&b%max stack size of {sql_bank-items::%{uuid::%{_account}%}%::%loop-value%::item}%&7)&b" and "&7 Shift-Right click to: &bstore &7(&b%max stack size of {sql_bank-items::%{uuid::%{_account}%}%::%loop-value%::item}%&7)&b" to {_lore::*}
- set slot {_slot} of {_viewer}'s current inventory to 1 of {sql_bank-items::%{uuid::%{_account}%}%::%loop-value%::item} with lore {_lore::*}
- delete {_lore::*}
- add 1 to {_slot}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement