Date: 2014/06/16 15:06:03 UTC-07:00
Type: Denizen Script
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
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
'GuardKillsPlayerEvent':
type: world
debug: true
events:
on npc damages player:
- if <npc[<context.damager>].name.contains[Guard]> {
- if <context.entity.health.sub[<context.damage>]> < 5 {
- heal <context.entity> 10.0
- ^if !<player.flag[playerisjailed]> flag <context.entity> beforejailloc:<context.entity.location.simple>
- run jailintro as:<context.entity> instantly
- determine CANCELLED
}
}
on server start:
- run jailyloops
on player drops item:
- if <global.flag[playersinjail].as_list> contains <player> && <player.location.in_region[jail]> {
- determine cancelled
}
on jail command:
- if !<player.has_permission[essentials.togglejail]> && !<player.is_op> {
- narrate "<&c>You do not have the permission to do this."
- determine fulfilled
}
- if <context.args.size> != 2 || <context.args> contains 'help' {
- narrate "<&c>/jail [player] [duration]"
- narrate "<&c>/unjail [player]"
- narrate "<&c>example durations<&co> 1w, 7d, 24h, 60m, 60s."
- determine fulfilled
}
- if <server.list_online_players> !contains <context.args.get[1].as_player> {
- narrate "<&c><context.args.get[1]> is not online."
- determine fulfilled
}
- flag <context.args.get[1].as_player> jailedbycommand
- run jailintro as:<context.args.get[1].as_player> def:<context.args.get[2]>|yes
- narrate "<&c>Jailed <context.args.get[1]> for <context.args.get[2]>."
- determine fulfilled
on unjail command:
- if !<player.has_permission[essentials.jail]> && !<player.is_op> {
- narrate "<&c>You do not have the permission to do this."
- determine fulfilled
}
- if <context.args.size> != 1 || <context.args> contains 'help' {
- narrate "<&c>/jail [player] [duration]"
- narrate "<&c>/unjail [player]"
- narrate "<&c>example durations<&co> 1w, 7d, 24h, 60m, 60s."
- determine fulfilled
}
- if <server.list_online_players> !contains <context.args.get[1].as_player> {
- narrate "<&c><context.args.get[1]> is not online."
- determine fulfilled
}
- flag <context.args.get[1].as_player> jailedbycommand:!
- narrate "<&c>You unjailed <context.args.get[1]>"
- flag <context.args.get[1].as_player> playerisjailed:!
- flag server playersinjail:<-:<context.args.get[1].as_player>
- ^inventory clear destination:<context.args.get[1].as_player.inventory>
- ^foreach <context.args.get[1].as_player.flag[itemsbeforejailed].exclude[m@air]> {
- ^give %value% player:<context.args.get[1].as_player>
}
- ^equip <context.args.get[1].as_player> boots:<context.args.get[1].as_player.flag[equipmentbeforejailedboots]||i@air>
- ^equip <context.args.get[1].as_player> leggings:<context.args.get[1].as_player.flag[equipmentbeforejailedleggings]||i@air>
- ^equip <context.args.get[1].as_player> chestplate:<context.args.get[1].as_player.flag[equipmentbeforejailedchestplate]||i@air>
- ^equip <context.args.get[1].as_player> helmet:<context.args.get[1].as_player.flag[equipmentbeforejailedhelmet]||i@air>
- ^teleport <context.args.get[1].as_player> l@2404,73,1181,world
- ^playsound <context.args.get[1].as_player> sound:PORTAL_TRIGGER
- ^flag <context.args.get[1].as_player> playerisjailed:!
- ^inventory update destination:<context.args.get[1].as_player.inventory>
- determine fulfilled
commandblock:
- if <player.location.in_region[jail]> {
- if !<player.is_op> determine cancelled
}
"jailintro":
type: task
debug: true
script:
- ^random {
- ^teleport <player> l@2428,73,1171,world
- ^teleport <player> l@2434,73,1171,world
- ^teleport <player> l@2440,73,1171,world
- ^teleport <player> l@2446,73,1171,world
- ^teleport <player> l@2446,73,1192,world
- ^teleport <player> l@2440,73,1192,world
- ^teleport <player> l@2434,73,1192,world
- ^teleport <player> l@2428,73,1191,world
}
- ^if !<player.location.in_region[jail]> queue clear
- execute as_server 'effect <player.name> clear'
- narrate "<&7><player.name> has been jailed!" targets:<server.list_online_players.exclude[<player>]>
- ^narrate "<&4>You have been jailed!"
- ^narrate "<&c>You can work your way out by mining coal, or serve your time by waiting"
- ^if !<player.flag[playerisjailed]> flag <player> itemsbeforejailed:<player.inventory.list_contents>
- ^if !<player.flag[playerisjailed]> flag <player> equipmentbeforejailedhelmet:<player.equipment.helmet>
- ^if !<player.flag[playerisjailed]> flag <player> equipmentbeforejailedchestplate:<player.equipment.chestplate>
- ^if !<player.flag[playerisjailed]> flag <player> equipmentbeforejailedleggings:<player.equipment.leggings>
- ^if !<player.flag[playerisjailed]> flag <player> equipmentbeforejailedboots:<player.equipment.boots>
- ^inventory clear destination:<player.inventory>
- ^equip <player> head:<i@Jailuniform1||Leather_helmet>
- ^equip <player> chest:<i@Jailuniform2||leather_chestplate>
- ^equip <player> legs:<i@Jailuniform3||leather_leggings>
- ^equip <player> boots:<i@Jailuniform4||leather_boots>
- ^equip <player> hand:i@Jailuniform5
- inventory update destination:<player.inventory>
- if %2% == yes {
- ^flag <player> playerisjailed duration:%1%
} else if <player.has_flag[MarkedCriminal]> {
- ^flag <player> playerisjailed duration:<player.flag[playerisjailed].expiration.in_minutes.add[10]||10>m
} else if <server.flag[KingsGuildMembers].as_list.contains[<player>]> {
- ^flag <player> playerisjailed duration:<player.flag[playerisjailed].expiration.in_minutes.add[3]||3>m
} else {
- ^flag <player> playerisjailed duration:<player.flag[playerisjailed].expiration.in_minutes.add[5]||5>m
}
- if <global.flag[playersinjail].as_list> !contains <player> flag server playersinjail:->:<player>
"jailyloops":
type: task
debug: true
script:
- if <server.list_online_players.size> > 0 {
- ^playeffect l@2410,72,1181,world effect:ENDER_SIGNAL qty:10
- ^playsound l@2410,72,1181,world sound:PORTAL volume:0.5
}
- ^foreach li@n@41|n@40|n@42|n@43 {
- ^if <%value%.is_spawned> flag server jailkilledguards:++
}
- ^if <global.flag[playersinjail].as_list.size||0> > 0 && <server.list_online_players.size> > 0 {
- ^foreach <global.flag[playersinjail].as_list> {
- if <%value%.is_online> run jailyloopsexternal as:%value% instantly
}
}
- run jailyloops delay:3s instantly
"jailyloopsexternal":
type: task
debug: true
script:
- ^if <cu@l@2411,73,1180,world|l@2409,73,1182,world.list_players> contains <player> run jailescape as:%value% instantly
- ^if !<player.has_flag[playerisjailed]> playeffect l@2410,72,1181,world effect:FIREWORKS_SPARK qty:500 offset:1 targets:<player>
- if <server.flag[jailkilledguards]||0> < 1 && !<player.has_flag[jailedbycommand]> {
- playeffect l@2410,72,1181,world effect:FIREWORKS_SPARK qty:500 offset:1 targets:<player>
}
- if <player.is_online> run jailscoreboard as:<player> instantly
"jailscoreboard":
type: task
debug: true
script:
- ^scoreboard add viewers:<player> id:FJRHJSKHKJDH
- scoreboard remove id:jail<player.name>
- ^scoreboard add id:jail<player.name> "obj:<&6>Jail Info" 'lines:<&4><&4>------------' score:9
- ^scoreboard add id:jail<player.name> "obj:<&6>Jail Info" 'lines:<&6>Jailtime<&co>' score:8
- ^scoreboard add id:jail<player.name> "obj:<&6>Jail Info" 'lines:<&e><el@val[<player.flag[playerisjailed].expiration.formatted||<&b><&a>Free!>].substring[1,16]>' score:7
- ^scoreboard add id:jail<player.name> "obj:<&6>Jail Info" 'lines:<&a><&4>------------' score:6
- ^scoreboard add id:jail<player.name> "obj:<&6>Jail Info" 'lines:<&6>Coal left<&co>' score:5
- ^scoreboard add id:jail<player.name> "obj:<&6>Jail Info" 'lines:<&d><&e><el@val[<player.flag[playerisjailed].expiration.in_seconds.div[5].round_up||<&a>Free!>].substring[1,16]>' score:4
- ^scoreboard add id:jail<player.name> "obj:<&6>Jail Info" 'lines:<&c><&4>------------' score:0
- ^scoreboard add id:jail<player.name> viewers:<player>
"jailescape":
type: task
debug: true
script:
- if <player.flag[playerisjailed].expiration.in_seconds||0> > 1 && <server.flag[jailkilledguards]||0> > 0 {
- narrate "<&c>You are not allowed to leave, and there are too many guards to try to escape."
} else if <player.flag[playerisjailed].expiration.in_seconds||0> > 1 && <player.flag[jailedbycommand]> {
- narrate "<&c>There is a much greater force than guards holding you here."
} else {
- narrate "<&c>You leave the jail..."
- ^flag server playersinjail:<-:<player>
- ^inventory clear destination:<player.inventory>
- ^foreach <player.flag[itemsbeforejailed].exclude[i@air]> {
- ^give %value%
}
- ^equip <player> boots:<player.flag[equipmentbeforejailedboots]||i@air>
- ^equip <player> leggings:<player.flag[equipmentbeforejailedleggings]||i@air>
- ^equip <player> chestplate:<player.flag[equipmentbeforejailedchestplate]||i@air>
- ^equip <player> helmet:<player.flag[equipmentbeforejailedhelmet]||i@air>
- ^teleport <player> l@2404,73,1181,world
- ^playsound <player> sound:PORTAL_TRIGGER
- ^flag <player> playerisjailed:!
- flag <player> jailedbycommand:!
- ^inventory update destination:<player.inventory>
- wait 2s
- if <util.random.int[1].to[50]> == 25 {
- narrate "<&c>You find a piece of Jail Uniform in your inventory.."
- give i@jailuniform<util.random.int[1].to[5]>
}
}
'jaildeath':
type: world
debug: true
events:
on player respawns:
- if <global.flag[playersinjail].as_list> contains <player> run jaildeathrespawn as:<player> delay:10t
"jaildeathrespawn":
type: task
debug: true
script:
- random {
- teleport <player> l@2428,73,1171,world
- teleport <player> l@2434,73,1171,world
- teleport <player> l@2440,73,1171,world
- teleport <player> l@2446,73,1171,world
- teleport <player> l@2446,73,1192,world
- teleport <player> l@2440,73,1192,world
- teleport <player> l@2434,73,1192,world
- teleport <player> l@2428,73,1191,world
}
- narrate "<&c>You are still jailed!"
- ^inventory clear destination:<player.inventory>
- ^equip <player> head:<i@Jailuniform1||Leather_helmet>
- ^equip <player> chest:<i@Jailuniform2||leather_chestplate>
- ^equip <player> legs:<i@Jailuniform3||leather_leggings>
- ^equip <player> boots:<i@Jailuniform4||leather_boots>
- ^equip <player> hand:i@jailuniform5
- inventory update destination:<player.inventory>
'jailcoalminer':
type: world
debug: true
events:
on player breaks m@coal_ore:
- if !<player.location.in_region[jail]> queue clear
- playsound <player> sound:ITEM_PICKUP pitch:2.0
- give <player> i@coal qty:1
- modifyblock <context.location> m@air
- if !<player.flag[jailcoalminerCD]> {
- narrate "<&c>You mined a piece of coal!"
- narrate "<&c>For each piece of coal that you hand the coal collector, you reduce your jail time by 5 seconds."
- flag <player> jailcoalminerCD duration:15m
}
- run jailcoalminerrestorecoal delay:30s def:<context.location> as:<player>
on player right clicks entity:
- if <context.entity> != n@45 queue clear
- if <player.inventory.contains[i@coal]> {
- define amount <player.inventory.qty[i@coal]>
- take i@coal qty:<player.inventory.qty[i@coal]>
- ^inventory update destination:<player.inventory>
- flag <player> playerisjailed duration:<player.flag[playerisjailed].expiration.in_seconds.sub[<el@val[%amount%].mul[5]>]>
- if <player.flag[playerisjailed].expiration.in_seconds||0> < 1 {
- narrate "<&c>You have served your time and are free to leave now."
- narrate "<&c>Step through the portal at the gate to leave."
- flag <player> playerisjailed:!
} else {
- narrate "<&c>You give the guard <el@val[%amount%].as_int> pieces of coal."
- narrate "<&c>Your jail time has been reduced by <el@val[%amount%].mul[5].as_int> seconds."
}
} else {
- narrate "<&c>You have no coal to hand to the officer."
}
CoalBreak:
type: world
debug: false
events:
on player breaks block:
- if <player.location.in_region[jail]> && <context.material> != m@coal_ore {
- narrate "<&c>Your jail issued pickaxe is far too dull to tunnel out."
- determine cancelled
}
CoalOnly:
type: world
debug: false
events:
on player places block:
- if <player.location.in_region[jail]> {
- narrate "<&c>You can't alter jail."
- determine cancelled
}
"jailcoalminerrestorecoal":
type: task
debug: true
script:
- modifyblock %1% m@coal_ore
Jailuniform1:
type: item
no_id: true
material: i@leather_helmet
display name: '<&8>Jail Helmet'
lore:
- Uniform for those
- who are jailed.
color: c@075,066,045
Jailuniform2:
type: item
no_id: true
material: i@leather_chestplate
display name: '<&8>Jail Tunic'
lore:
- Uniform for those
- who are jailed.
color: c@075,066,045
Jailuniform3:
type: item
no_id: true
material: i@leather_leggings
display name: '<&8>Jail Leggings'
lore:
- Uniform for those
- who are jailed.
color: c@075,066,045
Jailuniform4:
type: item
no_id: true
material: i@leather_boots
display name: '<&8>Jail Boots'
lore:
- Uniform for those
- who are jailed.
color: c@075,066,045
Jailuniform5:
type: item
no_id: true
material: i@stone_pickaxe
display name: '<&8>Jail Pickaxe'
lore:
- Pickaxe for Enforced Labor.