Advertisement
Guest User

MessageLogger

a guest
Mar 13th, 2021
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 7.75 KB | None | 0 0
  1. #
  2. #______ _ _
  3. #| ___ \ (_) | |
  4. #| |_/ /___ __ _ _ _ _ _ __ ___ _ __ ___ ___ _ __ | |_ ___
  5. #| // _ \/ _` | | | | | '__/ _ \ '_ ` _ \ / _ \ '_ \| __/ __|
  6. #| |\ \ __/ (_| | |_| | | | | __/ | | | | | __/ | | | |_\__ \
  7. #\_| \_\___|\__, |\__,_|_|_| \___|_| |_| |_|\___|_| |_|\__|___/
  8. # | |
  9. # |_|
  10. #
  11. #
  12. #REQUIRES:
  13. #Skript (https://github.com/SkriptLang/Skript/releases)
  14. #Skript TuSKe (https://skripttools.net/dl/TuSKe+1.8.3-PikachuPatch-v3.jar)
  15. # Tested on Paper Spigot 1.16.5
  16. #
  17. # _____ _ _ _
  18. #/ __ \ | (_) |
  19. #| / \/_ __ ___ __| |_| |_ ___
  20. #| | | '__/ _ \/ _` | | __/ __|
  21. #| \__/\ | | __/ (_| | | |_\__ \
  22. # \____/_| \___|\__,_|_|\__|___/
  23. #
  24. #
  25. #CREDITS:
  26. #
  27. #Made by CausedCornet365#0510
  28. #For help contact CausedCornet365#0510
  29. #Used part of AsuDev's pagtest gui system
  30. #
  31. #
  32. # ____ _ _
  33. # / __ \ | | (_)
  34. # | | | |_ __ | |_ _ ___ _ __ ___
  35. # | | | | '_ \| __| |/ _ \| '_ \/ __|
  36. # | |__| | |_) | |_| | (_) | | | \__ \
  37. # \____/| .__/ \__|_|\___/|_| |_|___/
  38. # | |
  39. # |_|
  40. options:
  41. #(9, 18, 27, 36, 45)
  42. #Example: guiSize: 9
  43. guiSize: 9
  44. #(Uses bukkit color codes [chatcodes] [https://htmlcolorcodes.com/bukkit-color-codes/])
  45. #(If there is no space between the text and prefix in messages add a space after the prefix)
  46. prefix: &b&l[MessageLogger]
  47. #(ONLY TOUCH THIS IF YOU RENAME THE SKRIPT)
  48. skriptname: ml
  49. #
  50. # _____ _ _
  51. # | __ \ (_) (_)
  52. # | |__) |__ _ __ _ __ ___ _ ___ ___ _ ___ _ __ ___
  53. # | ___/ _ \ '__| '_ ` _ \| / __/ __| |/ _ \| '_ \/ __|
  54. # | | | __/ | | | | | | | \__ \__ \ | (_) | | | \__ \
  55. # |_| \___|_| |_| |_| |_|_|___/___/_|\___/|_| |_|___/
  56. #
  57. #
  58. # "ml.*" - Allows access to all message logger commands
  59. # "ml.use" - Allows access to "/mlgui"
  60. # "ml.clear" - Allows access to "/mlclear"
  61. # "ml.reload" - Allows access to "/mlreload"
  62. #
  63. # _____ _
  64. # / ____| | |
  65. # | | ___ _ __ ___ _ __ ___ __ _ _ __ __| |___
  66. # | | / _ \| '_ ` _ \| '_ ` _ \ / _` | '_ \ / _` / __|
  67. # | |___| (_) | | | | | | | | | | | (_| | | | | (_| \__ \
  68. # \_____\___/|_| |_| |_|_| |_| |_|\__,_|_| |_|\__,_|___/
  69. #
  70. # "/mlgui (player)" - See a player's messages
  71. # "/mlclear (player)" - Clear a player's messages
  72. # "/mlreload" - Reload the skript (Any errors will appear in console)
  73. #
  74. # _____ _
  75. #/ __ \ | |
  76. #| / \/ ___ __| | ___
  77. #| | / _ \ / _` |/ _ \
  78. #| \__/\ (_) | (_| | __/
  79. # \____/\___/ \__,_|\___|
  80. #
  81. #
  82. command /mldebug <text>:
  83. permission: ml.use
  84. trigger:
  85. if arg-1 is set:
  86. add arg-1 to {messages::%player's uuid%::*}
  87. send "{@prefix} &bDebugged with &b""%arg-1%&b""" to player
  88. on chat:
  89. add message to {messages::%player's uuid%::*}
  90. # Function that returns true or false based on if the player can open a specific page
  91. function checkForSpecifiedPage(slot: number, guiSize: number, list: objects) :: boolean:
  92. set {_counter} and {_format} to 0
  93. loop {_list::*}:
  94. if {_counter}+1 is between {_slot} and {_slot}+({_guiSize}-1):
  95. add 1 to {_format}
  96. add 1 to {_counter}
  97. if {_format} is 0:
  98. return false
  99. else:
  100. return true
  101. #
  102. command /mlclear <offline player>:
  103. permission: ml.clear or ml.*
  104. permission message: {@prefix} &bYou do not have permission to do this!
  105. trigger:
  106. if arg-1 isn't set:
  107. send "{@prefix} &b&lplease specify a player" to player
  108. else:
  109. clear {messages::%arg-1's uuid%::*}
  110. send "{@prefix} &b&lcleared %arg-1%&b&l's messages" to player
  111. on load:
  112. if {reload} is true:
  113. set {reload} to false
  114. send "{@prefix} &breloaded!" to {reloader}
  115. send "&7(Any errors will appear in console)" to {reloader}
  116. delete {reloader}
  117. command /mlreload:
  118. permission: ml.reload or ml.*
  119. permission message: {@prefix} &bYou do not have permission to do this!
  120. trigger:
  121. if executor is not console:
  122. set {reload} to true
  123. set {reloader} to player
  124. execute console command "sk reload {@skriptname}.sk"
  125. else:
  126. send "{@prefix} &b&lThis cannot be executed by console!" to console
  127. command /mlgui <offline player> [<integer=1>]:
  128. permission: ml.use or ml.*
  129. permission message: {@prefix} &bYou do not have permission to do this!
  130. trigger:
  131. set {argg} to arg-1
  132. set {_a} to arg-2
  133. set {_pr} to {_a} - 1
  134. set {_next} to {_a} + 1
  135. # Make sure to block anhything below 0 as a page
  136. if arg 2 is less than or equal to 0:
  137. message "&c0 &7is not a valid page."
  138. execute player command "/mlgui %arg-1% 1"
  139. stop
  140. # Example size of the inventory / Must be divisible by 9 and up to 53
  141. # In the example I am using, I cannot use 53 size because I am going to
  142. # dedicate 1 row for the page switchers, therefore the max size in this
  143. # example can only be 45
  144. set {_guiSize} to {@guiSize}
  145.  
  146. # List to use as an example for the GUI
  147. set {_c} to 0
  148. loop {messages::%arg-1's uuid%::*}:
  149. add 1 of paper named "%loop-value%" with lore "&bClick to view" to {_list::*}
  150. add 1 to {_c}
  151.  
  152. # Gets the slot to start at on specified page
  153. set {_slot} to ((arg 2 * {_guiSize}) + 1) - {_guiSize}
  154.  
  155. # Checks if the specified page has anything in it / Gets how many available pages there are
  156. if checkForSpecifiedPage({_slot}, {_guiSize}, {_list::*}) is false:
  157. set {_availablePages} to ceil(size of {_list::*}/{_guiSize})
  158. message "&7Invalid page. &7You have &c%{_availablePages}% &7available pages."
  159. stop
  160.  
  161. # Open the Gui to the player / I used +1 because I want a row dedicated for the page turners
  162. open virtual chest inventory with size ({_guiSize}/9) + 1 named "&9&l%{argg}% &8&l| &8Page %arg 2%" to player
  163.  
  164. # Example buttons to switch to different pages / The last row in this case is dedicated to these
  165. format gui slot {_guiSize}+2 of player with feather named "&c&l<- PREVIOUS PAGE&r" to close then run player command "/mlgui %{argg}% %{_pr}%"
  166. format gui slot {_guiSize}+6 of player with feather named "&a&lNEXT PAGE ->&r" to close then run player command "/mlgui %{argg}% %{_next}%"
  167.  
  168. # Formats the gui
  169. set {_counter} and {_format} to 0
  170. loop {_list::*}:
  171. set {_text} to loop-value's name
  172. if {_counter}+1 is between {_slot} and {_slot}+({_guiSize}-1):
  173. format gui slot {_format} of player with loop-value to run:
  174. send "{@prefix} &b&l%{argg}% - &b""&b%{_text}%&b""" to player
  175. close player's inventory
  176. add 1 to {_format}
  177. add 1 to {_counter}
  178. # ______ ______ ______ ______ ______ ______ ______ ______ ______ ______ ______ ______ ______ ______ ______ ______
  179. # |______|______|______|______|______|______|______|______|______|______|______|______|______|______|______|______|
  180. # ______ ______ ______ ______ ______ ______ ______ ______ ______ ______ ______ ______ ______ ______ ______ ______
  181. # |______|______|______|______|______|______|______|______|______|______|______|______|______|______|______|______|
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement