Paste #67371: Untitled Paste

Date: 2020/04/12 16:39:10 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
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438


#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?

##ADD A TIMER

##SOUND EFFECT FOR WHEN ARROW IS RECHARGED?

##FIX HUNGER?

##USE TO_TITLECASE?

##CHANGE SCOREBOARD WHEN IT STARTS?

##SHOW THE SCORE IN THE LORE OF THE MAP SELECTION?

##WAIT LONGER BEFORE TELEPORTING OTHERS TO GIVE THEM A CHANCE TO JOIN NEW GAME


##CHECK FOR IF AN ARROW IS IN THE PLAYER'S INVENTORY ALREADY? OR CHECK FOR IF THEY HAVE THE FLAG <player.inventory.contains[arrow]>

##IRON BAR FOR CAGES?
bridge_solo_join_gui:
  debug: false
  type: inventory
  inventory: CHEST
  title: Play BreadBridge
  size: 36
  slots:
    - "[] [] [] [] [] [] [] [] []"
    - "[] [] [] [bridge_solo_join_game] [] [bridge_map_selector] [] [] []"
    - "[] [] [] [] [] [] [] [] []"
    - "[] [] [] [] [brclose] [] [] [] []"
bridge_solo_map_gui:
  debug: false
  type: inventory
  inventory: CHEST
  title: Play BreadBridge Duels
  size: 54
  slots:
    - "[] [] [] [] [] [] [] [] []"
    - "[] [] [] [] [] [] [] [] []"
    - "[] [] [] [] [] [] [] [] []"
    - "[] [] [] [] [] [] [] [] []"
    - "[] [] [] [] [bridge_random_map] [] [] [] []"
    - "[] [] [] [] [bridge_go_back] [] [] [] [map_selection_book]"
open_bridge_gui:
  type: assignment
  debug: false
  actions:
    on assignment:
    - trigger name:click state:true cooldown:0s
    on click:
    - inventory open d:<inventory[bridge_solo_join_gui]>
bridgesetupstart:
  debug: false
  type: command
  name: bridgesetup
  description: breadbridge
  usage: /bridgesetup
  permission: bridge.command.admin
  aliases:
  - brsetup
  tab complete:
  - if !<player.is_op||<context.server>>:
    - stop
  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]"
bridgejoin:
##CANT JOIN IN THE SAME WORLD FOR SOME REASON?
  debug: false
  type: command
  name: bridgejoin
  description: brjoin
  usage: /bridgejoin
  permission: bridge.command.join
  aliases:
  - brjoin
  tab complete:
  - if !<player.is_op||<context.server>>:
    - stop
  script:
  ##SHOULD I MAKE A FLAG MAP FOR PLAYING STATE, TEAM COLOR, ETC. RATHER THAN DIFFERENT FLAGS?
  ##INSTEAD OF USING PLAYER.WORLD, USE THE WORLD THE BRIDGEMAP IS LOCATED IN? LIKE THIS <server.flag[bridge.arenas.<player.flag[bridgearena]>.respawn1].as_location.world> IT RETURNS THE LOCATION OF A SAVED LOCATION OF A MAP THE PLAYER HAS JOINED AND IT'S WORLD
  ##THE REASON WHY I CAN'T JOIN THE ARENA IN THE SAME WORLD, IS BECAUSE THE SECOND THEY DO /BRJOIN, THEY ARE ALREADY IN THE WORLD
  - 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>]>:
          - if <server.flag[bridge.arenas.<player.flag[bridgearena]>.respawn1].as_location.world.players.filter[has_flag[playingbridge]].size> < 2:
            - flag player playingbridge:waiting
            - flag player bridgearena:<context.raw_args>
          - else:
            - narrate "<&c>This arena is full!"
        - else:
          - narrate "<&c>No arena exists by that name!"
      - else:
        - flag player bridgearena:<server.flag[BridgeArenas].random[1].separated_by[<empty>]>
        - while <server.flag[bridge.arenas.<player.flag[bridgearena]>.respawn1].as_location.world.players.filter[has_flag[playingbridge]].size> == 2:
          - flag player bridgearena:<server.flag[BridgeArenas].random[1].separated_by[<empty>]>
        - flag player playingbridge:waiting
          ##SHOULD I ADD THE SIDEBAR, OR JUST FLAG IT FOR THE ON TICK EVENT TO CATCH? FOR NOW, DON'T BECAUSE LESS LINES
      - inventory set d:<player.inventory> o:bridgelobbyinv
      # || <player.world.players.filter[has_flag[playingbridge]].filter[flag[playingbridge].is[==].to[waiting]].size> == 1 have this?
      - if <server.flag[bridge.arenas.<player.flag[bridgearena]>.respawn1].as_location.world.players.filter[has_flag[playingbridge]].filter[flag[playingbridge].is[==].to[waiting]].size> == 0:
        - 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]>
        - narrate "<player.chat_prefix.parse_color||<empty>><player.name> <&e>joined the arena (<&b><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"
      # || <player.world.players.filter[has_flag[playingbridge]].filter[flag[playingbridge].is[==].to[waiting]].size> == 2 have this?
      - else if <server.flag[bridge.arenas.<player.flag[bridgearena]>.respawn1].as_location.world.players.filter[has_flag[playingbridge]].filter[flag[playingbridge].is[==].to[waiting]].size> == 1:
        - if <server.flag[bridge.arenas.<player.flag[bridgearena]>.respawn1].as_location.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 <server.flag[bridge.arenas.<player.flag[bridgearena]>.respawn1].as_location.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]>
        - 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"
        - 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]]>
        - narrate "<player.chat_prefix.parse_color||<empty>><player.name> <&e>joined the arena (<&b><player.world.players.filter[has_flag[playingbridge]].size><&e>/<&b>2<&e>)!" targets:<player.world.players.filter[has_flag[playingbridge]]>
        - 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!"
    ##FIX THE SIDEEEEEEEEBARRRRRRRR
    ##MAKE SURE TO CHECK IF THE ARENA IS FULL OR NOT USING FILTER AND RANDOM??
brleave:
#################################DOOOOOOOOOOOOOOOOOOOOOO NOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOT                                 USEEEEEEEEEEEEEEEEEEEEEEEEEEEEE          BRLEAVE!!!!!!!!!!!!!!!!!!!!!!!!!
  debug: false
  type: command
  name: bridgeleave
  description: bridgeleave
  usage: /bridgeleave
  permission: bridge.admin.command.leave
  aliases:
  - brleave
  tab complete:
  - if !<player.is_op||<context.server>>:
    - stop
  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[bridge.arenas.<player.flag[bridgearena]>.pit1].blocks[end_portal]> air
        - modifyblock <cuboid[bridge.arenas.<player.flag[bridgearena]>.pit2].blocks[end_portal]> air
        - remove armor_stand world:<server.flag[bridge.arenas.<player.flag[bridgearena]>.respawn1].as_location.world>
      - 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[bridge.arenas.<[player].flag[bridgearena]>.cage1location].blocks> air
        #- modifyblock <cuboid[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: false
  type: command
  name: bridgecreate
  description: bridgecreate
  usage: /bridgecreate
  permission: bridge.command.admin
  aliases:
  - brcreate
  tab complete:
  - if !<player.is_op||<context.server>>:
    - stop
  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: false
  type: command
  name: bridgeremove
  description: bridgeremove
  usage: /bridgeremove
  permission: bridge.command.admin
  aliases:
  - brremove
  tab complete:
  - if !<player.is_op||<context.server>>:
    - stop
  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
    - note bridge.arenas.<context.raw_args>.void
    #just remove bridge.arenas?
    - 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: false
  type: command
  name: bridgelist
  description: bridgelist
  usage: /bridgelist
  permission: bridge.command.admin
  aliases:
  - brlist
  tab complete:
  - if !<player.is_op||<context.server>>:
    - stop
  script:
  - narrate "<&e>BreadBridge Arenas: <&a><server.flag[BridgeArenas].separated_by[<&e>, <&a>]||<&c>No Arenas!>"
bridgeregen:
  debug: false
  type: command
  name: bridgeregen
  description: bridgeregeneration
  usage: /bridgeregen
  permission: bridge.command.admin
  aliases:
  - brregen
  tab complete:
  - if !<player.is_op||<context.server>>:
    - stop
  script:
  - if <server.has_file[Bridge/<context.raw_args>]>:
    - modifyblock <cuboid[<yaml[<context.raw_args>].read[bridge.location]>]> air
brsetlobby:
  debug: false
  type: command
  name: bridgesetlobby
  description: bridgesetlobby
  usage: /bridgesetlobby
  permission: bridge.command.setlobby
  aliases:
  - brsetlobby
  tab complete:
  - if !<player.is_op||<context.server>>:
    - stop
  script:
  - narrate "<&6>Bread<&d>Bridge <&a>Lobby set!"
  - flag server BreadBridgeLobby:<player.location>
bradmin:
  debug: false
  type: command
  name: bridgeadmin
  description: bridgecreate
  usage: /bridgeadmin
  permission: bridge.command.admin
  aliases:
  - bradmin
  tab complete:
  - if !<player.is_op||<context.server>>:
    - stop
  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: false
  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: false
  material: yellow_terracotta
  display name: '<&6>Team 1'
brpink:
  type: item
  debug: false
  material: pink_terracotta
  display name: '<&c>Team 2'
brsetcage1:
  type: item
  debug: false
  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: false
  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: false
  material: barrier
  display name: '<&c>Close'
brsetbridge:
  type: item
  debug: false
  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: false
  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: false
  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: false
  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: false
  material: redstone
  display name: '<&e>Step 3'
  lore:
  - <&r>
  - <&7>Set the respawn location.
  - <&r>
  - <&a>Click to set location!
brrespawnlocation2:
  type: item
  debug: false
  material: redstone
  display name: '<&e>Step 3'
  lore:
  - <&r>
  - <&7>Set the respawn location.
  - <&r>
  - <&a>Click to set location!
brspawnlocation1:
  type: item
  debug: false
  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: false
  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: false
  material: black_stained_glass_pane
  display name: '<&r>'
#brsetlobby:
  #type: item
  #debug: false
  #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: false
  type: inventory
  inventory: CHEST
  title: Player Inventory
  size: 9
  slots:
    - "[] [] [] [] [] [] [] [] [bridgereturntolobby]"
bridgepinkteaminv:
  debug: false
  type: inventory
  inventory: CHEST
  title: Player Inventory
  size: 9
  slots:
    - "[bridgebreadsword] [bridgebow] [bridgepic] [pink_terracotta[quantity=64]] [pink_terracotta[quantity=64]] [goldenbread] [] [] []"
bridgeyellowteaminv:
  debug: false
  type: inventory
  inventory: CHEST
  title: Player Inventory
  size: 9
  slots:
    - "[bridgebreadsword] [bridgebow] [bridgepic] [yellow_terracotta[quantity=64]] [yellow_terracotta[quantity=64]] [goldenbread] [] [] []"
    #should we have black panes for the empty spots?
bridgereturntolobby:
  type: item
  debug: false
  material: red_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: false
  material: iron_sword
  display name: '<&e>Sharp Baguette'
  lore:
  - <&r>
  - <&7>wui
  mechanisms:
    unbreakable: true
bridgebow:
  type: item
  debug: false
  material: bow
  display name: '<&f>Bow'
  lore:
  - <&r>
  - <&7>Pew pew
  mechanisms:
    unbreakable: true
bridgepic:
  type: item
  debug: false
  material: diamond_pickaxe
  display name: '<&b>Diamond Pickaxe'
  lore:
  - <&r>
  - <&7>Shiny
  enchantments:
  - efficiency:2
  mechanisms:
    unbreakable: true
bridgeyellowterracotta:
  type: item
  debug: false
  material: yellow_terracotta[quantity=64]
  display name: '<&f>Yellow Terracotta'
  lore:
  - <&r>
  - <&7>Build, build, build!
bridgepinkterracotta:
  type: item
  debug: false
  material: pink_terracotta[quantity=64]
  display name: '<&f>Pink Terracotta'
  lore:
  - <&r>
  - <&7>Build, build, build!
goldenbread:
  type: item
  debug: false
  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: false
  material: shield
  display name: '<&7>Ryeot Shield'
  lore:
  - <&r>
  - <&7>The shield of heroes!
map_selection_book:
  type: item
  debug: false
  material: book
  display name: '<&a>Map Selection'
bridge_go_back:
  type: item
  debug: false
  material: arrow
  display name: '<&a>Go Back'
bridge_random_map:
  type: item
  debug: false
  material: FIREWORK_ROCKET
  display name: '<&a>Random Map'
  lore:
  - <&8>Duels
bridge_map_selector:
  type: item
  debug: false
  material: oak_sign
  display name: '<&a>Map Selector'
bridge_solo_join_game:
  type: item
  material: bread
  display name: <&6>Bread<&d>Bridge<&sp><&7>(Duels)
  mechanisms:
    flags: HIDE_ALL
  enchantments:
  - sharpness:1
  lore:
  - <&7>Play BreadBridge Duels
brsetup:
  type: world
  debug: false
  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
      #i don't think it's a good idea for the schematic and flag to have the same save name
      - 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>
      - note <cuboid[<player.we_selection.center.add[60,-9,60]>|<player.we_selection.center.add[-60,-30,-60]>]> as:bridge.arenas.<player.flag[bridgearenaselection]>.void
        #do i need to specify the points if im adding the same amount?
      #- 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 <--- this is dumb, because then only half of the people's flags,etc will be affected
    - foreach <server.list_online_players.filter[has_flag[playingbridge]].filter[flag[bridgeteamcolor].is[==].to[yellow]]> as:player:
      - modifyblock <cuboid[bridge.arenas.<[player].flag[bridgearena]>.pit1].blocks[end_portal]> air
      - modifyblock <cuboid[bridge.arenas.<[player].flag[bridgearena]>.pit2].blocks[end_portal]> air
      - modifyblock <cuboid[bridge.arenas.<[player].flag[bridgearena]>.cage1location].blocks> air
      - modifyblock <cuboid[bridge.arenas.<[player].flag[bridgearena]>.cage2location].blocks> air
      - remove armor_stand world:<server.flag[bridge.arenas.<player.flag[bridgearena]>.respawn1].as_location.world>
      - schematic paste name:bridge.arenas.<player.flag[bridgearena]>.location <server.flag[bridge.arenas.<player.flag[bridgearena]>.bridgecenter]>
    - foreach <server.list_online_players.filter[has_flag[playingbridge]]> as:player:
      - inventory clear d:<[player].inventory>
      - sidebar remove players:<[player]>
      - teleport <[player]> <server.flag[BreadBridgeLobby]>
      - flag <[player]> playingbridge:!
      - flag <[player]> bridgescore:!
      - flag <[player]> bridgeteamcolor:!
      - flag <[player]> bridgekills:!
      - flag <[player]> bridgearena:!
    on server start:
    - if <server.has_flag[bridgearenas]>:
      - foreach <server.flag[bridgearenas]> as:arena:
        - if !<schematic.list.contains[bridge.arenas.<[arena]>.cage1]>:
          - schematic load name:bridge.arenas.<[arena]>.cage1
        - if !<schematic.list.contains[bridge.arenas.<[arena]>.cage2]>:
          - schematic load name:bridge.arenas.<[arena]>.cage2
        - if !<schematic.list.contains[bridge.arenas.<[arena]>.location]>:
          - schematic load name:bridge.arenas.<[arena]>.location
          #do i really need to check?
brgameplay:
  type: world
  debug: false
  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]>]>:
          - wait 2t
          - 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]>]>:
          - wait 2t
          - 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]> && <context.material> != <material[white_terracotta]> || !<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
      - adjust <player> clear_body_arrows
      - flag player playingbridge:!
      - if <player.world.players.filter[has_flag[playingbridge]].size> == 1:
        - modifyblock <cuboid[bridge.arenas.<player.flag[bridgearena]>.pit1].blocks[end_portal]> air
        - modifyblock <cuboid[bridge.arenas.<player.flag[bridgearena]>.pit2].blocks[end_portal]> air
        - remove armor_stand world:<server.flag[bridge.arenas.<player.flag[bridgearena]>.respawn1].as_location.world>
      - 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
          - firework <server.flag[bridge.arenas.<[player].flag[bridgearena]>.bridgecenter].as_location.add[0,10,0]> primary:<color[255,185,0]> fade:<color[255,100,255]> trail
        - 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
          - firework <server.flag[bridge.arenas.<[player].flag[bridgearena]>.bridgecenter].as_location.add[0,10,0]> primary:<color[255,100,255]> fade:<color[255,185,0]> trail
      #should i change <player.name> to "You Won!"?
        - inventory clear d:<[player].inventory>
        - adjust <[player]> clear_body_arrows
        - adjust <[player]> remove_effects
        - 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]>
        - playsound <player.world.players.filter[has_flag[playingbridge]]> sound:ENTITY_PLAYER_LEVELUP
        - 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]]>
      - narrate "<player.chat_prefix.parse_color||<empty>><player.name> <&e>has quit (<&b><player.world.players.filter[has_flag[playingbridge]].size><&e>/<&b>2<&e>)!" targets:<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,1,100,false,true,true|ABSORPTION,0,2400,false,true,true
    on player right clicks with goldenbread:
    - wait 1t
    - animate <player> animation:START_USE_MAINHAND_ITEM
    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:++
      - playsound <context.damager> sound:ENTITY_EXPERIENCE_ORB_PICKUP
      - sidebar set_line scores:4 "values:<&f>Kills: <&f><context.damager.flag[bridgekills]>" players:<context.damager>
      - playsound <context.entity> sound:ENTITY_PLAYER_HURT
      - 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]]>
        - inventory set d:<context.entity.inventory> o:bridgeyellowteaminv
        - if !<context.entity.has_flag[exp_countdown]> || !<context.entity.inventory.contains[arrow]>:
          - give arrow quantity:1 to:<context.entity.inventory> slot:9
        - 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]]>
        - inventory set d:<context.entity.inventory> o:bridgepinkteaminv
        - if !<context.entity.has_flag[exp_countdown]> || !<context.entity.inventory.contains[arrow]>:
          - give arrow quantity:1 to:<context.entity.inventory> slot:9
        - teleport <context.entity> <server.flag[bridge.arenas.<player.flag[bridgearena]>.respawn2]>
    on player shoots bow:
    - if <player.flag[playingbridge]||null> == playing:
      - inject exp_countdown
      - give arrow quantity:1 slot:9
    on player picks up item:
    - if <player.flag[playingbridge]||null> == playing:
      - determine cancelled
    on player clicks leather_boots|leather_leggings|leather_chestplate|leather_helmet in inventory:
    - 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
        - adjust <player> clear_body_arrows
        - flag player playingbridge:!
        - if <player.world.players.filter[has_flag[playingbridge]].size> == 1:
          - modifyblock <cuboid[bridge.arenas.<player.flag[bridgearena]>.pit1].blocks[end_portal]> air
          - modifyblock <cuboid[bridge.arenas.<player.flag[bridgearena]>.pit2].blocks[end_portal]> air
          - remove armor_stand world:<server.flag[bridge.arenas.<player.flag[bridgearena]>.respawn1].as_location.world>
          #just making sure it's the right world, in case they remove the spawn's armor stands
        - modifyblock <cuboid[bridge.arenas.<[player].flag[bridgearena]>.cage1location].blocks> air
        - modifyblock <cuboid[bridge.arenas.<[player].flag[bridgearena]>.cage2location].blocks> 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
            - firework <server.flag[bridge.arenas.<player.flag[bridgearena]>.bridgecenter].as_location.add[0,10,0]> primary:<color[255,185,0]> fade:<color[255,100,255]> trail
          - 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
            - firework <server.flag[bridge.arenas.<player.flag[bridgearena]>.bridgecenter].as_location.add[0,10,0]> primary:<color[255,100,255]> fade:<color[255,185,0]> trail
          #should i change <player.name> to "You Won!"?
          - adjust <[player]> clear_body_arrows
          - inventory clear d:<[player].inventory>
          - adjust <[player]> remove_effects
          - 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]>
          - schematic paste name:bridge.arenas.<[player].flag[bridgearena]>.location <server.flag[bridge.arenas.<[player].flag[bridgearena]>.bridgecenter]>
          - playsound <player.world.players.filter[has_flag[playingbridge]]> sound:ENTITY_PLAYER_LEVELUP
          - wait 3s
          - sidebar remove players:<[player].world.players.filter[has_flag[playingbridge]]>
          - teleport <[player].world.players.filter[has_flag[playingbridge]]> <server.flag[BreadBridgeLobby]>
          - flag <[player]> playingbridge:!
          - flag <[player]> bridgekills:!
          - flag <[player]> bridgearena:!
          - flag <[player]> bridgescore:!
          - flag <[player]> bridgeteamcolor:!
      - else if <player.flag[playingbridge]> == waiting:
        - inventory clear d:<player.inventory>
        - sidebar remove
        - flag player playingbridge:!
        - if <player.world.players.filter[has_flag[playingbridge]].size> == 1:
          - modifyblock <cuboid[bridge.arenas.<player.flag[bridgearena]>.pit1].blocks[end_portal]> air
          - modifyblock <cuboid[bridge.arenas.<player.flag[bridgearena]>.pit2].blocks[end_portal]> air
          - remove armor_stand world:<server.flag[bridge.arenas.<player.flag[bridgearena]>.respawn1].as_location.world>
          - 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]]>
          - narrate "<player.chat_prefix.parse_color||<empty>><player.name> <&e>has quit (<&b><player.world.players.filter[has_flag[playingbridge]].size><&e>/<&b>2<&e>)!" targets:<player.world.players.filter[has_flag[playingbridge]]>
        - 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:!
        #setting lobby to normal even though not affected, just in case
    ##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]]>
      - narrate "<player.chat_prefix.parse_color||<empty>><player.name> <&e>has quit (<&b><player.world.players.filter[has_flag[playingbridge]].size><&e>/<&b>2<&e>)!" targets:<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
    on player right clicks *trapdoor:
    - if <player.has_flag[playingbridge]>:
      - determine cancelled
    on player opens bridge_solo_map_gui:
    - foreach <server.flag[BridgeArenas]> as:arena:
      - inventory set d:<context.inventory> o:paper[display_name=<&a><[arena]>;lore=<&8>Duels] slot:<server.flag[BridgeArenas].find[<[arena]>].add[10]>
    on player clicks bridge_go_back in bridge_solo_map_gui:
    - inventory open d:<inventory[bridge_solo_join_gui]>
    on player clicks brclose in bridge_solo_join_gui:
    - inventory close
    ##make join game go to the first available one, and random go to random?
    on player clicks bridge_solo_join_game in bridge_solo_join_gui:
    - if <player.flag[playingbridge]||null> == null:
      - if <server.flag[BridgeArenas]||null> != null:
        - foreach <server.flag[BridgeArenas].random[<server.flag[BridgeArenas].size>]> as:arena:
          - if <server.flag[bridge.arenas.<[arena]>.respawn1].as_location.world.players.filter[has_flag[playingbridge]].size> < 2:
            - flag player playingbridge:waiting
            - flag player bridgearena:<[arena]>
            - foreach stop
        - if <player.flag[bridgearena]||null> != null:
          - inject bridge_joingame
        - else:
          - narrate "<&c>All arenas are full!"
      - else:
        - narrate "<&c>No arenas have been created!"
    - else:
      - narrate "<&c>You're already in a match!"
    on player clicks bridge_random_map in bridge_solo_map_gui:
    - if <player.flag[playingbridge]||null> == null:
      - if <server.flag[BridgeArenas]||null> != null:
        - foreach <server.flag[BridgeArenas].random[<server.flag[BridgeArenas].size>]> as:arena:
          - if <server.flag[bridge.arenas.<[arena]>.respawn1].as_location.world.players.filter[has_flag[playingbridge]].size> < 2:
            - flag player playingbridge:waiting
            - flag player bridgearena:<[arena]>
            - foreach stop
        - if <player.flag[bridgearena]||null> != null:
          - inject bridge_joingame
        - else:
          - narrate "<&c>All arenas are full!"
      - else:
        - narrate "<&c>No arenas have been created!"
    - else:
      - narrate "<&c>You're already in a match!"
    on player clicks paper in bridge_solo_map_gui:
    - if <player.flag[playingbridge]||null> == null:
      - if <server.flag[BridgeArenas]||null> != null:
        - if <server.flag[bridge.arenas.<context.item.display.strip_color>.respawn1].as_location.world.players.filter[has_flag[playingbridge]].size> < 2:
          - flag player playingbridge:waiting
          - flag player bridgearena:<context.item.display.strip_color>
        - else:
          - flag player bridgearena:!
          - narrate "<&c>The arena is full!"
          - stop
        - inject bridge_joingame
      - else:
        - narrate "<&c>No arenas have been created!"
    - else:
      - narrate "<&c>You're already in a match!"
    on player clicks bridge_map_selector in bridge_solo_join_gui:
    - inventory open d:<inventory[bridge_solo_map_gui]>
    on player clicks in bridge_solo_map_gui priority:10000:
    - determine cancelled
    on player clicks in bridge_solo_join_gui priority:10000:
    - determine cancelled
exp_countdown:
  type: task
  debug: false
  script:
    #- repeat 20:
      #- adjust <player> fake_experience:<>|0
    #- wait 3t
  - flag player exp_countdown
  - repeat 60:
    - define num <element[100].sub[<[value].mul[1.67]>].div[100]>
    - if <[value]> >= 0 && <[value]> < 20:
      - adjust <player> fake_experience:<[num]>|3
    - if <[value]> >= 20 && <[value]> < 40:
      - adjust <player> fake_experience:<[num]>|2
    - if <[value]> >= 40 && <[value]> < 60:
      - adjust <player> fake_experience:<[num]>|1
    - if <[value]> == 60:
      - adjust <player> fake_experience
    - wait 1t
  - flag player exp_countdown:!
#run 30 times with 2 tick waits, or 60 times with 1 tick?
 # 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: false
  events:
  #specify if the player was hit or shot into the void using context.cause?
    on player enters notable cuboid:
    - if <player.has_flag[playingbridge]>:
      - if <context.cuboids.contains[<cuboid[bridge.arenas.<player.flag[bridgearena]>.void]>]>:
        - if <player.flag[bridgeteamcolor]> == yellow:
          - if <player.flag[playingbridge]> == playing:
            - if <player.has_flag[bridgehit]>:
              - flag <player[<player.flag[bridgehit]>]> bridgekills:++
              - playsound <player[<player.flag[bridgehit]>]> sound:ENTITY_EXPERIENCE_ORB_PICKUP
              - sidebar set_line scores:4 "values:<&f>Kills: <&f><player[<player.flag[bridgehit]>].flag[bridgekills]>" players:<player[<player.flag[bridgehit]>]>
              - playsound <player> sound:ENTITY_PLAYER_HURT
              - 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:
              - playsound <player> sound:ENTITY_PLAYER_HURT
              - 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:!
            - playsound <player> sound:ENTITY_PLAYER_HURT
            - inventory set d:<player> o:bridgeyellowteaminv
            - if !<player.has_flag[exp_countdown]> || !<player.inventory.contains[arrow]>:
              - give arrow quantity:1 to:<player.inventory> slot:9
          - 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:++
              - playsound <player[<player.flag[bridgehit]>]> sound:ENTITY_EXPERIENCE_ORB_PICKUP
              - sidebar set_line scores:4 "values:<&f>Kills: <&f><player[<player.flag[bridgehit]>].flag[bridgekills]>" players:<player[<player.flag[bridgehit]>]>
              - playsound <player> sound:ENTITY_PLAYER_HURT
              - 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:
              - playsound <player> sound:ENTITY_PLAYER_HURT
              - 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:!
            - playsound <player> sound:ENTITY_PLAYER_HURT
            - inventory set d:<player> o:bridgepinkteaminv
            - if !<player.has_flag[exp_countdown]> || !<player.inventory.contains[arrow]>:
              - give arrow quantity:1 to:<player.inventory> slot:9
          - teleport <player> <server.flag[bridge.arenas.<player.flag[bridgearena]>.respawn2]>
          - health <player> heal 20
bridgestartgame:
  type: task
  debug: false
  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
      - playsound <player.world.players.filter[has_flag[playingbridge]]> sound:BLOCK_NOTE_BLOCK_HAT
      - wait 1s
    - else:
      - title title:<red>CANCELLED! targets:<player.world.players.filter[has_flag[playingbridge]]> fade_in:0s fade_out:0s
      - playsound <player.world.players.filter[has_flag[playingbridge]]> sound:ENTITY_VILLAGER_NO pitch:1
      - 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]>
    #the armor stand commands don't necessarily have to be in the foreach commabd
    - 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
        - give arrow quantity:1 to:<[player].inventory> slot:9
        #- fakeitem bread[display_name=<&6>Baguette] slot:<player.inventory.find.scriptname[bridgebreadsword]>
        - define pinkteam <player.world.players.filter[has_flag[bridgeteamcolor]].filter[flag[bridgeteamcolor].is[==].to[pink]].get[1]>
        - spawn ARMOR_STAND[custom_name=<&6><&l>Your<&sp>Goal;custom_name_visibility=true;gravity=false;collidable=false;invulnerable=true;visible=false] <cuboid[bridge.arenas.<player.flag[bridgearena]>.pit1].center> save:holo1
        - adjust <[pinkteam]> hide_entity:<entry[holo1].spawned_entity>
        - spawn ARMOR_STAND[custom_name=<&7><&o>Defend!;custom_name_visibility=true;gravity=false;collidable=false;invulnerable=true;visible=false] <entry[holo1].spawned_entity.location.sub[0,0.4,0]> save:holo2
        - adjust <[pinkteam]> hide_entity:<entry[holo2].spawned_entity>
        - spawn ARMOR_STAND[custom_name=<&d><&l>Pink<&sp>Goal;custom_name_visibility=true;gravity=false;collidable=false;invulnerable=true;visible=false] <cuboid[bridge.arenas.<player.flag[bridgearena]>.pit2].center> save:holo3
        - adjust <[pinkteam]> hide_entity:<entry[holo3].spawned_entity>
        - spawn ARMOR_STAND[custom_name=<&e><&o>Jump<&sp>in<&sp>to<&sp>score!;custom_name_visibility=true;gravity=false;collidable=false;invulnerable=true;visible=false] <entry[holo3].spawned_entity.location.sub[0,0.4,0]> save:holo4
        - adjust <[pinkteam]> hide_entity:<entry[holo4].spawned_entity>
      - 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
        - give arrow quantity:1 to:<[player].inventory> slot:9
        #- fakeitem bread[display_name=<&d>Baguette] slot:<player.inventory.find.scriptname[bridgebreadsword]>
        - define yellowteam <player.world.players.filter[has_flag[bridgeteamcolor]].filter[flag[bridgeteamcolor].is[==].to[yellow]].get[1]>
        - spawn ARMOR_STAND[custom_name=<&d><&l>Your<&sp>Goal;custom_name_visibility=true;gravity=false;collidable=false;invulnerable=true;visible=false] <cuboid[bridge.arenas.<player.flag[bridgearena]>.pit2].center> save:holo1
        - adjust <[yellowteam]> hide_entity:<entry[holo1].spawned_entity>
        - spawn ARMOR_STAND[custom_name=<&7><&o>Defend!;custom_name_visibility=true;gravity=false;collidable=false;invulnerable=true;visible=false] <entry[holo1].spawned_entity.location.sub[0,0.4,0]> save:holo2
        - adjust <[yellowteam]> hide_entity:<entry[holo2].spawned_entity>
        - spawn ARMOR_STAND[custom_name=<&6><&l>Gold<&sp>Goal;custom_name_visibility=true;gravity=false;collidable=false;invulnerable=true;visible=false] <cuboid[bridge.arenas.<player.flag[bridgearena]>.pit1].center> save:holo3
        - adjust <[yellowteam]> hide_entity:<entry[holo3].spawned_entity>
        - spawn ARMOR_STAND[custom_name=<&e><&o>Jump<&sp>in<&sp>to<&sp>score!;custom_name_visibility=true;gravity=false;collidable=false;invulnerable=true;visible=false] <entry[holo3].spawned_entity.location.sub[0,0.4,0]> save:holo4
        - adjust <[yellowteam]> hide_entity:<entry[holo4].spawned_entity>
    - modifyblock <cuboid[bridge.arenas.<player.flag[bridgearena]>.pit1].blocks[air]> end_portal
    - modifyblock <cuboid[bridge.arenas.<player.flag[bridgearena]>.pit2].blocks[air]> end_portal
  ##armor stand - should i flag armor stand locations to specifically only remove those armor stands instead of removing all the armor stands in that world?
  ##armor stand
    - 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
        - playsound <player.world.players.filter[has_flag[playingbridge]]> sound:ENTITY_VILLAGER_NO pitch:1
        #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 subtitle:<green>Fight! 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:BLOCK_NOTE_BLOCK_PLING
   ####################- 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
    - playsound <player.world.players.filter[has_flag[playingbridge]]> sound:ENTITY_VILLAGER_NO pitch:1
    - 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: false
  script:
  ##SHOULD I HAVE A WAIT BEFORE THIS? LIKE ONE SECOND?
  #should i make the score less than or equal to 5, so that it narrates when a player scored final time too or no?
  - 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.has_flag[exp_countdown]> || !<player.inventory.contains[arrow]>:
          - give arrow quantity:1 to:<[player].inventory> slot:9
      - if <[player].flag[bridgeteamcolor]> == pink:
        - inventory set d:<[player].inventory> o:bridgepinkteaminv
        - if !<player.has_flag[exp_countdown]> || !<player.inventory.contains[arrow]>:
          - give arrow quantity:1 to:<[player].inventory> slot:9
    - 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
        - firework <server.flag[bridge.arenas.<player.flag[bridgearena]>.bridgecenter].as_location.add[0,10,0]> primary:<color[255,185,0]> fade:<color[255,100,255]> trail
      - 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
        - firework <server.flag[bridge.arenas.<player.flag[bridgearena]>.bridgecenter].as_location.add[0,10,0]> primary:<color[255,100,255]> fade:<color[255,185,0]> trail
          #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 subtitle:<green>Fight! 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:BLOCK_NOTE_BLOCK_PLING
    - 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 subtitle:<green>Fight! 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:BLOCK_NOTE_BLOCK_PLING
  - else if <player.flag[bridgescore]> == 5:
    - inject bridge_endgame

#hypixel uses this for cage sounds /ex playsound <player> sound:BLOCK_NOTE_BLOCK_XYLOPHONE
bridge_endgame:
  type: task
  debug: false
  script:
  - foreach <player.world.players.filter[has_flag[playingbridge]]> as:player:
    - flag <[player]> playingbridge:waiting
    - health <[player]> heal 20
    - adjust <[player]> clear_body_arrows
  - modifyblock <cuboid[bridge.arenas.<player.flag[bridgearena]>.pit1].blocks[end_portal]> air
  - modifyblock <cuboid[bridge.arenas.<player.flag[bridgearena]>.pit2].blocks[end_portal]> air
  - remove armor_stand world:<server.flag[bridge.arenas.<player.flag[bridgearena]>.respawn1].as_location.world>
  - if <player.flag[bridgeteamcolor]> == yellow:
    - define opponent <player.world.players.filter[has_flag[bridgeteamcolor]].filter[flag[bridgeteamcolor].is[==].to[pink]].get[1]>
    - title "title:<&6><player.name> Won!" targets:<player.world.players.filter[has_flag[playingbridge]]> fade_in:0.2s fade_out:0.2s stay:3s
    - firework <server.flag[bridge.arenas.<player.flag[bridgearena]>.bridgecenter].as_location.add[0,10,0]> primary:<color[255,185,0]> fade:<color[255,100,255]> trail
    #####SHOULD I ADD WHERE IT SAYS 1 KILL AND WHEN IT SAYS KILLS
    ####################I FEEL LIKE THERE'S A MUCH MORE EFFICIENT WAY...
    - if <player.flag[bridgekills]> == 1 && <[opponent].flag[bridgekills]||0> == 1:
    #should i just put 1 instead of <player.flag[bridgekills]> ?
    #narrate as different commands?
      - narrate "<&8><&l>---------------------------------------------<&nl><&nl>                   <&r><player.chat_prefix.parse_color||<empty>><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> kill<&nl>                           <&d><[opponent].name||null><&f>: <[opponent].flag[bridgekills]||0> kill<&nl><&nl><&8><&l>---------------------------------------------" targets:<player.world.players.filter[has_flag[playingbridge]]>
    - else if <player.flag[bridgekills]> == 1 && <[opponent].flag[bridgekills]||0> != 1:
      - narrate "<&8><&l>---------------------------------------------<&nl><&nl>                   <&r><player.chat_prefix.parse_color||<empty>><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> kill<&nl>                           <&d><[opponent].name||null><&f>: <[opponent].flag[bridgekills]||0> kills<&nl><&nl><&8><&l>---------------------------------------------" targets:<player.world.players.filter[has_flag[playingbridge]]>
    - else if <[opponent].flag[bridgekills]> == 1 && <player.flag[bridgekills]||0> != 1:
      - narrate "<&8><&l>---------------------------------------------<&nl><&nl>                   <&r><player.chat_prefix.parse_color||<empty>><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> kill<&nl><&nl><&8><&l>---------------------------------------------" targets:<player.world.players.filter[has_flag[playingbridge]]>
    - else:
      - narrate "<&8><&l>---------------------------------------------<&nl><&nl>                   <&r><player.chat_prefix.parse_color||<empty>><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]].get[1]>
    - title "title:<&d><player.name> Won!" targets:<player.world.players.filter[has_flag[playingbridge]]> fade_in:0.2s fade_out:0.2s stay:3s
    - firework <server.flag[bridge.arenas.<player.flag[bridgearena]>.bridgecenter].as_location.add[0,10,0]> primary:<color[255,100,255]> fade:<color[255,185,0]> trail
    - if <player.flag[bridgekills]> == 1 && <[opponent].flag[bridgekills]||0> == 1:
      - narrate "<&8><&l>---------------------------------------------<&nl><&nl>                   <&r><player.chat_prefix.parse_color||<empty>><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> kill<&nl>                          <&6><[opponent].name||null><&f>: <[opponent].flag[bridgekills]||0> kill<&nl><&nl><&8><&l>---------------------------------------------" targets:<player.world.players.filter[has_flag[playingbridge]]>
    - else if <player.flag[bridgekills]> == 1 && <[opponent].flag[bridgekills]||0> != 1:
      - narrate "<&8><&l>---------------------------------------------<&nl><&nl>                   <&r><player.chat_prefix.parse_color||<empty>><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> kill<&nl>                          <&6><[opponent].name||null><&f>: <[opponent].flag[bridgekills]||0> kills<&nl><&nl><&8><&l>---------------------------------------------" targets:<player.world.players.filter[has_flag[playingbridge]]>
    - else if <[opponent].flag[bridgekills]> == 1 && <player.flag[bridgekills]||0> != 1:
      - narrate "<&8><&l>---------------------------------------------<&nl><&nl>                   <&r><player.chat_prefix.parse_color||<empty>><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> kill<&nl><&nl><&8><&l>---------------------------------------------" targets:<player.world.players.filter[has_flag[playingbridge]]>
    - else:
      - narrate "<&8><&l>---------------------------------------------<&nl><&nl>                   <&r><player.chat_prefix.parse_color||<empty>><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]]>
  ##how does this work?
  - foreach <player.world.players.filter[has_flag[playingbridge]]> as:player:
    - inventory clear d:<[player].inventory>
    - adjust <[player]> remove_effects
    - 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]>
  - playsound <player.world.players.filter[has_flag[playingbridge]]> sound:ENTITY_PLAYER_LEVELUP
  - wait 3s
  - sidebar remove players:<player.world.players.filter[has_flag[playingbridge]]>
  #should i have it in the same tag as when the flags are removed?
  - 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: false
  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=false;collidable=false;custom_name=<[player].health.round_to[1]><&c>❤;custom_name_visible=false] <[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>

#should i widen the holograms even more? hypixel has it more... 0.3 and 0.4 look good holographic displays have it much closer
bridge_pit_text:
  type: task
  debug: false
  script:
  - foreach <player.world.players.filter[has_flag[playingbridge]]> as:player:
    - if <[player].flag[bridgeteamcolor]> == yellow:
      - spawn ARMOR_STAND[custom_name=<&6>Your<&sp>Goal;custom_name_visibility=true;gravity=false;collidable=false;invulnerable=true;visible=false] <cuboid[bridge.arenas.<player.flag[bridgearena]>.pit1].center> save:holo1
      - adjust <player.world.players.filter[has_flag[bridgeteamcolor]].filter[flag[bridgeteamcolor].is[==].to[pink]].get[1]> hide_entity:<entry[holo1].spawned_entity>
      - spawn ARMOR_STAND[custom_name=<&7><&o>Defend!;custom_name_visibility=true;gravity=false;collidable=false;invulnerable=true;visible=false] <entry[holo1].spawned_entity.location.sub[0,0.4,0]> save:holo2
      - adjust <player.world.players.filter[has_flag[bridgeteamcolor]].filter[flag[bridgeteamcolor].is[==].to[pink]].get[1]> hide_entity:<entry[holo2].spawned_entity>
      - spawn ARMOR_STAND[custom_name=<&d>Opponent<&sp>Goal;custom_name_visibility=true;gravity=false;collidable=false;invulnerable=true;visible=false] <cuboid[bridge.arenas.<player.flag[bridgearena]>.pit2].center> save:holo3
      - adjust <player.world.players.filter[has_flag[bridgeteamcolor]].filter[flag[bridgeteamcolor].is[==].to[pink]].get[1]> hide_entity:<entry[holo3].spawned_entity>
      - spawn ARMOR_STAND[custom_name=<&o>Jump<&sp>in!;custom_name_visibility=true;gravity=false;collidable=false;invulnerable=true;visible=false] <entry[holo3].spawned_entity.location.sub[0,0.4,0]> save:holo4
      - adjust <player.world.players.filter[has_flag[bridgeteamcolor]].filter[flag[bridgeteamcolor].is[==].to[pink]].get[1]> hide_entity:<entry[holo4].spawned_entity>
    - if <[player].flag[bridgeteamcolor]> == pink:
      - spawn ARMOR_STAND[custom_name=<&d>Your<&sp>Goal;custom_name_visibility=true;gravity=false;collidable=false;invulnerable=true;visible=false] <cuboid[bridge.arenas.<player.flag[bridgearena]>.pit2].center> save:holo1
      - adjust <player.world.players.filter[has_flag[bridgeteamcolor]].filter[flag[bridgeteamcolor].is[==].to[yellow]].get[1]> hide_entity:<entry[holo1].spawned_entity>
      - spawn ARMOR_STAND[custom_name=<&7><&o>Defend!;custom_name_visibility=true;gravity=false;collidable=false;invulnerable=true;visible=false] <entry[holo1].spawned_entity.location.sub[0,0.4,0]> save:holo2
      - adjust <player.world.players.filter[has_flag[bridgeteamcolor]].filter[flag[bridgeteamcolor].is[==].to[yellow]].get[1]> hide_entity:<entry[holo2].spawned_entity>
      - spawn ARMOR_STAND[custom_name=<&6>Opponent<&sp>Goal;custom_name_visibility=true;gravity=false;collidable=false;invulnerable=true;visible=false] <cuboid[bridge.arenas.<player.flag[bridgearena]>.pit1].center> save:holo3
      - adjust <player.world.players.filter[has_flag[bridgeteamcolor]].filter[flag[bridgeteamcolor].is[==].to[yellow]].get[1]> hide_entity:<entry[holo3].spawned_entity>
      - spawn ARMOR_STAND[custom_name=<&o>Jump<&sp>in!;custom_name_visibility=true;gravity=false;collidable=false;invulnerable=true;visible=false] <entry[holo3].spawned_entity.location.sub[0,0.4,0]> save:holo4
      - adjust <player.world.players.filter[has_flag[bridgeteamcolor]].filter[flag[bridgeteamcolor].is[==].to[yellow]].get[1]> hide_entity:<entry[holo4].spawned_entity>

bridge_joingame:
  type: task
  debug: false
  script:
  - inventory set d:<player.inventory> o:bridgelobbyinv
   #|| <player.world.players.filter[has_flag[playingbridge]].filter[flag[playingbridge].is[==].to[waiting]].size> == 1
  - if <server.flag[bridge.arenas.<player.flag[bridgearena]>.respawn1].as_location.world.players.filter[has_flag[playingbridge]].filter[flag[playingbridge].is[==].to[waiting]].size> == 0:
    - 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]>
    - narrate "<player.chat_prefix.parse_color||<empty>><player.name> <&e>joined the arena (<&b><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"
    # || <player.world.players.filter[has_flag[playingbridge]].filter[flag[playingbridge].is[==].to[waiting]].size> == 2
  - else if <server.flag[bridge.arenas.<player.flag[bridgearena]>.respawn1].as_location.world.players.filter[has_flag[playingbridge]].filter[flag[playingbridge].is[==].to[waiting]].size> == 1:
    - if <server.flag[bridge.arenas.<player.flag[bridgearena]>.respawn1].as_location.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 <server.flag[bridge.arenas.<player.flag[bridgearena]>.respawn1].as_location.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]>
    - 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"
    - 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]]>
    - narrate "<player.chat_prefix.parse_color||<empty>><player.name> <&e>joined the arena (<&b><player.world.players.filter[has_flag[playingbridge]].size><&e>/<&b>2<&e>)!" targets:<player.world.players.filter[has_flag[playingbridge]]>
    - 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