Paste #66755: Untitled Paste

Date: 2020/03/31 16:07:09 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
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
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071


#HAVE A 1 in 100000000 chance of instantly winning a game if they go in their own goal
##CHECK FOR IF ALL THE FLAGS ARE MET FOR SETUP OF BRIDGE, THEN MAKE THE ARENA AVAILABLE FOR PLAYERS TO JOIN?

##MAKE THE PLAYERS LEAVE THE GAME ON SERVER RESTART/SHUTDOWN

##MAKE A WHOLE LIST FLAG FOR ALL THE PLAYER FLAGS IN GAME?

##WIN THE GAME OR CANCEL IT WHEN THEY LEAVE ON THE FIRST POINT?
bridgesetupstart:
  debug: true
  type: command
  name: bridgesetup
  description: breadbridge
  usage: /bridgesetup
  permission: bridge.command.admin
  aliases:
  - brsetup
  script:
  - if <server.flag[BridgeArenas]||null> != null:
    - if !<server.flag[BridgeArenas].contains[<context.raw_args>]>:
      - narrate "<&c>No arena exists by that name. To create an arena, type /brcreate [arena name]"
    - else:
      - inventory open d:<inventory[bridgesetupinv]>
      - flag player bridgearenaselection:<context.raw_args>
  - else:
    - narrate "<&c>No arenas have been created. To create an arena, type /brcreate [arena name]"
brjoin:
##WAS BRSTART
  debug: true
  type: command
  name: bridgejoin
  description: brjoin
  usage: /bridgestart
  permission: bridge.command.join
  aliases:
  - brjoin
  script:
  ##SHOULD I MAKE A FLAG MAP FOR PLAYING STATE, TEAM COLOR, ETC. RATHER THAN DIFFERENT FLAGS?
  - if <player.flag[playingbridge]||null> == null:
    - if <server.flag[BridgeArenas]||null> != null:
      - if !<context.args.is_empty>:
        - if <server.flag[BridgeArenas].contains[<context.raw_args>]>:
          - flag player playingbridge:waiting
          - flag player bridgearena:<context.raw_args.to_titlecase>
        - else:
          - narrate "<&c>No arena exists by that name!"
      - else:
        - flag player playingbridge:waiting
        - flag player bridgearena:<server.flag[BridgeArenas].random[1].separated_by[<empty>].to_titlecase>
          ##SHOULD I ADD THE SIDEBAR, OR JUST FLAG IT FOR THE ON TICK EVENT TO CATCH? FOR NOW, DON'T BECAUSE LESS LINES
      - sidebar set "title:<&6><&l>BREAD<&d><&l>BRIDGE" "values:<&b>|<&f>Players: <&a><player.world.players.filter[has_flag[playingbridge]].size>/2|<&f>Map: <&b><player.flag[bridgearena]||null>||<&f>Waiting for players...|<&f>|<&e>mc.breadpixel.net" players:<player.world.players.filter[has_flag[playingbridge]]>
      - inventory set d:<player.inventory> o:bridgelobbyinv
      - narrate "<player.chat_prefix.parse_color><player.name> <&e>joined the arena (<&b><&a><player.world.players.filter[has_flag[playingbridge]].size><&e>/<&b>2<&e>)!" targets:<[player].world.players.filter[has_flag[playingbridge]]>
      #- sidebar set "title:<&6><&l>BREAD<&d><&l>BRIDGE" "values:<&b>|<&f>Players: <&a><player.world.players.filter[has_flag[playingbridge]].size>/2|<&f>Map: <&b><player.flag[bridgearena]||null>||<&f>Waiting for players...|<&f>|<&e>mc.breadpixel.net"
      - if <player.world.players.filter[has_flag[playingbridge]].filter[flag[playingbridge].is[==].to[waiting]].size> == 1:
        - if <util.random.int[1].to[100]> <= 50:
          - flag player bridgeteamcolor:yellow
          - teleport <player> <server.flag[bridge.arenas.<player.flag[bridgearena]>.respawn1]>
        - else:
          - flag player bridgeteamcolor:pink
          - teleport <player> <server.flag[bridge.arenas.<player.flag[bridgearena]>.respawn2]>
      - else if <player.world.players.filter[has_flag[playingbridge]].filter[flag[playingbridge].is[==].to[waiting]].size> == 2:
        - if <player.world.players.filter[has_flag[bridgeteamcolor]].filter[flag[bridgeteamcolor].is[==].to[yellow]].size> == 1:
          - flag player bridgeteamcolor:pink
          - teleport <player> <server.flag[bridge.arenas.<player.flag[bridgearena]>.respawn2]>
        - else if <player.world.players.filter[has_flag[bridgeteamcolor]].filter[flag[bridgeteamcolor].is[==].to[pink]].size> == 1:
          - flag player bridgeteamcolor:yellow
          - teleport <player> <server.flag[bridge.arenas.<player.flag[bridgearena]>.respawn1]>
        - if !<schematic.list.contains[bridge.arenas.<player.flag[bridgearena]>.cage1]>:
          - schematic load name:bridge.arenas.<player.flag[bridgearena]>.cage1
        - if !<schematic.list.contains[bridge.arenas.<player.flag[bridgearena]>.cage2]>:
          - schematic load name:bridge.arenas.<player.flag[bridgearena]>.cage2
        - if !<schematic.list.contains[bridge.arenas.<player.flag[bridgearena]>.location]>:
          - schematic load name:bridge.arenas.<player.flag[bridgearena]>.location
        - inject bridgestartgame
    - else:
      - narrate "<&c>No arenas have been created!"
  - else:
    - narrate "<&c>You're already in a match!"
brleave:
#################################DOOOOOOOOOOOOOOOOOOOOOO NOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOT                                 USEEEEEEEEEEEEEEEEEEEEEEEEEEEEE          BRLEAVE!!!!!!!!!!!!!!!!!!!!!!!!!
  debug: true
  type: command
  name: bridgeleave
  description: bridgeleave
  usage: /bridgeleave
  permission: bridge.admin.command.leave
  aliases:
  - brleave
  script:
  - if <server.flag[BridgeArenas]||null> != null:
    - if <player.has_flag[playingbridge]>:
      - narrate "<&e>Left BreadBridge game from arena <&a><player.flag[bridgearena]><&e>!"
      - foreach <player.world.players.filter[has_flag[playingbridge]]> as:player:
        - inventory clear d:<[player].inventory>
      - sidebar remove
      #- foreach <player.world.players.filter[has_flag[playingbridge]]> as:player:
        #- remove <[player].flag[healthstand]>
        #- flag <[player]> healthstand:!
      - flag player playingbridge:!
      - if <player.world.players.filter[has_flag[playingbridge]].size> == 1:
        - modifyblock <cuboid[<server.flag[bridge.arenas.<player.flag[bridgearena]>.pit1]>].blocks[end_portal]> air
        - modifyblock <cuboid[<server.flag[bridge.arenas.<player.flag[bridgearena]>.pit2]>].blocks[end_portal]> air
      - if <player.world.players.filter[has_flag[playingbridge]].size> == 0:
        - schematic paste name:bridge.arenas.<player.flag[bridgearena]>.location <server.flag[bridge.arenas.<player.flag[bridgearena]>.bridgecenter]>
        ##REMOVE IT WHILE WAITING
        ##PASTE IT WHEN THE GAME STARTS
        ##REMOVE IT WHEN THE GAME ENDS
        #- modifyblock <cuboid[<server.flag[bridge.arenas.<[player].flag[bridgearena]>.cage1location]>].blocks> air
        #- modifyblock <cuboid[<server.flag[bridge.arenas.<[player].flag[bridgearena]>.cage2location]>].blocks> air
      #- schematic unload name:bridge.arenas.<player.flag[bridgearena]>.cage1
      - flag player bridgescore:!
      - flag player bridgekills:!
      - flag player bridgeteamcolor:!
      - flag player bridgearena:!
      #why is the map sidebar returning null?
      - sidebar set_line scores:6 "values:<&f>Players: <&a><player.world.players.filter[has_flag[playingbridge]].size>/2" players:<player.world.players.filter[has_flag[playingbridge]]>
      #- sidebar set "title:<&6><&l>BREAD<&d><&l>BRIDGE" "values:<&b>|<&f>Players: <&a><player.world.players.filter[has_flag[playingbridge]].size>/2|<&f>Map: <&b><player.flag[bridgearena]||null>||<&f>Waiting for players...|<&f>|<&e>mc.breadpixel.net" players:<player.world.players.filter[has_flag[playingbridge]]>
    - else:
      - narrate "<&c>You're not in a match!"
  - else:
    - narrate "<&c>No arenas have been created!"
#################################DOOOOOOOOOOOOOOOOOOOOOO NOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOT                                 USEEEEEEEEEEEEEEEEEEEEEEEEEEEEE          BRLEAVE!!!!!!!!!!!!!!!!!!!!!!!!!

###MAKE THIS (BRLEAVE) A TASK AND INJECT IT, SO THAT I CAN USE IT FOR ON PLAYER LEAVES NETWORK TOO
bridgecreatearena:
  debug: true
  type: command
  name: bridgecreate
  description: bridgecreate
  usage: /bridgecreate
  permission: bridge.command.admin
  aliases:
  - brcreate
  script:
  - if <server.flag[BridgeArenas]||null> != null:
    - if !<server.flag[BridgeArenas].contains[<context.raw_args>]>:
      - flag server BridgeArenas:->:<context.raw_args>
      - narrate "<&e>Created arena <&a><context.raw_args> <&e>for BreadBridge!"
    - else:
      - narrate "<&c>This is already an existing arena!"
  - else:
    - flag server BridgeArenas:->:<context.raw_args>
    - narrate "<&e>Created arena <&a><context.raw_args> <&e>for BreadBridge!"
bridgeremovearena:
  debug: true
  type: command
  name: bridgeremove
  description: bridgeremove
  usage: /bridgeremove
  permission: bridge.command.admin
  aliases:
  - brremove
  script:
  - if <player.flag[arenaremove].is_expired>:
    - if <server.has_flag[BridgeArenas]>:
      - if <server.flag[BridgeArenas].contains[<context.raw_args>]>:
        - narrate "<&c>Are you sure you want to delete the arena? Retype the command within 10 seconds to confirm"
        - flag player arenaremove:<context.raw_args> duration:10s
      - else:
        - narrate "<&c>There's no arena by this name!"
    - else:
      - narrate "<&c>No arenas have been created!"
  - else:
    - adjust server delete_file:schematics/bridge.arenas.<context.raw_args>.cage1.schem
    - adjust server delete_file:schematics/bridge.arenas.<context.raw_args>.cage2.schem
    - adjust server delete_file:schematics/bridge.arenas.<context.raw_args>.location.schem
    - note remove as:bridge.arenas.<context.raw_args>.location
    - note remove as:bridge.arenas.<context.raw_args>.pit1
    - note remove as:bridge.arenas.<context.raw_args>.pit2
    - flag server bridge.arenas.<[<context.raw_args>]>:!
    - flag server BridgeArenas:<-:<context.raw_args>
    - narrate "<&e>Deleted arena <&a><context.raw_args> <&e>for BreadBridge!"
    - flag player arenaremove:!
bridgelist:
  debug: true
  type: command
  name: bridgelist
  description: bridgelist
  usage: /bridgelist
  permission: bridge.command.admin
  aliases:
  - brlist
  script:
  - narrate "<&e>BreadBridge Arenas: <&a><server.flag[BridgeArenas].separated_by[<&e>, <&a>]||<&c>No Arenas!>"
bridgeregen:
  debug: true
  type: command
  name: bridgeregen
  description: bridgeregeneration
  usage: /bridgeregen
  permission: bridge.command.admin
  aliases:
  - brregen
  script:
  - if <server.has_file[Bridge/<context.raw_args>]>:
    - modifyblock <cuboid[<yaml[<context.raw_args>].read[bridge.location]>]> air

brsetlobby:
  debug: true
  type: command
  name: bridgesetlobby
  description: bridgesetlobby
  usage: /bridgesetlobby
  permission: bridge.command.setlobby
  aliases:
  - brsetlobby
  script:
  - narrate "<&6>Bread<&d>Bridge <&a>Lobby set!"
  - flag server BreadBridgeLobby:<player.location>

bradmin:
  debug: true
  type: command
  name: bridgeadmin
  description: bridgecreate
  usage: /bridgeadmin
  permission: bridge.command.admin
  aliases:
  - bradmin
  script:
  - narrate "<&8>-----------------------------------------------------<&6><&l>Bread<&d><&l>Bridge <&e>Help menu<&nl><&e>Create a new arena with <&a>/brcreate [arena name]<&nl><&e>Setup your arena with <&a>/brsetup [arena name]<&nl><&e>Get a list of all available arenas with <&a>/brlist<&nl><&e>Remove arenas with <&a>/brremove [arena name]<&nl><&e>Set the main lobby to return to with <&a>/brlobby<&nl><&8>-----------------------------------------------------"
bridgesetupinv:
  debug: true
  type: inventory
  inventory: CHEST
  title: BreadBridge Setup
  size: 45
  slots:
    - "[blackpane] [blackpane] [blackpane] [blackpane] [brsetbridge] [blackpane] [blackpane] [blackpane] [blackpane]"
    - "[bryellow] [blackpane] [brsetpit1] [blackpane] [brsetcage1] [blackpane] [brrespawnlocation1] [blackpane] [brspawnlocation1]"
    - "[blackpane] [blackpane] [blackpane] [blackpane] [blackpane] [blackpane] [blackpane] [blackpane] [blackpane]"
    - "[brpink] [blackpane] [brsetpit2] [blackpane] [brsetcage2] [blackpane] [brrespawnlocation2] [blackpane] [brspawnlocation2]"
    - "[blackpane] [blackpane] [blackpane] [blackpane] [blackpane] [blackpane] [blackpane] [blackpane] [brclose]"
bryellow:
  type: item
  debug: true
  material: yellow_terracotta
  display name: '<&6>Team 1'
brpink:
  type: item
  debug: true
  material: pink_terracotta
  display name: '<&c>Team 2'
brsetcage1:
  type: item
  debug: true
  material: yellow_stained_glass
  display name: '<&e>Step 2'
  lore:
  - <&r>
  - <&7>Select the cage
  - <&7>corners.
  - <&r>
  - <&a>Click to set cage!
brsetcage2:
  type: item
  debug: true
  material: pink_stained_glass
  display name: '<&e>Step 2'
  lore:
  - <&r>
  - <&7>Select the cage
  - <&7>corners.
  - <&r>
  - <&a>Click to set cage!
brclose:
  type: item
  debug: true
  material: barrier
  display name: '<&a>Close'
brsetbridge:
  type: item
  debug: true
  material: oak_fence
  display name: '<&e>Set Bridge'
  lore:
  - <&r>
  - <&7>Select the bridge
  - <&7>whole bridge.
  - <&r>
  - <&a>Click to set bridge!
brcenter:
  type: item
  debug: true
  material: glass
  display name: '<&e>Step 1'
  lore:
  - <&r>
  - <&7>Select the center
  - <&7>of the bridge.
  - <&r>
  - <&a>Click to set center!
brsetpit1:
  type: item
  debug: true
  material: end_portal_frame
  display name: '<&e>Step 1'
  lore:
  - <&r>
  - <&7>Set the first pit.
  - <&r>
  - <&a>Click to set pit!
brsetpit2:
  type: item
  debug: true
  material: end_portal_frame
  display name: '<&e>Step 1'
  lore:
  - <&r>
  - <&7>Set the second pit.
  - <&r>
  - <&a>Click to set pit!
brrespawnlocation1:
  type: item
  debug: true
  material: redstone
  display name: '<&e>Step 3'
  lore:
  - <&r>
  - <&7>Set the respawn location.
  - <&r>
  - <&a>Click to set location!
brrespawnlocation2:
  type: item
  debug: true
  material: redstone
  display name: '<&e>Step 3'
  lore:
  - <&r>
  - <&7>Set the respawn location.
  - <&r>
  - <&a>Click to set location!
brspawnlocation1:
  type: item
  debug: true
  material: beacon
  display name: '<&e>Step 4'
  lore:
  - <&r>
  - <&7>Set the spawn location,
  - <&7>typically in a cage.
  - <&r>
  - <&a>Click to set location!
brspawnlocation2:
  type: item
  debug: true
  material: beacon
  display name: '<&e>Step 4'
  lore:
  - <&r>
  - <&7>Set the spawn location,
  - <&7>typically in a cage.
  - <&r>
  - <&a>Click to set location!
blackpane:
  type: item
  debug: true
  material: black_stained_glass_pane
  display name: '<&r>'
#brsetlobby:
  #type: item
  #debug: true
  #material: bookshelf
  #display name: '<&e>Set Lobby'
  #lore:
  #- <&r>
  #- <&7>Set the lobby location
  #- <&7>after the game.
  #- <&r>
  #- <&a>Click to set location!
bridgelobbyinv:
  debug: true
  type: inventory
  inventory: CHEST
  title: Player Inventory
  size: 9
  slots:
    - "[] [] [] [] [] [] [] [] [bridgereturntolobby]"
bridgepinkteaminv:
  debug: true
  type: inventory
  inventory: CHEST
  title: Player Inventory
  size: 9
  slots:
    - "[bridgebreadsword] [bridgebow] [bridgepic] [pink_terracotta[quantity=64]] [pink_terracotta[quantity=64]] [goldenbread] [] [] [arrow]"
bridgeyellowteaminv:
  debug: true
  type: inventory
  inventory: CHEST
  title: Player Inventory
  size: 9
  slots:
    - "[bridgebreadsword] [bridgebow] [bridgepic] [yellow_terracotta[quantity=64]] [yellow_terracotta[quantity=64]] [goldenbread] [] [] [arrow]"
    #should we have black panes for the empty spots?
bridgereturntolobby:
  type: item
  debug: true
  material: bed
  display name: '<&c><&l>Return to Lobby <&7>(Right Click)'
  lore:
  - <&r>
  - <&7>Right click to return
  - <&7>to the main BP lobby!
  mechanisms:
    unbreakable: true
bridgebreadsword:
  type: item
  debug: true
  material: iron_sword
  display name: '<&e>Sharp Baguette'
  lore:
  - <&r>
  - <&7>wui
  mechanisms:
    unbreakable: true
bridgebow:
  type: item
  debug: true
  material: bow
  display name: '<&f>Bow'
  lore:
  - <&r>
  - <&7>Pew pew
  mechanisms:
    unbreakable: true
bridgepic:
  type: item
  debug: true
  material: diamond_pickaxe
  display name: '<&b>Diamond Pickaxe'
  lore:
  - <&r>
  - <&7>Shiny
  mechanisms:
    unbreakable: true
bridgeyellowterracotta:
  type: item
  debug: true
  material: yellow_terracotta[quantity=64]
  display name: '<&f>Yellow Terracotta'
  lore:
  - <&r>
  - <&7>Build, build, build!
bridgepinkterracotta:
  type: item
  debug: true
  material: pink_terracotta[quantity=64]
  display name: '<&f>Pink Terracotta'
  lore:
  - <&r>
  - <&7>Build, build, build!
goldenbread:
  type: item
  debug: true
  material: bread[quantity=8]
  display name: '<&b>Golden Bread'
  lore:
  - <&r>
  - <&7>The bread from above!
  mechanisms:
    flags: HIDE_ALL
  enchantments:
  - sharpness:1
ryeotshield:
  type: item
  debug: true
  material: shield
  display name: '<&7>Ryeot Shield'
  lore:
  - <&r>
  - <&7>The shield of heroes!
  mechanisms:
    durability:999999
brsetup:
  type: world
  debug: true
  events:
    on player clicks in bridgesetupinv priority:1000:
    - determine cancelled
    on player clicks brclose in bridgesetupinv:
    - inventory close
    ##BRIDGE BUILDING AREA
    on player left clicks brsetbridge in bridgesetupinv:
    - if <player.we_selection||null> != null:
      - narrate "<&a>Bridge set <&7>(<player.we_selection>)<&a>!"
      #checks what direction the bridge is in
      #this is in the x direction, so expand in the z direction, other is in the z dir, expand in x
      - if <player.we_selection.center.add[1,0,0].material> != <material[air]>:
        - note <cuboid[<player.we_selection.min.add[-2,0,-17]>|<player.we_selection.max.add[2,8,17]>]> as:bridge.arenas.<player.flag[bridgearenaselection]>.location
        - if <schematic.list.contains[bridge.arenas.<player.flag[bridgearenaselection]>.location]>:
          - schematic unload name:bridge.arenas.<player.flag[bridgearenaselection]>.location
        - schematic create name:bridge.arenas.<player.flag[bridgearenaselection]>.location <cuboid[<player.we_selection.min.add[-2,0,-17]>|<player.we_selection.max.add[2,8,17]>]> <player.we_selection.center>
        - ~schematic save name:bridge.arenas.<player.flag[bridgearenaselection]>.location
        - flag server bridge.arenas.<player.flag[bridgearenaselection]>.bridgecenter:<player.we_selection.center>
      - else if <player.we_selection.center.add[0,0,1].material> != <material[air]>:
        - note <cuboid[<player.we_selection.min.add[-17,0,-2]>|<player.we_selection.max.add[17,8,2]>]> as:bridge.arenas.<player.flag[bridgearenaselection]>.location
        - if <schematic.list.contains[bridge.arenas.<player.flag[bridgearenaselection]>.location]>:
          - schematic unload name:bridge.arenas.<player.flag[bridgearenaselection]>.location
        - schematic create name:bridge.arenas.<player.flag[bridgearenaselection]>.location <cuboid[<player.we_selection.min.add[-17,0,-2]>|<player.we_selection.max.add[17,8,2]>]> <player.we_selection.center>
        - ~schematic save name:bridge.arenas.<player.flag[bridgearenaselection]>.location
        - flag server bridge.arenas.<player.flag[bridgearenaselection]>.bridgecenter:<player.we_selection.center>
      #- flag server bridge.arenas.<player.flag[bridgearenaselection]>.bridgelocation:<player.we_selection>
    - else:
      - narrate "<&c>No area is selected!"
    ##PITS
    on player left clicks brsetpit1 in bridgesetupinv:
    - if <player.we_selection||null> != null:
      - narrate "<&a>Pit set <&7>(<player.we_selection>)<&a>!"
      - note <player.we_selection> as:bridge.arenas.<player.flag[bridgearenaselection]>.pit1
      #- flag server bridge.arenas.<player.flag[bridgearenaselection]>.pit1:<player.we_selection>
    - else:
      - narrate "<&c>No area is selected!"
    on player left clicks brsetpit2 in bridgesetupinv:
    - if <player.we_selection||null> != null:
      - narrate "<&a>Pit set <&7>(<player.we_selection>)<&a>!"
      - note <player.we_selection> as:bridge.arenas.<player.flag[bridgearenaselection]>.pit2
     # - flag server bridge.arenas.<player.flag[bridgearenaselection]>.pit2:<player.we_selection>
    - else:
      - narrate "<&c>No area is selected!"
    ##CAGES
    #only make notables for pits, don't need em for cages
    on player left clicks brsetcage1 in bridgesetupinv:
    - if <player.we_selection||null> != null:
      - narrate "<&a>Cage set <&7>(<player.we_selection>)<&a>!"
      - if <schematic.list.contains[bridge.arenas.<player.flag[bridgearenaselection]>.cage1]>:
        - schematic unload name:bridge.arenas.<player.flag[bridgearenaselection]>.cage1
      - schematic create name:bridge.arenas.<player.flag[bridgearenaselection]>.cage1 <player.we_selection> <player.we_selection.center>
      - ~schematic save name:bridge.arenas.<player.flag[bridgearenaselection]>.cage1
      - flag server bridge.arenas.<player.flag[bridgearenaselection]>.cage1center:<player.we_selection.center>
      - flag server bridge.arenas.<player.flag[bridgearenaselection]>.cage1location:<player.we_selection>
    - else:
      - narrate "<&c>No area is selected!"
    on player left clicks brsetcage2 in bridgesetupinv:
    - if <player.we_selection||null> != null:
      - narrate "<&a>Cage set <&7>(<player.we_selection>)<&a>!"
      - if <schematic.list.contains[bridge.arenas.<player.flag[bridgearenaselection]>.cage2]>:
        - schematic unload name:bridge.arenas.<player.flag[bridgearenaselection]>.cage2
      - schematic create name:bridge.arenas.<player.flag[bridgearenaselection]>.cage2 <player.we_selection> <player.we_selection.center>
      - ~schematic save name:bridge.arenas.<player.flag[bridgearenaselection]>.cage2
      - flag server bridge.arenas.<player.flag[bridgearenaselection]>.cage2center:<player.we_selection.center>
      - flag server bridge.arenas.<player.flag[bridgearenaselection]>.cage2location:<player.we_selection>
    - else:
      - narrate "<&c>No area is selected!"
    ##CENTER
    on player left clicks brcenter in bridgesetupinv:
    - if <player.we_selection||null> != null:
      - narrate "<&a>Center set <&7>(<player.we_selection.center>)<&a>!"
      - flag server bridge.arenas.<player.flag[bridgearenaselection]>.center:<player.we_selection.center>
    - else:
      - narrate "<&c>No area is selected!"
    ##SPAWN LOCATIONS
    on player left clicks brspawnlocation1 in bridgesetupinv:
    - narrate "<&a>Spawn set <&7>(<player.location>)<&a>!"
    - flag server bridge.arenas.<player.flag[bridgearenaselection]>.spawn1:<player.location>
    on player left clicks brspawnlocation2 in bridgesetupinv:
    - narrate "<&a>Spawn set <&7>(<player.location>)<&a>!"
    - flag server bridge.arenas.<player.flag[bridgearenaselection]>.spawn2:<player.location>
    ##RESPAWN LOCATIONS
    on player left clicks brrespawnlocation1 in bridgesetupinv:
    - narrate "<&a>Respawn set <&7>(<player.location>)<&a>!"
    - flag server bridge.arenas.<player.flag[bridgearenaselection]>.respawn1:<player.location>
    on player left clicks brrespawnlocation2 in bridgesetupinv:
    - narrate "<&a>Respawn set <&7>(<player.location>)<&a>!"
    - flag server bridge.arenas.<player.flag[bridgearenaselection]>.respawn2:<player.location>
    ##LOBBY LOCATION
    ##MAKE ONE UNIVERSAL LOBBY LOCATION SET IN SETTINGS/BY ONE COMMAND?
    #on player left clicks brsetlobby in bridgesetupinv:
    #- if <player.we_selection||null> != null:
      #- narrate "<&a>Respawn set <&7>(<player.location>)<&a>!"
      #- flag server bridge.arenas.<player.flag[bridgearenaselection]>.lobby:<player.location>
    on player closes bridgesetupinv:
    #- ~yaml savefile:Bridge/Arenas/<player.flag[bridgearena]>.yml id:<player.flag[bridgearena]>
    - narrate "<&e>Closed the BreadBridge setup menu!"
    - flag player bridgearenaselection:!
    on shutdown:
    #ONLY GETTING YELLOW TEAM, SO THAT OTHER HALF WONT NEED DATA
    - foreach <server.list_online_players.filter[has_flag[playingbridge]].filter[flag[bridgeteamcolor].is[==].to[yellow]]> as:player:
      - inventory clear d:<[player].inventory>
      - sidebar remove players:<[player]>
      - teleport <[player]> <server.flag[BreadBridgeLobby]>
      - modifyblock <cuboid[<server.flag[bridge.arenas.<[player].flag[bridgearena]>.pit1]>].blocks[end_portal]> air
      - modifyblock <cuboid[<server.flag[bridge.arenas.<[player].flag[bridgearena]>.pit2]>].blocks[end_portal]> air
      - modifyblock <cuboid[<server.flag[bridge.arenas.<[player].flag[bridgearena]>.cage1location]>].blocks> air
      - modifyblock <cuboid[<server.flag[bridge.arenas.<[player].flag[bridgearena]>.cage2location]>].blocks> air
      - flag <[player]> playingbridge:!
      - flag <[player]> bridgescore:!
      - flag <[player]> bridgeteamcolor:!
      - flag <[player]> bridgekills:!
      - flag <[player]> bridgearena:!
brgameplay:
  type: world
  debug: true
  events:
    on player enters notable cuboid:
    #- if <player.has_flag[playingbridge]>:
    - if <player.flag[playingbridge]||null> == playing:
      - if <player.flag[bridgeteamcolor]||null> == yellow:
        - if <context.cuboids.contains[<cuboid[bridge.arenas.<player.flag[bridgearena]>.pit2]>]>:
          - inject bridgenextgame
        - else if <context.cuboids.contains[<cuboid[bridge.arenas.<player.flag[bridgearena]>.pit1]>]>:
          - wait 5t
          - narrate "<&c>Congratulations, you just played yourself."
      - if <player.flag[bridgeteamcolor]||null> == pink:
        - if <context.cuboids.contains[<cuboid[bridge.arenas.<player.flag[bridgearena]>.pit1]>]>:
          - inject bridgenextgame
        - else if <context.cuboids.contains[<cuboid[bridge.arenas.<player.flag[bridgearena]>.pit2]>]>:
          - wait 5t
          - narrate "<&c>Congratulations, you just played yourself."
      #- if <context.cuboids.contains[<cuboid[bridge.arenas.<player.flag[bridgearena]>.location]>]>:
        #- flag player bridgecanbuild
    #on player exits notable cuboid:
    # if <player.flag[playingbridge]||null> == playing:
      #- if <context.cuboids.contains[<cuboid[bridge.arenas.<player.flag[bridgearena]>.location]>]>:
        #- flag player bridgecanbuild:!
    on player places block:
    - if <player.flag[playingbridge]||null> == playing:
      - if !<cuboid[bridge.arenas.<player.flag[bridgearena]>.location].blocks.contains[<context.location>]>:
        - determine passively cancelled
        - narrate "<&c>You can't place blocks here!"
    - if <player.flag[playingbridge]||null> == waiting:
      - determine cancelled
      #######CHECK HERE
    on player breaks block:
    - if <player.flag[playingbridge]||null> == playing:
      - if <context.material> != <material[pink_terracotta]> && <context.material> != <material[yellow_terracotta]>:
        - if !<cuboid[bridge.arenas.<player.flag[bridgearena]>.location].blocks.contains[<context.location>]>:
          - determine passively cancelled
          - narrate "<&c>You can't break blocks here!"
      - else:
        - determine NOTHING
    - if <player.flag[playingbridge]||null> == waiting:
      - determine cancelled
      ##NOT WORKING?
    on player quit:
    - if <player.flag[playingbridge]||null> == playing:
      - foreach <player.world.players.filter[has_flag[playingbridge]]> as:player:
        - inventory clear d:<[player].inventory>
      - sidebar remove
      - flag player playingbridge:!
      - if <player.world.players.filter[has_flag[playingbridge]].size> == 1:
        - modifyblock <cuboid[<server.flag[bridge.arenas.<player.flag[bridgearena]>.pit1]>].blocks[end_portal]> air
        - modifyblock <cuboid[<server.flag[bridge.arenas.<player.flag[bridgearena]>.pit2]>].blocks[end_portal]> air
      - if <player.world.players.filter[has_flag[playingbridge]].size> == 0:
        - schematic paste name:bridge.arenas.<player.flag[bridgearena]>.location <server.flag[bridge.arenas.<player.flag[bridgearena]>.bridgecenter]>
      - flag player bridgescore:!
      - flag player bridgekills:!
      - flag player bridgeteamcolor:!
      - flag player bridgearena:!
      ##DO THE WINNING STUFF HERE
      - foreach <player.world.players.filter[has_flag[playingbridge]]> as:player:
        - flag <[player]> playingbridge:waiting
        - if <[player].flag[bridgeteamcolor]> == yellow:
          - title "title:<&6><[player].name> Won!" targets:<[player].world.players.filter[has_flag[playingbridge]]> fade_in:0.2s fade_out:0.2s stay:3s
        - if <[player].flag[bridgeteamcolor]> == pink:
          - title "title:<&d><[player].name> Won!" targets:<[player].world.players.filter[has_flag[playingbridge]]> fade_in:0.2s fade_out:0.2s stay:3s
      #should i change <player.name> to "You Won!"?
        - inventory clear d:<[player].inventory>
        - if <[player].flag[bridgeteamcolor]> == yellow:
          - teleport <[player]> <server.flag[bridge.arenas.<[player].flag[bridgearena]>.respawn1]>
        - if <[player].flag[bridgeteamcolor]> == pink:
          - teleport <[player]> <server.flag[bridge.arenas.<[player].flag[bridgearena]>.respawn2]>
        - wait 3s
        - sidebar remove players:<[player].world.players.filter[has_flag[playingbridge]]>
        - teleport <[player].world.players.filter[has_flag[playingbridge]]> <server.flag[BreadBridgeLobby]>
        - schematic paste name:bridge.arenas.<[player].flag[bridgearena]>.location <server.flag[bridge.arenas.<[player].flag[bridgearena]>.bridgecenter]>
        - flag <[player]> playingbridge:!
        - flag <[player]> bridgekills:!
        - flag <[player]> bridgearena:!
        - flag <[player]> bridgescore:!
        - flag <[player]> bridgeteamcolor:!
    - if <player.flag[playingbridge]||null> == waiting:
      - inventory clear d:<player.inventory>
      - sidebar remove
      - flag player playingbridge:!
      - flag player bridgescore:!
      - flag player bridgekills:!
      - flag player bridgeteamcolor:!
      - flag player bridgearena:!
      - if <player.world.players.filter[has_flag[playingbridge]].size> == 1:
        - sidebar set_line scores:6 "values:<&f>Players: <&a><player.world.players.filter[has_flag[playingbridge]].size>/2" players:<player.world.players.filter[has_flag[playingbridge]]>
      - teleport <player> <server.flag[BreadBridgeLobby]>
    ##MAKE THE CODE AFTER SECOND CHECK IN THIS EVENT AN INJECT SO IT DOESN'T HAVE TO BE COPY AND PASTED?


  ##MAKE SURE TO DELAY THE DUEL PLAY AGAIN BECAUSE IF PLAYER'S BRIDGE FLAGS DELETE AFTER STARTING NEW GAME
    on player damaged by fall:
    - if <player.has_flag[playingbridge]>:
      - determine cancelled
    on player damaged by projectile:
    - if <player.has_flag[playingbridge]>:
      - if <player.flag[bridgeteamcolor]> == yellow:
      #should i use heart symbol, or HP
        - if <context.entity.health.sub[<context.final_damage>].round_to[1]> >= 0.1:
          - narrate "<&d><context.entity.name> <&7>now has <&c><context.entity.health.sub[<context.final_damage>].round_to[1]> <&7>HP!"
      - if <player.flag[bridgeteamcolor]> == pink:
        - if <context.entity.health.sub[<context.final_damage>].round_to[1]> >= 0.1:
          - narrate "<&6><context.entity.name> <&7>now has <&c><context.entity.health.sub[<context.final_damage>].round_to[1]> <&7>HP!"
    on player consumes goldenbread:
    - adjust <player> potion_effects:REGENERATION,0,100,false,false,true|ABSORPTION,1,2400,false,false,true
    on player drops item:
    - if <player.has_flag[playingbridge]>:
      - determine cancelled
    #on player item takes damage:
    #- if <player.has_flag[playingbridge]>:
      #- determine cancelled
    on player changes food level:
    - if <player.has_flag[playingbridge]>:
      - determine cancelled
    on player death:
    - if <player.has_flag[playingbridge]>:
      - determine passively NO_DROPS_OR_XP
      - determine passively KEEP_INV
    on player damaged by player:
    - if <player.[playingbridge]||null> == waiting:
      - determine cancelled
    - if <player.flag[playingbridge]||null> == playing:
      - flag <context.entity> bridgehit:<player> duration:3s
      #- if <context.entity.health.sub[<context.final_damage>].round_to[1]> <= 0:
        #- flag []
        #- if <player.flag[bridgeteamcolor]> == yellow:
          #- teleport <context.entity> <server.flag[bridge.arenas.<player.flag[bridgearena]>.respawn2]>
          #- health <context.entity> heal 20
        #- if <player.flag[bridgeteamcolor]> == pink:
          #- teleport <context.entity> <server.flag[bridge.arenas.<player.flag[bridgearena]>.respawn1]>
          #- health <context.entity> heal 20
    on player killed:
    - if <context.entity.flag[playingbridge]||null> == playing:
      - determine passively cancelled
      - playeffect effect:CRIT_MAGIC at:<player.location.add[0,1,0]> visibility:100 quantity:15
      - flag <context.damager> bridgekills:++
      - sidebar set_line scores:4 "values:<&f>Kills: <&f><context.damager.flag[bridgekills]>" players:<context.damager>
      - health <context.entity> heal 20
      - if <context.entity.flag[bridgeteamcolor]> == yellow:
      #say with what item later?
        - narrate "<&6><context.entity.name> <&7>was killed by <&d><context.damager.name><&7>!" targets:<player.world.players.filter[has_flag[playingbridge]]>
        - teleport <context.entity> <server.flag[bridge.arenas.<player.flag[bridgearena]>.respawn1]>
      - if <context.entity.flag[bridgeteamcolor]> == pink:
        - narrate "<&d><context.entity.name> <&7>was killed by <&6><context.damager.name><&7>!" targets:<player.world.players.filter[has_flag[playingbridge]]>
        - teleport <context.entity> <server.flag[bridge.arenas.<player.flag[bridgearena]>.respawn2]>
    on player shoots bow:
    - if <player.flag[playingbridge]||null> == playing:
      - experience give level 4
      #- run exp_countdown
      - repeat 3:
        - experience take level 1
        - wait 1s
      - experience take level 1
      - give arrow quantity:1 slot:9
    on player picks up item:
    - if <player.flag[playingbridge]||null> == playing:
      - determine cancelled
      #not working?
    on player unequips armor:
    - if <player.flag[playingbridge]||null> == playing:
      - determine cancelled
    on spawn command:
    - if <player.has_flag[playingbridge]>:
      - if <player.flag[playingbridge]> == playing:
        - foreach <player.world.players.filter[has_flag[playingbridge]]> as:player:
          - inventory clear d:<[player].inventory>
        - sidebar remove
        - flag player playingbridge:!
        - if <player.world.players.filter[has_flag[playingbridge]].size> == 1:
          - modifyblock <cuboid[<server.flag[bridge.arenas.<player.flag[bridgearena]>.pit1]>].blocks[end_portal]> air
          - modifyblock <cuboid[<server.flag[bridge.arenas.<player.flag[bridgearena]>.pit2]>].blocks[end_portal]> air
        - if <player.world.players.filter[has_flag[playingbridge]].size> == 0:
          - schematic paste name:bridge.arenas.<player.flag[bridgearena]>.location <server.flag[bridge.arenas.<player.flag[bridgearena]>.bridgecenter]>
        - flag player bridgescore:!
        - flag player bridgekills:!
        - flag player bridgeteamcolor:!
        - flag player bridgearena:!
        ##DO THE WINNING STUFF HERE
      - foreach <player.world.players.filter[has_flag[playingbridge]]> as:player:
        - flag <[player]> playingbridge:waiting
        - if <[player].flag[bridgeteamcolor]> == yellow:
          - title "title:<&6><[player].name> Won!" targets:<[player].world.players.filter[has_flag[playingbridge]]> fade_in:0.2s fade_out:0.2s stay:3s
        - if <[player].flag[bridgeteamcolor]> == pink:
          - title "title:<&d><[player].name> Won!" targets:<[player].world.players.filter[has_flag[playingbridge]]> fade_in:0.2s fade_out:0.2s stay:3s
          #should i change <player.name> to "You Won!"?
        - inventory clear d:<[player].inventory>
        - if <[player].flag[bridgeteamcolor]> == yellow:
          - teleport <[player]> <server.flag[bridge.arenas.<[player].flag[bridgearena]>.respawn1]>
        - if <[player].flag[bridgeteamcolor]> == pink:
          - teleport <[player]> <server.flag[bridge.arenas.<[player].flag[bridgearena]>.respawn2]>
        - wait 3s
        - sidebar remove players:<[player].world.players.filter[has_flag[playingbridge]]>
        - teleport <[player].world.players.filter[has_flag[playingbridge]]> <server.flag[BreadBridgeLobby]>
        - schematic paste name:bridge.arenas.<[player].flag[bridgearena]>.location <server.flag[bridge.arenas.<[player].flag[bridgearena]>.bridgecenter]>
        - flag <[player]> playingbridge:!
        - flag <[player]> bridgekills:!
        - flag <[player]> bridgearena:!
        - flag <[player]> bridgescore:!
        - flag <[player]> bridgeteamcolor:!
      - else if <player.flag[playingbridge]> == waiting:
        - foreach <player.world.players.filter[has_flag[playingbridge]]> as:player:
          - inventory clear d:<[player].inventory>
        - sidebar remove
        - flag player playingbridge:!
        - if <player.world.players.filter[has_flag[playingbridge]].size> == 1:
          - modifyblock <cuboid[<server.flag[bridge.arenas.<player.flag[bridgearena]>.pit1]>].blocks[end_portal]> air
          - modifyblock <cuboid[<server.flag[bridge.arenas.<player.flag[bridgearena]>.pit2]>].blocks[end_portal]> air
        - if <player.world.players.filter[has_flag[playingbridge]].size> == 0:
          - schematic paste name:bridge.arenas.<player.flag[bridgearena]>.location <server.flag[bridge.arenas.<player.flag[bridgearena]>.bridgecenter]>
        - flag player bridgescore:!
        - flag player bridgekills:!
        - flag player bridgeteamcolor:!
        - flag player bridgearena:!
    ##give the return to lobby item in slot 1 or 9?
    on player right clicks with bridgereturntolobby:
    - determine passively cancelled
    - wait 1t
    - inventory clear d:<player.inventory>
    - sidebar remove
    - flag player playingbridge:!
    - flag player bridgescore:!
    - flag player bridgekills:!
    - flag player bridgeteamcolor:!
    - flag player bridgearena:!
    - if <player.world.players.filter[has_flag[playingbridge]].size> == 1:
      - sidebar set_line scores:6 "values:<&f>Players: <&a><player.world.players.filter[has_flag[playingbridge]].size>/2" players:<player.world.players.filter[has_flag[playingbridge]]>
    - teleport <player> <server.flag[BreadBridgeLobby]>

      #make sure to have the main lobby in a different world
      #use an inject script for all the parts that need to end game

exp_countdown:
  type: task
  debug: false
  script:
  - repeat 12:
    - experience take 1
    - wait 3t





 # type: world
 # debug: false
 # events:
    #on player shoots bow:
    #have a yellow/pink dye trail mixed in?
    #########- if <player.has_flag[playingbridge]>:
      #- displayitem bread <context.projectile.location> duration:10t
      #why doesn't ! work?
      ########- wait 1t
      ########- while <context.projectile.is_in_block> == false:
      #location = player's cursor, velocity = projectile direction?
        #######- displayitem bread <context.projectile.location.sub[0,1,0]> duration:5t
        #######- wait 1t
      ##feature allowing enabling/disabling breadeffect (breffect)
        #- wait 1t
        ###### = lines of code


voidrespawn:
  type: world
  debug: true
  events:
  #specify if the player was hit or shot into the void using context.cause?
    on player steps on air:
    #too lazy to make tag for finding other team name, so i flagged damager's name
    #make this one tag? check for if the player has the flag first, or just add a fallback?
    - if <player.has_flag[playingbridge]>:
      - if <player.eye_location.y> <= <cuboid[<server.flag[bridge.arenas.<player.flag[bridgearena]>.location]>].min.y.sub[9]>:
        - if <player.flag[bridgeteamcolor]> == yellow:
          - if <player.flag[playingbridge]> == playing:
            - if <player.has_flag[bridgehit]>:
              - flag <player[<player.flag[bridgehit]>]> bridgekills:++
              - sidebar set_line scores:4 "values:<&f>Kills: <&f><player[<player.flag[bridgehit]>].flag[bridgekills]>" players:<player[<player.flag[bridgehit]>]>
              - narrate "<&6><player.name> <&7>was knocked in the void by <&d><player[<player.flag[bridgehit]>].name><&7>!" targets:<player.world.players.filter[has_flag[playingbridge]]>
            - else:
              - narrate "<&6><player.name> <&7>fell in the void." targets:<player.world.players.filter[has_flag[playingbridge]]>
          ########- wait 1t FOR ARMOR STANDS
          - flag player bridgehit:!
          - teleport <player> <server.flag[bridge.arenas.<player.flag[bridgearena]>.respawn1]>
          - health <player> heal 20
        - if <player.flag[bridgeteamcolor]> == pink:
          - if <player.flag[playingbridge]> == playing:
            - if <player.has_flag[bridgehit]>:
              - flag <player[<player.flag[bridgehit]>]> bridgekills:++
              - sidebar set_line scores:4 "values:<&f>Kills: <&f><player[<player.flag[bridgehit]>].flag[bridgekills]>" players:<player[<player.flag[bridgehit]>]>
              - narrate "<&d><player.name> <&7>was knocked in the void by <&6><player[<player.flag[bridgehit]>].name><&7>!" targets:<player.world.players.filter[has_flag[playingbridge]]>
            - else:
              - narrate "<&d><player.name> <&7>fell in the void." targets:<player.world.players.filter[has_flag[playingbridge]]>
          #########- wait 1t FOR ARMOR STANDS
          - flag player bridgehit:!
          - teleport <player> <server.flag[bridge.arenas.<player.flag[bridgearena]>.respawn2]>
          - health <player> heal 20
bridgestartgame:
  type: task
  debug: true
  script:
  - wait 1s
  - foreach 5|4|3|2|1 as:countdown:
    - if <player.world.players.filter[has_flag[playingbridge]].filter[flag[playingbridge].is[==].to[waiting]].size> == 2:
      - narrate "<&e>The game is starting in <&c><bold><[countdown]><&r><&e> seconds!" targets:<player.world.players.filter[has_flag[playingbridge]]>
      - title "title:<green><[countdown]>" targets:<player.world.players.filter[has_flag[playingbridge]]> fade_in:0s fade_out:0s
      - wait 1s
    - else:
      - title "title:<red>CANCELLED!" targets:<player.world.players.filter[has_flag[playingbridge]]> fade_in:0s fade_out:0s
      - foreach <player.world.players.filter[has_flag[playingbridge]].filter[flag[playingbridge].is[==].to[playing]]> as:player:
        - flag <[player]> playingbridge:waiting
      - sidebar set_line scores:6 "values:<&f>Players: <&a><player.world.players.filter[has_flag[playingbridge]].size>/2" players:<player.world.players.filter[has_flag[playingbridge]]>
      - stop
  - if <player.world.players.filter[has_flag[playingbridge]].filter[flag[playingbridge].is[==].to[waiting]].size> == 2:
    - schematic paste name:bridge.arenas.<player.flag[bridgearena]>.cage1 <server.flag[bridge.arenas.<player.flag[bridgearena]>.cage1center]>
    - schematic paste name:bridge.arenas.<player.flag[bridgearena]>.cage2 <server.flag[bridge.arenas.<player.flag[bridgearena]>.cage2center]>
    - teleport <player.world.players.filter[has_flag[bridgeteamcolor]].filter[flag[bridgeteamcolor].is[==].to[yellow]]> <server.flag[bridge.arenas.<player.flag[bridgearena]>.spawn1]>
    - teleport <player.world.players.filter[has_flag[bridgeteamcolor]].filter[flag[bridgeteamcolor].is[==].to[pink]]> <server.flag[bridge.arenas.<player.flag[bridgearena]>.spawn2]>
    - foreach <player.world.players.filter[has_flag[playingbridge]]> as:player:
      - inventory clear d:<[player].inventory>
      - if <[player].flag[bridgeteamcolor]> == yellow:
        - adjust <[player]> equipment:leather_boots[color=<color[255,165,0]>;unbreakable=true]|leather_leggings[color=<color[255,165,0]>;unbreakable=true]|leather_chestplate[color=<color[255,165,0]>;unbreakable=true]|leather_helmet[color=<color[255,165,0]>;unbreakable=true]
        - inventory set d:<[player].inventory> o:bridgeyellowteaminv
        - fakeitem bread[display_name=<&6>Baguette] slot:<player.inventory.find.scriptname[bridgebreadsword]>
      - if <[player].flag[bridgeteamcolor]> == pink:
        - adjust <[player]> equipment:leather_boots[color=<color[255,100,255]>;unbreakable=true]|leather_leggings[color=<color[255,100,255]>;unbreakable=true]|leather_chestplate[color=<color[255,100,255]>;unbreakable=true]|leather_helmet[color=<color[255,100,255]>;unbreakable=true]
        - inventory set d:<[player].inventory> o:bridgepinkteaminv
        - fakeitem bread[display_name=<&d>Baguette] slot:<player.inventory.find.scriptname[bridgebreadsword]>
    - modifyblock <cuboid[bridge.arenas.<player.flag[bridgearena]>.pit1].blocks[air]> end_portal
    - modifyblock <cuboid[bridge.arenas.<player.flag[bridgearena]>.pit2].blocks[air]> end_portal
    - foreach <player.world.players.filter[has_flag[playingbridge]].filter[flag[playingbridge].is[==].to[waiting]]> as:player:
      - flag <[player]> playingbridge:playing
    - sidebar set "title:<&6><&l>BREAD<&d><&l>BRIDGE" "values:<&b>|<&6>[G]<&f>: <gray>    █|<&d>[P]<&f>: <gray>    █||<&f>Kills: 0|<&f>Score: <player.zflag[bridgescore]||0>|<&f>|<&e>mc.breadpixel.net" players:<player.world.players.filter[has_flag[playingbridge]].filter[flag[playingbridge].is[==].to[playing]]>
    - foreach 5|4|3|2|1 as:countdown:
      - if <player.world.players.filter[has_flag[playingbridge]].filter[flag[playingbridge].is[==].to[playing]].size> == 2:
        - title "subtitle:<gray>Cages open in <green><[countdown]>s<gray>..." targets:<player.world.players.filter[has_flag[playingbridge]].filter[flag[playingbridge].is[==].to[playing]]> fade_in:0s fade_out:0s
        #fade_out:0.1s SHOULD I FADE OUT OR NO
        - playsound <player.world.players.filter[has_flag[playingbridge]].filter[flag[playingbridge].is[==].to[playing]]> sound:UI_BUTTON_CLICK
        - wait 1s
      - else:
        - title "title:<red>CANCELLED!" targets:<player.world.players.filter[has_flag[playingbridge]].filter[flag[playingbridge].is[==].to[playing]]> fade_in:0s fade_out:0s
        #FADE OUT OR NO?
        - foreach <player.world.players.filter[has_flag[playingbridge]].filter[flag[playingbridge].is[==].to[playing]]> as:player:
          - flag <[player]> playingbridge:waiting
        - sidebar set_line scores:6 "values:<&f>Players: <&a><player.world.players.filter[has_flag[playingbridge]].size>/2" players:<player.world.players.filter[has_flag[playingbridge]]>
        - stop
    - modifyblock <cuboid[<server.flag[bridge.arenas.<player.flag[bridgearena]>.cage1location]>].blocks> air
    - modifyblock <cuboid[<server.flag[bridge.arenas.<player.flag[bridgearena]>.cage2location]>].blocks> air
    - title "title:<green>Begin!" targets:<player.world.players.filter[has_flag[playingbridge]].filter[flag[playingbridge].is[==].to[playing]]> fade_in:0s fade_out:0.2s
    - playsound <player.world.players.filter[has_flag[playingbridge]].filter[flag[playingbridge].is[==].to[playing]]> sound:ENTITY_PLAYER_LEVELUP
   ####################- run playerhealthstand player:<player>
  - else:
    - title "title:<red>CANCELLED!" targets:<player.world.players.filter[has_flag[playingbridge]].filter[flag[playingbridge].is[==].to[waiting]]> fade_in:0.1s
    - foreach <player.world.players.filter[has_flag[playingbridge]].filter[flag[playingbridge].is[==].to[playing]]> as:player:
      - flag <[player]> playingbridge:waiting
    - sidebar set_line scores:6 "values:<&f>Players: <&a><player.world.players.filter[has_flag[playingbridge]].size>/2" players:<player.world.players.filter[has_flag[playingbridge]]>
    - stop

##CREATE AN INJECT COMMAND FOR THE FOREACHES?


#MAKE ONE INJECT AND SPLIT THE REST OF THE CODE TO THE JOIN SCRIPT??
#<element[].pad_right[1].with[<&chr[6969]>].pad_right[5].with[<&chr[4200]>].replace[<&chr[6969]>].with[<gold>█].replace[<&chr[4200]>].with[<gray>█]>
bridgenextgame:
  type: task
  debug: true
  script:
  ##SHOULD I HAVE A WAIT BEFORE THIS? LIKE ONE SECOND?
  - flag player bridgescore:++
  ##set scores value for player with individual line, or scores?
  - sidebar set_line score:3 "values:<&f>Score: <player.flag[bridgescore]||0>"
  - if <player.flag[bridgeteamcolor]> == yellow:
    - if <player.flag[bridgescore]> <= 5:
      - narrate "<&8><&l>---------------------------------------------<&nl><&6><player.name> <&e>scored <&7>(<&a><player.health.round_to[1]><&c><&7>)<&e>! <&e>Goal No. <&a><player.flag[bridgescore]><&nl><&8><&l>---------------------------------------------" targets:<player.world.players.filter[has_flag[playingbridge]]>
      ####- sidebar set_line scores:7 "values:<&6>[G]<&f>: <element[].pad_right[<player.flag[bridgescore]>].with[<&chr[6969]>].pad_right[5].with[<&chr[4200]><&sp>].replace[<&chr[6969]>].with[<gold>█].replace[<&chr[4200]>].with[<&sp><gray>█]>" players:<player.world.players.filter[has_flag[playingbridge]].filter[flag[playingbridge].is[==].to[playing]]>
      ##- sidebar set_line scores:7 "values:<&6>[G]<&f>: <element[].pad_right[<player.flag[bridgescore]>].with[<&chr[6969]>].pad_right[5].with[<&chr[4200]>].replace[<&chr[6969]>].with[<gold>█].replace[<&chr[4200]>].with[<gray>█]>" players:<player.world.players.filter[has_flag[playingbridge]].filter[flag[playingbridge].is[==].to[playing]]> <--- this one is w/out spaces
    - if <player.flag[bridgescore]> == 1:
      - sidebar set_line scores:7 "values:<&6>[G]<&f>: <gold> <gray>   █" players:<player.world.players.filter[has_flag[playingbridge]].filter[flag[playingbridge].is[==].to[playing]]>
    - if <player.flag[bridgescore]> == 2:
      - sidebar set_line scores:7 "values:<&6>[G]<&f>: <gold>  <gray>  █" players:<player.world.players.filter[has_flag[playingbridge]].filter[flag[playingbridge].is[==].to[playing]]>
    - if <player.flag[bridgescore]> == 3:
      - sidebar set_line scores:7 "values:<&6>[G]<&f>: <gold>   <gray> █" players:<player.world.players.filter[has_flag[playingbridge]].filter[flag[playingbridge].is[==].to[playing]]>
    - if <player.flag[bridgescore]> == 4:
      - sidebar set_line scores:7 "values:<&6>[G]<&f>: <gold>    <gray>█" players:<player.world.players.filter[has_flag[playingbridge]].filter[flag[playingbridge].is[==].to[playing]]>
    - if <player.flag[bridgescore]> == 5:
      - sidebar set_line scores:7 "values:<&6>[G]<&f>: <gold>    █" players:<player.world.players.filter[has_flag[playingbridge]].filter[flag[playingbridge].is[==].to[playing]]>
      ##DO STUFF HERE!
  - if <player.flag[bridgeteamcolor]> == pink:
    - if <player.flag[bridgescore]> <= 5:
      - narrate "<&8><&l>---------------------------------------------<&nl><&d><player.name> <&e>scored <&7>(<&a><player.health.round_to[1]><&c><&7>)<&e>! <&e>Goal No. <&a><player.flag[bridgescore]><&nl><&8><&l>---------------------------------------------" targets:<player.world.players.filter[has_flag[playingbridge]]>
      ####- sidebar set_line scores:6 "values:<&d>[P]<&f>: <element[].pad_right[<player.flag[bridgescore]>].with[<&chr[6969]>].pad_right[5].with[<&chr[4200]><&sp>].replace[<&chr[6969]>].with[<&d>█].replace[<&chr[4200]>].with[<&sp><gray>█]>" players:<player.world.players.filter[has_flag[playingbridge]].filter[flag[playingbridge].is[==].to[playing]]>
      ##- sidebar set_line scores:6 "values:<&d>[P]<&f>: <element[].pad_right[<player.flag[bridgescore]>].with[<&chr[6969]>].pad_right[5].with[<&chr[4200]>].replace[<&chr[6969]>].with[<&d>█].replace[<&chr[4200]>].with[<gray>█]>" players:<player.world.players.filter[has_flag[playingbridge]].filter[flag[playingbridge].is[==].to[playing]]> <--- this one is w/out spaces
    - if <player.flag[bridgescore]> == 1:
      - sidebar set_line scores:6 "values:<&d>[P]<&f>: <&d> <gray>   █" players:<player.world.players.filter[has_flag[playingbridge]].filter[flag[playingbridge].is[==].to[playing]]>
    - if <player.flag[bridgescore]> == 2:
      - sidebar set_line scores:6 "values:<&d>[P]<&f>: <&d>  <gray>  █" players:<player.world.players.filter[has_flag[playingbridge]].filter[flag[playingbridge].is[==].to[playing]]>
    - if <player.flag[bridgescore]> == 3:
      - sidebar set_line scores:6 "values:<&d>[P]<&f>: <&d>   <gray> █" players:<player.world.players.filter[has_flag[playingbridge]].filter[flag[playingbridge].is[==].to[playing]]>
    - if <player.flag[bridgescore]> == 4:
      - sidebar set_line scores:6 "values:<&d>[P]<&f>: <&d>    <gray>█" players:<player.world.players.filter[has_flag[playingbridge]].filter[flag[playingbridge].is[==].to[playing]]>
    - if <player.flag[bridgescore]> == 5:
      - sidebar set_line scores:6 "values:<&d>[P]<&f>: <&d>    █" players:<player.world.players.filter[has_flag[playingbridge]].filter[flag[playingbridge].is[==].to[playing]]>
      ##DO STUFF HERE!
  - if <player.flag[bridgescore]> < 5:
    - schematic paste name:bridge.arenas.<player.flag[bridgearena]>.cage1 <server.flag[bridge.arenas.<player.flag[bridgearena]>.cage1center]>
    - schematic paste name:bridge.arenas.<player.flag[bridgearena]>.cage2 <server.flag[bridge.arenas.<player.flag[bridgearena]>.cage2center]>
    - teleport <player.world.players.filter[has_flag[bridgeteamcolor]].filter[flag[bridgeteamcolor].is[==].to[yellow]]> <server.flag[bridge.arenas.<player.flag[bridgearena]>.spawn1]>
    - teleport <player.world.players.filter[has_flag[bridgeteamcolor]].filter[flag[bridgeteamcolor].is[==].to[pink]]> <server.flag[bridge.arenas.<player.flag[bridgearena]>.spawn2]>
    - foreach <player.world.players.filter[has_flag[playingbridge]]> as:player:
      - health <[player]> heal 20
      - if <[player].flag[bridgeteamcolor]> == yellow:
        - inventory set d:<[player].inventory> o:bridgeyellowteaminv
      - if <[player].flag[bridgeteamcolor]> == pink:
        - inventory set d:<[player].inventory> o:bridgepinkteaminv
    - foreach 5|4|3|2|1 as:countdown:
      - if <player.flag[bridgeteamcolor]> == yellow:
        - title "title:<&6><player.name> Scored!" "subtitle:<gray>Cages open in <green><[countdown]>s<gray>..." targets:<player.world.players.filter[has_flag[playingbridge]].filter[flag[playingbridge].is[==].to[playing]]> fade_in:0s fade_out:0s
      - if <player.flag[bridgeteamcolor]> == pink:
        - title "title:<&d><player.name> Scored!" "subtitle:<gray>Cages open in <green><[countdown]>s<gray>..." targets:<player.world.players.filter[has_flag[playingbridge]].filter[flag[playingbridge].is[==].to[playing]]> fade_in:0s fade_out:0s
          #fade_out:0.1s SHOULD I FADE OUT OR NO
      - playsound <player.world.players.filter[has_flag[playingbridge]].filter[flag[playingbridge].is[==].to[playing]]> sound:UI_BUTTON_CLICK
      - wait 1s
    - title "title:<green>Begin!" targets:<player.world.players.filter[has_flag[playingbridge]].filter[flag[playingbridge].is[==].to[playing]]> fade_in:0s fade_out:0s
    - playsound <player.world.players.filter[has_flag[playingbridge]].filter[flag[playingbridge].is[==].to[playing]]> sound:ENTITY_PLAYER_LEVELUP
    - modifyblock <cuboid[<server.flag[bridge.arenas.<player.flag[bridgearena]>.cage1location]>].blocks> air
    - modifyblock <cuboid[<server.flag[bridge.arenas.<player.flag[bridgearena]>.cage2location]>].blocks> air
    - title "title:<green>Begin!" targets:<player.world.players.filter[has_flag[playingbridge]].filter[flag[playingbridge].is[==].to[playing]]> fade_in:0s fade_out:0s
    - playsound <player.world.players.filter[has_flag[playingbridge]].filter[flag[playingbridge].is[==].to[playing]]> sound:ENTITY_PLAYER_LEVELUP
  - else if <player.flag[bridgescore]> == 5:
    - inject bridge_endgame

bridge_endgame:
  type: task
  debug: true
  script:
  - foreach <player.world.players.filter[has_flag[playingbridge]]> as:player:
    - flag <[player]> playingbridge:waiting
    - health <[player]> heal 20
  - modifyblock <cuboid[<server.flag[bridge.arenas.<player.flag[bridgearena]>.pit1]>].blocks[end_portal]> air
  - modifyblock <cuboid[<server.flag[bridge.arenas.<player.flag[bridgearena]>.pit2]>].blocks[end_portal]> air
  - if <player.flag[bridgeteamcolor]> == yellow:
    - define opponent <player.world.players.filter[has_flag[bridgeteamcolor]].filter[flag[bridgeteamcolor].is[==].to[pink]]>
    - title "title:<&6><player.name> Won!" targets:<player.world.players.filter[has_flag[playingbridge]]> fade_in:0.2s fade_out:0.2s stay:3s
    - narrate "<&8><&l>---------------------------------------------                      <&r><player.name> <&b><&l>WINS!<&nl><&nl>                          <&6><&l><player.flag[bridgescore]||0> <&8><&l>- <&d><&l><[opponent].flag[bridgescore]||0><&nl><&nl>                        <&6><player.name><&f>: <player.flag[bridgekills]||0> Kills<&nl>                               <&d><[opponent].name||null><&f>: <[opponent].flag[bridgekills]||0> Kills<&nl><&nl><&8><&l>---------------------------------------------" targets:<player.world.players.filter[has_flag[playingbridge]]>"
    #<player.chat_prefix.parse_color> add this
    #"<&8><&l>---------------------------------------------<&nl><&6><player.name> <&e>scored <&7>(<&a><player.health.round_to[1]><&c>❤<&7>)<&e>! <&e>Goal No. <&a><player.flag[bridgescore]><&nl><&8><&l>---------------------------------------------" targets:<player.world.players.filter[has_flag[playingbridge]]>
  - if <player.flag[bridgeteamcolor]> == pink:
    - define opponent <player.world.players.filter[has_flag[bridgeteamcolor]].filter[flag[bridgeteamcolor].is[==].to[yellow]]>
    - title "title:<&d><player.name> Won!" targets:<player.world.players.filter[has_flag[playingbridge]]> fade_in:0.2s fade_out:0.2s stay:3s
    - narrate "<&8><&l>---------------------------------------------                      <&r><player.name> <&b><&l>WINS!<&nl><&nl>                          <&d><&l><player.flag[bridgescore]||0> <&8><&l>- <&6><&l><[opponent].flag[bridgescore]||0><&nl><&nl>                         <&d><player.name><&f>: <player.flag[bridgekills]||0> Kills<&nl>                              <&6><[opponent].name||null><&f>: <[opponent].flag[bridgekills]||0> Kills<&nl><&nl><&8><&l>---------------------------------------------" targets:<player.world.players.filter[has_flag[playingbridge]]>"
  - foreach <player.world.players.filter[has_flag[playingbridge]]> as:player:
    - inventory clear d:<[player].inventory>
    - if <player.flag[bridgeteamcolor]> == yellow:
      - teleport <player> <server.flag[bridge.arenas.<player.flag[bridgearena]>.respawn1]>
    - if <player.flag[bridgeteamcolor]> == pink:
      - teleport <player> <server.flag[bridge.arenas.<player.flag[bridgearena]>.respawn2]>
  - wait 3s
  - sidebar remove players:<player.world.players.filter[has_flag[playingbridge]]>
  - teleport <player.world.players.filter[has_flag[playingbridge]]> <server.flag[BreadBridgeLobby]>
  - schematic paste name:bridge.arenas.<player.flag[bridgearena]>.location <server.flag[bridge.arenas.<player.flag[bridgearena]>.bridgecenter]>
  - foreach <player.world.players.filter[has_flag[playingbridge]]> as:player:
    - flag <[player]> playingbridge:!
    - flag <[player]> bridgekills:!
    - flag <[player]> bridgearena:!
    - flag <[player]> bridgescore:!
    - flag <[player]> bridgeteamcolor:!


playerhealthstand:
  type: task
  debug: true
  script:
  - foreach <player.world.players.filter[has_flag[playingbridge]].filter[flag[playingbridge].is[==].to[playing]]> as:player:
    - spawn armor_stand[invulnerable=true;gravity=false;visible=true;collidable=false;custom_name=<[player].health.round_to[1]><&c>❤;custom_name_visible=true] <[player].location.add[0,0.7,0]> save:HealthStand
    - adjust <[player]> hide_entity:<entry[HealthStand].spawned_entity>
    - mount <entry[healthstand].spawned_entity>|<[player]>
    - flag <[player]> healthstand:<entry[HealthStand].spawned_entity>