Paste #54089: Untitled Paste

Date: 2019/04/27 12:19:53 UTC-07:00
Type: Denizen Script

View Raw Paste Download This Paste
Copy Link


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


CTF_Template:
  type: world
  events:

    on server start:
      - run "s@CTF_01_SIDEBAR_Loop" instantly


    on player joins:
      #most of this will probably go away
      #remove sidebar on re-join
      - flag <player> CTF_01_SIDEBAR:!
      - sidebar remove players:<player>
      #in the event a player is still red or blue, run removal operations
      - if <player.has_flag[RedPlayer_01]> || <player.has_flag[BluePlayer_01]> {
        - execute as_op RemovePlayersTeams_01
        #run the carrying flag fix commands again REMOVE
        - if <player.has_flag[CarryingRedFlag_01]> {
          - modifyblock cu@RedFlagStaff_01 Red_Wool
          - flag global RedFlagStolen_01:!
          - flag <player> CarryingRedFlag_01:!
        }
        - if <player.has_flag[CarryingBlueFlag_01]> {
          - modifyblock cu@BlueFlagStaff_01 Blue_Wool
          - flag global BlueFlagStolen_01:!
          - flag <player> CarryingBlueFlag_01:!
        }

        #restore player to normal on re-join after game quit
        - equip head:i@air chest:i@air legs:i@air feet:i@air
        - execute as_op "speed 1" silent
        - teleport <player> l@hub
      }

    #Player quitting mid-game
    on player quits:
      - if <player.has_flag[RedPlayer_01]> || <player.has_flag[BluePlayer_01]> {

        # remove team color flags from player
        - execute as_op RemovePlayersTeams_01

        #reduce total game count by 1
        - flag global TotalPlayerCount_01:--

        #move the player to hub, restore speed and remove armor
        - teleport <player> l@hub
        - execute as_op "speed 1" silent
        - equip head:i@air chest:i@air legs:i@air feet:i@air

        # if player was holding a flag, remove and restore to active game
        - if <player.has_flag[CarryingRedFlag_01]> {
          - modifyblock cu@RedFlagStaff_01 Red_Wool
          - flag global RedFlagStolen_01:!
          - flag <player> CarryingRedFlag_01:!
        }
        - if <player.has_flag[CarryingBlueFlag_01]> {
          - modifyblock cu@BlueFlagStaff_01 Blue_Wool
          - flag global BlueFlagStolen_01:!
          - flag <player> CarryingBlueFlag_01:!
        }

        #after all above operations, check to see if game still has enough players
        - if <global.flag[TotalPlayerCount_01]> <= 1 {
          - execute as_server "EndGame_01"
          - announce "The game has ended early due to lack of players..."
        }
      }

    # Player event overrides
    on player drops item:
      - if <player.has_flag[RedPlayer_01]> || <player.has_flag[BluePlayer_01]> {
        - determine cancelled
      }


    on player drags item in inventory:
      - if <player.has_flag[RedPlayer_01]> || <player.has_flag[BluePlayer_01]> {
        - determine cancelled
      }


    on item moves from inventory:
      - if <player.has_flag[RedPlayer_01]> || <player.has_flag[BluePlayer_01]> {
        - determine cancelled
      }


    on player clicks in inventory:
      - if <player.has_flag[RedPlayer_01]> || <player.has_flag[BluePlayer_01]> {
        - determine cancelled
      }


    on player killed priority:-99:
      #If killed player is RED
      - if <player.has_flag[RedPlayer_01]> {
        - determine passively cancelled
        - execute as_op RedPlayerKilledMSG_01
        - if <player.has_flag[CarryingBlueFlag_01]> {
          - equip head:i@leather_helmet[color=RED]
          - flag <player> CarryingBlueFlag_01:!
          - flag global BlueFlagStolen_01:!
          - modifyblock cu@BlueFlagStaff_01 Blue_Wool
          - execute as_op BlueTeamFlagResetMSG_01
          - execute as_op "speed 1" silent
        }
        - inventory clear
        - teleport <player> l@RespawnWait_01
        - equip head:i@leather_helmet[color=RED] chest:i@leather_chestplate[color=RED] legs:i@leather_leggings[color=RED] feet:i@leather_boots[color=RED]
        - heal <player>
        - feed <player>
        - title 'title:<&c><&l><&o>You Died!' 'subtitle:' fade_in:1s stay:1s fade_out:2s targets:<player>
        - wait 3
        - title 'title:<&f><&l>Respawning' 'subtitle:<&f><&o>Please wait...' fade_in:1s stay:3s fade_out:.6s targets:<player>
        - wait 4
        - random {
          - teleport <player> l@RedSpawn_01
          - teleport <player> l@RedSpawn_02
          - teleport <player> l@RedSpawn_03
          - teleport <player> l@RedSpawn_04
        }
        - give <player> bow quantity:1
        - give <player> arrow quantity:60
        - title 'title:<&c><&l><&o>FIGHT!' 'subtitle:' fade_in:1s stay:1s fade_out:0.5s targets:<player>
      }



      #If killed player is BLUE
      - if <player.has_flag[BluePlayer_01]> {
        - determine passively cancelled
        - execute as_op BluePlayerKilledMSG_01
        - if <player.has_flag[CarryingRedFlag_01]> {
          - equip head:i@leather_helmet[color=BLUE]
          - flag <player> CarryingRedFlag_01:!
          - flag global RedFlagStolen_01:!
          - modifyblock cu@RedFlagStaff_01 Red_Wool
          - execute as_op RedTeamFlagResetMSG_01
          - execute as_op "speed 1" silent
        }
        - inventory clear
        - teleport <player> l@RespawnWait_01
        - equip head:i@leather_helmet[color=BLUE] chest:i@leather_chestplate[color=BLUE] legs:i@leather_leggings[color=BLUE] feet:i@leather_boots[color=BLUE]
        - heal <player>
        - feed <player>
        - title 'title:<&c><&l><&o>You Died!' 'subtitle:' fade_in:1s stay:1s fade_out:2s targets:<player>
        - wait 3
        - title 'title:<&f><&l>Respawning' 'subtitle:<&f><&o>Please wait...' fade_in:1s stay:3s fade_out:.6s targets:<player>
        - wait 4
        - random {
          - teleport <player> l@BlueSpawn_01
          - teleport <player> l@BlueSpawn_02
          - teleport <player> l@BlueSpawn_03
          - teleport <player> l@BlueSpawn_04
        }
        - give <player> bow quantity:1
        - give <player> arrow quantity:60
        - title 'title:<&c><&l><&o>FIGHT!' 'subtitle:' fade_in:1s stay:1s fade_out:0.5s targets:<player>
      }

    # Cuboid regions in game
    on player enters GameArena_01:
      - narrate "You have entered the battle arena."


    on player enters RedFlag_01:
      - if <player.has_flag[CarryingBlueFlag_01]> && !<global.has_flag[RedFlagStolen_01]> {
        - playeffect <player.location> effect:Happy_Villager quantity:255 offset:1.8,1.8,1.8
        - equip head:i@leather_helmet[color=RED]
        - execute as_op "speed 1" silent
        - execute as_op RedTeamScoresMSG_01
        - flag global RedScore_01:++
        - flag server RedTeamPoints:++
        - execute as_op FireworksRed_01
        - execute as_op "hd setline bluescore_01 1 &l<server.flag[RedTeamPoints]>" silent

        - foreach <server.get_online_players_flagged[RedPlayer_01]> {
          - title 'title:<&c><&l>RED TEAM <&f><&l>SCORES' 'subtitle:<&c><&l><global.flag[RedScore_01]> <&9><&l><global.flag[BlueScore_01]>' fade_in:1s stay:1s fade_out:1s targets:<player>
        }
        - foreach <server.get_online_players_flagged[BluePlayer_01]> {
          - title 'title:<&c><&l>RED TEAM <&f><&l>SCORES' 'subtitle:<&c><&l><global.flag[RedScore_01]> <&9><&l><global.flag[BlueScore_01]>' fade_in:1s stay:1s fade_out:1s targets:<player>
        }

        - modifyblock cu@BlueFlagStaff_01 Blue_Wool
        - flag <player> CarryingBlueFlag_01:!
        - flag global BlueFlagStolen_01:!

        - if <global.flag[RedScore_01]> = 3 {
          - flag global BlueScore_01:0
          - execute as_op "EndGame_01"
          - wait 6
          - execute as_op PlayerScoredWinningPointMSG_01
        }
        - queue clear
      }
      - if <player.has_flag[CarryingBlueFlag_01]> && <global.has_flag[RedFlagStolen_01]> {
        - execute as_op CannotScoreFlagAwayMSG_01
        - queue clear
      }
      - if <player.has_flag[RedPlayer_01]> {
        - execute as_op YourFlagMSG_01
      }
      - if <player.has_flag[BluePlayer_01]> && !<global.has_flag[RedFlagStolen_01]> {
        - modifyblock cu@RedFlagStaff_01 air
        - equip head:i@red_banner
        - execute as_op "speed 0.66" silent
        - firework <player.location> power:1 star primary:blue fade:white flicker trail
        - wait 0.33
        - firework <player.location> power:1 star primary:blue fade:white flicker trail
        - wait 0.33
        - firework <player.location> power:1 star primary:blue fade:white flicker trail
        - execute as_op RedFlagStolenMSG_01

        - foreach <server.get_online_players_flagged[RedPlayer_01]> {
          - title 'title:<&c><&l>RED FLAG <&f><&l>STOLEN' 'subtitle:' fade_in:1s stay:1s fade_out:1s targets:<player>
        }

        - foreach <server.get_online_players_flagged[BluePlayer_01]> {
          - title 'title:<&c><&l>RED FLAG <&f><&l>STOLEN' 'subtitle:' fade_in:1s stay:1s fade_out:1s targets:<player>
        }

        - flag <player> CarryingRedFlag_01
        - flag global RedFlagStolen_01
        - queue clear
      }
      - if <player.has_flag[BluePlayer_01]> && <global.has_flag[RedFlagStolen_01]> {
        - execute as_op EnemyFlagAlreadyStolenMSG_01
        - queue clear
      }
      - if <player.has_flag[RedPlayer_01]> && <global.has_flag[RedFlagStolen_01]> {
        - execute as_op YourFlagMissingMSG_01
        - queue clear
      }


    on player enters BlueFlag_01:
      - if <player.has_flag[CarryingRedFlag_01]> && !<global.has_flag[BlueFlagStolen_01]> {
        - playeffect <player.location> effect:Happy_Villager quantity:255 offset:1.8,1.8,1.8
        - equip head:i@leather_helmet[color=BLUE]
        - execute as_op "speed 1" silent
        - execute as_op BlueTeamScoresMSG_01
        - flag global BlueScore_01:++
        - flag server BlueTeamPoints:++
        - execute as_op FireworksBlue_01
        - execute as_op "hd setline redscore_01 1 &l<server.flag[BlueTeamPoints]>" silent
        - foreach <server.get_online_players_flagged[RedPlayer_01]> {
          - title 'title:<&9><&l>BLUE TEAM <&f><&l>SCORES' 'subtitle:<&c><&l><global.flag[RedScore_01]> <&9><&l><global.flag[BlueScore_01]>' fade_in:1s stay:1s fade_out:1s targets:<player>
        }
        - foreach <server.get_online_players_flagged[BluePlayer_01]> {
          - title 'title:<&9><&l>BLUE TEAM <&f><&l>SCORES' 'subtitle:<&c><&l><global.flag[RedScore_01]> <&9><&l><global.flag[BlueScore_01]>' fade_in:1s stay:1s fade_out:1s targets:<player>
        }
        - modifyblock cu@RedFlagStaff_01 Red_Wool
        - flag <player> CarryingRedFlag_01:!
        - flag global RedFlagStolen_01:!

        - if <global.flag[BlueScore_01]> = 3 {
          - flag global RedScore_01:0
          - execute as_op "EndGame_01"
          - wait 6
          - execute as_op PlayerScoredWinningPointMSG_01
        }
        - queue clear
      }
      - if <player.has_flag[CarryingRedFlag_01]> && <global.has_flag[BlueFlagStolen_01]> {
        - execute as_op CannotScoreFlagAwayMSG_01
        - queue clear
      }
      - if <player.has_flag[BluePlayer_01]> {
        - execute as_op YourFlagMSG_01
      }
      - if <player.has_flag[RedPlayer_01]> && !<global.has_flag[BlueFlagStolen_01]> {
        - modifyblock cu@BlueFlagStaff_01 air
        - equip head:i@blue_banner
        - execute as_op "speed 0.66" silent
        - execute as_op BlueFlagStolenMSG_01
        - foreach <server.get_online_players_flagged[RedPlayer_01]> {
          - title 'title:<&9><&l>BLUE FLAG <&f><&l>STOLEN' 'subtitle:' fade_in:1s stay:1s fade_out:1s targets:<player>
        }
        - foreach <server.get_online_players_flagged[BluePlayer_01]> {
          - title 'title:<&9><&l>BLUE FLAG <&f><&l>STOLEN' 'subtitle:' fade_in:1s stay:1s fade_out:1s targets:<player>
        }
        - flag <player> CarryingBlueFlag_01
        - flag global BlueFlagStolen_01
        - queue clear
      }
      - if <player.has_flag[RedPlayer_01]> && <global.has_flag[BlueFlagStolen_01]> {
        - execute as_op EnemyFlagAlreadyStolenMSG_01
        - queue clear
      }
      - if <player.has_flag[BluePlayer_01]> && <global.has_flag[BlueFlagStolen_01]> {
        - execute as_op YourFlagMissingMSG_01
        - queue clear
      }

    # Joining / Quitting / Disconnecting
    on player clicks birch_button in button11:
      - execute as_op "PlayerStartJoinRun_01" silent

    # Game control custom command system
    on PlayerStartJoinRun_01 command:
      - determine passively fulfilled
      - if <global.flag[TotalPlayerCount_01]> >= 2 {
        - narrate "<&e><&l>This game is still in progress..."
        - queue clear
      }
      - if !<global.has_flag[GamePrimed1_01]> {
        - flag global TotalPlayerCount_01:1
        - execute as_op "hd setline join1 1 <global.flag[TotalPlayerCount_01]> Players In The Game" silent
        - flag global GamePrimed1_01 duration:35
        - run WaitTimerTask_01
        - flag <player> Joined_01 duration:40
        - execute as_server "GameTimerStart_01"
        - announce ""
        - announce "<&e><player.name> is hosting a match."
        - announce "<&c><&l>Capture <&f><&l>The <&9><&l>Flag"
        - announce ""
        - wait 25
        - run GameTimerTask_01
        - queue clear
      }
      - if <player.has_flag[Joined_01]> {
        - narrate "You are already joined."
        - queue clear
      }
      - announce "<player.name> joined"
      - flag <player> Joined_01 duration:35
      - flag global TotalPlayerCount_01:++
      - execute as_op "hd setline join1 1 <global.flag[TotalPlayerCount_01]> Players In The Game" silent
      - queue clear


    on GameTimerStart_01 command:
      - determine passively fulfilled
      - wait 35
      - execute as_server "PlayerGrabber_01"


    on PlayerGrabber_01 command:
      - determine passively fulfilled
      - if <global.flag[TotalPlayerCount_01]> == 1 {

        - execute as_op NotEnoughPlayersMSG_01
        - flag global TotalPlayerCount_01:0
        - execute as_op "hd setline join1 1 <global.flag[TotalPlayerCount_01]> Players In The Game" silent
        - queue clear
      }
      - foreach <server.get_online_players_flagged[Joined_01]> {
        - execute as_op "BeginGame_01" player:<def[value]>
        - flag <player> Joined_01:!
      }


    on RemovePlayersTeams_01 command:
      - determine passively fulfilled
      - flag <player> RedPlayer_01:!
      - flag <player> BluePlayer_01:!


    on EndGame_01 command:
      - determine passively fulfilled
      - execute as_op "speed 1" silent
      - flag global TotalPlayerCount_01:0
      - execute as_server "hd setline join1 1 Press to start a game" silent

      - if <global.flag[RedScore_01]> > 0 {
        - flag global RedScore_01:0
        - execute as_op RedTeamWinMSG_01
      }
      - if <global.flag[BlueScore_01]> > 0 {
        - flag global BlueScore_01:0
        - execute as_op BlueTeamWinMSG_01
      }
      - foreach <server.get_online_players_flagged[PlayingGame_01]> {
        - execute as_op "hub" player:<def[value]>
        - flag <player> CTF_01_SIDEBAR:!
        - sidebar remove players:<player>
        - execute as_op RemovePlayersTeams_01
        - flag <player> CarryingRedFlag_01:!
        - flag <player> CarryingBlueFlag_01:!
        - flag <player> PlayingGame_01:!
      }
      - wait 1
      - execute as_op reset_ctf_01


    on BeginGame_01 command:
      - determine passively fulfilled
      - teleport <player> l@RespawnWait_01
      - flag <player> Easy_Sidebar:!
      - flag <player> CTF_01_SIDEBAR
      - sidebar remove players:<player>
      - flag global TotalPlayerCount_01:++
      - wait 3
      - title 'title:<&c><&l><&o>Capture <&f><&l><&o>The <&9><&l><&o>Flag!' 'subtitle:Team Objective Minigame' fade_in:1s stay:1s fade_out:4s targets:<player>
      - wait 3
      - random {
        - wait 0.1
        - wait 0.2
        - wait 0.3
        - wait 0.4
        - wait 0.5
        - wait 0.6
        - wait 0.7
        - wait 0.8
        - wait 0.9
        - wait 1
      }
      - if !<global.has_flag[RedReady_01]> && !<global.has_flag[BlueReady_01]> {
        - flag global RedReady_01
      }
      - if !<global.has_flag[TimerSlower_01]> {
        - flag global TimerSlower_01 duration:30
        - execute as_op "hd setline join1 1 <global.flag[TotalPlayerCount_01]> Players In The Game" silent
      }

      - if <global.has_flag[RedReady_01]> {
        - flag global RedReady_01:!
        - flag global BlueReady_01
        - flag <player> PlayingGame_01
        - execute as_op "RedPlayerAssign_01"
        - queue clear
      }

      - if <global.has_flag[BlueReady_01]> {
        - flag global RedReady_01
        - flag global BlueReady_01:!
        - flag <player> PlayingGame_01
        - execute as_op "BluePlayerAssign_01"
        - queue clear
      }


    on RedPlayerAssign_01 command:
      - determine passively fulfilled
      - flag <player> RedPlayer_01
      - flag <player> BluePlayer_01:!
      - equip head:i@leather_helmet[color=RED] chest:i@leather_chestplate[color=RED] legs:i@leather_leggings[color=RED] feet:i@leather_boots[color=RED]
      - heal <player>
      - feed <player>
      - title 'title:<&c><&l>RED TEAM' 'subtitle:<&f><&o>Please wait...' fade_in:1s stay:3s fade_out:.6s targets:<player>
      - wait 5
      - random {
        - teleport <player> l@RedSpawn_01
        - teleport <player> l@RedSpawn_02
        - teleport <player> l@RedSpawn_03
        - teleport <player> l@RedSpawn_04
      }
      - give <player> bow quantity:1
      - give <player> arrow quantity:60


    on BluePlayerAssign_01 command:
      - determine passively fulfilled
      - flag <player> RedPlayer_01:!
      - flag <player> BluePlayer_01
      - equip head:i@leather_helmet[color=BLUE] chest:i@leather_chestplate[color=BLUE] legs:i@leather_leggings[color=BLUE] feet:i@leather_boots[color=BLUE]
      - heal <player>
      - feed <player>
      - title 'title:<&9><&l>BLUE TEAM' 'subtitle:<&f><&o>Please wait...' fade_in:1s stay:3s fade_out:.6s targets:<player>
      - wait 5
      - random {
        - teleport <player> l@BlueSpawn_01
        - teleport <player> l@BlueSpawn_02
        - teleport <player> l@BlueSpawn_03
        - teleport <player> l@BlueSpawn_04
      }
      - give <player> bow quantity:1
      - give <player> arrow quantity:60


    on reset_ctf_01 command:
      - determine passively fulfilled
      - flag global RedScore_01:0
      - flag global BlueScore_01:0
      - flag global MatchmakingPool_01:!
      - flag global GamePrimed_01:!
      - flag global RedFlagStolen_01:!
      - flag global BlueFlagStolen_01:!
      - modifyblock cu@BlueFlagStaff_01 Blue_Wool
      - modifyblock cu@RedFlagStaff_01 Red_Wool


    on FireworksRed_01 command:
      - determine passively fulfilled
      - repeat 5 {
        - wait 0.3
        - firework l@firework0101 power:1 star primary:red fade:red flicker trail
        - firework l@firework0102 power:1 star primary:red fade:red flicker trail
        - wait 0.1
        - firework l@firework0103 power:1 star primary:red fade:red flicker trail
        - firework l@firework0104 power:1 star primary:red fade:red flicker trail
        - wait 0.1
        - firework l@firework0105 power:1 star primary:red fade:red flicker trail
        - firework l@firework0106 power:1 star primary:red fade:red flicker trail
        - wait 0.1
        - firework l@firework0107 power:1 star primary:red fade:red flicker trail
        - firework l@firework0108 power:1 star primary:red fade:red flicker trail
      }


    on FireworksBlue_01 command:
      - determine passively fulfilled
      - repeat 5 {
        - wait 0.3
        - firework l@firework0101 power:1 star primary:blue fade:blue flicker trail
        - firework l@firework0102 power:1 star primary:blue fade:blue flicker trail
        - wait 0.1
        - firework l@firework0103 power:1 star primary:blue fade:blue flicker trail
        - firework l@firework0104 power:1 star primary:blue fade:blue flicker trail
        - wait 0.1
        - firework l@firework0105 power:1 star primary:blue fade:blue flicker trail
        - firework l@firework0106 power:1 star primary:blue fade:blue flicker trail
        - wait 0.1
        - firework l@firework0107 power:1 star primary:blue fade:blue flicker trail
        - firework l@firework0108 power:1 star primary:blue fade:blue flicker trail
      }













# ================================================================
# ================================================================
                      #TITLE COMMANDS
# ================================================================
# ================================================================

                            #UNIVERSAL
# ================================================================
    on ttt command:
      - determine passively fulfilled

                            #TEAM BASED
# ================================================================
    on tttt command:
      - determine passively fulfilled








# ================================================================
# ================================================================
                      #MESSAGING COMMANDS
# ================================================================
# ================================================================

                          #ANNOUNCEMENTS

                            #UNIVERSAL
# ================================================================
    on NotEnoughPlayersMSG_01 command:
      - determine passively fulfilled
      - announce "<&c>Not enough players to start the game."

    on PlayerScoredWinningPointMSG_01 command:
      - determine passively fulfilled
      - announce "<&7><player.name> scored the winning point."

                            #TEAM BASED
# ================================================================
    on RedPlayerKilledMSG_01 command:
      - determine passively fulfilled
      - announce "<&c><&l><player.name> <&7>has been killed."

    on BluePlayerKilledMSG_01 command:
      - determine passively fulfilled
      - announce "<&9><&l><player.name> <&7>has been killed."

    on RedTeamFlagResetMSG_01 command:
      - determine passively fulfilled
      - announce "<&9><&l>The red team's flag has been reset"

    on BlueTeamFlagResetMSG_01 command:
      - determine passively fulfilled
      - announce "<&9><&l>The blue team's flag has been reset"

    on BlueTeamWinMSG_01 command:
      - determine passively fulfilled
      - announce "<&9><&l>BLUE TEAM <&f>has won CTF Minigame!"

    on RedTeamWinMSG_01 command:
      - determine passively fulfilled
      - announce "<&c><&l><player.name> <&7>has been killed."

    on RedFlagStolenMSG_01 command:
      - determine passively fulfilled
      - announce "<&c><&l>Red flag stolen"

    on BlueFlagStolenMSG_01 command:
      - determine passively fulfilled
      - announce "<&9><&l>Blue flag STOLEN"

    on RedTeamScoresMSG_01 command:
      - determine passively fulfilled
      - announce "<&c><&l>Red Team Scores!!!!!!!!"

    on BlueTeamScoresMSG_01 command:
      - determine passively fulfilled
      - announce "<&9><&l>Blue Team Scores!!!!!!!!"




                            #NARRATIONS

                            #UNIVERSAL
# ================================================================
    on CannotScoreFlagAwayMSG_01 command:
      - determine passively fulfilled
      - narrate "You cannot score while your home flag is away"

    on YourFlagMSG_01 command:
      - determine passively fulfilled
      - narrate "This is your flag"

    on YourFlagMissingMSG_01 command:
      - determine passively fulfilled
      - narrate "Your flag has been stolen by the enemy team."

    on EnemyFlagAlreadyStolenMSG_01 command:
      - determine passively fulfilled
      - narrate "The enemy flag has already been stolen by your team "


                            #TEAM BASED
# ================================================================









#System Tasks and Services
WaitTimerTask_01:
    debug: false
    type: task
    script:
        - announce "Press the game button to join in!"
        - wait 1
        - announce "30 seconds to join the party..."
        - wait 15
        - announce "15 seconds to join the party..."
        - wait 5
        - announce "10 seconds to join the party..."
        - wait 5
        - ^announce "5 seconds to join the party..."
        - ^wait 1
        - ^announce "4 seconds to join the party..."
        - ^wait 1
        - ^announce "3 seconds to join the party..."
        - ^wait 1
        - ^announce "2 seconds to join the party..."
        - ^wait 1
        - ^announce "1 seconds to join the party..."


GameTimerTask_01:
    debug: false
    type: task
    script:
        - announce "Game starting in 10 seconds..."
        - wait 180
        - run GameTimerTask_Part2_01


GameTimerTask_Part2_01:
    debug: false
    type: task
    script:
        - if <global.flag[TotalPlayerCount_01]> <= 1 {
          - queue clear
        }
        - announce "2 Minutes Remaining"
        - wait 60
        - announce "1 Minute Remaining"
        - wait 30
        - run GameTimerTask_Part3_01


GameTimerTask_Part3_01:
    debug: false
    type: task
    script:
        - if <global.flag[TotalPlayerCount_01]> <= 1 {
          - queue clear
        }
        - announce "30 Seconds Remaining"
        - wait 15
        - announce "15 seconds..."
        - wait 10
        - announce "5..."
        - announce "4..."
        - announce "3..."
        - announce "2..."
        - announce "1..."
        - foreach <server.get_online_players_flagged[RedPlayer_01]> {
          - execute as_op "hub" player:<def[value]>
          - flag <player> RedPlayer_01:!
        }
        - foreach <server.get_online_players_flagged[BluePlayer_01]> {
          - execute as_op "hub" player:<def[value]>
          - flag <player> BluePlayer_01:!
        }
        - narrate "The game has ended."
        - execute as_op EndGame_01

# Sidebar control
CTF_01_SIDEBAR_Config:
  type: yaml data
  debug: false
  title: <&c><&l>C<&f><&l>T<&9><&l>F
  lines:
    - "<&c><&l>RED TEAM: <&f><&l> <server.flag[RedScore_01]>"
    - "<&9><&l>BLUE TEAM: <&f><&l> <server.flag[BlueScore_01]>"
  update rate: 5s


CTF_01_SIDEBAR_Loop:
  type: task
  debug: false
  script:
    - if <server.get_online_players_flagged[CTF_01_SIDEBAR].is_empty.not> && <s@CTF_01_SIDEBAR_Config.yaml_key[lines].is_empty.not||false> {
      - sidebar title:<parse:<s@CTF_01_SIDEBAR_Config.yaml_key[title]>> values:<parse:<s@CTF_01_SIDEBAR_Config.yaml_key[lines]>> players:<server.get_online_players_flagged[CTF_01_SIDEBAR]> per_player
    }
    - run <script> instantly "delay:<s@CTF_01_SIDEBAR_config.yaml_key[update rate].as_duration||1s>"


CTF_01_SIDEBAR_Command:
  type: command
  debug: false
  name: CTF_01_sidebar
  usage: /CTF_01_sidebar
  description: Toggles your sidebar!
  aliases:
    - ctf01sb
  script:
    - if <player.has_flag[CTF_01_SIDEBAR]> {
      - flag <player> CTF_01_SIDEBAR:!
      - sidebar remove players:<player>
      - narrate "<&6>Your sidebar has been <&b><&l>disabled<&9>!"
      - queue clear
    }
    - flag <player> CTF_01_SIDEBAR
    - narrate "<&6>Your sidebar has been <&b><&l>enabled<&9>!"