Date: 2020/04/28 12:10:30 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
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
CastleWarsEvent:
type: task
debug: false
script:
# % % % % % % % % % % QUEUE BEGIN % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % #
# | ██ [ Prepare Event ] ██
- define Message "<&6>/<&e>event join CastleWars"
- define Command "event join castlewars"
- define Hover "<&2>C<&a>lick <&2>T<&a>o <&2>R<&a>un<&2><&co><n><&6>/<&e>event join CastleWars"
- announce "<&6>[<&e>Server Event<&6>] <&c>Event Starting Soon<&c>: <&4><&l>Castle Wars!<n><&a> Click or Type <proc[MsgCommand].context[<[Message]>|<[Command]>|<[Hover]>]> <&a>to join! <&4>[<&c>5 Minutes<&4>] "
- flag server EventQueueTimer:300
# | ██ [ Reset Game Variables ] ██
- define VariableList <list[NightMode|FriendlyFire|DeathExplosion|DoubleSpeed|18CombatMode|NPCs]>
- foreach <[VariableList]>:
- flag server CastleWars.Gamemode.<[value]>VoteY:!
- flag server CastleWars.Gamemode.<[value]>VoteN:!
- define VarSignList <list[<location[755,98,-1,Hub]>|<location[755,98,0,Hub]>|<location[755,98,1,Hub]>|<location[755,97,-1,Hub]>|<location[755,97,0,Hub]>|<location[755,97,1,Hub]>]>
- foreach VarSignList:
- define Contents <context.location.sign_contents>
- define NewContent3 "<context.location.sign_contents.get[3].before[:]>:<&sp><&sp><[VoteYes]>"
- define NewContent4 "<context.location.sign_contents.get[4].before[:]>:<&sp><&sp><[VoteNo]>"
- adjust <[value]> "sign_contents:<[Contents].remove[3|4].include[<[NewContent3]>|<[NewContent4]>]>"
# | ██ [ Queue Wait ] ██
- while <server.flag[EventQueueTimer]> > 0:
- actionbar "<&2>T<&a>ime <&2>R<&a>emaining<&2>:<&e> <server.flag[EventQueueTimer]||0>" targets:<server.flag[CastleWars.Queue]||>
- flag server EventQueueTimer:--
- if <server.flag[EventQueueTimer]> == 60:
- announce "<&6>[<&e>Server Event<&6>] <&c>Event Starting Soon<&c>: <&4><&l>Castle Wars!<n><&a> Click or Type <proc[MsgCommand].context[<[Message]>|<[Command]>|<[Hover]>]> <&a>to join! <&4>[<&c>1 Minute!<&4>] "
- wait 1s
# % % % % % % % % % % GAME PRE-START % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % #
# | ██ [ Adjust Game Variables ] ██
- foreach <[Variable]>:
- if <server.flag[CastleWars.Gamemode.<[value]>VoteY]> > <server.flag[CastleWars.Gamemode.<[value]>VoteN]>:
- flag server CastleWars.Gamemode.<[value]>:True
- else:
- flag server CastleWars.Gamemode.<[value]>:False
# | ██ [ Adjust Players ] ██
- define Players <server.flag[CastleWars.Queue].random[99]>
- foreach <[Players]>:
- flag <[value]> event:CastleWars
- flag <[value]> PreviousEventGamemode:<[value].gamemode>
- adjust <[value]> gamemode:adventure
- adjust <[value]> food:30
- adjust <[value]> health:
- if <[Loop_Index].mod[2]> == 1:
- define TeamColor Red
- equip <[value]> head:RedEventHat
- title "title:<&4>R<&c>ed <&4>T<&c>eam" "subtitle:<&6>C<&e>apture <&6>T<&e>he <&6>F<&e>lag<&6>!" fade_in:1s stay:1s fade_out:1s targets:<[value]>
- teleport <[Value]> <cuboid[castlewarsredrespawn].blocks.random>
- else:
- define TeamColor Blue
- equip <[value]> head:BlueEventHat
- title "title:<&3>B<&b>lue <&3>T<&b>eam" "subtitle:<&6>C<&e>apture <&6>T<&e>he <&6>F<&e>lag<&6>!" fade_in:1s stay:1s fade_out:1s targets:<[value]>
- teleport <[Value]> <cuboid[castlewarsbluerespawn].blocks.random>
- flag server CastleWars.Queue:<-:<[Value]>
- flag <[value]> Castlewars.Team:<[TeamColor]>
- if <server.flag[CastleWars.Gamemode.NightMode]> == true:
- adjust <[value]> freeze_time:18000
- if <server.flag[CastleWars.Gamemode.DoubleSpeed]> == true:
- adjust <[value]> walk_speed:0.4
# | ██ [ Set Scores ] ██
- sidebar "title:<&6>S<&e>core<&6>:" scores:0|0 "values:<&4>R<&c>ed <&4>T<&c>eam|<&3>B<&b>lue <&3>T<&b>eam" players:<server.list_online_players>
- flag server CastleWars.Scores.Red:0
- flag server CastleWars.Scores.Blue:0
# % % % % % % % % % % GAME START % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % #
# | ██ [ Redundant Repair Landscape ] ██
- modifyblock <location[691,169,-58,hub]> red_banner
- adjust <location[691,169,-58,hub]> block_facing:<location[0.7,0,0.7]>
- modifyblock <location[808,169,59,hub]> blue_banner
- adjust <location[808,169,59,hub]> block_facing:<location[-0.7,0,-0.7]>
# | ██ [ Announce Start ] ██
- foreach <server.list_players_flagged[event]>:
- if <[value].flag[CastleWars.Team]> == red:
- narrate format:CWFormat "<&e>You<&6>'<&e>re on the <&4>R<&c>ed <&4>T<&c>eam<&6>!"
- if <[value].flag[CastleWars.Team]> == Blue:
- narrate format:CWFormat "<&e>You<&6>'<&e>re on the <&3>B<&b>lue <&3>T<&b>eam<&6>!"
- narrate "<&e>Capture the enemy flag<&6>!"
# | ██ [ Event Timer ] ██
- flag server EventTimer:600
- flag server EventTimer:--
- while <server.flag[EventTimer]> > 0:
- actionbar "<&2>T<&a>ime <&2>R<&a>emaining<&2>: <&6><server.flag[EventTimer]>" targets:<server.list_players_flagged[Event]||>
- flag server EventTimer:--
- if <server.flag[EventTimer].mod[60]> == 0:
- announce format:EventFormat "<&2>T<&a>ime <&2>L<&a>eft<&2>: <&6><server.flag[EventTimer].div[60].as_int><&e> Minutes<&6>!"
- if <server.flag[EventTimer.mod[30]> == 0:
- foreach <cuboid[CastleWarsBarrier].blocks>:
- ~showfake barrier <[value]> players:<server.list_players_flagged[event]> duration:16s
- wait 1s
# % % % % % % % % % % GAME FINALIZE % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % #
- foreach <server.list_players_flagged[event]>:
- teleport <[value]> <cuboid[castlewarswaitingroomspawn].blocks.random>
- teleport <[value]> <cuboid[castlewarswaitingroomspawn].blocks.random>
# | ██ [ Announce Winners Timer ] ██
- define RedScore <server.flag[CastleWars.Scores.Red]>
- define BlueScore <server.flag[CastleWars.Scores.Blue]>
- if <[RedScore]> > <[BlueScore]>:
- announce "<&6>[<&e>Server Event<&6>] <&a>The <&4>R<&c>ed <&4>my T<&c>eam<&a> was the winning team for the Castle Wars event!"
- else if <[RedScore]> < <[BlueScore]>:
- announce "<&6>[<&e>Server Event<&6>] <&a>The <&3>B<&b>lue <&3>T<&b>eam<&a> was the winning team for the Castle Wars event!"
- else:
- announce "<&6>[<&e>Server Event<&6>] <&a>The Castle Wars game was a Tie!"
# % % % % % % % % % % GAME END % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % #
# | ██ [ Adjust Players ] ██
- define Players <server.list_players_flagged[event]>
- foreach <[Players]>:
- equip <[value]> head:air
- sidebar remove
- adjust <[value]> gamemode:<[value].flag[PreviousEventGamemode]>
- flag <[value]> event:!
- flag <[value]> FlagHolder:!
- flag <[value]> CastleWars.Team:!
- flag <[value]> PreviousEventGamemode:!
- flag <[value]> CastleWars:!
- if <server.flag[CastleWars.Gamemode.NightMode]> == true:
- adjust <[value]> freeze_time:0
- if <server.flag[CastleWars.Gamemode.DoubleSpeed]> == true:
- adjust <[value]> walk_speed:0.2
# | ██ [ Adjust Server ] ██
- flag server event:!
- flag server CastleWars.Scores.Red:!
- flag server CastleWars.Scores.Blue:!
- flag server EventQueue:!
- flag server EventQueueQ:!
- flag server Eventqueuetimer:!
- flag server CastleWars:!
- flag server EventTimer:!
- foreach <[VariableList]>:
- flag server CastleWars.Gamemode.<[value]>VoteY:!
- flag server CastleWars.Gamemode.<[value]>VoteN:!
# | ██ [ Redundant Repair Landscape ] ██
- modifyblock <location[691,169,-58,hub]> red_banner
- adjust <location[691,169,-58,hub]> block_facing:<location[0.7,0,0.7]>
- modifyblock <location[808,169,59,hub]> blue_banner
- adjust <location[808,169,59,hub]> block_facing:<location[-0.7,0,-0.7]>
CastleWarsHandler:
type: world
debug: true
PortalCooldown:
- if <player.has_flag[CastleWWars.Portal.Cooldown.Notification]>:
- stop
- narrate "<&c>Portal cooldown is still in effect."
- flag player CastleWWars.Portal.Cooldown.Notification duration:5s
- stop
events:
on x command:
- if <server.match_player[behr]> == <player>:
- reload
- determine cancelled
on player respawns bukkit_priority:LOWEST:
- choose <player.flag[Event]>:
- case "CastleWars":
- determine <cuboid[CastleWars<player.flag[CastleWars.Team]||Red>Respawn].blocks.random>
on player dies bukkit_priority:LOWEST:
- if !<player.has_flag[event]>:
- stop
- choose <player.flag[Event]||>:
- case "CastleWars":
- wait 1s
- teleport <cuboid[CastleWars<player.flag[CastleWars.Team]>Respawn].blocks.random>
- if <server.flag[CastleWars.Gamemode.DoubleSpeed]> == true:
- adjust <[value]> walk_speed:0.4
- if <player.flag[CastleWars.team]> == red:
- equip <player> head:RedEventHat
- else if <player.flag[CastleWars.team]> == blue:
- equip <player> head:BlueEventhat
- if <player.has_flag[FlagHolder]>:
- flag player FlagHolder:!
- if <player.flag[CastleWars.Team]> == red:
- Run FlagReturn Instantly def:False|Red|<server.flag[CastleWars.Scores.Red]||1>|<server.flag[CastleWars.Scores.Blue]||1>|FlagHolder
- else:
- Run FlagReturn Instantly def:False|Blue|<server.flag[CastleWars.Scores.Red]||1>|<server.flag[CastleWars.Scores.Blue]||1>|FlagHolder
on player clicks block in castlewarsblueflag:
- if <player.flag[CastleWars.Team]> == red:
- if <cuboid[castlewarsblueflag].blocks.parse[material.name].contains[blue_banner]>:
- modifyblock <location[808,169,59,hub]> air
- equip head:BlueEventBanner
- flag <player> FlagHolder
- if <server.flag[CastleWars.Gamemode.DoubleSpeed]||false> == true:
- adjust <player> walk_speed:0.34
- else:
- adjust <player> walk_speed:0.17
- run FlagEffect path:blue instantly
- title "subtitle:<&4>R<&c>ed <&4>T<&c>eam <&4>h<&c>as <&4>s<&c>tolen <&4>t<&c>he <&4>f<&c>lag!"
- else if <player.has_flag[FlagHolder]>:
- flag player FlagHolder:!
- modifyblock <location[691,169,-58,hub]> red_banner
- adjust <location[691,169,-58,hub]> block_facing:<location[0.7,0,0.7]>
- flag server CastleWars.Scores.Blue:++
- run FlagReturn Instantly def:True|Blue|<server.flag[CastleWars.Scores.Red]||0>|<server.flag[CastleWars.Scores.Blue]||1>|<player>
on player clicks block in castlewarsredflag:
- if <player.flag[CastleWars.team]> == blue:
- if <cuboid[castlewarsredflag].blocks.parse[material.name].contains[red_banner]>:
- modifyblock <location[691,169,-58,hub]> air
- equip head:RedEventBanner
- flag <player> FlagHolder
- if <server.flag[CastleWars.Gamemode.DoubleSpeed]||false> == true:
- adjust <player> walk_speed:0.34
- else:
- adjust <player> walk_speed:0.17
- run FlagEffect path:Red instantly
- title "subtitle:<&3>B<&b>lue <&3>T<&b>eam <&3>h<&b>as <&3>s<&b>tolen <&3>t<&b>he <&3>f<&b>lag!"
- else if <player.has_flag[FlagHolder]>:
- flag player FlagHolder:!
- modifyblock <location[808,169,59,hub]> blue_banner
- adjust <location[808,169,59,hub]> block_facing:<location[-0.7,0,-0.7]>
- flag server CastleWars.Scores.Red:++
- run FlagReturn Instantly def:True|Red|<server.flag[CastleWars.Scores.Red]||1>|<server.flag[CastleWars.Scores.Blue]||0>|<player>
on player damages player in castlewarswaitingroom:
- if !<context.entity.has_flag[smacked]>:
- define vector <context.entity.location.sub[<context.damager.location>].normalize.mul[0.5]>
- adjust <context.entity> velocity:<def[vector].x>,0.4,<def[vector].z>
- flag <context.entity> smacked duration:0.45s
- playeffect effect:EXPLOSION_NORMAL at:<context.entity.location.add[0,1,0]> visibility:50 quantity:10 offset:0.5
- playeffect effect:EXPLOSION_LARGE at:<context.entity.location.add[0,1,0]> visibility:50 quantity:1 offset:0.5
- determine cancelled
on player clicks with Ender_Pearl in castlewars:
- determine cancelled
on player damages player in castlewars:
- if <player.flag[Castlewars.Team]> == <context.entity.flag[CastleWars.Team]>:
- determine cancelled
on player changes food level in castlewars:
- determine cancelled
on player right clicks entity in castlewars:
- if <context.entity.entity_type> == armor_stand:
- determine cancelled
on player clicks block in castlewars:
- define Blacklist <list[trapdoor|barrel|brewing|hopper|lever|cactus|sapling|furnace|smoker|crafting|chest]>
- if <context.location.material.contains_any[<[Blacklist]>]>:
- determine cancelled
on player breaks block in castlewars:
- determine cancelled
on player toggles flying in castlewars:
- if !<player.gamemode.contains_any[creative|spetactor]>
- determine cancelled
on cmi command:
- if <context.server||false>:
- stop
- if <player.has_flag[event]>:
- if <context.args.get[1].contains_any[back|gm|fly|walkspeed|flyspeed|heal|kill|switch|tpa|tpahere|repair|home|hat|suicide]>:
- determine cancelled
- if <context.args.get[1]> == sit:
- if <player.has_flag[SitPrevention]>:
- determine fulfilled
on switch command:
- if <context.args[1].contains[behr]>:
- narrate "<&c><&l><&o>no fuck you"
- determine fulfilled
on player enters CastleWarsBarrier:
- determine cancelled
on player damaged by:SUFFOCATION:
- if <player.has_flag[SuffocationBypass]>:
- determine cancelled
on player clicks block in CastleWarsRed1Portal:
- if <player.flag[CastleWars.Team]> != red:
- stop
- if <player.has_flag[FlagHolder]>:
- stop
- flag player SitPrevention duration:5t
- flag player SuffocationBypass duration:10t
# % % % % % % % % % % % % # OUTSIDE -> INSIDE # % % % % % % % % % #
- define CCenter <cuboid[CastleWarsRed1Portal].center>
- define iA 704.5
- define iB -54
- if <player.location.x> > <[CCenter].x> && <player.location.x> < <[CCenter].x.add[1.5]> && <player.location.z> > <[CCenter].z.sub[0.75]> && <player.location.z> < <[CCenter].z.add[0.75]> && <player.location.y> >= 157:
- if <player.has_flag[CastleWars.Portal.Cooldown]>:
- inject locally PortalCooldown instantly
- else:
- foreach <location[<player.location.x>,<player.location.y>,<player.location.z>].points_between[<location[<[CCenter].x.sub[1]>,<player.location.y>,<player.location.z>]>].distance[0.5]>:
- teleport <location[<[value].x>,<[value].y>,<[value].z>,<player.location.pitch>,<player.location.yaw>,<player.world.name>]>
- wait 1t
- flag player CastleWars.Portal.Cooldown duration:1t
# % % % % % % % % % % % % # INSIDE -> OUTSIDE # % % % % % % % % % #
- else if <player.location.x> < <[CCenter].x> && <player.location.x> > <[CCenter].x.sub[2.5]> && <player.location.z> > <[CCenter].z.sub[0.75]> && <player.location.z> < <[CCenter].z.add[0.75]> && <player.location.y> >= 157:
- if <player.has_flag[CastleWars.Portal.Cooldown]>:
- inject locally PortalCooldown instantly
- else:
- foreach <location[<player.location>].points_between[<location[<[CCenter].x.add[1]>,<player.location.y>,<player.location.z>]>].distance[0.5]>:
- teleport <location[<[value].x>,<[value].y>,<[value].z>,<player.location.pitch>,<player.location.yaw>,<player.world.name>]>
- wait 1t
- flag player CastleWars.Portal.Cooldown duration:1t
on player clicks block in CastleWarsRed2Portal:
- if <player.flag[CastleWars.Team]> != red:
- stop
- if <player.has_flag[FlagHolder]>:
- stop
- flag player SitPrevention duration:5t
- flag player SuffocationBypass duration:10t
# % % % % % % % % % % % % # OUTSIDE -> INSIDE # % % % % % % % % % #
- define CCenter <cuboid[CastleWarsRed2Portal].center>
#- define iA -44.5 z
#- define iB 697 x
- if <player.location.z> > <[CCenter].z> && <player.location.z> < <[CCenter].z.add[1.5]> && <player.location.x> > <[CCenter].x.sub[0.75]> && <player.location.x> < <[CCenter].x.add[0.75]> && <player.location.y> >= 157:
- if <player.has_flag[CastleWars.Portal.Cooldown]>:
- inject locally PortalCooldown instantly
- else:
- foreach <location[<player.location>].points_between[<location[<player.location.x>,<player.location.y>,<[CCenter].z.sub[1]>]>].distance[0.5]>:
- teleport <location[<[value].x>,<[value].y>,<[value].z>,<player.location.pitch>,<player.location.yaw>,<player.world.name>]>
- wait 1t
- flag player CastleWars.Portal.Cooldown duration:1t
# % % % % % % % % % % % % # INSIDE -> OUTSIDE # % % % % % % % % % #
- else if <player.location.z> < <[CCenter].z> && <player.location.z> > <[CCenter].z.sub[2.5]> && <player.location.x> > <[CCenter].x.sub[0.75]> && <player.location.x> < <[CCenter].x.add[0.75]> && <player.location.y> >= 157:
- if <player.has_flag[CastleWars.Portal.Cooldown]>:
- inject locally PortalCooldown instantly
- else:
- foreach <location[<player.location>].points_between[<location[<player.location.x>,<player.location.y>,<[CCenter].z.add[1]>]>].distance[0.5]>:
- teleport <location[<[value].x>,<[value].y>,<[value].z>,<player.location.pitch>,<player.location.yaw>,<player.world.name>]>
- wait 1t
- flag player CastleWars.Portal.Cooldown duration:1t
on player clicks block in CastleWarsBlue2Portal:
- if <player.flag[CastleWars.Team]> != Blue:
- stop
- if <player.has_flag[FlagHolder]>:
- stop
- flag player SitPrevention duration:5t
- flag player SuffocationBypass duration:10t
# % % % % % % % % % % % % # OUTSIDE -> INSIDE # % % % % % % % % % #
- define CCenter <cuboid[CastleWarsBlue2Portal].center>
#- define iA -44.5 z
#- define iB 697 x
- if <player.location.z> > <[CCenter].z> && <player.location.z> < <[CCenter].z.add[1.5]> && <player.location.x> > <[CCenter].x.sub[0.75]> && <player.location.x> < <[CCenter].x.add[0.75]> && <player.location.y> >= 157:
- if <player.has_flag[CastleWars.Portal.Cooldown]>:
- inject locally PortalCooldown instantly
- else:
- foreach <location[<player.location>].points_between[<location[<player.location.x>,<player.location.y>,<[CCenter].z.sub[1]>]>].distance[0.5]>:
- teleport <location[<[value].x>,<[value].y>,<[value].z>,<player.location.pitch>,<player.location.yaw>,<player.world.name>]>
- wait 1t
- flag player CastleWars.Portal.Cooldown duration:1t
# % % % % % % % % % % % % # INSIDE -> OUTSIDE # % % % % % % % % % #
- else if <player.location.z> < <[CCenter].z> && <player.location.z> > <[CCenter].z.sub[2.5]> && <player.location.x> > <[CCenter].x.sub[0.75]> && <player.location.x> < <[CCenter].x.add[0.75]> && <player.location.y> >= 157:
- if <player.has_flag[CastleWars.Portal.Cooldown]>:
- inject locally PortalCooldown instantly
- else:
- foreach <location[<player.location>].points_between[<location[<player.location.x>,<player.location.y>,<[CCenter].z.add[1]>]>].distance[0.5]>:
- teleport <location[<[value].x>,<[value].y>,<[value].z>,<player.location.pitch>,<player.location.yaw>,<player.world.name>]>
- wait 1t
- flag player CastleWars.Portal.Cooldown duration:1t
on player clicks block in CastleWarsBlue1Portal:
- if <player.flag[CastleWars.Team]> != Blue:
- stop
- if <player.has_flag[FlagHolder]>:
- stop
- flag player SitPrevention duration:5t
- flag player SuffocationBypass duration:10t
# % % % % % % % % % % % % # OUTSIDE -> INSIDE # % % % % % % % % % #
- define CCenter <cuboid[CastleWarsBlue1Portal].center>
- if <player.location.x> > <[CCenter].x> && <player.location.x> < <[CCenter].x.add[1.5]> && <player.location.z> > <[CCenter].z.sub[0.75]> && <player.location.z> < <[CCenter].z.add[0.75]> && <player.location.y> >= 157:
- if <player.has_flag[CastleWars.Portal.Cooldown]>:
- inject locally PortalCooldown instantly
- else:
- foreach <location[<player.location.x>,<player.location.y>,<player.location.z>].points_between[<location[<[CCenter].x.sub[1]>,<player.location.y>,<player.location.z>]>].distance[0.5]>:
- teleport <location[<[value].x>,<[value].y>,<[value].z>,<player.location.pitch>,<player.location.yaw>,<player.world.name>]>
- wait 1t
- flag player CastleWars.Portal.Cooldown duration:1t
# % % % % % % % % % % % % # INSIDE -> OUTSIDE # % % % % % % % % % #
- else if <player.location.x> < <[CCenter].x> && <player.location.x> > <[CCenter].x.sub[2.5]> && <player.location.z> > <[CCenter].z.sub[0.75]> && <player.location.z> < <[CCenter].z.add[0.75]> && <player.location.y> >= 157:
- if <player.has_flag[CastleWars.Portal.Cooldown]>:
- inject locally PortalCooldown instantly
- else:
- foreach <location[<player.location>].points_between[<location[<[CCenter].x.add[1]>,<player.location.y>,<player.location.z>]>].distance[0.5]>:
- teleport <location[<[value].x>,<[value].y>,<[value].z>,<player.location.pitch>,<player.location.yaw>,<player.world.name>]>
- wait 1t
- flag player CastleWars.Portal.Cooldown duration:1t
on player clicks block in CastleWarsRedTopPortal:
- if <player.flag[CastleWars.Team]> != red:
- stop
- if <player.has_flag[FlagHolder]>:
- stop
- flag player SitPrevention duration:5t
- flag player SuffocationBypass duration:10t
# % % % % % % % % % % % % # OUTSIDE -> INSIDE # % % % % % % % % % #
- define CCenter <cuboid[CastleWarsRedTopPortal].center>
- if <player.location.y> >= 162 && <player.location.x> > <[CCenter].x.sub[0.7]> && <player.location.x> < <[CCenter].x.add[0.7]> && <player.location.x> > <[CCenter].z.sub[0.7]> && <player.location.x> > <[CCenter].z.add[0.7]>:
- if <player.has_flag[CastleWars.Portal.Cooldown]>:
- inject locally PortalCooldown instantly
- else:
- foreach <location[<player.location>].points_between[<[CCenter].sub[0,1.5,0]>].distance[0.5]>:
- teleport <location[<[value].x>,<[value].y>,<[value].z>,<player.location.pitch>,<player.location.yaw>,<player.world.name>]>
- wait 1t
- flag player CastleWars.Portal.Cooldown duration:1t
# % % % % % % % % % % % % # INSIDE -> OUTSIDE # % % % % % % % % % #
- else if <player.location.y> >= 158 && <player.location.y> < <[CCenter].y> && <player.location.x> > <[CCenter].x.sub[0.7]> && <player.location.x> < <[CCenter].x.add[0.7]> && <player.location.x> > <[CCenter].z.sub[0.7]> && <player.location.x> > <[CCenter].z.add[0.7]>:
- if <player.has_flag[CastleWars.Portal.Cooldown]>:
- inject locally PortalCooldown instantly
- else:
- foreach <location[<player.location>].points_between[<[CCenter].add[0,1,0]>].distance[0.5]>:
- teleport <location[<[value].x>,<[value].y>,<[value].z>,<player.location.pitch>,<player.location.yaw>,<player.world.name>]>
- wait 1t
- flag player CastleWars.Portal.Cooldown duration:1t
- flag player SitPrevention duration:5t
- flag player SuffocationBypass duration:10t
on player clicks block in CastleWarsBlueTopPortal:
- if <player.flag[CastleWars.Team]> != Blue:
- stop
- if <player.has_flag[FlagHolder]>:
- stop
- flag player SitPrevention duration:5t
- flag player SuffocationBypass duration:10t
# % % % % % % % % % % % % # OUTSIDE -> INSIDE # % % % % % % % % % #
- define CCenter <cuboid[CastleWarsBlueTopPortal].center>
- if <player.location.y> >= 162 && <player.location.x> > <[CCenter].x.sub[0.7]> && <player.location.x> < <[CCenter].x.add[0.7]> && <player.location.x> > <[CCenter].z.sub[0.7]> && <player.location.x> > <[CCenter].z.add[0.7]>:
- if <player.has_flag[CastleWars.Portal.Cooldown]>:
- inject locally PortalCooldown instantly
- else:
- foreach <location[<player.location>].points_between[<[CCenter].sub[0,1.5,0]>].distance[0.5]>:
- teleport <location[<[value].x>,<[value].y>,<[value].z>,<player.location.pitch>,<player.location.yaw>,<player.world.name>]>
- wait 1t
- flag player CastleWars.Portal.Cooldown duration:1t
# % % % % % % % % % % % % # INSIDE -> OUTSIDE # % % % % % % % % % #
- else if <player.location.y> >= 158 && <player.location.y> < <[CCenter].y> && <player.location.x> > <[CCenter].x.sub[0.7]> && <player.location.x> < <[CCenter].x.add[0.7]> && <player.location.x> > <[CCenter].z.sub[0.7]> && <player.location.x> > <[CCenter].z.add[0.7]>:
- if <player.has_flag[CastleWars.Portal.Cooldown]>:
- inject locally PortalCooldown instantly
- else:
- foreach <location[<player.location>].points_between[<[CCenter].add[0,1,0]>].distance[0.5]>:
- teleport <location[<[value].x>,<[value].y>,<[value].z>,<player.location.pitch>,<player.location.yaw>,<player.world.name>]>
- wait 1t
- flag player CastleWars.Portal.Cooldown duration:1t
- flag player SitPrevention duration:5t
- flag player SuffocationBypass duration:10t
On player clicks block in castlewarswaitingroom:
- if <context.location.material.contains_any[sign]>:
- define Variable "<context.location.sign_contents.get[1].after[<&lb>].before[<&rb>].replace[<&sp>].with[].replace[.].with[]>"
- define Contents <context.location.sign_contents>
- define Contents3 <context.location.sign_contents.get[3].before[:]>
- define Contents4 <context.location.sign_contents.get[4].before[:]>
- if <context.click_type.contains[Left]>:
- if !<server.flag[CastleWars.Gamemode.<[Variable]>VoteY].contains[<player>]||false>:
- flag server CastleWars.Gamemode.<[Variable]>VoteY:->:<player>
- if <server.flag[CastleWars.Gamemode.<[Variable]>VoteN].contains[<player>]||false>:
- flag server CastleWars.Gamemode.<[Variable]>VoteN:<-:<player>
- else if <context.click_type.contains[Right]>:
- if !<server.flag[CastleWars.Gamemode.<[Variable]>VoteN].contains[<player>]||false>:
- flag server CastleWars.Gamemode.<[Variable]>VoteN:->:<player>
- if <server.flag[CastleWars.Gamemode.<[Variable]>VoteY].contains[<player>]||false>:
- flag server CastleWars.Gamemode.<[Variable]>VoteY:<-:<player>
- define VoteYes <server.flag[CastleWars.Gamemode.<[Variable]>VoteY].size>
- define VoteNo <server.flag[CastleWars.Gamemode.<[Variable]>VoteN].size>
- define NewContent3 "<context.location.sign_contents.get[3].before[:]>:<&sp><&sp><[VoteYes]>"
- define NewContent4 "<context.location.sign_contents.get[4].before[:]>:<&sp><&sp><[VoteNo]>"
- adjust <context.location> "sign_contents:<[Contents].remove[3|4].include[<[NewContent3]>|<[NewContent4]>]>"
FlagEffect:
type: task
debug: false
definitions: Player
Blue:
- while <Player.has_flag[FlagHolder]>:
- playeffect at:<Player.location.add[0,3,0]> quantity:1 offset:0.01,0.01,0.01 visibility:500 effect:REDSTONE special_data:2|0,0,255 data:0
- wait 1t
- if <[loop_index].mod[5]> == 1:
- playeffect at:<Player.location.add[0,20,0]> quantity:1 offset:0.01,0.01,0.01 visibility:500 effect:REDSTONE special_data:5|0,0,255 data:0
Red:
- while <Player.has_flag[FlagHolder]>:
- playeffect at:<Player.location.add[0,3,0]> quantity:1 offset:0.01,0.01,0.01 visibility:500 effect:REDSTONE special_data:2|255,5,0 data:0
- wait 1t
- if <[loop_index].mod[5]> == 1:
- playeffect at:<Player.location.add[0,20,0]> quantity:1 offset:0.01,0.01,0.01 visibility:500 effect:REDSTONE special_data:5|255,5,0 data:0
FlagReturn:
type: task
debug: false
definitions: TeamScored|Team|RedScore|BlueScore|FlagHolder
script:
- define Players <server.list_online_players.filter[flag[Event].is[EQUALS].to[CastleWars]]>
- if <[TeamScored]> == true:
- if <[Team]> == red:
- equip <[FlagHolder]> head:RedEventHat
- title "subtitle:<&4>R<&c>ed <&4>T<&c>eam <&4>S<&c>cored<&4>!" fade_in:1s stay:1t fade_out:1s targets:<[Players]>
- wait 22t
- title "title:<&6>S<&e>core<&6>:" "subtitle:<&3>[<&b><[BlueScore]><&6><&3>] - <&4>[<&c><[RedSCore]><&4>]" fade_in:1s stay:1s fade_out:1s targets:<[Players]>
- else if <[Team]> == blue:
- equip <[FlagHolder]> head:BlueEventHat
- title "subtitle:<&3>B<&b>lue <&3>T<&b>eam <&3>S<&b>cored!" fade_in:1s stay:1t fade_out:1s targets:<[Players]>
- wait 22t
- title "title:<&6>S<&e>core<&6>:" "subtitle:<&3>[<&b><[BlueScore]><&6><&3>] - <&4>[<&c><[RedSCore]><&4>]" fade_in:1s stay:1s fade_out:1s targets:<[Players]>
- sidebar "title:<&6>S<&e>core<&6>:" scores:<[RedSCore]>|<[BlueScore]> "values:<&4>R<&c>ed <&4>T<&c>eam|<&3>B<&b>lue <&3>T<&b>eam" players:<[Players]>
- else if <[TeamScored]> == false:
- if <[Team]> == red:
- title "subtitle:<&3>B<&b>lue <&3>T<&b>eam <&3>F<&b>lag <&3>R<&b>eturned<&3>!" fade_in:1s stay:1t fade_out:1s targets:<[Players]>
- modifyblock <location[808,169,59,hub]> blue_banner
- adjust <location[808,169,59,hub]> block_facing:<location[-0.7,0,-0.7]>
- else if <[Team]> == blue:
- title "subtitle:<&4>R<&c>ed <&4>T<&c>eam <&4>F<&c>lag <&4>R<&c>eturned<&4>!" fade_in:1s stay:1t fade_out:1s targets:<[Players]>
- modifyblock <location[691,169,-58,hub]> red_banner
- adjust <location[691,169,-58,hub]> block_facing:<location[0.7,0,0.7]>
Event_Command:
type: command
debug: false
name: event
description: Event Management
usage: <&6>/<&e>Event <&6><<><&e><script.yaml_key[Args].separated_by[<&6>/<&e>]><&e><&6><>> <&6>(<&e>Forced<&6>)
aliases:
- cw
tab complete:
- define list <script.yaml_key[Args]>
- if !<player.groups.contains_any[Owner|Co-Owner|Plugmaster|Admin|Mod]||true>:
- define List <[List].exclude[Start|Stop]>
- if <context.args.size||0> == 0:
- determine <[list]>
- else if <context.args.size> == 1 && !<context.raw_args.ends_with[<&sp>]>:
- determine <[List].filter[starts_with[<context.args.get[1]>]]>
- else if <context.args.size> < 2:
- if <context.raw_args.ends_with[<&sp>]> && <script.yaml_key[SubArgs].contains[<context.args.get[1]>]>:
- determine <list[<script.yaml_key[SubArgs.<context.args.get[1]>]||>].filter[starts_with[<context.args.get[2]||>]]>
- else if <context.args.size> == 2 && !<context.raw_args.ends_with[<&sp>]>:
- determine <list[<script.yaml_key[SubArgs.<context.args.get[1]>]||>].filter[starts_with[<context.args.get[2]||>]]>
Args:
- Start
- Join
- Leave
- Stop
SubArgs:
Start:
- CastleWars
join:
- CastleWars
Syntax:
- define Command "<script.yaml_key[name]>"
- define Hover "<&2>C<&a>lick to <&2>I<&a>nsert<&nl><&6>Syntax<&co> <script.yaml_key[usage].parsed>"
- define Message "<&6>Syntax<&co> <script.yaml_key[Usage].parsed>"
- narrate <proc[MsgHint].context[<[Message]>|<[Command]>|<[Hover]>]>
- stop
script:
- if <context.args.get[1]||null> == null:
- inject locally Syntax Instantly
- choose <context.args.get[1]>:
- case default:
- inject locally Syntax Instantly
- case "start":
- if <context.args.get[2]||null> == null:
- inject locally Syntax Instantly
- choose <context.args.get[2]>:
- case default:
- narrate format:EventFormat"<&c>This event does not exist or is not implemented currently."
- case "CastleWars":
- if !<context.args.get[3]||null> == null:
- inject locally Syntax Instantly
- if <server.flag[Event]||>
- narrate format:EventFormat "<&c>There's already an event in progress!"
- stop
- if <context.args.get[3]> == Forced:
- foreach <server.list_online_players>:
- flag server CastleWars.Queue:->:<[value]>
- flag server EventQueue:CastleWars
- flag server EventQueueQ:<queue>
- run CastleWarsEvent Instantly
- case "Stop":
- if !<server.has_flag[EventQueueQ]>:
- narrate format:EventFormat "<&c>There is no event in process."
- else:
- queue <server.flag[EventQueueQ]> clear
- narrate format:EventFormat "<&6>Event name<&6>:<&e><server.flag[EventQueue]><&c> Stopped."
# | ██ [ Adjust Server ] ██
- flag server event:!
- flag server CastleWars.Scores.Red:!
- flag server CastleWars.Scores.Blue:!
- flag server EventQueue:!
# | ██ [ Adjust Players ] ██
- define Players <server.list_players.flagged[event]>
- foreach <[Players]>:
- equip <[value]> head:air
- sidebar remove
- teleport <[value]> <cuboid[castlewarswaitingroomspawn].blocks.random>
- wait 1t
- teleport <[value]> <cuboid[castlewarswaitingroomspawn].blocks.random>
- adjust <[value]> gamemode:<[value].flag[PreviousEventGamemode]>
- flag <[value]> event:!
- flag <[value]> FlagHolder:!
- flag <[value]> CastleWars.Team:!
- flag <[value]> PreviousEventGamemode:!
- flag server EventQueue:!
- flag server EventQueueQ:!
- case "Join":
- choose <context.args.get[2]>:
- case default:
- narrate format:EventFormat"<&c>This event does not exist or is not implemented currently."
- case "CastleWars":
- if !<context.args.get[3]||null> == null:
- inject locally Syntax Instantly
- if !<server.flag[EventQueue]> == CastleWars:
- narrate format:EventFormat "<&c> There is no Castle Wars game in queue!"
- if <server.flag[CastleWars.Queue].contains[<player>]||false>:
- narrate format:CWFormat "<&c>You're already in queue."
- stop
- if <player.equipment.helmet.material.name> != air:
- narrate format:CWFormat "<&c>You must remove your helmet to enter."
- stop
- narrate format:CWFormat "<player.name.display><&r> <&e>just joined the game<&6>!"
- flag <player> PreviousEventLocation:<player.location>
- teleport <player> <cuboid[CastleWarsWaitingRoomSpawn].blocks.random>
- flag server CastleWars.Queue:->:<player>
- case "Leave":
- if <context.args.get[2]||null>:
- narrate format:EventFormat"<&c>Please type the event name as well as <&6>/<&e>event leave"
- choose <context.args.get[2]||null>:
- case default:
- inject locally Syntax Instantly
- case "CastleWars":
- if !<context.args.get[3]||null> == null:
- inject locally Syntax Instantly
- if !<server.flag[CastleWars.Queue].contains[<player>]||true>:
- narrate format:CWFormat "<&c>not in any queue."
- stop
- teleport <player> <player.flag[PreviousEventLocation]>
- flag <player> PreviousEventLocation:!
- flag server CastleWars.Queue:<-:<[value]>
- narrate format:EventFormat "<&a>You've been returned to your previous location."
CastleWarsCommands:
type: command
debug: false
name: CastleWars
description: Castle Wars related commands
usage: <&6>/<&e>CW <&6><<><&e><script.yaml_key[Args].separated_by[<&6>/<&e>]><&e><&6><>>
aliases:
- cw
tab complete:
- define list <script.yaml_key[Args]>
- if <context.args.size||0> == 0:
- determine <[list]>
- else if <context.args.size> == 1 && !<context.raw_args.ends_with[<&sp>]>:
- determine <[List].filter[starts_with[<context.args.get[1]>]]>
- else if <context.args.size> < 2:
- if <context.raw_args.ends_with[<&sp>]> && <script.yaml_key[SubArgs].contains[<context.args.get[1]>]>:
- determine <list[<script.yaml_key[SubArgs.<context.args.get[1]>]||>].filter[starts_with[<context.args.get[2]||>]]||>
- else if <context.args.size> == 2 && !<context.raw_args.ends_with[<&sp>]>:
- determine <list[<script.yaml_key[SubArgs.<context.args.get[1]>]||>].filter[starts_with[<context.args.get[2]||>]]||>
Args:
- JoinTeam
- SwitchTeam
- LeaveTeam
SubArgs:
JoinTeam:
- Red
- Blue
Syntax:
- define Command "<script.yaml_key[Name]>"
- define Hover "<&2>C<&a>lick to <&2>I<&a>nsert<&nl><&6>Syntax<&co> <script.yaml_key[Usage].parsed>"
- define Message "<&6>Syntax<&co> <script.yaml_key[Usage].parsed>"
- narrate <proc[MsgHint].context[<[Message]>|<[Command]>|<[Hover]>]>
- stop
script:
- if <context.args.get[1]||null> == null:
- inject locally Syntax Instantly
- choose <context.args.get[1]>:
- case "JoinTeam":
- if <context.args.get[2]||null> == null:
- inject locally Syntax Instantly
- if <player.has_flag[CastleWars.Team]>:
- narrate format:CWFormat "<&c>You're on the <&6><player.flag[CastleWars.team]><&c> team! Switching teams instead."
- execute as_op "CastleWars SwitchTeam"
- else:
- if !<context.args.get[2].contains_any[Blue|Red]> && <context.args.get[3]||null> == null:
- narrate format:CWFormat "<&c>Invalid Team<&2>:<&e> <context.raw_args>"
- else if <context.args.get[2]> == Red || <context.args.get[2]> == Blue:
- narrate format:CWFormat "<&a>Joined team<&2>:<&e> <context.args.get[2]>"
- flag <player> CastleWars.Team:<context.args.get[2]>
- if <player.flag[CastleWars.team]> == red:
- equip <player> head:RedEventHat
- else if <player.flag[CastleWars.team]> == blue:
- equip <player> Head:BlueEventHat
- case "SwitchTeam":
- if !<context.args.get[2]||null> == null:
- inject locally Syntax Instantly
- if !<player.has_flag[CastleWars.Team]>:
- narrate format:CWFormat "<&c>You are not on a team!"
- else if <player.flag[CastleWars.Team]> == red:
- flag <player> CastleWars.Team:Blue
- narrate format:CWFormat "<&a>New Team<&2>:<&e> Blue"
- equip <player> head:BlueEventHat
- else if <player.flag[CastleWars.Team]> == blue:
- flag <player> CastleWars.Team:Red
- equip <player> head:RedEventHat
- narrate format:CWFormat "<&a>New Team<&2>:<&e> Red"
- else:
- narrate format:CWFormat "<&c>Internal Error<&2> <&e>Team Name<&6> <&e><player.flag[CastleWars.Team]> <&c> is invalid"
- case "LeaveTeam":
- if !<context.args.get[2]||null> == null:
- inject locally Syntax Instantly
- if !<player.has_flag[CastleWars.Team]>:
- narrate format:CWFormat "<&c>You are not on a team!"
- else:
- narrate format:CWFormat "<&a>Left team<&2>: <&e><player.flag[CastleWars.Team]>"
- equip <player> head:air
- flag player CastleWars.Team:!
- case default:
- narrate format:CWFormat "<&c>Invalid Arg(s)<&2>: <&e><context.raw_args>"
CWFormat:
type: format
debug: false
format: "<&4>[<&c>CastleWars<&4>]<&r> <text>"
EventFormat:
type: format
debug: false
format: "<&6>[<&e>Event<&6>]<&r> <text>"
BlueEventBanner:
type: item
debug: false
material: blue_banner
display name: <&3>B<&b>lue <&3>T<&b>eam <&3>B<&b>anner
lore:
- "<&c>You have the other team's banner!"
- "<&c>Return to base for a point!"
enchantments:
- BINDING_CURSE:1
mechanisms:
flags: HIDE_ALL
RedEventBanner:
type: item
debug: false
material: red_banner
display name: <&4>R<&c>ed <&4>T<&c>eam <&4>B<&c>anner
lore:
- "<&c>You have the other team's banner!"
- "<&c>Return to base for a point!"
enchantments:
- BINDING_CURSE:1
mechanisms:
flags: HIDE_ALL
BlueEventHat:
type: item
debug: false
material: leather_helmet
display name: <&3>B<&b>lue <&3>T<&b>eam <&3>H<&b>elmet
lore:
- "<&b>This is your hat."
enchantments:
- BINDING_CURSE:1
mechanisms:
color: <color[60,68,170]>
flags: HIDE_ALL
RedEventHat:
type: item
debug: false
material: leather_helmet
display name: <&4>R<&c>ed <&4>T<&c>eam <&4>H<&c>elmet
lore:
- "<&c>This is your hat."
enchantments:
- BINDING_CURSE:1
mechanisms:
color: <color[176,46,38]>
flags: HIDE_ALL
unbreakable: true
testrun:
type: task
script:
- foreach <cuboid[CastleWarsBarrier].blocks>:
#players:<server.list_players_flagged[event]>
- ~showfake barrier <[value]> duration:16s