Advertisement
namekuzi

Untitled

Dec 19th, 2018
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.68 KB | None | 0 0
  1. options:
  2.  
  3. #Toggles the changing of the chat display name with the /nick command.
  4.  
  5. #Default: true
  6. #Accepts: boolean (true/false, yes/no, on/off)
  7. changeChatNick: true
  8.  
  9. #Toggles the changing of the tablist display name with the /nick command.
  10.  
  11. #Default: true
  12. #Accepts: boolean (true/false, yes/no, on/off)
  13. changeTablistNick: true
  14.  
  15. #Toggles the changing of the nametag (above head) display name with the /nick command.
  16.  
  17. #Default: true
  18. #Accepts: boolean (true/false, yes/no, on/off)
  19. changeAboveHeadNick: true
  20.  
  21.  
  22. #Function RemoveColors:
  23. #Removes the color which the specified permission holder (command sender) doesn't have permission for from a text.
  24.  
  25. #Parameters:
  26.  
  27. #{_input} = text to remove the colors.
  28. #{_permission-holder} = the player whose permissions will be checked.
  29.  
  30. #Example:
  31. #can be seen below.
  32.  
  33. function removeColors(input: text, permission-holder: command sender) :: text:
  34.  
  35. set {_colors::*} to integers from 0 to 9 and split "abcdefonmrkl" by ""
  36. set {_input-characters::*} to {_input} split by ""
  37.  
  38. loop {_colors::*}:
  39. if {_input} contains "&%loop-value%":
  40. if {_permission-holder} doesn't have permission "nick.color.&%loop-value%" or "nick.color.all":
  41.  
  42. loop {_input-characters::*}:
  43.  
  44. if loop-value-2 is "&":
  45. set {_next-index} to loop-index-2 parsed as integer + 1
  46.  
  47. if {_input-characters::%{_next-index}%} is "%loop-value-1%":
  48. clear {_input-characters::%loop-index-2%} and {_input-characters::%{_next-index}%}
  49.  
  50. set {_output} to join {_input-characters::*} by ""
  51. return colored {_output}
  52.  
  53.  
  54. function getTrimmedUUIDfromName(player: text) :: text:
  55.  
  56. set {_uuid} to {_player} parsed as offline player's uuid
  57. set {_trimmed-uuid-parts::*} to {_uuid} split by "-"
  58.  
  59. return join {_trimmed-uuid-parts::*} by ""
  60.  
  61.  
  62.  
  63. #skQuery function getSkin:
  64. #First of all and to clarify things, why skQuery functions? Well, Skript functions don't allow delayed code when something is returned.
  65. #That means it won't wait for the request to finish to return and as I'm using Reqn + Skript-JSON now, it'll not return anything.
  66.  
  67. #Parameters:
  68. #Parameter 1 = the player who we will get the skin from.
  69.  
  70. #Examples:
  71. #Can be seen below.
  72. func "getSkin":
  73.  
  74. set {_player} to parameter 1
  75.  
  76. if "%{skin-cache::%{_player}%}%" is "{""signature"":"""",""value"":""""}":
  77. delete {skin-cache::%{_player}%}
  78. if {skin-cache::%{_player}%} isn't set:
  79.  
  80. set {_trimmed-uuid} to getTrimmedUUIDfromName({_player})
  81.  
  82. send request to "https://api.mineskin.org/generate/user/%{_trimmed-uuid}%"
  83. map json last response's body to {_skin-api::*}
  84.  
  85. set {skin-cache::%{_player}%} to skin with value {_skin-api::data::texture::value} signature {_skin-api::data::texture::signature}
  86. set transient "skinOutput" to {skin-cache::%{_player}%}
  87.  
  88. $ access
  89. set {_skin} to transient "skinOutput"
  90. return
  91.  
  92. on join:
  93.  
  94. wait 3 ticks
  95. if {skinStorage::%player's uuid%} is set:
  96. set player's displayed skin to {skinStorage::%player's uuid%}
  97.  
  98. if {nickStorage::%player's uuid%} is set:
  99.  
  100. if {@changeChatNick} = true:
  101. set player's display name to {nickStorage::%player's uuid%}
  102. if {@changeTablistNick} = true:
  103. set player's mundosk tablist name to {nickStorage::%player's uuid%}
  104. if {@changeAboveHeadNick} = true:
  105. set player's nametag to {nickStorage::%player's uuid%}
  106.  
  107.  
  108.  
  109. command /nick1 [<text>]:
  110. permission: nick.change
  111. permission message: <light red>You don<grey>'<light red>t have permission for this.
  112. executable by: players
  113. usage: /nick1 [new nick]
  114. description: Changes your above head,tablist and/or chat nick.
  115. trigger:
  116.  
  117. if argument is set:
  118. set {_match} to uncolored (colored argument)
  119.  
  120. if length of {_match} is less than 16:
  121. set {nickStorage::%sender's uuid%} to removeColors(argument, sender)
  122.  
  123. if {@changeChatNick} is true:
  124. set sender's display name to {nickStorage::%sender's uuid%}
  125. if {@changeTablistNick} is true:
  126. set sender's mundosk tablist name to {nickStorage::%sender's uuid%}
  127. if {@changeAboveHeadNick} is true:
  128. set sender's nametag to {nickStorage::%sender's uuid%}
  129.  
  130. send "<light green>Your name has been set to <grey>""%colored argument%<grey>"""
  131.  
  132. else:
  133. send "<light green>The nickname can<grey>'<light red>t be less than <orange>4<light red> characters or greater than <orange>16<light red> and doesn<grey>'<light red>t accept any kind of special characters<grey>."
  134.  
  135. else:
  136. if {@changeChatNick} = true:
  137. set sender's display name to sender's name
  138. if {@changeTablistNick} = true:
  139. set sender's mundosk tablist name to sender's name
  140. if {@changeAboveHeadNick} = true:
  141. set sender's nametag to sender's name
  142.  
  143. send "<light green>Your name has been reset<grey>."
  144.  
  145. command /skin <player=%sender%> [<text>]:
  146. permission: skin.change
  147. permission message: <light red>You don<grey>'<light red>t have permission for this.
  148. executable by: players and console
  149. usage: /skin [player] [ign]
  150. description: changes your skin to the skin of other person's IGN.
  151. trigger:
  152. if arg-2 is set:
  153.  
  154. access "getSkin" from arg-2
  155. wait 1 tick
  156.  
  157. if {_skin} is set:
  158. set arg-1's displayed skin to {_skin}
  159. set {skinStorage::%arg-1's uuid%} to {_skin}
  160. send "<light green>Your skin has been set to <orange>%arg-2%<grey>'<light green>s skin<grey>."
  161. else:
  162. send "<light red>Invalid IGN<grey>,<light red> try again later or put other IGN<grey>."
  163. else:
  164. reset arg-1's displayed skin
  165. send "<light green>Your skin has been reset<grey>."
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement