Guest User

DynamicListGUI

a guest
May 28th, 2022
57
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 5.54 KB | None | 0 0
  1. command /sethome_test [<string>] [<string>]:
  2.     trigger:
  3.         if arg 1 is set:
  4.             set {skycreations::database.%player%.homes::%arg 1%} to arg 1
  5.             set {skycreations::database.%player%.homes.command::%arg 1%} to arg-1
  6.             if arg 2 is set:
  7.                 set {skycreations::database.%player%.homes.icon::%arg 1%} to arg-2 parsed as item
  8.             if arg 2 is not set:
  9.                 set {skycreations::database.%player%.homes.icon::%arg 1%} to Big Dripleaf
  10.            
  11. command /unsethome_test [<text>]:
  12.     trigger:
  13.         if arg 1 is set:
  14.             delete {skycreations::database.%player%.homes::%arg 1%}
  15.             delete {skycreations::database.%player%.homes.command::%arg 1%}
  16.             delete {skycreations::database.%player%.homes.icon::%arg 1%}
  17.  
  18. command /home_test [<text>] [<text>] [<text>] [<text>]:
  19.     trigger:
  20.         if arg 1 is set:
  21.             SummonListOfWaypoints(player, arg 1, "Warp To")
  22.         if arg 1 is not set:
  23.             SummonListOfWaypoints(player, "1", "Warp To")
  24.  
  25. function SummonListOfWaypoints(player: player, typedpage: text, action: text):
  26.     open chest inventory with 6 rows named "&8Menadzer szybkiej podrozy" to {_player}
  27.     wait 1 ticks
  28.     set {_page} to {_typedpage} parsed as number
  29.     set {skycreations::player::VarTransfer::lastpage} to {_typedpage} parsed as number
  30.     if {_page} is not set:
  31.         set {_page} to 1
  32.     set {_numberofrecords} to size of {skycreations::database.%{_player}%.homes::*}
  33.     set {_numberofpages} to ceil({_numberofrecords}/18)
  34.     if {_numberofpages} is smaller than 1:
  35.         set {_numberofpages} to 1
  36.     if {_page} is smaller than 1:
  37.         send "none" to {_player}
  38.         stop
  39.     if {_page} is greater than {_numberofpages}:
  40.         send "none" to {_player}
  41.         stop
  42.     if {_numberofrecords} is greater than (18*{_page}):
  43.         set slot 43 of {_player}'s current inventory to 1 of arrow named "&aPrzejdz do nastepnej strony" with lore ""
  44.    if {_page} is greater than 1:
  45.        set slot 37 of {_player}'s current inventory to 1 of arrow named "&aPrzejdz do poprzedniej strony" with lore ""
  46.     if size of {skycreations::database.%{_player}%.homes::*} is smaller than 1:
  47.         send "none" to {_player}
  48.         stop
  49.     set slot 40 of {_player}'s current inventory to 1 of book named "&aStrona &e&l%{_page}% &6z &e&l%{_numberofpages}%" with lore "" and "&6Ta lista moze przetwarzac" and "&6naprawde wiele rekordow..."
  50.    loop {skycreations::database.%{_player}%.homes::*}:
  51.        add loop-value to {_skycreations::database.%{_player}%.homes::*}
  52.    loop {skycreations::database.%{_player}%.homes.command::*}:
  53.        add loop-value to {_skycreations::database.%{_player}%.homes.command::*}
  54.    loop {skycreations::database.%{_player}%.homes.icon::*}:
  55.        add loop-value to {_skycreations::database.%{_player}%.homes.icon::*}
  56.    loop {_numberofrecords} times:
  57.        set {_list} to ({_page}-1)*18
  58.        add loop-number to {_list}
  59.        if {_skycreations::database.%{_player}%.homes::%{_list}%} is not set:
  60.            stop
  61.        if loop-number is (18+1):
  62.            stop
  63.        set slot (17+loop-number) of {_player}'s current inventory to 1 of {_skycreations::database.%{_player}%.homes.icon::%{_list}%} named "&e&l%{_skycreations::database.%{_player}%.homes::%{_list}%}%" with lore ""
  64.         # send "&7ID --- Name --- Persorm --- Icon" to {_player}
  65.         # send "&a%{_list}% &f--- &b&l%{_skycreations::database.%{_player}%.homes::%{_list}%}% &f--- &e&l%{_skycreations::database.%{_player}%.homes.command::%{_list}%}% &f--- &c%{_skycreations::database.%{_player}%.homes.icon::%{_list}%}% " to {_player}
  66.         # send "" to {_player}
  67.              
  68. on inventory click:
  69.     event-inventory is not player's inventory
  70.    if name of event-inventory is "&8Menadzer szybkiej podrozy":
  71.        cancel event
  72.        set {_player} to player
  73.        set {_page} to 1
  74.        set {_numberofrecords} to size of {skycreations::database.%{_player}%.homes::*}
  75.        set {_numberofpages} to ceil({_numberofrecords}/32000)
  76.        if {_numberofpages} is smaller than 1:
  77.            set {_numberofpages} to 1
  78.        loop {skycreations::database.%{_player}%.homes::*}:
  79.            add loop-value to {_skycreations::database.%{_player}%.homes::*}
  80.        loop {skycreations::database.%{_player}%.homes.command::*}:
  81.            add loop-value to {_skycreations::database.%{_player}%.homes.command::*}
  82.        loop {skycreations::database.%{_player}%.homes.icon::*}:
  83.            add loop-value to {_skycreations::database.%{_player}%.homes.icon::*}
  84.        set {_numberofrecords} to size of {skycreations::database.%{_player}%.homes::*}
  85.        loop {_numberofrecords} times:
  86.            set {_list} to ({_page}-1)*32000
  87.            add loop-number to {_list}
  88.            if {_skycreations::database.%{_player}%.homes::%{_list}%} is not set:
  89.                stop
  90.            if loop-number is 32000:
  91.                stop
  92.            event-item is {_skycreations::database.%{_player}%.homes.icon::%{_list}%} named "&e&l%{_skycreations::database.%{_player}%.homes::%{_list}%}%":
  93.                send "./home %{_skycreations::database.%{_player}%.homes.command::%{_list}%}% get %{_player}%" to {_player}
  94.        if event-item is arrow named "&aPrzejdz do nastepnej strony":
  95.            execute {_player} command "/hometest %({skycreations::player::VarTransfer::lastpage}+1)%"
  96.        if event-item is arrow named "&aPrzejdz do poprzedniej strony":
  97.            execute {_player} command "/hometest %({skycreations::player::VarTransfer::lastpage}-1)%"
Advertisement
Add Comment
Please, Sign In to add comment