View difference between Paste ID: 1eSqzcMC and Dira0yty
SHOW: | | - or go back to the newest paste.
1
# Whitelist skript by dvwinn
2
# Feel free to edit for personal use
3
4
options:
5
	prefix : &8[&7Whitelist&8]&7
6
	kickmsg : You are not whitelisted!
7
	bypass : skript.whitelist.bypass
8
	permission : skript.whitelist
9
10
variables:
11
	{whitelist} = false
12
	{wlbroadcast} = op
13
	{deathwl} = off
14
	
15
command /whitelist [<text>] [<text>]:
16
	description: Whitelist command
17
	usage: /whitelist
18
	permission: {@permission}
19
	permission message: §4You don't have permission to use this command
20
	aliases: /wl
21
	executable by: players and console
22
	trigger:
23
		if arg 1 is "on":
24
			if {whitelist} is false:
25
				set {whitelist} to true
26
				if {wlbroadcast} is "op":
27
					loop all players:
28
						loop-player is op
29
						message "{@prefix} Whitelist on" to loop-player
30
				else if {wlbroadcast} is "all":
31
					broadcast "{@prefix} Whitelist on"
32
				else:
33
					message "{@prefix} Whitelist on" to command sender
34
			else:
35
				message "{@prefix} The whitelist is already on!" to command sender
36
				
37
		else if arg 1 is "off":
38
			if {whitelist} is true:
39
				set {whitelist} to false
40
				if {wlbroadcast} is "op":
41
					loop all players:
42
						loop-player is op
43
						message "{@prefix} Whitelist off" to loop-player
44
				else if {wlbroadcast} is "all":
45
					broadcast "{@prefix} Whitelist off"
46
				else:
47
					message "{@prefix} Whitelist off" to command sender
48
			else:
49
				message "{@prefix} The whitelist is already off!" to command sender
50
				
51
		else if arg 1 is "add":
52
			if arg 2 is not set:
53
				message "{@prefix} Please set a player or all players to add to the whitelist" to command sender
54
			else if arg 2 is "all":
55
				loop all players:
56
					set {whitelisted::%loop-player%} to true
57
				if {wlbroadcast} is "op":
58
					loop all players:
59
						loop-player is op
60
						message "{@prefix} All whitelisted" to loop-player
61
				else if {wlbroadcast} is "all":
62
					broadcast "{@prefix} All whitelisted"
63
				else:
64
					message "{@prefix} All whitelisted" to command sender
65
			else:
66
				set {whitelisted::%arg 2%} to true
67
				if {wlbroadcast} is "op":
68
					loop all players:
69
						loop-player is op
70
						message "{@prefix} %arg 2% added to whitelist" to loop-player
71
				else if {wlbroadcast} is "all":
72
					broadcast "{@prefix} %arg 2% added to whitelist"
73
				else:
74
					message "{@prefix} %arg 2% added to whitelist" to command sender
75
		
76
		else if arg 1 is "remove":
77
			if arg 2 is not set:
78
				message "{@prefix} Please set a player or all players to add to the whitelist" to command sender
79
			else if arg 2 is "all":
80
				clear {whitelisted::*}
81
				if {wlbroadcast} is "op":
82
					loop all players:
83
						loop-player is op
84
						message "{@prefix} Whitelist emptied" to loop-player
85
				else if {wlbroadcast} is "all":
86
					broadcast "{@prefix} Whitelist emptied"
87
				else:
88
					message "{@prefix} Whitelist emptied" to command sender
89
			else:
90
				delete {whitelisted::%arg 2%}
91
				if {wlbroadcast} is "op":
92
					loop all players:
93
						loop-player is op
94
						message "{@prefix} %arg 2% removed from whitelist" to loop-player
95
				else if {wlbroadcast} is "all":
96
					broadcast "{@prefix} %arg 2% removed from whitelist"
97
				else:
98
					message "{@prefix} %arg 2% removed from whitelist" to command sender
99
					
100
		else if arg 1 is "list":
101
			loop {whitelisted::*}:
102
				add "%loop-index%" to {_Temp::*}
103
			message "{@prefix} Whitelisted players:" to command sender
104
			message "%{_Temp::*}%" to command sender
105
		
106
		else if arg 1 is "broadcast":
107
			if arg 2 is "op":
108
				set {wlbroadcast} to "op"
109
				message "{@prefix} Broadcast set to op" to command sender
110
			else if arg 2 is "all":
111
				set {wlbroadcast} to "all"
112
				message "{@prefix} Broadcast set to all" to command sender
113
			else if arg 2 is "none":
114
				set {wlbroadcast} to "none"
115
				message "{@prefix} Broadcast set to none" to command sender
116
			else:
117
				message "{@prefix} Please set it to op, all or none" to command sender
118
				
119
		else if arg 1 is "death":
120
			if arg 2 is "on":
121
				{deathwl} is "off"
122
				set {deathwl} to "on"
123
				if {wlbroadcast} is "op":
124
					loop all players:
125
						loop-player is op
126
						message "{@prefix} Death whitelist enabled" to loop-player
127
				else if {wlbroadcast} is "all":
128
					broadcast "{@prefix} Death whitelist enabled"
129
				else:
130
					message "{@prefix} Death whitelist enabled" to command sender
131
			else if arg 2 is "off":
132
				{deathwl} is "on"
133
				set {deathwl} to "off"
134
				if {wlbroadcast} is "op":
135
					loop all players:
136
						loop-player is op
137
						message "{@prefix} Death whitelist disabled" to loop-player
138
				else if {wlbroadcast} is "all":
139
					broadcast "{@prefix} Death whitelist disabled"
140
				else:
141
					message "{@prefix} Death whitelist disabled" to command sender
142
			else:
143
				message "{@prefix} Please set death whitelist to on/off!"
144
					
145
		else:
146
			message "{@prefix} List of available commands:" to command sender
147
			message "/whitelist on &7- Turns the whitelist on" to command sender
148
			message "/whitelist off &7- Turns the whitelist off" to command sender
149
			message "/whitelist add <player/all> &7- Adds a player or everyone on the server to the whitelist" to command sender
150
			message "/whitelist remove <player/all> &7- Removes a player from the whitelist or clears the whitelist" to command sender
151
			message "/whitelist list &7- Lists everyone on the whitelist currently" to command sender
152
			message "/whitelist broadcast <op/all/none> &7- Sets who can see broadcasts" to command sender
153
			message "/whitelist death <on/off> &7- Turns the death whitelist on or off" to command sender
154
			message "To access the default whitelist, do /bukkit:whitelist" to command sender
155
			
156
on connect:
157
	{whitelist} is true
158
	{whitelisted::%player%} is not set
159
	player does not have permission "{@bypass}"
160
	kick the player due to "{@kickmsg}"
161
162
on death:
163
	victim is player
164
	{deathwl} is "on"
165-
	delete {whitelisted::%arg 2%}
165+
	delete {whitelisted::%victim%}