This repository has been archived by the owner on May 17, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Midnight AntiXray.sk
262 lines (246 loc) · 11.1 KB
/
Midnight AntiXray.sk
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
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
#-------------------------------------------
#
# Midnight AntiXRay v1.4
#
# Created by bradleyw8_ and koqel
#
# Reccomended Addons:
# Skript
# 1.16+: https://github.com/SkriptLang/Skript/releases
# SkUtils
# 1.16+: https://forums.skunity.com/resources/skutilities.26/
# SkRayFall
# 1.16+: https://sk.rayfall.net/
#
#
#
#
#-------------------------------------------
#Options (You Can Edit These!)
options: # <- Config
Version: 1.4 # <- Dont Edit This
APILink: https://raw.githubusercontent.com/Diplodocolus/MidnightCore/Master/APIVer.ver # <- DO NOT CHANGE THIS, IT IS REQUIRED FOR AUTO UPDATE
Prefix: &9Midnight Anti-XRay&7» # <- Prefix of the skript (LEAVE BLACK TO DISABLE)
GUIPrefix: &&9Midnight Anti-XRay # <- Prefix Of the GUI
primaryColor: &9
secondaryColor: &5
StaffPermission: midnight.staff #S <- Staff Permission
PermissionMessage: &cNo Permission. # <- No permission message
CheckForUpdates: true # <- Automatically Checks For Updates
ResetVLInterval: 60 # <- Reset ore interval in Minutes
AutoBanInterval: 15 # <- Auto ban interval in seconds
AutoBan: true # <- Choose to auto ban a player for xray
BanLength: 5d # <- Self explanatory
CoalBanVL: 100 # <- Amount of coal mined per reset time to trigger a ban
IronBanVL: 50 # <- Amount of iron mined per reset time to trigger a ban
GoldBanVL: 30 # <- Amount of gold mined per reset time to trigger a ban
LapisBanVL: 35 # <- Amount of lapis mined per reset time to trigger a ban
RedstoneBanVL: 50 # <- Amount of redstone mined per reset time to trigger a ban
DiamondBanVL: 30 # <- Amount of diamonds mined per reset time to trigger a ban
EmeraldBanVL: 10 # <- Amount of emeralds mined per reset time to trigger a ban
#Alerts
function Alert(P: player, Ore: text, VL: string):
loop all players:
if loop-player has permission "{@StaffPermission}":
if {midnight.%loop-player%.alerts} is set:
send formatted "<tooltip:&6&l%{_P}%'s Logs%nl%&7&lVL: &c%{_VL}%%nl%&7&lRecent Ore: &c%{_Ore}%%nl%&5&lClick to teleport><cmd:/tp %{_P}%>{@Prefix} &5%{_P}% &7Mined &5%{_Ore}% &8[&c%{_VL}%&8]" to loop-player
log "{@Prefix} %{_P}% Mined %{_Ore}% On %now%" to "MidnightAntiXRay/%{_P}%.log"
else:
stop
#Variables
variables:
{coalmined.%player%} = 0
{ironmined.%player%} = 0
{goldmined.%player%} = 0
{lapismined.%player%} = 0
{redstonemined.%player%} = 0
{diamondmined.%player%} = 0
{emeralmined.%player%} = 0
{netheritemined.%player%} = 0
{total.coalmined.%player%} = 0
{total.ironmined.%player%} = 0
{total.goldmined.%player%} = 0
{total.lapismined.%player%} = 0
{total.redstonemined.%player%} = 0
{total.diamondmined.%player%} = 0
{total.emeralmined.%player%} = 0
{netheritemined.total.%player%} = 0
#Main Code
on break:
if event-block is coal ore:
add 1 to {coalmined.%player%}
add 1 to {total.coalmined.%player%}
Alert(Player, "Coal Ore", "%{coalmined.%player%}%")
else if event-block is iron ore:
add 1 to {ironmined.%player%}
add 1 to {total.ironmined.%player%}
Alert(Player, "Iron Ore", "%{ironmined.%player%}%")
else if event-block is gold ore:
add 1 to {goldmined.%player%}
add 1 to {total.goldmined.%player%}
Alert(Player, "Gold Ore", "%{goldmined.%player%}%")
else if event-block is lapis ore:
add 1 to {lapismined.%player%}
add 1 to {total.lapismined.%player%}
Alert(Player, "Lapis Ore", "%{lapismined.%player%}%")
else if event-block is redstone ore:
add 1 to {redstonemined.%player%}
add 1 to {total.redstonemined.%player%}
Alert(Player, "Redstone Ore", "%{redstonemined.%player%}%")
else if event-block is diamond ore:
add 1 to {diamondmined.%player%}
add 1 to {total.diamondmined.%player%}
Alert(Player, "Diamond Ore", "%{diamondmined.%player%}%")
else if event-block is emerald ore:
add 1 to {emeraldmined.%player%}
add 1 to {total.emeraldmined.%player%}
Alert(Player, "Emerald Ore", "%{emeraldmined.%player%}%")
else if event-block is ancient debris:
add 1 to {netheritemined.%player%}
add 1 to {netheritemined.total.%player%}
Alert(Player, "Netherite", "%{netheritemined.%player%}%")
else if event-block is deepslate coal ore:
add 1 to {coalmined.%player%}
add 1 to {coalmined.total.%player%}
Alert(Player, "Coal Ore", "%{coalmined.%player%}%")
else if event-block is deepslate iron ore:
add 1 to {ironmined.%player%}
add 1 to {ironmined.total.%player%}
Alert(Player, "Iron Ore", "%{ironmined.%player%}%")
else if event-block is deepslate gold ore:
add 1 to {goldmined.%player%}
add 1 to {goldmined.total.%player%}
Alert(Player, "Gold Ore", "%{goldmined.%player%}%")
else if event-block is deepslate lapis ore:
add 1 to {lapismined.%player%}
add 1 to {lapismined.total.%player%}
Alert(Player, "Lapis Ore", "%{lapismined.%player%}%")
else if event-block is deepslate redstone ore:
add 1 to {redstonemined.%player%}
add 1 to {redstonemined.total.%player%}
Alert(Player, "Redsone Ore", "%{redstonemined.%player%}%")
else if event-block is deepslate diamond ore:
add 1 to {diamondmined.%player%}
add 1 to {diamondmined.total.%player%}
Alert(Player, "Diamond Ore", "%{diamondmined.%player%}%")
else if event-block is deepslate emerald ore:
add 1 to {emeraldmined.%player%}
add 1 to {emeraldmined.total.%player%}
Alert(Player, "Emerald Ore", "%{emeraldmined.%player%}%")
#AutoBans
every {@AutoBanInterval} seconds:
if {@AutoBan} is true:
loop all players:
if {coalmined.%loop-player%} >= {@CoalBanVL}:
execute console command "tempban %loop-player% {@BanLength} {@Prefix} {@primaryColor}XRay has been detected on your client! -s"
if {ironmined.%loop-player%} >= {@IronBanVL}:
execute console command "tempban %loop-player% {@BanLength} {@Prefix} {@primaryColor}XRay has been detected on your client! -s"
if {goldmined.%loop-player%} >= {@GoldBanVL}:
execute console command "tempban %loop-player% {@BanLength} {@Prefix} {@primaryColor}XRay has been detected on your client! -s"
if {lapismined.%loop-player%} >= {@LapisBanVL}:
execute console command "tempban %loop-player% {@BanLength} {@Prefix} {@primaryColor}XRay has been detected on your client! -s"
if {redstonemined.%loop-player%} >= {@RedstoneBanVL}:
execute console command "tempban %loop-player% {@BanLength} {@Prefix} {@primaryColor}XRay has been detected on your client! -s"
if {diamondmined.%loop-player%} >= {@DiamondBanVL}:
execute console command "tempban %loop-player% {@BanLength} {@Prefix} {@primaryColor}XRay has been detected on your client! -s"
if {emeraldmined.%loop-player%} >= {@EmeraldBanVL}:
execute console command "tempban %loop-player% {@BanLength} {@Prefix} {@primaryColor}XRay has been detected on your client! -s"
else if {@AutoBan} is false:
stop
#Reset VL
on join:
set {coalmined.%player%} to 0
set {ironmined.%player%} to 0
set {goldmined.%player%} to 0
set {lapismined.%player%} to 0
set {redstonemined.%player%} to 0
set {diamondmined.%player%} to 0
set {emeralmined.%player%} to 0
set {netheritemined.%player%} to 0
on quit:
set {coalmined.%player%} to 0
set {ironmined.%player%} to 0
set {goldmined.%player%} to 0
set {lapismined.%player%} to 0
set {redstonemined.%player%} to 0
set {diamondmined.%player%} to 0
set {emeralmined.%player%} to 0
set {netheritemined.%player%} to 0
every {@ResetVLInterval} minutes:
loop all players:
set {coalmined.%loop-player%} to 0
set {ironmined.%loop-player%} to 0
set {lapismined.%loop-player%} to 0
set {redstonemined.%loop-player%} to 0
set {diamondmined.%loop-player%} to 0
set {emeralmined.%loop-player%} to 0
if loop-player has permission "{@StaffPermission}":
send "{@Prefix} &aCleared ore violations!" to loop-player
#Command
command /xray [<text>] [<player>]:
permission: {@StaffPermission}
permission message: {@PermissionMessage}
aliases: /mn
trigger:
if arg-1 is "alerts":
if arg-2 is set:
send "{@Prefix} &cNo second argument"
else:
if {midnight.%player%.alerts} is not set:
set {midnight.%player%.alerts} to false
send "{@Prefix} &aYou will see alerts now."
else:
delete {midnight.%player%.alerts}
send "{@Prefix} &cYou will no longer see alerts."
if arg-1 is "gui":
if arg-2 is set:
set {_main} to a new chest inventory with 3 row with name "&cPlayer Log"
set slot 10 of {_main} to paper named "&c&lTotal Ore Mined" with lore "&7&lCoal: &c%{total.coalmined.%arg-2%}%%nl%&7&lIron: &c%{total.ironmined.%arg-2%}%%nl%&7&lGold: &c%{total.goldmined.%arg-2%}%%nl%&7&lRedstone: &c%{total.redstonemined.%arg-2%}%%nl%&7&lLapis: &c%{total.lapismined.%arg-2%}%%nl%&7&lDiamond: &c%{total.diamondmined.%arg-2%}%%nl%&7&lEmerald: &c%{total.emeraldmined.%arg-2%}%%nl%&7&lNetherite: &c%{netheritemined.total.%arg-2%}%"
set slot 16 of {_main} to player head named "&c%arg-2%" with lore "&7&lPing: %arg-2's ping%"
if arg-1 is "info":
if arg-2 is set:
send "{@Prefix} &cNo second argument"
else:
send "&a&m--------------------------------------------" to player
send "&9Midnight &5Xray v{@Version}" to player
send "&aCreated by bradleyw8_ and koqel" to player
send "&a&m-------------------------------------------" to player
if arg-1 is "reload":
if arg-2 is set:
send "{@Prefix} &cNo second argument"
else:
execute console command "sk reload %script%"
send "{@Prefix} &aReloaded!" to player
if arg-1 or arg-2 is not set:
send formatted "&a&m----<tooltip:https://www.spigotmc.org/resources/midnight-anti-xray.99767/><link:https://www.spigotmc.org/resources/midnight-anti-xray.99767/>&7[&9Midnight &5Xray&7]<reset>&a&m----&7[&9{@Version}&7]&a&m----" to player
send "&a&l/xray alerts &8(Toggles Xray Alerts)" to player
send "&a&l/xray gui &8(Opens a GUI with player info)" to player
send "&a&l/xray info &8(Shows plugin info)" to player
send "&a&l/xray reload &8(Reloads the script)" to player
send formatted "&a&m----<tooltip:https://www.spigotmc.org/resources/midnight-anti-xray.99767/><link:https://www.spigotmc.org/resources/midnight-anti-xray.99767/>&7[&9Midnight &5Xray&7]<reset>&a&m----&7[&9{@Version}&7]&a&m----" to player
on inventory click:
if name of event-inventory is "&cPlayer Log":
if index of event-slot = 10:
cancel event
if index of event-slot = 16:
cancel event
#Load
on load:
send "&a-------------------------------------------" to console
send "&9Midnight &5Xray v{@Version} has been enabled!" to console
send "&aCreated by bradleyw8_" to console
send "&a-------------------------------------------" to console
#Auto Updater
on join:
if player is op:
if {@CheckForUpdates} is true:
set {_latestVer} to line 2 from url "{@APILink}"
if {_latestVer} is not "{@Version}":
send "&a&m----------------------------" to player
send "&9Midnight &5Xray &fhas found an update" to player
send "<link:https://www.spigotmc.org/resources/midnight-anti-xray.99767/>&c[Click Here to download it]<reset>" to player
send "&a&m----------------------------" to player
if {_latestVer} is "{@APILink}":
send "{@Prefix} &aNo new updates found" to player
else if {@CheckForUpdates} is false:
stop