Advertisement
Cool_Colton

Untitled

Sep 12th, 2020
38
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 8.04 KB | None | 0 0
  1. function rainbow(input: string, saturation: number = 1, lightness: number = 0.5) :: string:
  2. set {_l} to 280 / (length of {_input})
  3. loop (length of {_input}) times:
  4. set {_r} to "%{_r} ? """"%%rgbToHex(hslToRgb((loop-number * ({_l} if loop-number != 1, else 1)), {_saturation}, {_lightness}))%%subtext of {_input} from indices loop-number to loop-number%"
  5. return colored {_r}
  6.  
  7. function hslToRgb(h: number, s: number, l: number) :: integers: #
  8. set {_h} to {_h}/360
  9. if {_s} = 0:
  10. set {_r}, {_g} and {_b} to {_l}
  11. else:
  12. set {_q} to (({_l} * ({_s} + 1)) if {_l} < 0.5, else ({_l} + {_s} - {_l} * {_s}))
  13. set {_p} to (2 * {_l}) - {_q}
  14.  
  15. set {_r} to hueToRgb({_p}, {_q}, {_h} + 1 / 3)
  16. set {_g} to hueToRgb({_p}, {_q}, {_h})
  17. set {_b} to hueToRgb({_p}, {_q}, {_h} - 1 / 3)
  18. return round(min(255, (255 * {_r}))), round(min(255, (255 * {_g}))) and round(min(255, (255 * {_b})))
  19.  
  20. function hueToRgb(p: number, q: number, t: number) :: number:
  21. add 1 to {_t} if {_t} < 0
  22. remove 1 from {_t} if {_t} > 1
  23. return {_p} + ({_q} - {_p}) * 6 * {_t} if {_t} < 1 / 6
  24. return {_q} if {_t} < 1/2
  25. return {_p} + ({_q} - {_p}) * (2 / 3 - {_t}) * 6 if {_t} < 2 / 3
  26. return {_p}
  27.  
  28. on load:
  29. set {hex::*} to split "&0|&1|&2|&3|&4|&5|&6|&7|&8|&9|&a|&b|&c|&d|&e|&f" at "|"
  30.  
  31. function rgbToHex(values: numbers) :: string:
  32. loop {_values::*}:
  33. set {_r} to "%{_r} ? ""&x""%%{hex::%((loop-value - mod(loop-value, 16)) / 16 + 1)%} ? """"%%{hex::%mod(loop-value, 16) + 1%} ? """"%"
  34. return {_r}
  35.  
  36. function gradient(input: string, color-from: integers, color-to: integers) :: string:
  37. loop {_color-from::*}:
  38. set {_i::%loop-index%} to round(({_color-to::%loop-index%} - loop-value) / length of {_input})
  39. loop length of {_input} times:
  40. set {_r} to "%{_r} ? """"%%rgbToHex({_color-from::*})%%subtext of {_input} from indices loop-number to loop-number%"
  41. set {_color-from::*} to ({_color-from::1} + {_i::1}), ({_color-from::2} + {_i::2}) and ({_color-from::3} + {_i::3})
  42. return colored {_r}
  43.  
  44. on chat:
  45. {rainbowchat::%player's uuid%} is true:
  46. set {_d} to rainbow("%message%", 1, 0.725)
  47. {silver-goldchat::%player's uuid%} is true:
  48. set {_d} to gradient("%message%", (179, 220, and 252), (234, 192, and 80))
  49. {chromechat::%player's uuid%} is true:
  50. set {_d} to gradient("%message%", (142, 141, and 141), (190, 192, and 194))
  51. {janluchat::%player's uuid%} is true:
  52. set {_d} to gradient("%message%", (245, 178, and 44), (82, 84, and 204))
  53. {nxoichat::%player's uuid%} is true:
  54. set {_d} to gradient("%message%", (36, 35, and 35), (255, 255, and 255))
  55. {redchat::%player's uuid%} is true:
  56. set {_d} to gradient("%message%", (255, 0, and 0), (250, 0, and 0))
  57. {jackchat::%player's uuid%} is true:
  58. set {_d} to gradient("%message%", (213, 255, and 46), (147, 36, and 35))
  59. {zeechat::%player's uuid%} is true:
  60. set {_d} to gradient("%message%", (255, 255, and 102), (153, 255, and 102))
  61. {_d} is set
  62. set chat format to "%player's display name%: %{_d}%"
  63.  
  64.  
  65. on join:
  66. set {_d} to rainbow("Colors", 1, 0.725)
  67. set metadata tag "colors" of player to chest inventory with 5 rows named "%{_d}%"
  68. loop {gradientnames::*}:
  69. set {_d} to loop-index
  70. set {_d} to {_d} - 1
  71. set slot {_d} of metadata tag "colors" of player to any wool named "%loop-value%"
  72.  
  73. command /creategradient <integer> <integer> <integer> <integer> <integer> <integer>:
  74.  
  75. command /allcolors:
  76. trigger:
  77. open metadata tag "colors" of player to player
  78.  
  79. command /redchat [<text>]:
  80. permission: rainbowchat.use
  81. trigger:
  82. arg 1 is "on":
  83. set {redchat::%player's uuid%} to true
  84. set {rainbowchat::%player's uuid%} to false
  85. set {silver-goldchat::%player's uuid%} to false
  86. set {chromechat::%player's uuid%} to false
  87. set {janluchat::%player's uuid%} to false
  88. set {nxoichat::%player's uuid%} to false
  89. set {jackchat::%player's uuid%} to false
  90. set {zeechat::%player's uuid%} to false
  91. else if arg 1 is "off":
  92. set {redchat::%player's uuid%} to false
  93. else:
  94. send "Use /redchat <on/off>"
  95.  
  96. command /rainbowchat [<text>]:
  97. permission: rainbowchat.use
  98. trigger:
  99. arg 1 is "on":
  100. set {redchat::%player's uuid%} to false
  101. set {rainbowchat::%player's uuid%} to true
  102. set {silver-goldchat::%player's uuid%} to false
  103. set {chromechat::%player's uuid%} to false
  104. set {janluchat::%player's uuid%} to false
  105. set {nxoichat::%player's uuid%} to false
  106. set {jackchat::%player's uuid%} to false
  107. set {zeechat::%player's uuid%} to false
  108. else if arg 1 is "off":
  109. set {rainbowchat::%player's uuid%} to false
  110. else:
  111. send "Use /rainbowchat <on/off>"
  112.  
  113. command /silver-goldchat [<text>]:
  114. permission: rainbowchat.use
  115. trigger:
  116. arg 1 is "on":
  117. set {redchat::%player's uuid%} to false
  118. set {rainbowchat::%player's uuid%} to false
  119. set {silver-goldchat::%player's uuid%} to true
  120. set {chromechat::%player's uuid%} to false
  121. set {janluchat::%player's uuid%} to false
  122. set {nxoichat::%player's uuid%} to false
  123. set {jackchat::%player's uuid%} to false
  124. set {zeechat::%player's uuid%} to false
  125. else if arg 1 is "off":
  126. set {silver-goldchat::%player's uuid%} to false
  127. else:
  128. send "Use /silver-goldchat <on/off>"
  129.  
  130. command /chromechat [<text>]:
  131. permission: rainbowchat.use
  132. trigger:
  133. arg 1 is "on":
  134. set {redchat::%player's uuid%} to false
  135. set {rainbowchat::%player's uuid%} to false
  136. set {silver-goldchat::%player's uuid%} to false
  137. set {chromechat::%player's uuid%} to true
  138. set {janluchat::%player's uuid%} to false
  139. set {nxoichat::%player's uuid%} to false
  140. set {jackchat::%player's uuid%} to false
  141. set {zeechat::%player's uuid%} to false
  142. else if arg 1 is "off":
  143. set {chromechat::%player's uuid%} to false
  144. else:
  145. send "Use /chromechat <on/off>"
  146.  
  147. command /janluchat [<text>]:
  148. permission: rainbowchat.use
  149. trigger:
  150. arg 1 is "on":
  151. set {redchat::%player's uuid%} to false
  152. set {rainbowchat::%player's uuid%} to false
  153. set {silver-goldchat::%player's uuid%} to false
  154. set {chromechat::%player's uuid%} to false
  155. set {janluchat::%player's uuid%} to true
  156. set {nxoichat::%player's uuid%} to false
  157. set {jackchat::%player's uuid%} to false
  158. set {zeechat::%player's uuid%} to false
  159. else if arg 1 is "off":
  160. set {janluchat::%player's uuid%} to false
  161. else:
  162. send "Use /janluchat <on/off>"
  163.  
  164. command /nxoichat [<text>]:
  165. permission: rainbowchat.use
  166. trigger:
  167. arg 1 is "on":
  168. set {redchat::%player's uuid%} to false
  169. set {rainbowchat::%player's uuid%} to false
  170. set {silver-goldchat::%player's uuid%} to false
  171. set {chromechat::%player's uuid%} to false
  172. set {janluchat::%player's uuid%} to false
  173. set {nxoichat::%player's uuid%} to true
  174. set {jackchat::%player's uuid%} to false
  175. set {zeechat::%player's uuid%} to false
  176. else if arg 1 is "off":
  177. set {nxoichat::%player's uuid%} to false
  178. else:
  179. send "Use /nxoichat <on/off>"
  180.  
  181. command /jackchat [<text>]:
  182. permission: rainbowchat.use
  183. trigger:
  184. arg 1 is "on":
  185. set {redchat::%player's uuid%} to false
  186. set {rainbowchat::%player's uuid%} to false
  187. set {silver-goldchat::%player's uuid%} to false
  188. set {chromechat::%player's uuid%} to false
  189. set {janluchat::%player's uuid%} to false
  190. set {nxoichat::%player's uuid%} to false
  191. set {jackchat::%player's uuid%} to true
  192. set {zeechat::%player's uuid%} to false
  193. else if arg 1 is "off":
  194. set {jackchat::%player's uuid%} to false
  195. else:
  196. send "Use /jackchat <on/off>"
  197.  
  198. command /zeechat [<text>]:
  199. permission: rainbowchat.use
  200. trigger:
  201. arg 1 is "on":
  202. set {redchat::%player's uuid%} to false
  203. set {rainbowchat::%player's uuid%} to false
  204. set {silver-goldchat::%player's uuid%} to false
  205. set {chromechat::%player's uuid%} to false
  206. set {janluchat::%player's uuid%} to false
  207. set {nxoichat::%player's uuid%} to false
  208. set {jackchat::%player's uuid%} to false
  209. set {zeechat::%player's uuid%} to true
  210. else if arg 1 is "off":
  211. set {zeechat::%player's uuid%} to false
  212. else:
  213. send "Use /jackchat <on/off>"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement