This repository was archived by the owner on Feb 1, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcore.sk
More file actions
214 lines (191 loc) · 9.21 KB
/
core.sk
File metadata and controls
214 lines (191 loc) · 9.21 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
#Created by ringoXD
#!=======[DO NOT EDIT]=======
options:
version: 1.1.2
cskapi: https://github.com/MCSV-Network/Core/raw/main/cskversion
#!=======[DO NOT EDIT]=======
#*OPTIONS==============================
checkupdate: true #true -> check updates | false -> do not check updates (default: true)
showdebug: false #true -> send debug message to player | false -> do not send debug message to player (default: false)
#*OPTIONS==============================
#!TAB COMPLETE
on tab complete of "/skcore":
set tab completions for position 1 to "purgelogs", "showlogs" and "help"
#!TAB COMPLETE
on skript load:
send "&b=================" to console
send "&bCore (v{@version})" to console
send "Created by ringoXD" to console
send "Github: &bhttps://github.com/MCSV-Network/Core" to console
send "&b=================" to console
#*CHECK UPDATE===
if {@checkupdate} is true:
send "[Core] Checking Updates..." to console
set {_v} to text from url "{@cskapi}"
if {_v} is not set:
send "[Core] Failed to check new version! Check internet connection." to console
stop
if {_v} = "{@version}":
send "[Core] No updates aviliable." to console
delete {csk.update}
delete {csk.latest}
else:
send "[Core] New version aviliable! {@version} -> %{_v}%" to console
set {csk.update} to true
set {csk.latest} to {_v}
send "Download: https://github.com/MCSV-Network/Core/" to console
#?debug log
command /skcore [<text>]:
permission: admin
trigger:
if arg-1 is not set:
send "&bCore&3.sk &7- Utility Skript Project"
send "&7Created by ringoXD &7(<link:https://github.com/MCSV-Network/Core>&b&nGithub&7)"
send "&7/skcore &bhelp &7to show commands."
stop
if arg-1 is "help":
send "&bCore&3.sk &7- &bCommands:"
send "&7/skcore &bpurgelogs&f: &3Purge log file."
send "&7/skcore &bshowlog&f: &3Show logs."
stop
if arg-1 is "purgelogs":
send "&7Deleting log.txt..."
delete file "plugins/Skript/scripts/Core-sk/log.txt"
send "&aSuccess!"
stop
if arg-1 is "showlogs":
set {_path} to "plugins/Skript/scripts/Core-sk/log.txt"
set {_l} to line count of file {_path}
send "&7Core.sk debug function logs(%{_l}%lines):"
set {_n} to 1
loop {_l} times:
set {_x} to line {_n} in file {_path}
send "&7%{_x}%"
add 1 to {_n}
wait a tick
send "&7END"
stop
else:
send "&cUnknown command."
#*Debug log function (plugins/Skript/scripts/Core-sk/log.txt)
function debug(p: player, t: text, m: text = "info"):
if file "plugins/Skript/scripts/Core-sk/log.txt" doesn't exist:
send "[!] log.txt does not exist!!" to console
send "Generating log.txt..." to console
create file "plugins/Skript/scripts/Core-sk/log.txt"
write "=============================================================================" at line (file "plugins/Skript/scripts/Core-sk/log.txt"'s line count + 1) to file "plugins/Skript/scripts/Core-sk/log.txt"
write "Core.sk - log file" at line (file "plugins/Skript/scripts/Core-sk/log.txt"'s line count + 1) to file "plugins/Skript/scripts/Core-sk/log.txt"
write "When the debug function is executed, it is written to this file as a log." at line (file "plugins/Skript/scripts/Core-sk/log.txt"'s line count + 1) to file "plugins/Skript/scripts/Core-sk/log.txt"
write "=============================================================================" at line (file "plugins/Skript/scripts/Core-sk/log.txt"'s line count + 1) to file "plugins/Skript/scripts/Core-sk/log.txt"
write "" at line (file "plugins/Skript/scripts/Core-sk/log.txt"'s line count + 1) to file "plugins/Skript/scripts/Core-sk/log.txt"
send "Success!" to console
set {_t} to colored {_t}
#*INFO
if {_m} is "info":
send "&7[debug-info] %{_t}%" to {_p}
write "[%now% DEBUG-INFO - %{_p}%] %{_t}%" at line (file "plugins/Skript/scripts/Core-sk/log.txt"'s line count + 1) to file "plugins/Skript/scripts/Core-sk/log.txt"
if {_m} is "info-red":
send "&7[debug-info] &c%{_t}%" to {_p}
write "[%now% DEBUG-INFO - %{_p}%] %{_t}%" at line (file "plugins/Skript/scripts/Core-sk/log.txt"'s line count + 1) to file "plugins/Skript/scripts/Core-sk/log.txt"
if {_m} is "info-blue":
send "&7[debug-info] &b%{_t}%" to {_p}
write "[%now% DEBUG-INFO - %{_p}%] %{_t}%" at line (file "plugins/Skript/scripts/Core-sk/log.txt"'s line count + 1) to file "plugins/Skript/scripts/Core-sk/log.txt"
if {_m} is "info-green":
send "&7[debug-info] &a%{_t}%" to {_p}
write "[%now% DEBUG-INFO - %{_p}%] %{_t}%" at line (file "plugins/Skript/scripts/Core-sk/log.txt"'s line count + 1) to file "plugins/Skript/scripts/Core-sk/log.txt"
#*WARN
if {_m} is "warn":
send "&7[debug-warn] &e%{_t}%" to {_p}
write "[%now% DEBUG-WARN - %{_p}%] %{_t}%" at line (file "plugins/Skript/scripts/Core-sk/log.txt"'s line count + 1) to file "plugins/Skript/scripts/Core-sk/log.txt"
#*ERR
if {_m} is "error":
send "&e[debug-error] &c%{_t}%" to {_p}
write "[%now% DEBUG-ERROR - %{_p}%] %{_t}%" at line (file "plugins/Skript/scripts/Core-sk/log.txt"'s line count + 1) to file "plugins/Skript/scripts/Core-sk/log.txt"
#*CRIT
if {_m} is "crit":
send "&c[debug-crit] &c&l%{_t}%" to {_p}
write "[%now% DEBUG-CRIT - %{_p}%] %{_t}%" at line (file "plugins/Skript/scripts/Core-sk/log.txt"'s line count + 1) to file "plugins/Skript/scripts/Core-sk/log.txt"
#?debug for console
function debugforconsole(t: text, m: text = "info"):
if file "plugins/Skript/scripts/Core-sk/log.txt" doesn't exist:
send "[!] log.txt does not exist!!" to console
send "Generating log.txt..." to console
create file "plugins/Skript/scripts/Core-sk/log.txt"
write "=============================================================================" at line (file "plugins/Skript/scripts/Core-sk/log.txt"'s line count + 1) to file "plugins/Skript/scripts/Core-sk/log.txt"
write "Core.sk - log file" at line (file "plugins/Skript/scripts/Core-sk/log.txt"'s line count + 1) to file "plugins/Skript/scripts/Core-sk/log.txt"
write "When the debug function is executed, it is written to this file as a log." at line (file "plugins/Skript/scripts/Core-sk/log.txt"'s line count + 1) to file "plugins/Skript/scripts/Core-sk/log.txt"
write "=============================================================================" at line (file "plugins/Skript/scripts/Core-sk/log.txt"'s line count + 1) to file "plugins/Skript/scripts/Core-sk/log.txt"
write "" at line (file "plugins/Skript/scripts/Core-sk/log.txt"'s line count + 1) to file "plugins/Skript/scripts/Core-sk/log.txt"
send "Success!" to console
#*INFO
if {_m} is "info":
send "&7[debug-info] %{_t}%" to console
write "[%now% DEBUG-INFO - CONSOLE] %{_t}%" at line (file "plugins/Skript/scripts/Core-sk/log.txt"'s line count + 1) to file "plugins/Skript/scripts/Core-sk/log.txt"
#*WARN
if {_m} is "warn":
send "&7[debug-warn] &e%{_t}%" to console
write "[%now% DEBUG-WARN - CONSOLE] %{_t}%" at line (file "plugins/Skript/scripts/Core-sk/log.txt"'s line count + 1) to file "plugins/Skript/scripts/Core-sk/log.txt"
#*ERR
if {_m} is "error":
send "&e[debug-error] &c%{_t}%" to console
write "[%now% DEBUG-ERROR - CONSOLE] %{_t}%" at line (file "plugins/Skript/scripts/Core-sk/log.txt"'s line count + 1) to file "plugins/Skript/scripts/Core-sk/log.txt"
#*CRIT
if {_m} is "crit":
send "&c[debug-crit] &c&l%{_t}%" to console
write "[%now% DEBUG-CRIT - CONSOLE] %{_t}%" at line (file "plugins/Skript/scripts/Core-sk/log.txt"'s line count + 1) to file "plugins/Skript/scripts/Core-sk/log.txt"
#*Better Randomnum generator(l is length)
#!This isn't parsed as number.
function randomnumgen(l: number) :: text:
set {_num} to ""
loop {_l} times:
set {_x} to random integer between 0 and 9
set {_num} to "%{_num}%%{_x}%"
return {_num}
#Alphabet generatior(l is length)
#未完成
function randomAlphabet(l: number) :: text:
set {_alpb::*} to "A", "Y" and "Z"
set {_abc} to ""
loop {_l} times:
set {_x} to ""
#*Notification function
function notification(p: player, t: text, s: number = 5):
set {_t2} to {_t}
add {_t2} to {notify.%{_p}%::*}
set {_notify} to join {notify.%{_p}%::*} by " &7|&r "
set action bar of {_p} to "%{_notify}%"
debugforconsole("notify list: %{notify.%{_p}%::*}%")
notificationTimer({_p}, {_t2}, {_s})
#*Notification Timer
function notificationTimer(p: player, x: text, s: number):
debugforconsole("called timer")
loop {_s} times:
if {_s} is 0:
stop loop
subtract 1 from {_s}
wait a second
remove {_x} from {notify.%{_p}%::*}
debugforconsole("notify list: %{notify.%{_p}%::*}%")
#*For Notification test
command /skcorenotify [<text>]:
permission: admin
trigger:
set {_x} to arg-1
notification(player, {_x})
send "Success (%{_x}%)"
#*time, but it's japanese
#*Sorry, I can't make return function (skill issue)
function japanesetimespan(p: player, time: timespan):
set {_x} to "%{_time}%"
debug({_p}, "set %{_x}%")
replace all " seconds" or " second" with "秒" in {_x}
replace all " minutes" or " minute" with "分" in {_x}
replace all " hours" or " hour" with "時間" in {_x}
replace all " days" or " day" with "日" in {_x}
replace all "and" with "" in {_x}
set {_x2} to "%{_x}%"
debug({_p}, "result: %{_x2}%")
set {jts_result.%{_p}%} to {_x2}
function randomcolor() :: text:
set {_x} to "&a" or "&b" or "&c" or "&d" or "&e" or "&f" or "&1" or "&2" or "&3" or "&4" or "&5" or "&6" or "&7" or "&8" or "&9" or "&0"
return {_x}