Advertisement
NAOSAMA

Untitled

Mar 10th, 2019
104
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 25.33 KB | None | 0 0
  1. options:
  2. #
  3. # _____ _ _ _ ______ _ _ ___
  4. # / ____| | (_) | | | ____| | | | | |__ \
  5. # | (___ | | ___ __ _ _ __ | |_| |__ _ __ | |__ __ _ _ __ ___ ___ __| | ) |
  6. # \___ \| |/ / '__| | '_ \| __| __| | '_ \| '_ \ / _` | '_ \ / __/ _ \/ _` | / /
  7. # ____) | <| | | | |_) | |_| |____| | | | | | | (_| | | | | (_| __/ (_| | / /_
  8. # |_____/|_|\_\_| |_| .__/ \__|______|_| |_|_| |_|\__,_|_| |_|\___\___|\__,_| |____|
  9. # | |
  10. # Adds many |_| useful features that enhance the usage of Skript.
  11. #
  12. #
  13. # Script: SkriptEnhanced2
  14. # Author: Duetro
  15. # Version: 2.07
  16. #
  17. #
  18. # Dependencies:
  19. # - Skript 2.3.1 (Bensku's Fork) # Download: https://github.com/SkriptLang/Skript/releases (use 2.3-alpha4 for 1.13)
  20. # - skript-mirror 0.19.1 # Download: https://skripttools.net/?q=skript-mirror
  21. # - MundoSK 1.8.6-BETA.55 # Download: https://skripttools.net/?q=MundoSK
  22. # - ProtocolLib # Download: https://www.spigotmc.org/resources/protocollib.1997/
  23. #
  24. # Settings:
  25. skript_prefix: &7[&bSkript&7] # Default: &7[&bSkript&7]
  26. skript_color: &6 # Default: &6
  27. preview_limit: 55 # Default: 55 | Limit of characters in one line while hovering the errors
  28.  
  29. notify_ingame: true # Default: true
  30. check_update: true # Default: true
  31. metrics: true # Default: true | Please do NOT disable this. It will send only one single HTTP request. If you disable this, you won't get any updates.
  32.  
  33. #
  34. # -> You should not change the code below unless you know what you are doing.
  35. # -> You should not change the code below unless you know what you are doing.
  36. # -> You should not change the code below unless you know what you are doing.
  37. #
  38.  
  39. version: 2.07
  40. skunity: https://forums.skunity.com/resources/skriptenhanced.409/
  41. import:
  42. java.lang.System
  43. java.net.URL
  44. java.net.URLEncoder
  45. java.nio.file.Files
  46. java.io.File
  47. java.io.BufferedReader
  48. java.io.InputStream
  49. java.io.InputStreamReader
  50. java.io.FileWriter
  51. java.time.LocalDateTime
  52. org.apache.commons.io.FileUtils
  53. org.bukkit.Bukkit
  54. function SE2_fixPath(path: text) :: text:
  55. if System.getProperty("file.separator") is "/":
  56. return {_path}.replace("\", "/")
  57. return {_path}.replace("/", "\")
  58. function SE2_fileExists(path: text) :: boolean:
  59. return new File(SE2_fixPath({_path})).isFile()
  60. function SE2_fileContent(path: text) :: strings:
  61. return ...Files.readAllLines(new File(SE2_fixPath({_path})).toPath())
  62. function SE2_deleteFile(path: text) :: boolean:
  63. return new File(SE2_fixPath({_path})).delete()
  64. function SE2_downloadString(url: text) :: strings:
  65. set {_url} to new URL({_url})
  66. set {_in} to new BufferedReader(new InputStreamReader({_url}.openStream()))
  67. set {_count} to 0
  68. while true:
  69. set {_content::%{_count}%} to {_in}.readLine()
  70. if {_content::%{_count}%} isn't set:
  71. delete {_content::%{_count}%}
  72. exit loop
  73. add 1 to {_count}
  74. {_in}.close()
  75. return {_content::*}
  76. function SE2_NL(~:INT=0) :: text:
  77. return last character of System.getProperty("line.separator")
  78. function SE2_basename(path: text) :: text:
  79. if {_path} contains "/" or "\":
  80. return (last element out of ({_path}.replace("\", "/") split at "/"))
  81. return {_path}
  82. function SE2_GetFileList(path: text) :: texts:
  83. loop ...(new File({_path}).listFiles()):
  84. if loop-value.isDirectory():
  85. loop SE2_GetFileList(loop-value.toString()):
  86. add loop-value-2 to {_files::*}
  87. else:
  88. add loop-value.toString() to {_files::*}
  89. return {_files::*}
  90. function SE2_setLine(script: text, line: integer, content: text):
  91. if {_script} contains "..":
  92. exit
  93. set {_content::*} to SE2_fileContent(SE2_fixPath("plugins/Skript/scripts/%{_script}%.sk"))
  94. set {_line} to "%{_line}%"
  95. set {_fw} to try new FileWriter(SE2_fixPath("plugins/Skript/scripts/%{_script}%.sk") and false)
  96. loop {_content::*}:
  97. if loop-index is {_line}:
  98. {_fw}.write({_content})
  99. else:
  100. {_fw}.write(loop-value)
  101. {_fw}.write(System.getProperty("line.separator"))
  102. {_fw}.close()
  103. function SE2_SendMessage(p: player, type: text, message: text):
  104. if {_type} contains "se.":
  105. set {_prefix} to "&7[&bSkriptEnhanced&7]"
  106. replace all "se." in {_type} with ""
  107. else:
  108. set {_prefix} to "{@skript_prefix}"
  109. if {_type} is "error":
  110. set {_icon} to "&4&l✖&c "
  111. replace all "&r" in {_message} with "&c"
  112. else if {_type} is "success":
  113. set {_icon} to "&2&l✔&a "
  114. replace all "&r" in {_message} with "&a"
  115. else:
  116. set {_icon} to "&f"
  117. replace all "&r" in {_message} with "&f"
  118. send "%{_prefix}% %{_icon}%%{_message}%" to {_p}
  119. command /se2 [<text>] [<text>] [<integer>] [<text>]:
  120. aliases: /se, /skriptenhanced, /skriptenhanced2
  121. permission: skript.admin
  122. trigger:
  123. if arg-1 is "update":
  124. SE2_SendMessage(player, "se.info", "Checking for updates...")
  125. if {SkriptEnhanced::latestversion} isn't set:
  126. set {_dl::*} to SE2_downloadString("http://api.duetro.de/skriptenhanced/index.php?version={@version}")
  127. if {_dl::1} isn't set:
  128. SE2_SendMessage(player, "se.error", "An error as occurred while trying to to check for updates. Please check for Updates manually! Download: {@skunity}")
  129. exit
  130. set {SkriptEnhanced::latestversion} to {_dl::1}
  131. send " &7Current Version: v{@version} (Latest: v%{SkriptEnhanced::latestversion}%)"
  132. if {@metrics} isn't true:
  133. SE2_SendMessage(player, "se.error", "Please set 'metrics' to 'true' in the script options.")
  134. else if {@check_update} isn't true:
  135. SE2_SendMessage(player, "se.error", "Please set 'check_update' to 'true' in the script options.")
  136. else if {@notify_ingame} isn't true:
  137. SE2_SendMessage(player, "se.error", "Please set 'notify_ingame' to 'true' in the script options.")
  138. else if {SkriptEnhanced::latestversion} is "{@version}":
  139. SE2_SendMessage(player, "se.success", "You already have the latest Version of SkriptEnhanced!")
  140. else:
  141. SE2_SendMessage(player, "se.info", "Deleting SkriptEnhanced...")
  142. SE2_deleteFile("plugins/Skript/scripts/%script%.sk")
  143. if SE2_fileExists("plugins/Skript/scripts/%script%.sk"):
  144. SE2_SendMessage(player, "se.error", "An error as occurred while trying to delete SkriptEnhanced. Please update manually! Download: {@skunity}")
  145. exit
  146. SE2_SendMessage(player, "se.info", "Downloading SkriptEnhanced...")
  147. set {_fw} to try new FileWriter(SE2_fixPath("plugins/Skript/scripts/%script%.sk") and true)
  148. set {_contents::*} to SE2_downloadString("http://api.duetro.de/skriptenhanced/dl/SkriptEnhanced.sk")
  149. if {_contents::1} isn't "options:":
  150. SE2_SendMessage(player, "se.error", "An error as occurred while trying to download the script. Please update manually! Download: {@skunity}")
  151. exit
  152. loop {_contents::*}:
  153. {_fw}.write(loop-value)
  154. {_fw}.write(System.getProperty("line.separator"))
  155. {_fw}.close()
  156. if SE2_fileExists("plugins/Skript/scripts/%script%.sk") isn't true:
  157. SE2_SendMessage(player, "se.error", "An error as occurred while trying to download the script. Please update manually! Download: {@skunity}")
  158. exit
  159. SE2_SendMessage(player, "se.info", "Reloading SkriptEnhanced...")
  160. execute console command "/skript reload %script%"
  161. SE2_SendMessage(player, "se.success", "Successfully updated to SkriptEnhanced v%{SkriptEnhanced::latestversion}%!")
  162. else if arg-1 is "backup":
  163. SE2_SendMessage(player, "se.info", "Creating Backup of all scripts...")
  164. set {_} to System.currentTimeMillis()
  165. set {_ldt} to LocalDateTime.now()
  166. set {_date} to "%{_ldt}.getYear()%-%{_ldt}.getMonthValue()%-%{_ldt}.getDayOfMonth()%_%{_ldt}.getHour()%-%{_ldt}.getMinute()%-%{_ldt}.getSecond()%"
  167. set {_source} to new File(SE2_fixPath("plugins/Skript/scripts"))
  168. set {_destination} to new File(SE2_fixPath("plugins/Skript/backups/scripts_%{_date}%"))
  169. try FileUtils.copyDirectory({_source}, {_destination})
  170. if the last java exception is set:
  171. SE2_SendMessage(player, "se.error", "%the last java exception%")
  172. else:
  173. SE2_SendMessage(player, "se.success", "Successfully created a backup of all scripts. &7(%System.currentTimeMillis() - {_}%ms)")
  174. send " &8&l>&7 Destination: Skript/backups/scripts_%{_date}%/"
  175. else if arg-1 is "addons":
  176. SE2_SendMessage(player, "se.info", "Getting a list of latest Addons...")
  177. set {_json} to join SE2_downloadString("https://api.skripttools.net/v4/addons") by ""
  178. set {_jsonobject} to {_json} parsed as jsonobject
  179. put json {_jsonobject} in listvar {_parsedjson::*}
  180. loop tree of {_parsedjson::*}:
  181. set {_splitter1::*} to branch split at "::"
  182. {_splitter1::1} is "data"
  183. set {_splitter2::*} to loop-value.replace(".jar" and "") split at " "
  184. delete {_splitter2::1}
  185. set {_addons::%{_splitter1::2}%.ver} to join {_splitter2::*} by " "
  186. set {_addons::%{_splitter1::2}%.file} to loop-value
  187. SE2_SendMessage(player, "se.info", "Installed Addons: &7&o(Click to Download)")
  188. set {_counter::latest} to 0
  189. set {_counter::outdated} to 0
  190. loop ...Bukkit.getPluginManager().getPlugins():
  191. set {_plugin::lowercase} to loop-value.getName().toLowerCase()
  192. set {_plugin::name} to loop-value.getName()
  193. set {_plugin::version} to loop-value.getDescription().getVersion()
  194. # Fix for some Addons
  195. if {_plugin::lowercase} is "skquery":
  196. if "%...loop-value.getDescription().getAuthors()%" contains "LimeGlass":
  197. set {_plugin::lowercase} to "skquery-lime"
  198. set {_plugin::name} to "SkQuery-Lime"
  199. else if {_plugin::lowercase} is "tuske":
  200. if {_plugin::version} contains "Pikachu-Patch":
  201. set {_plugin::version} to {_plugin::version}.replace("-Pikachu-Patch-", "-PikachuPatch-v").replace("1.8.2", "1.8.3")
  202. {_addons::%{_plugin::lowercase}%.ver} is set
  203. if {_plugin::version} is {_addons::%{_plugin::lowercase}%.ver}:
  204. send "<command:/ver %{_plugin::name}%> &b%{_plugin::name}% &a&o(latest)<reset>"
  205. else:
  206. set {_known} to false
  207. loop {_parsedjson::data::%{_plugin::lowercase}%::*}:
  208. if loop-value-2 contains " %{_plugin::version}%.jar":
  209. set {_known} to true
  210. set {_current} to loop-index parsed as number
  211. set {_latest} to loop-index parsed as number
  212.  
  213. set {_dlt} to "<tooltip:&9&nhttps://skripttools.net/addons?q=%URLEncoder.encode({_plugin::name})%%SE2_NL()%%SE2_NL()%&cThe new version of this addon &ocould&c break things.%SE2_NL()%&c&oYou should not update without checking for new errors.><url:https://skripttools.net/addons?q=%URLEncoder.encode({_plugin::name})%>"
  214.  
  215. if {_known} is true:
  216. send "%{_dlt}% &b%{_plugin::name}% &c&o(outdated)<reset>"
  217. else:
  218. send "%{_dlt}% &b%{_plugin::name}% &c&o(probably outdated)<reset>"
  219. send "%{_dlt}% &8&l>&7 Installed Version: &e%{_plugin::version}%&7, Found Version: &e%{_addons::%{_plugin::lowercase}%.ver}%"
  220. if {_known} is true:
  221. send " &8&l>&7 &oYou are currently %{_latest}-{_current}% version(s) behind latest."
  222.  
  223. set {_found} to true
  224. if {_found} isn't true:
  225. send " &cThere are no installed addons."
  226. else:
  227. if {SkriptEnhanced::latestversion} is "{@version}":
  228. set {_label} to "latest"
  229. else:
  230. set {_label} to "outdated"
  231. send "Usage: &7/&6se2&b ... &8&l|&7 SkriptEnhanced v{@version} &o(%{_label}%)"
  232. send " &bbackup &7- &fCreate a backup of the whole scripts folder"
  233. send " &bupdate &7- &fCheck for updates and download the latest version of SkriptEnhanced"
  234. send " &baddons &7- &fCheck for updates and download the latest version of any installed Addon"
  235. on load:
  236. wait 0.5 seconds
  237. if {@metrics} is true:
  238. set {_dl::*} to SE2_downloadString("http://api.duetro.de/skriptenhanced/index.php?version={@version}")
  239. if {_dl::1} isn't set:
  240. send "&7[&bSkriptEnhanced&7] &cAn error as occurred while trying to to check for updates. Please check for Updates manually!" to console
  241. else:
  242. set {SkriptEnhanced::latestversion} to {_dl::1}
  243. if {@check_update} is true:
  244. {SkriptEnhanced::latestversion} isn't "{@version}"
  245. send "&7[&bSkriptEnhanced&7] &fThere is already a new version of SkriptEnhanced! Please update to get the latest changes and fixes. Download: {@skunity} or use '/se2 update'" to console
  246. else:
  247. send "&7[&bSkriptEnhanced&7] &cThere might be a new version of SkriptEnhanced! Please enable 'check_update' or use '/se2 update' to check for updates." to console
  248. else:
  249. send "&7[&bSkriptEnhanced&7] &cThere might be a new version of SkriptEnhanced! Please enable 'metrics' or use '/se2 update' to check for updates." to console
  250. send "&7[&bSkriptEnhanced&7] &fSkriptEnhanced v{@version} by Duetro has been enabled and hooked into Skript!" to console
  251. on join:
  252. {@metrics} is true
  253. {@check_update} is true
  254. {@notify_ingame} is true
  255. player has permission "skript.admin"
  256. {SkriptEnhanced::latestversion} isn't "{@version}"
  257. wait 15 seconds
  258. SE2_SendMessage(player, "se.info", "There is already a new version of SkriptEnhanced! Please update to get the latest changes and fixes. <command:/se2 update>{@skript_color}&l× {@skript_color}Click to update {@skript_color}&l×<reset>")
  259. on tab complete:
  260. player has permission "skript.admin"
  261. set {_arg::*} to event-string split at " "
  262.  
  263. if {_arg::1} is "/se2", "/skriptenhanced" or "/skriptenhanced2":
  264. delete completions
  265. if {_arg::2} is "":
  266. add "addons", "backup", "update" to completions
  267. else if {_arg::1} is "/skript" or "/sk":
  268. delete completions
  269. if {_arg::2} is "reload" or "disable":
  270. {_arg::3} is set
  271. {_arg::4} isn't set
  272. loop SE2_GetFileList(SE2_fixPath("plugins/Skript/scripts/")):
  273. set {_scriptpath} to loop-value.replace(SE2_fixPath("plugins/Skript/scripts/") and "").replace("\" and "/")
  274. set {_scriptname} to SE2_basename({_scriptpath})
  275. last element out of {_scriptname} split at "." is "sk"
  276. first character of {_scriptname} isn't "-"
  277. if length of {_arg::3} > 0:
  278. if {_arg::3} is the first (length of {_arg::3}) characters of {_scriptpath}:
  279. add {_scriptpath} to completions
  280. else if {_arg::3} is the first (length of {_arg::3}) characters of {_scriptname}:
  281. add {_scriptpath} to completions
  282. else:
  283. add {_scriptpath} to completions
  284. else if {_arg::2} is "enable":
  285. {_arg::3} is set
  286. {_arg::4} isn't set
  287. loop SE2_GetFileList(SE2_fixPath("plugins/Skript/scripts/")):
  288. set {_scriptpath} to loop-value.replace(SE2_fixPath("plugins/Skript/scripts/") and "").replace("\" and "/")
  289. set {_scriptname} to SE2_basename({_scriptpath})
  290. last element out of {_scriptname} split at "." is "sk"
  291. first character of {_scriptname} is "-"
  292. if length of {_arg::3} > 0:
  293. if {_arg::3} is the first (length of {_arg::3}) characters of {_scriptpath}:
  294. add {_scriptpath} to completions
  295. else if {_arg::3} is the first (length of {_arg::3}) characters of {_scriptname}:
  296. add {_scriptpath} to completions
  297. else:
  298. add {_scriptpath} to completions
  299. else if {_arg::2} is "update":
  300. add "check", "changes" and "download" to completions
  301. else if {_arg::2} is "":
  302. add "reload", "enable", "disable", "update" and "help" to completions
  303. on load:
  304. loop {SkriptEnhanced.catchErrors::*}:
  305. delete {SkriptEnhanced.errorLogger::%loop-index%::*}
  306. delete {SkriptEnhanced.catchErrors::*}
  307. on quit:
  308. delete {SkriptEnhanced.errorLogger::%player%::*}
  309. delete {SkriptEnhanced.catchErrors::%player%}
  310. function SE2_ChatComponentToText(json: jsonobject) :: text:
  311. {_json} is set
  312. put json {_json} in listvar {_json::*}
  313. loop tree of {_json::extra::*}:
  314. if branch contains "color":
  315. set {_color} to "%loop-value%"
  316. if {_color} contains "_":
  317. replace all "_" with " " in {_color}
  318. else if {_color} isn't "black", "white", "yellow" or "gold":
  319. set {_color} to "light %{_color}%"
  320. set {_color} to "<%{_color}%>"
  321. else if branch contains "text":
  322. if {_color} isn't set:
  323. set {_color} to "<white>"
  324. add "%{_color}%%loop-value%" to {_full-text::*}
  325. delete {_color}
  326. return join {_full-text::*} by ""
  327. on packet event play_server_chat:
  328. if {SkriptEnhanced.catchErrors::%player%} is true:
  329. set {_message} to SE2_ChatComponentToText("chatcomponent" pjson 0 of event-packet)
  330. set {_uncolored-message} to uncolored {_message}
  331. set {_parse::*} to {_uncolored-message} parsed as "%text% \(%text%.sk, line %integer%\: %text%'\)"
  332. if {_parse::1} is set:
  333. add {_uncolored-message} to {SkriptEnhanced.errorLogger::%player%::*}
  334. cancel event
  335. stop
  336. else:
  337. set {_parse::*} to {_uncolored-message} parsed as "A command with the name /%text% is already defined in %text%.sk"
  338. if {_parse::1} is set:
  339. add "%{_uncolored-message}% (unknown.sk, line 0: unknown')" to {SkriptEnhanced.errorLogger::%player%::*}
  340. cancel event
  341. stop
  342. else:
  343. System.currentTimeMillis() - {SkriptEnhanced.reloadTime::%player%} > 50
  344. delete {SkriptEnhanced.catchErrors::%player%}
  345. set {_chatcomponent} to "chatcomponent" pjson 0 of event-packet
  346. {_chatcomponent} is set
  347. "%{_chatcomponent}%".startsWith("{""extra"":[{""color"":""gray"",""text"":""[""},{""color"":""gold"",""text"":""Skript""},{""color"":""gray"",""text"":""]""}") is true
  348. cancel event
  349. set {_message} to SE2_ChatComponentToText("chatcomponent" pjson 0 of event-packet)
  350. set {_message} to {_message}.replace("&7[&6Skript&7]&f " and "")
  351. set {_uncolored-message} to uncolored {_message}
  352. set {_parse::*} to {_uncolored-message} parsed as "(Reloading|Enabling) %string%.sk..."
  353. if {_parse::1} is set:
  354. if {_uncolored-message} contains "Reloading":
  355. SE2_SendMessage(player, "info", "Reloading {@skript_color}%{_parse::1}%.sk&r...")
  356. else:
  357. SE2_SendMessage(player, "info", "Enabling {@skript_color}%{_parse::1}%.sk&r...")
  358. delete {SkriptEnhanced.errorLogger::%player%::*}
  359. set {SkriptEnhanced.catchErrors::%player%} to true
  360. set {SkriptEnhanced.reloadTime::%player%} to System.currentTimeMillis()
  361. stop
  362. set {_parse::*} to {_uncolored-message} parsed as "Successfully (reloaded|enabled & parsed) %string%.sk."
  363. if {_parse::1} is set:
  364. SE2_SendMessage(player, "success", "<tooltip:&7Reloading {@skript_color}%{_parse::1}%.sk&7 took {@skript_color}&l%System.currentTimeMillis()-{SkriptEnhanced.reloadTime::%player%}%ms&7!>Successfully reloaded {@skript_color}%{_parse::1}%.sk&r!<reset>")
  365. delete {SkriptEnhanced.errorLogger::%player%::*}
  366. delete {SkriptEnhanced.catchErrors::%player%}
  367. delete {SkriptEnhanced.reloadTime::%player%}
  368. stop
  369. set {_parse::*} to {_uncolored-message} parsed as "Encountered %integer% error[s] while (reloading|parsing) %text%.sk!"
  370. if {_parse::1} is set:
  371. delete {SkriptEnhanced.catchErrors::%player%}
  372. loop {SkriptEnhanced.errorLogger::%player%::*}:
  373. set {_temp::*} to loop-value parsed as "%text% \(%text%.sk, line %integer%\: %text%'\)"
  374. set {_filepath} to SE2_fixPath("plugins\Skript\scripts\%{_temp::2}%.sk")
  375. exit loop
  376. set {_lines} to 0
  377. if SE2_fileExists({_filepath}):
  378. set {_filecontent::*} to SE2_fileContent({_filepath})
  379. set {_lines} to (amount of {_filecontent::*})
  380. if {_lines} is 0:
  381. add "Sorry, the File couldn't be displayed." to {_filecontent::*}
  382. add "This can happen when Skript prints out errors weirdly." to {_filecontent::*}
  383. set {_filepath} to SE2_fixPath("plugins\Skript\scripts\unknown.sk")
  384. set {_lines} to 0
  385. send "&8&m--------------------------------------------------"
  386. send ""
  387. loop {SkriptEnhanced.errorLogger::%player%::*}:
  388. set {_errorparser::*} to loop-value parsed as "%text% \(%text%.sk, line %integer%\: %text%'\)"
  389. set {_tooltip} to "&6&lFile:&e /%{_filepath}.replace(""\"" and ""/"").replace(""plugins/Skript/scripts/"" and """")% &7&o(%{_lines}% lines)%SE2_NL()%&8&m-----------------------------------------------------%SE2_NL()%"
  390. if {_errorparser::1}.startsWith("Empty configuration section!"):
  391. set {_errorparser::1} to "Empty configuration section!"
  392. loop 7 times:
  393. set {_currentLogLine} to ({_errorparser::3}-4)+(loop-value-2)
  394. {_filecontent::%{_currentLogLine}%} is set
  395. set {_current-line} to {_filecontent::%{_currentLogLine}%}
  396. replace all " " and " " in {_current-line} with " "
  397. if {_currentLogLine} is {_errorparser::3}:
  398. replace all "&" in {_current-line} with "&&c"
  399. set {_tooltip} to "%{_tooltip}%&8%{_currentLogLine}%] &c%{_current-line}%%SE2_NL()%&r"
  400. else:
  401. replace all "&" in {_current-line} with "&&7"
  402. if length of {_current-line} > {@preview_limit}:
  403. set {_current-line} to "%first {@preview_limit}-3 characters of {_current-line}%..."
  404. set {_tooltip} to "%{_tooltip}%&8%{_currentLogLine}%] &7%{_current-line}%%SE2_NL()%&r"
  405. set {_tooltip} to "%{_tooltip}%&8&m-----------------------------------------------------%SE2_NL()%"
  406. set {_tooltip} to "%{_tooltip}%&c&o%{_errorparser::1}.replace(""&"" and ""&&c&o"")%%SE2_NL()%"
  407. set {_tooltip} to "%{_tooltip}%&8&m-----------------------------------------------------"
  408. replace all "<" and ">" in {_tooltip} with "?"
  409. send "<tooltip:%{_tooltip}%>&e&lLine %{_errorparser::3}%: <reset>"
  410. send "<tooltip:%{_tooltip}%>&7%{_errorparser::1}.replace(""&"" and ""&&7"")%<reset>"
  411. send ""
  412. send "&8&m--------------------------------------------------"
  413. set {_tooltip} to "&7Reloading {@skript_color}%{_parse::2}%.sk&7 took {@skript_color}&l%System.currentTimeMillis()-{SkriptEnhanced.reloadTime::%player%}%ms&7!"
  414. if {_parse::1} is 1:
  415. SE2_SendMessage(player, "error", "<tooltip:%{_tooltip}%>Encountered an error while reloading {@skript_color}%{_parse::2}%.sk&r!<reset>")
  416. else:
  417. SE2_SendMessage(player, "error", "<tooltip:%{_tooltip}%>Encountered %{_parse::1}% errors while reloading {@skript_color}%{_parse::2}%.sk&r!<reset>")
  418. delete {SkriptEnhanced.errorLogger::%player%::*}
  419. delete {SkriptEnhanced.catchErrors::%player%}
  420. delete {SkriptEnhanced.reloadTime::%player%}
  421. stop
  422. set {_message} to {_message}.replace("&6" and "{@skript_color}")
  423. if {_message} contains "&4":
  424. SE2_SendMessage(player, "error", {_message}.replace("&4", "&r").replace("&f", "&r"))
  425. else:
  426. if {_message} contains "successfully":
  427. set {_type} to "success"
  428. else if {_message} contains "is already":
  429. set {_type} to "error"
  430. else:
  431. set {_type} to "info"
  432. SE2_SendMessage(player, {_type}, {_message}.replace("&f", "&r"))
  433. # Formatted by https://skripttools.net/script-formatter
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement