Advertisement
Guest User

Memest of the memes

a guest
Nov 20th, 2018
439
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 23.77 KB | None | 0 0
  1. options:
  2. command: display # What do you want the command to be. (/display this is the command guys)
  3. prefix: &b%player%'s &8» # The prefix of the display. (Test's Item Display: stone (1x) » yay) (":" comes up with an error, I've used "›")
  4. perm: display.use # The permission required to use the command.
  5. permmsg: &cYou do not have access to this command. # If you dont have the required permission.
  6. cooldown: 10 seconds # The cooldown that players need to wait till they can use it again.
  7.  
  8. noitem: &cYou are not holding an item. # The message recieved if youre holding air.
  9. namecolour: &7 # The default name colour of the item. If the item is named, the name will override the colour.
  10. amountcolour: &7 # The colour that "(1x)" will be displayed as.
  11. split: &3&l» # The split between "stone (1x)" and the message.
  12. chatcolour: &f # The colour of the message displayed given in the command. (/display this is the text here)
  13.  
  14.  
  15. command /{@command} [<text>]:
  16. permission: {@perm}
  17. permission message: {@permmsg}
  18. trigger:
  19. set {_wait} to difference between now and {display.%player's uuid%}
  20. if {_wait} is less than {@cooldown}:
  21. send "&cPlease wait %difference between {@cooldown} and {_wait}%."
  22. stop
  23. set {display.%player's uuid%} to now
  24. if player's held item is air:
  25. send "{@noitem}"
  26. stop
  27. if arg-1 is not set:
  28. set {_text} to "&7"
  29. if arg-1 is set:
  30. set {_text} to arg-1
  31. set {_name} to held item's name
  32. if {_name} is not set:
  33. set {_name} to "{@namecolour}%player's tool's type%"
  34. set {_amount} to amount of player's held item in player's inventory
  35.  
  36. set {_protection} to "%level of protection of player's tool%" parsed as a number
  37. if {_protection} is greater than or equal to 1:
  38. set {_enchants} to "&7Protection %{_protection}%"
  39.  
  40. set {_fprotection} to "%level of fire protection of player's tool%" parsed as a number
  41. if {_fprotection} is greater than or equal to 1:
  42. if {_enchants} is set:
  43. set {_enchants} to "%{_enchants}%%new line%&7Fire Protection %{_fprotection}%"
  44. else:
  45. set {_enchants} to "&7Fire Protection %{_fprotection}%"
  46.  
  47. set {_featherfalling} to "%level of feather falling of player's tool%" parsed as a number
  48. if {_featherfalling} is greater than or equal to 1:
  49. if {_enchants} is set:
  50. set {_enchants} to "%{_enchants}%%new line%&7Feather Falling %{_featherfalling}%"
  51. else:
  52. set {_enchants} to "&7Feather Falling %{_featherfalling}%"
  53.  
  54. set {_bprotection} to "%level of blast protection of player's tool%" parsed as a number
  55. if {_bprotection} is greater than or equal to 1:
  56. if {_enchants} is set:
  57. set {_enchants} to "%{_enchants}%%new line%&7Blast Protection %{_bprotection}%"
  58. else:
  59. set {_enchants} to "&7Blast Protection %{_bprotection}%"
  60.  
  61. set {_pprotection} to "%level of projectile protection of player's tool%" parsed as a number
  62. if {_pprotection} is greater than or equal to 1:
  63. if {_enchants} is set:
  64. set {_enchants} to "%{_enchants}%%new line%&7Projectile Protection %{_pprotection}%"
  65. else:
  66. set {_enchants} to "&7Projectile Protection %{_pprotection}%"
  67.  
  68. set {_respiration} to "%level of respiration of player's tool%" parsed as a number
  69. if {_respiration} is greater than or equal to 1:
  70. if {_enchants} is set:
  71. set {_enchants} to "%{_enchants}%%new line%&7Respiration %{_respiration}%"
  72. else:
  73. set {_enchants} to "&7Respiration %{_respiration}%"
  74.  
  75. set {_aquaaffinity} to "%level of aqua affinity of player's tool%" parsed as a number
  76. if {_aquaaffinity} is greater than or equal to 1:
  77. if {_enchants} is set:
  78. set {_enchants} to "%{_enchants}%%new line%&7Aqua Affinity %{_aquaaffinity}%"
  79. else:
  80. set {_enchants} to "&7Aqua Affinity %{_aquaaffinity}%"
  81.  
  82. set {_thorns} to "%level of thorns of player's tool%" parsed as a number
  83. if {_thorns} is greater than or equal to 1:
  84. if {_enchants} is set:
  85. set {_enchants} to "%{_enchants}%%new line%&7Thorns %{_thorns}%"
  86. else:
  87. set {_enchants} to "&7Thorns %{_thorns}%"
  88.  
  89. set {_depthstrider} to "%level of depth strider of player's tool%" parsed as a number
  90. if {_depthstrider} is greater than or equal to 1:
  91. if {_enchants} is set:
  92. set {_enchants} to "%{_enchants}%%new line%&7Depth Strider %{_depthstrider}%"
  93. else:
  94. set {_enchants} to "&7Depth Strider %{_depthstrider}%"
  95.  
  96. set {_frostwalker} to "%level of frost walker of player's tool%" parsed as a number
  97. if {_frostwalker} is greater than or equal to 1:
  98. if {_enchants} is set:
  99. set {_enchants} to "%{_enchants}%%new line%&7Frost Walker %{_frostwalker}%"
  100. else:
  101. set {_enchants} to "&7Frost Walker %{_frostwalker}%"
  102.  
  103. set {_sharpness} to "%level of sharpness of player's tool%" parsed as a number
  104. if {_sharpness} is greater than or equal to 1:
  105. if {_enchants} is set:
  106. set {_enchants} to "%{_enchants}%%new line%&7Sharpness %{_sharpness}%"
  107. else:
  108. set {_enchants} to "&7Sharpness %{_sharpness}%"
  109.  
  110. set {_smite} to "%level of smite of player's tool%" parsed as a number
  111. if {_smite} is greater than or equal to 1:
  112. if {_enchants} is set:
  113. set {_enchants} to "%{_enchants}%%new line%&7Smite %{_smite}%"
  114. else:
  115. set {_enchants} to "&7Smite %{_smite}%"
  116.  
  117. set {_boa} to "%level of bane of arthropods of player's tool%" parsed as a number
  118. if {_boa} is greater than or equal to 1:
  119. if {_enchants} is set:
  120. set {_enchants} to "%{_enchants}%%new line%&7Bane Oof Arthropods %{_boa}%"
  121. else:
  122. set {_enchants} to "&7Bane of Arthropods %{_bca}%"
  123.  
  124. set {_knockback} to "%level of knockback of player's tool%" parsed as a number
  125. if {_knockback} is greater than or equal to 1:
  126. if {_enchants} is set:
  127. set {_enchants} to "%{_enchants}%%new line%&7Knockback %{_knockback}%"
  128. else:
  129. set {_enchants} to "&7Knockback %{_knockback}%"
  130.  
  131. set {_fireaspect} to "%level of fire aspect of player's tool%" parsed as a number
  132. if {_fireaspect} is greater than or equal to 1:
  133. if {_enchants} is set:
  134. set {_enchants} to "%{_enchants}%%new line%&7Fire Aspect %{_fireaspect}%"
  135. else:
  136. set {_enchants} to "&7Fire Aspect %{_fireaspect}%"
  137.  
  138. set {_looting} to "%level of looting of player's tool%" parsed as a number
  139. if {_looting} is greater than or equal to 1:
  140. if {_enchants} is set:
  141. set {_enchants} to "%{_enchants}%%new line%&7Looting %{_looting}%"
  142. else:
  143. set {_enchants} to "&7Looting %{_looting}%"
  144.  
  145. set {_se} to "%level of sweeping edge of player's tool%" parsed as a number
  146. if {_se} is greater than or equal to 1:
  147. if {_enchants} is set:
  148. set {_enchants} to "%{_enchants}%%new line%&7Sweeping Edge %{_se}%"
  149. else:
  150. set {_enchants} to "&7Sweeping Edge %{_se}%"
  151.  
  152. set {_unbreaking} to "%level of unbreaking of player's tool%" parsed as a number
  153. if {_unbreaking} is greater than or equal to 1:
  154. if {_enchants} is set:
  155. set {_enchants} to "%{_enchants}%%new line%&7Unbreaking %{_unbreaking}%"
  156. else:
  157. set {_enchants} to "&7Unbreaking %{_unbreaking}%"
  158.  
  159. set {_power} to "%level of power of player's tool%" parsed as a number
  160. if {_power} is greater than or equal to 1:
  161. if {_enchants} is set:
  162. set {_enchants} to "%{_enchants}%%new line%&7Power %{_power}%"
  163. else:
  164. set {_enchants} to "&7Power %{_power}%"
  165.  
  166. set {_punch} to "%level of punch of player's tool%" parsed as a number
  167. if {_punch} is greater than or equal to 1:
  168. if {_enchants} is set:
  169. set {_enchants} to "%{_enchants}%%new line%&7Punch %{_punch}%"
  170. else:
  171. set {_enchants} to "&7Punch %{_punch}%"
  172.  
  173. set {_flame} to "%level of flame of player's tool%" parsed as a number
  174. if {_flame} is greater than or equal to 1:
  175. if {_enchants} is set:
  176. set {_enchants} to "%{_enchants}%%new line%&7Flame %{_flame}%"
  177. else:
  178. set {_enchants} to "&7Flame %{_flame}%"
  179.  
  180. set {_infinity} to "%level of infinity of player's tool%" parsed as a number
  181. if {_infinity} is greater than or equal to 1:
  182. if {_enchants} is set:
  183. set {_enchants} to "%{_enchants}%%new line%&7Infinty %{_infinity}%"
  184. else:
  185. set {_enchants} to "&7Infinity %{_infinity}%"
  186.  
  187. set {_mending} to "%level of mending of player's tool%" parsed as a number
  188. if {_mending} is greater than or equal to 1:
  189. if {_enchants} is set:
  190. set {_enchants} to "%{_enchants}%%new line%&7Mending %{_mending}%"
  191. else:
  192. set {_enchants} to "&7Mending %{_mending}%"
  193.  
  194. set {_efficiency} to "%level of efficiency of player's tool%" parsed as a number
  195. if {_efficiency} is greater than or equal to 1:
  196. if {_enchants} is set:
  197. set {_enchants} to "%{_enchants}%%new line%&7Efficiency %{_efficiency}%"
  198. else:
  199. set {_enchants} to "&7Efficiency %{_efficiency}%"
  200.  
  201. set {_silktouch} to "%level of silk touch of player's tool%" parsed as a number
  202. if {_silktouch} is greater than or equal to 1:
  203. if {_enchants} is set:
  204. set {_enchants} to "%{_enchants}%%new line%&7Silk Touch %{_silktouch}%"
  205. else:
  206. set {_enchants} to "&7Silk Touch %{_silktouch}%"
  207.  
  208. set {_fortune} to "%level of fortune of player's tool%" parsed as a number
  209. if {_fortune} is greater than or equal to 1:
  210. if {_enchants} is set:
  211. set {_enchants} to "%{_enchants}%%new line%&7Fortune %{_fortune}%"
  212. else:
  213. set {_enchants} to "&7Fortune %{_fortune}%"
  214.  
  215. set {_lots} to "%level of luck of the sea of player's tool%" parsed as a number
  216. if {_lots} is greater than or equal to 1:
  217. if {_enchants} is set:
  218. set {_enchants} to "%{_enchants}%%new line%&7Lust of the Sea %{_lots}%"
  219. else:
  220. set {_enchants} to "&7Luck of the Sea %{_lots}%"
  221.  
  222. set {_lure} to "%level of lure of player's tool%" parsed as a number
  223. if {_lure} is greater than or equal to 1:
  224. if {_enchants} is set:
  225. set {_enchants} to "%{_enchants}%%new line%&7Lure %{_lure}%"
  226. else:
  227. set {_enchants} to "&7Lure %{_lure}%"
  228. set {_lore1} to line 1 of lore of player's tool
  229. if {_lore1} is set:
  230. set {_lore2} to line 2 of lore of player's tool
  231. set {_lore} to "%{_lore1}%"
  232. if {_lore2} is set:
  233. set {_lore3} to line 3 of lore of player's tool
  234. set {_lore} to "%{_lore}%%newline%%{_lore2}%"
  235. if {_lore3} is set:
  236. set {_lore4} to line 4 of lore of player's tool
  237. set {_lore} to "%{_lore}%%newline%%{_lore3}%"
  238. if {_lore4} is set:
  239. set {_lore5} to line 5 of lore of player's tool
  240. set {_lore} to "%{_lore}%%newline%%{_lore4}%"
  241. if {_lore5} is set:
  242. set {_lore6} to line 6 of lore of player's tool
  243. set {_lore} to "%{_lore}%%newline%%{_lore5}%"
  244. if {_lore6} is set:
  245. set {_lore7} to line 7 of lore of player's tool
  246. set {_lore} to "%{_lore}%%newline%%{_lore6}%"
  247. if {_lore7} is set:
  248. set {_lore8} to line 8 of lore of player's tool
  249. set {_lore} to "%{_lore}%%newline%%{_lore7}%"
  250. if {_lore8} is set:
  251. set {_lore} to "%{_lore}%%newline%%{_lore8}%"
  252. if {_enchants} is set:
  253. json("@a", "{@prefix} &7%{_name}%{@amountcolour} (%{_amount}%x) {@split} {@chatcolour}%{_text}%||ttp:&7%{_name}%%newline%&7%{_enchants}%%newline%%{_lore}%%newline%&8%player's tool's type%")
  254. stop
  255. else:
  256. json("@a", "{@prefix} &7%{_name}%{@amountcolour} (%{_amount}%x) {@split} {@chatcolour}%{_text}%||ttp:&7%{_name}%%newline%%{_lore}%%newline%&8%player's tool's type%")
  257. stop
  258.  
  259. # json.sk by RezzedUp
  260. # ---
  261. # Version: 2.3
  262. # Requires: Skript 2.2
  263. # ---
  264. # Contributors:
  265. # - RezzedUp
  266. # - JKGamerxD
  267. #
  268. # General usage:
  269. #
  270. # ==> json(<recipient>, <text in json.sk format>, <OPTIONAL: whether or not to convert color codes>) :: returns nothing
  271. #
  272. # This function handles everything you could ever need regarding json.
  273. # Everything is automatic with it, you just need to provide the proper json.sk notatation and someone to recieve the message!
  274. #
  275. # --> example #1:
  276. # set {_to} to "@a"
  277. # set {_msg} to "&6Hello, this is a &ejson message&6!||ttp:&b&oSuper duper cool!||cmd:/msg RezzedUp You rock!!!!"
  278. # json({_to}, {_msg})
  279. #
  280. # --> example #2: v [NEW]
  281. # json("%player%", "&6:D||&5Neat", false)
  282. # ^
  283. # json.sk won't convert color codes if set to false.
  284. # If no value is set, it will convert color codes by default.
  285. #
  286. # ==> jsonFormat(<text in json.sk format>) :: returns text
  287. #
  288. # The purpose of this function is to return the formatted peice of json for your own use.
  289. # You can set up your own /tellraw with it
  290. #
  291. # --> example:
  292. # set {_toBeJson} to "I will return a json!||ttp:It's true!"
  293. # set {_jsonText} to jsonFormat({_toBeJson})
  294. # execute console command "/tellraw myUserName %{_jsonText}%"
  295. #
  296.  
  297. #
  298. # JSON.SK NOTATION:
  299. # --> How to create json's!
  300. #
  301. # <always start with normal text>||<3 letter tag>:<text>||<regular text, new json cluster>
  302. # ^
  303. # "||" separates each segment.
  304. #
  305. # json.sk notation follows these rules:
  306. # 1. A cluster of json is formed at each regular text segment.
  307. # 2. There may be only one hoverable and one clickable event per cluster, otherwise things could get messy.
  308. # 3. Json effects are defined by a 3 letter tag at the very start of a segment, followed directly by a colon.
  309. # 4. "||" should only ever be used to separate each json segment.
  310. #
  311. # Json Effect Tags:
  312. # ttp:
  313. # --> Tooltip, hover event
  314. # cmd:
  315. # --> Run command, click event
  316. # sgt:
  317. # --> Suggest command, click event
  318. # url:
  319. # --> Open url, click event
  320. # ins:
  321. # --> Adds an "insertion", shift + click event
  322. # | For more information about the "insertion" attribute, visit
  323. # | http://www.minecraftforum.net/forums/minecraft-discussion/redstone-discussion-and/351959#insertion
  324. #
  325. # Example json.sk notation:
  326. #
  327. #
  328. # "Hello, this is a sample json.||ttp:&bI'm a tooltip for the first cluster.||There's no tag, so I've started a new cluster.||cmd:/ping"
  329. # |_______________________________________________________________________| |_______________________________________________________|
  330. # | |
  331. # JSON Cluster #1 JSON Cluster #2
  332. #
  333. #
  334. # The above json.sk notation purely as their segment types:
  335. #
  336. # "< regular text >||<ttp: tooltip >||< regular text, starting a new cluster >||<cmd:/command>"
  337.  
  338. options:
  339. debug: false
  340. codes: 0|1|2|3|4|5|6|7|8|9|a|b|c|d|e|f|k|l|m|n|o|r
  341.  
  342. #
  343. # FUNCTION: Remove all `&` color codes.
  344. # -> Usage:
  345. # Geneal purpose function to remove color codes.
  346. # This function will not remove color codes already converted.
  347. #
  348.  
  349. function removeColor(msg: text) :: text:
  350. set {_m::*} to {_msg} split at ""
  351.  
  352. set {_color-codes} to "{@codes}"
  353. set {_colors::*} to {_color-codes} split at "|"
  354.  
  355. set {_new} to ""
  356.  
  357. loop {_m::*}:
  358. set {_char} to loop-value
  359. set {_prev} to the last character of {_new}
  360.  
  361. if {_prev} is "&":
  362.  
  363. loop {_colors::*}:
  364.  
  365. if loop-value-2 is {_char}:
  366. set {_skip} to true
  367.  
  368. if {_skip} is set:
  369. delete {_skip}
  370.  
  371. else:
  372. set {_new} to "%{_new}%%{_char}%"
  373.  
  374. return {_new}
  375.  
  376. #
  377. # FUNCTION: Replace all `&` color codes with valid JSON color codes.
  378. # -> Usage:
  379. # Used by json functions to convert color codes.
  380. #
  381.  
  382. function jsonColorize(msg: text, default-color: text = "&r") :: text:
  383. set {_m::*} to {_msg} split at ""
  384.  
  385. set {_color-codes} to "{@codes}"
  386. set {_colors::*} to {_color-codes} split at "|"
  387.  
  388. set {_color} to colored {_default-color}
  389. set {_code} to the first character of {_color}
  390.  
  391. set {_new} to ""
  392. set {_skip} to 0
  393.  
  394. loop amount of {_m::*} times:
  395.  
  396. if {_skip} is more than or equal to 1:
  397. subtract 1 from {_skip}
  398.  
  399. else:
  400. set {_char} to {_m::%loop-number%}
  401. set {_next} to {_m::%loop-number + 1%}
  402.  
  403. if {@debug} is true:
  404. broadcast "&a[Character Check] &r%loop-number%: &7%{_char}% &r&onext: &8%{_next}% &r[%{_color}%color&r]"
  405.  
  406. if {_char} is "&" or {_code}:
  407.  
  408. if {@debug} is true:
  409. broadcast "&a[Color Check] &rFOUND: &o%{_char}%%{_next}% &7&m<--&7&o is it valid?"
  410.  
  411. loop {_colors::*}:
  412.  
  413. if loop-value-2 is {_next}:
  414. set {_color} to "%{_color}%%{_code}%%{_next}%"
  415.  
  416. if {_next} is "r":
  417. set {_color} to {_default-color}
  418.  
  419. set {_new} to "%{_new}%%{_color}%"
  420. set {_skip} to 1
  421.  
  422. if {_skip} is less than or equal to 0:
  423. set {_new} to "%{_new}%%{_char}%"
  424.  
  425. else if {_char} is " ":
  426. set {_new} to "%{_new}% %{_color}%"
  427.  
  428. else:
  429. set {_new} to "%{_new}%%{_char}%"
  430.  
  431. return {_new}
  432.  
  433. #
  434. # FUNCTION: Replace all json-breaking characters.
  435. # -> Usage:
  436. # Used by json functions to avoid errors.
  437. # Allows usage of quotes and back-slashes in your json.
  438. #
  439.  
  440. function jsonSanitize(msg: text) :: text:
  441. if {@debug} is true:
  442. broadcast "&a[Sanitize] &7&oSanitizing input..."
  443.  
  444. set {_m::*} to {_msg} split at ""
  445.  
  446. loop {_m::*}:
  447.  
  448. if loop-value is """":
  449. set {_m::%loop-index%} to "\""" # """
  450.  
  451. else if loop-value is "\":
  452. set {_m::%loop-index%} to "\\"
  453.  
  454. set {_new} to join {_m::*} with ""
  455. return {_new}
  456.  
  457. #
  458. # FUNCTION: Generate a new /tellraw json object from a json.sk-notation string.
  459. # -> Usage:
  460. # See the top of this skript, listed under general usage.
  461. #
  462.  
  463. function jsonFormat(msg: text, color: boolean = true) :: text:
  464. set {_m::*} to {_msg} split at "||"
  465.  
  466. set {_current} to 1
  467.  
  468. loop {_m::*}:
  469. if {_clusters::%{_current}%} is not set:
  470. set {_clusters::%{_current}%} to ""
  471.  
  472. if {_clusters::%{_current}%::text} is not set:
  473. set {_clusters::%{_current}%::text} to jsonSanitize(loop-value)
  474.  
  475. else:
  476. set {_tag} to the first 4 characters of loop-value
  477. set {_value} to subtext of loop-value from characters 5 to the length of loop-value
  478.  
  479. if {_tag} is "ttp:":
  480. set {_clusters::%{_current}%::tooltip} to jsonSanitize({_value})
  481.  
  482. else if {_tag} is "cmd:":
  483. set {_clusters::%{_current}%::command} to jsonSanitize({_value})
  484.  
  485. else if {_tag} is "sgt:":
  486. set {_clusters::%{_current}%::suggest} to jsonSanitize({_value})
  487.  
  488. else if {_tag} is "url:":
  489.  
  490. if {_value} doesn't contain "http://" or "https://":
  491. set {_value} to "http://%{_value}%"
  492.  
  493. set {_clusters::%{_current}%::url} to jsonSanitize({_value})
  494.  
  495. else if {_tag} is "ins:":
  496. set {_clusters::%{_current}%::insertion} to jsonSanitize({_value})
  497.  
  498. else:
  499. add 1 to {_current}
  500. set {_clusters::%{_current}%::text} to jsonSanitize(loop-value)
  501. set {_clusters::%{_current}%} to ""
  502.  
  503. if {@debug} is true:
  504. broadcast "&a[Tag Check] &3cluster:&b%{_current}% &8(&f&o%{_tag}%&8)"
  505.  
  506. loop {_clusters::*}:
  507.  
  508. if {@debug} is true:
  509. broadcast "&a[Cluster Check] &7&oCluster ##%loop-index% exists."
  510.  
  511. set {_i} to loop-index
  512.  
  513. set {_text} to {_clusters::%{_i}%::text}
  514.  
  515. if {_color} is true:
  516. set {_text} to jsonColorize({_text})
  517.  
  518. if {_json} is not set:
  519. set {_json} to "{""text"":""%{_text}%"""
  520. else:
  521. set {_json} to "%{_json}%,{""text"":""%{_text}%"""
  522.  
  523. if {_clusters::%{_i}%::tooltip} is set:
  524.  
  525. if {_color} is true:
  526. set {_tooltip} to jsonColorize({_clusters::%{_i}%::tooltip})
  527.  
  528. else:
  529. set {_tooltip} to {_clusters::%{_i}%::tooltip}
  530.  
  531. set {_json} to "%{_json}%,""hoverEvent"":{""action"": ""show_text"",""value"": ""%{_tooltip}%""}"
  532.  
  533. if {_clusters::%{_i}%::insertion} is set:
  534. set {_json} to "%{_json}%,""insertion"":""%{_clusters::%{_i}%::insertion}%"",""obfuscated"":false"
  535.  
  536. if {_clusters::%{_i}%::command} is set:
  537. set {_clickable} to "%{_json}%,""clickEvent"":{""action"":""run_command"",""value"":""%{_clusters::%{_i}%::command}%""}"
  538.  
  539. if {_clusters::%{_i}%::suggest} is set:
  540. set {_clickable} to "%{_json}%,""clickEvent"":{""action"": ""suggest_command"",""value"": ""%{_clusters::%{_i}%::suggest}%""}"
  541.  
  542. if {_clusters::%{_i}%::url} is set:
  543. set {_clickable} to "%{_json}%,""clickEvent"":{""action"": ""open_url"",""value"": ""%{_clusters::%{_i}%::url}%""}"
  544.  
  545. if {_clickable} is set:
  546. set {_json} to "%{_clickable}%}"
  547. delete {_clickable}
  548.  
  549. else:
  550. set {_json} to "%{_json}%}"
  551.  
  552. return "{""text"":"""", ""extra"":[%{_json}%]}"
  553.  
  554. #
  555. # FUNCTION: Send a json message with json.sk-notation.
  556. # -> Usage:
  557. # See the top of this skript, listed under general usage.
  558. #
  559.  
  560. function json(to: text, msg: text, color: boolean = true):
  561. set {_msg} to jsonFormat({_msg}, {_color})
  562. execute console command "/tellraw %{_to}% %{_msg}%"
  563.  
  564. if {@debug} is true:
  565. set {_player} to {_to} parsed as offline player
  566. if {_player} is online:
  567. send uncolored {_msg} to {_player}
  568.  
  569. #
  570. # FUNCTION: Broadcast a json message with json.sk-notation.
  571. #
  572.  
  573. function jsonBroadcast(msg: text, color: boolean = true):
  574. json("@a", {_msg}, {_color})
  575.  
  576. #
  577. # COMMAND: A command to show that these json functions really work!
  578. # -> Usage:
  579. # /json recipient <text in json.sk notation>
  580. # It's just a test command, not in best practice to use this instead of the json function.
  581. #
  582.  
  583. command /json [<text>] [<text>]:
  584. permission: "is.op"
  585. trigger:
  586. set {_to} to arg 1
  587. set {_msg} to arg 2
  588.  
  589. if arg 1 is not set:
  590. set {_to} to "%player%"
  591. if arg 2 is not set:
  592. set {_msg} to "This is a json message! &c&oClick here for no reason!||ttp:&lReally, click your mouse!||cmd:/json @a %{_to}% clicked their mouse on json..."
  593.  
  594. json({_to}, {_msg})
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement