- D1 Meta Docs - Denizen Script -
Home Page / Pi to one million places / Contact mcmonkey / Donate / Paste Scripts / Denizen Help /
You are browsing as a guest.
Login | Register








The script repo is an archive of historical scripts. For modern scripts, or to post your own, please use the Scripts forum section.





Staff Pick: Teams


By Mwthorn
Created: 2016/02/11 14:56:45 UTC-08:00 (8 years and 316 days ago)
Edited: 2016/09/15 02:53:59 UTC-07:00 (8 years and 99 days ago)
Likes: 1

Staff pick as of: 2016/02/11 14:58:26 UTC-08:00 (8 years and 316 days ago)
Denizen Version: 0.9.7-SNAPSHOT (Build 460)
Script Version: 3
Description:

Teams created by Mwthorn

Created your own teams and parties. Manage your team with a shared bank and stats to show-off in top ranks.

Friendlyfire is off and there is included a fancy menu system if you also install another script called ThornChat (I'll get that on later)

This script also includes a language config to easily fit in for your language on your server! You can also specefy other stuff such as maximum members on each team.

This is just a start-up version, but I'll hopefully (eventually) add a few more features and fixes here and there.

Credits to both Blackcoyote and Fortifier for helping out :)

1.1 Changes:
- Fixed a BUNCH of stuff, more like it now should work.
- Now includes a menu with /team
- Promote, rename, top and kick commands added
- Rank kills/color-system (kills to get a higher rank)

3 Changes:
- Added webget update
- Added hotfixes and bug fixes


Download script | View raw script
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
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
104500

### Flags
# Teams_Groups:
# Teams_Group_Name_Kills:
# Teams_Group_Name_Deaths:
# Teams_Group_Name_Rank:
# Teams_Group_Name_Members:
# Teams_Group_Name_Leaders:
# Teams_Group_Name_Created:
# Teams_Group_Name_Bank:
# Teams_Player_Group:
# Teams_Player_Menu_Respond:
# Teams_Player_Pending:
# Teams_Player_Chat:
 
# <s@Teams_Data.yaml_key[config.ranks.color.1]>
Teams_Version:
    type: version
    name: Teams
    id: 87
    description: Allows teaming up with other players.
    version: 3
    
Teams_Data:
    type: yaml data
    config:
        ranks:
            kills:
                "1": 500
                "2": 1250
                "3": 2000
                "4": 10000
                "5": 50000
                "6": 100000
            colors:
                "1""&7"
                "2""&9"
                "3""&6"
                "4""&b"
                "5""&a"
                "6""&c"
        chat_system"true"
        # TODO
        namemaxlength: 10
        nameminlength: 2
        maxmembers: 8
        commands: 
            main"team"
            args:
                help"help"
                create"create"
                info"info"
                leave"leave"
                top"top"
                accept"accept"
                deny"deny"
                invite"invite"
                deposit"deposit"
                withdraw"withdraw"
                rename"rename"
                promote"promote"
                kick"kick"
            args_descriptions:
                help"Shows commands for teams."
                create"(name) Creates a new team."
                info"(name/lpayer) Shows information about a team."
                leave"Leaves the team you are in."
                top"Shows a list of top teams."
                accept"Accepts an invitation from a team."
                deny"Declines an invitation from a team."
                invite"(player) Invites a player."
                deposit"(money) Puts money into your team-bank"
                withdraw"(money) Takes money from your team-bank"
                rename"(new name) Changes your team name."
                promote"(player) Gives player leader promotion."
                kick"(player) Kick a player from your team."
        lang:
            # Titles
            help_title"Team Information"
            yourteam_title"Your Team"
            # Error messages
            alreadyonteam"is already on a team!"
            noteam"Is not on any team!"
            unknown"Unknown command!"
            missargs"Not enugh arguements!"
            teamalreadyexist"already exists!"
            noteamfound"No team was found!"
            nolistteam"There are no teams!"
            teamfull"cannot have more members!"
            nopending"have not been invited to any team!"
            alreadypending"already have an invitation!"
            notenoughmoney"do not have enough money!"
            notvalid"This command is not correct!"
            nametoolong"Name is too long!"
            nametooshort"Name is too short!"
            nonegative"No negative numbers!"
            notyourside"is not on your team!"
            alreadyleader"is already a leader!"
            cannotkickleader"cannot kick a leader!"
            noleader"is not a leader!"
            spamming"Cooldown command, wait"
            noplayerfound"No player was found!"
            # You
            you"You"
            # Announces
            newteam"has created a new team called"
            teamdisband1"Team"
            teamdisband2"was disbanded by"
            renamedteam1"changed team-name from"
            renamedteam2"to"
            # Info
            teamtotal"Team Total"
            kills"Kills"
            deaths"Deaths"
            kdr"KDR"
            teambank"Team Bank"
            teamrank"Team Rank"
            level"Level"
            members"Members"
            leaders"Leaders"
            created"Team created"
            nextrank"Next Rank"
            moreinfo"For more information, write"
            # messages
            leftteam"left team"
            invited"on your team invited"
            invitedtoteam"have been invited to team"
            declinedpending"declined the invitation to"
            acceptedpending"became a member of"
            moneydeposit1"deposited"
            moneydeposit2"to your team bank"
            moneywithdraw1"took"
            moneywithdraw2"from your team bank"
            menufinalstep"Write the last argument for your command."
            promoted"gave leadership to"
            waskicked1"kick"
            waskicked2"out of"
            gotkicked"were kicked out of"
            teamrankup"Your team is now rank"
            # top
            toptitle"Top Teams"
            topkdr"KDR"
            topupdate"Updating list..."
            
Teams_Help_List:
    type: task
    debug: false
    script:
    - narrate "<&9>--- <&d><s@Teams_Data.yaml_key[config.lang.help_title]> <&9>---"
    - foreach <s@Teams_Data.list_keys[config.commands.args]> {
        - narrate "<&6>/<s@Teams_Data.yaml_key[config.commands.main]> <s@Teams_Data.yaml_key[config.commands.args.<def[value]>]> <&8><&b><s@Teams_Data.yaml_key[config.commands.args_descriptions.<def[value]>]>"
    }
    
Teams_Help_Message:
    type: procedure
    debug: false
    script:
    - determine "<&b>/<s@Teams_Data.yaml_key[config.commands.main]> <s@Teams_Data.yaml_key[config.commands.args.help]>"
    
Teams_Events:
    type: world
    debug: false
    events:
        on system time hourly: 
        - webget "http://stats.denizenscript.com/tracker?script=<s@Teams_Version.yaml_key[id]>&version=<s@Teams_Version.yaml_key[version]>" 
    
        on player death:
        - if <player.has_flag[Teams_Player_Group]> {
            - define flag2 "Teams_Group_<player.flag[Teams_Player_Group]>_Deaths"
            - flag server "<def[flag2]>:++"
        }
        - if <context.damager.is_player||false>  {
            - run Teams_Kills player:<context.damager> instantly
        }
        else if <context.damager.shooter.is_player||false> {
            - run Teams_Kills player:<context.damager.shooter> instantly
        }
        
        on player damaged:
        - if <context.cause> != ENTITY_ATTACK {
            - if <context.cause> != PROJECTILE {
                - queue clear
            }
        }
        - if <context.entity.is_player||false>  {
            - define player <context.entity>
            - inject Teams_FriendlyFire
        }
        else if <context.projectile.shooter.is_player||false> {
            - define player <context.projectile.shooter>
            - inject Teams_FriendlyFire
        }
        
        on player clicks in Teams_Menu:
        - determine cancelled passively
        - inventory close d:<context.inventory>
        - if <context.item.scriptname||false> == "Teams_Close" {
            - queue clear
        }
        - define title <context.item.display_name.after[<&l>]>
        - if <context.item.lore.get[1].starts_with[<&b>(]> {
            - flag player Teams_Player_Menu_Respond:<def[title]>
            - narrate "<&a><s@Teams_Data.yaml_key[config.lang.menufinalstep]> <&b>/<s@Teams_Data.yaml_key[config.commands.main]> <def[title]> (*)"
            - queue clear
        }
        - execute as_player "<s@Teams_Data.yaml_key[config.commands.main]> <def[title]>"
        
        
        on player drags in Teams_Menu:
        - determine cancelled
        
        on player drags in Teams_Menu_v2:
        - determine cancelled
        
        on player clicks in Teams_Menu_v2:
        - determine cancelled passively
        - inventory close d:<context.inventory>
        
Teams_Kills:
    type: task
    debug: false
    script:
    ## HOTFIX
    - if <player.has_flag[Teams_Player_Group]> {
        - define flag Teams_Group_<player.flag[Teams_Player_Group]>_Kills
        - if <server.has_flag[<def[flag]>].not||true> {
            - announce "<&c><player.name> har <player.flag[Teams_Player_Group]> som ikke findes!" to_flagged:Show_Errors
            - flag player Teams_Player_Group:!
        }
    }
    ##
    - if <player.has_flag[Teams_Player_Group]> {
        - define flag1 "Teams_Group_<player.flag[Teams_Player_Group]>_Kills"
        - flag server "<def[flag1]>:++"
        - if <server.flag[Teams_Group_<player.flag[Teams_Player_Group]>_Rank]> < <s@Teams_Data.list_keys[config.ranks.kills].size> {
            - if <server.flag[<def[flag1]>].round> >= <s@Teams_Data.yaml_key[config.ranks.kills.<server.flag[Teams_Group_<player.flag[Teams_Player_Group]>_Rank]>].round> {
                - define flag Teams_Group_<player.flag[Teams_Player_Group]>_Rank
                - flag server "<def[flag]>:<server.flag[Teams_Group_<player.flag[Teams_Player_Group]>_Rank].add_int[1]>"
                - define flag "Teams_Group_<player.flag[Teams_Player_Group]>_Members"
                - define text1 "<s@Teams_Data.yaml_key[config.ranks.colors.<server.flag[Teams_Group_<player.flag[Teams_Player_Group]>_Rank]>].parse_color>"
                - define text2 "<server.flag[Teams_Group_<player.flag[Teams_Player_Group]>_Rank]>"
                - announce "<&b><player.flag[Teams_Player_Group]> <&3><s@Teams_Data.yaml_key[config.lang.teamrankup]> <def[text1]><def[text2]>"
            }
        }
    }
    
Teams_FriendlyFire:
    type: task
    debug: false
    script:
    - if <player.has_flag[Teams_Player_Group]> && <def[player].as_player.has_flag[Teams_Player_Group]> {
        - if <player.flag[Teams_Player_Group]> == <def[player].as_player.flag[Teams_Player_Group]> {
            - determine CANCELLED
        }
    }

Teams_Command:
    type: command
    name: team
    description: Commands for teams.
    usage: /<s@Teams_Data.yaml_key[config.commands.main]>
    debug: false
    aliases:
    - <s@Teams_Data.yaml_key[config.commands.main]>
    # permission: ggpvp.teams
    # permission message: Sorry, <player.name>, you don't have the permission '<permission>'!
    script:
    ## HOTFIX
    - if <player.has_flag[Teams_Player_Group]> {
        - define flag Teams_Group_<player.flag[Teams_Player_Group]>_Members
        - if <server.has_flag[<def[flag]>].not||true> {
            - announce "<&c><player.name> har <player.flag[Teams_Player_Group]> som ikke findes!" to_flagged:Show_Errors
            - flag player Teams_Player_Group:!
        }
        else if <server.flag[<def[flag]>].as_list.contains[<player>].not||true> {
            - announce "<&c><player.name> har <player.flag[Teams_Player_Group]> som ikke findes!" to_flagged:Show_Errors
            - flag player Teams_Player_Group:!
        }
    }
    ##
    - if <context.args.size> > 0 {
        # Help
        - if <context.args.get[1]> == "<s@Teams_Data.yaml_key[config.commands.args.help]>" {
            - inject Teams_Help_List
        }
        # Create
        else if <context.args.get[1]> == "<s@Teams_Data.yaml_key[config.commands.args.create]>" {
            - if <player.has_flag[Teams_Player_Spam]||true> {
                - narrate "<s@Teams_Data.yaml_key[config.lang.spamming]> <player.flag[Teams_Player_Spam].expiration.formatted>"
                - queue clear
            }
            - if <context.args.size> >= 2 {
                - define team "<context.args.get[2]>"
                - if <player.has_flag[Teams_Player_Group]||true> {
                    - narrate "<&c><s@Teams_Data.yaml_key[config.lang.you]> <s@Teams_Data.yaml_key[config.lang.alreadyonteam]> <proc[Teams_Help_Message]>"
                    - queue clear
                }
                - if <server.has_flag[Teams_Group_<def[team]>_Created]||true> {
                    - narrate "<&c><def[team]> <s@Teams_Data.yaml_key[config.lang.teamalreadyexist]> <proc[Teams_Help_Message]>"
                    - queue clear
                }
                - if <def[team].length> > <s@Teams_Data.yaml_key[config.namemaxlength]> {
                    - narrate "<&c><s@Teams_Data.yaml_key[config.lang.nametoolong]> <proc[Teams_Help_Message]>"
                    - queue clear
                }
                - if <def[team].length> < <s@Teams_Data.yaml_key[config.nameminlength]> {
                    - narrate "<&c><s@Teams_Data.yaml_key[config.lang.nametooshort]> <proc[Teams_Help_Message]>"
                    - queue clear
                }
                - if <def[team].contains_any[*|?|,|.|!|(|)|/|#|¤|%|&|/|<&nl>|<&amp>|<&cm>|<&ss>|<&sq>|<&sp>|<&nbsp>|<&dq>|<&co>|<&sc>|<&rb>|<&lb>|<&rc>|<&lc>|<&ns>|<&pc>|<&pipe>|<&ds>|<&lt>|<&gt>|<&bs>|<&at>|<&dot>]||true> {
                    - narrate "<&c><s@Teams_Data.yaml_key[config.lang.notvalid]> <proc[Teams_Help_Message]>"
                    - queue clear
                }
                - flag player Teams_Player_Spam:True duration:30s
                # Create Team
                - flag player Teams_Player_Group:<def[team]>
                - define flag "Teams_Group_<def[team]>_Kills"
                - flag server "<def[flag]>:0"
                - define flag "Teams_Group_<def[team]>_Deaths"
                - flag server "<def[flag]>:0"
                - define flag "Teams_Group_<def[team]>_Bank"
                - flag server "<def[flag]>:0"
                - define flag "Teams_Group_<def[team]>_Rank"
                - flag server "<def[flag]>:1"
                - define flag "Teams_Group_<def[team]>_Members"
                - flag server "<def[flag]>:|:<player>"
                - define flag "Teams_Group_<def[team]>_Leaders"
                - flag server "<def[flag]>:|:<player>"
                - define flag "Teams_Group_<def[team]>_Created"
                - flag server "<def[flag]>:<util.date.time.day>-<util.date.time.month>-<util.date.time.year>"
                - flag server Teams_Groups:->:<def[team]>
                - announce "<&b><player.name> <&3><s@Teams_Data.yaml_key[config.lang.newteam]> <&b><def[team]>"
            }
            else {
                - narrate "<&c><s@Teams_Data.yaml_key[config.lang.missargs]> <proc[Teams_Help_Message]>"
            }
        }
        # Info
        else if <context.args.get[1]> == "<s@Teams_Data.yaml_key[config.commands.args.info]>" {
            - if <context.args.size> >= 2 {
                # Check other team (args either player or team)
                - define team <context.args.get[2]>
                - define flag Teams_Group_<def[team]>_Members
                - if <server.has_flag[<def[flag]>].not> {
                    - define Target <server.match_offline_player[<context.args.get[2]>]||null>
                    - if <def[Target]> == null {
                        - narrate "<&c><s@Teams_Data.yaml_key[config.lang.noteamfound]> <proc[Teams_Help_Message]>"
                        - queue clear
                    }
                    else {
                        # Found player
                        - if <def[Target].has_flag[Teams_Player_Group]||false> {
                            - define flag Teams_Group_<def[Target].flag[Teams_Player_Group]>_Members
                            - if <server.has_flag[<def[flag]>].not||true> {
                                - narrate "<&c><def[Target].name> <s@Teams_Data.yaml_key[config.lang.noteam]> <proc[Teams_Help_Message]>"
                                - queue clear
                            }
                            - define team <def[Target].flag[Teams_Player_Group]>
                        }
                        else {
                            - narrate "<&c><def[Target].name> <s@Teams_Data.yaml_key[config.lang.noteam]> <proc[Teams_Help_Message]>"
                            - queue clear
                        }
                    }
                }
                # Found team <def[team]>
                - define flag1 "Teams_Group_<def[team]>_Kills"
                - define flag2 "Teams_Group_<def[team]>_Deaths"
                - define flag3 "Teams_Group_<def[team]>_Members"
                - define flag4 "Teams_Group_<def[team]>_Leaders"
                - define flag5 "Teams_Group_<def[team]>_Created"
                - define flag6 "Teams_Group_<def[team]>_Bank"
                - define flag7 "Teams_Group_<def[team]>_Rank"
                - define nextlvl "<&8>(<&a><s@Teams_Data.yaml_key[config.lang.nextrank]> <&8><&co> <&c><server.flag[<def[flag1]>].round><&8>/<&c><s@Teams_Data.yaml_key[config.ranks.kills.<server.flag[Teams_Group_<def[team]>_Rank]>]> <&a><s@Teams_Data.yaml_key[config.lang.kills]><&8>)"
                - define teamcolor "<s@Teams_Data.yaml_key[config.ranks.colors.<server.flag[Teams_Group_<def[team]>_Rank]>].parse_color>"
                - narrate "<&9>--- --- <&b><def[team]> <&9>--- ---"
                - narrate "<&a><s@Teams_Data.yaml_key[config.lang.teamtotal]> <s@Teams_Data.yaml_key[config.lang.kills]> <&8><&co> <&c><server.flag[<def[flag1]>].round>"
                - narrate "<&a><s@Teams_Data.yaml_key[config.lang.teamtotal]> <s@Teams_Data.yaml_key[config.lang.deaths]> <&8><&co> <&c><server.flag[<def[flag2]>].round>"
                - narrate "<&a><s@Teams_Data.yaml_key[config.lang.teamtotal]> <s@Teams_Data.yaml_key[config.lang.kdr]> <&8><&co> <&c><proc[Teams_KDR_Cal].context[<server.flag[<def[flag1]>]>|<server.flag[<def[flag2]>]>]>"
                - narrate "<&a><s@Teams_Data.yaml_key[config.lang.teambank]> <&8><&co> <&c><server.flag[<def[flag6]>]> $"
                - narrate "<&a><s@Teams_Data.yaml_key[config.lang.teamrank]> <&8><&co> <def[teamcolor]><s@Teams_Data.yaml_key[config.lang.level]> <server.flag[<def[flag7]>]> <def[nextlvl]>"
                - narrate "<&a><s@Teams_Data.yaml_key[config.lang.leaders]> <&8><&co> <&3><server.flag[<def[flag4]>].as_list.parse[name].separated_by[<&sp>]>"
                - narrate "<&a><s@Teams_Data.yaml_key[config.lang.members]> <&8><&co> <&3><server.flag[<def[flag3]>].as_list.parse[name].separated_by[<&sp>]>"
                - narrate "<&9>--- --- <&7><s@Teams_Data.yaml_key[config.lang.created]> <server.flag[<def[flag5]>]> <&9>--- ---"
            }
            else if <player.has_flag[Teams_Player_Group]> {
                # Check own team
                - define flag1 "Teams_Group_<player.flag[Teams_Player_Group]>_Kills"
                - define flag2 "Teams_Group_<player.flag[Teams_Player_Group]>_Deaths"
                - define flag3 "Teams_Group_<player.flag[Teams_Player_Group]>_Members"
                - define flag4 "Teams_Group_<player.flag[Teams_Player_Group]>_Leaders"
                - define flag5 "Teams_Group_<player.flag[Teams_Player_Group]>_Created"
                - define flag6 "Teams_Group_<player.flag[Teams_Player_Group]>_Bank"
                - define flag7 "Teams_Group_<player.flag[Teams_Player_Group]>_Rank"
                - define nextlvl "<&8>(<&a><s@Teams_Data.yaml_key[config.lang.nextrank]> <&8><&co> <&c><server.flag[<def[flag1]>].round><&8>/<&c><s@Teams_Data.yaml_key[config.ranks.kills.<server.flag[Teams_Group_<player.flag[Teams_Player_Group]>_Rank]>]> <&a><s@Teams_Data.yaml_key[config.lang.kills]><&8>)"
                - define teamcolor "<s@Teams_Data.yaml_key[config.ranks.colors.<server.flag[Teams_Group_<player.flag[Teams_Player_Group]>_Rank]>].parse_color>"
                - narrate "<&9>--- --- <&b><s@Teams_Data.yaml_key[config.lang.yourteam_title]> <&9>--- ---"
                - narrate "<&a><s@Teams_Data.yaml_key[config.lang.teamtotal]> <s@Teams_Data.yaml_key[config.lang.kills]> <&8><&co> <&c><server.flag[<def[flag1]>].round>"
                - narrate "<&a><s@Teams_Data.yaml_key[config.lang.teamtotal]> <s@Teams_Data.yaml_key[config.lang.deaths]> <&8><&co> <&c><server.flag[<def[flag2]>].round>"
                - narrate "<&a><s@Teams_Data.yaml_key[config.lang.teamtotal]> <s@Teams_Data.yaml_key[config.lang.kdr]> <&8><&co> <&c><proc[Teams_KDR_Cal].context[<server.flag[<def[flag1]>]>|<server.flag[<def[flag2]>]>]>"
                - narrate "<&a><s@Teams_Data.yaml_key[config.lang.teambank]> <&8><&co> <&c><server.flag[<def[flag6]>]> $"
                - narrate "<&a><s@Teams_Data.yaml_key[config.lang.teamrank]> <&8><&co> <def[teamcolor]><s@Teams_Data.yaml_key[config.lang.level]> <server.flag[<def[flag7]>]> <def[nextlvl]>"
                - narrate "<&a><s@Teams_Data.yaml_key[config.lang.leaders]> <&8><&co> <&3><server.flag[<def[flag4]>].as_list.parse[name].separated_by[<&sp>]>"
                - narrate "<&a><s@Teams_Data.yaml_key[config.lang.members]> <&8><&co> <&3><server.flag[<def[flag3]>].as_list.parse[name].separated_by[<&sp>]>"
                - narrate "<&9>--- --- <&7><s@Teams_Data.yaml_key[config.lang.created]> <server.flag[<def[flag5]>]> <&9>--- ---"
            }
            else {
                - narrate "<&c><s@Teams_Data.yaml_key[config.lang.you]> <s@Teams_Data.yaml_key[config.lang.noteam]> <proc[Teams_Help_Message]>"
            }
        }
        # Leave
        else if <context.args.get[1]> == "<s@Teams_Data.yaml_key[config.commands.args.leave]>" {
            - inject Teams_Inject_Leave
        }
        # top
        else if <context.args.get[1]> == "<s@Teams_Data.yaml_key[config.commands.args.top]>" {
            - if <server.has_flag[Teams_Groups]> {
                - if <server.has_flag[teams_topkills_cooldown].not> {
                    - narrate "<&8><s@Teams_Data.yaml_key[config.lang.topupdate]>"
                    - narrate "<server.list_online_players.filter[has_flag[Teams_Player_Group]].parse[flag[Teams_Player_Group]].include[<server.flag[teams_topkills].as_list>].deduplicate.size>"
                    - define Leaders <server.list_online_players.filter[has_flag[Teams_Player_Group]].parse[flag[Teams_Player_Group]].include[<server.flag[teams_topkills].as_list>].deduplicate.sort[Teams_Proc_Sort].get[1].to[5]||li@>
                    - flag server teams_topkills_cooldown:True duration:2h
                    - flag server teams_topkills:!
                    - flag server teams_topkills:<def[Leaders]>
                }
                - narrate "----- <&6><s@Teams_Data.yaml_key[config.lang.toptitle]><&r> -----"
                - if <server.has_flag[teams_topkills]> {
                    - foreach <server.flag[teams_topkills]> {
                        - narrate "<&9><def[loop_index]><&8><&6><def[Value]> <&8><&6><server.flag[Teams_Group_<def[Value]>_Kills].round||0> <&8>(<&9><s@Teams_Data.yaml_key[config.lang.topkdr]><&8><&co> <&6><proc[Teams_KDR_Cal].context[<server.flag[Teams_Group_<def[Value]>_Kills]>|<server.flag[Teams_Group_<def[Value]>_Deaths]>]><&8>)" 
                    }
                }
                else {
                    - narrate "<&c>Venter pÃ¥ næste sortering..."
                }
            }
            else {
                - narrate "<&c><s@Teams_Data.yaml_key[config.lang.nolistteam]> <proc[Teams_Help_Message]>"
            }
        }
        # Invite
        else if <context.args.get[1]> == "<s@Teams_Data.yaml_key[config.commands.args.invite]>" {
            - if <context.args.size> >= 2 {
                - if <player.has_flag[Teams_Player_Group].not||true> {
                    - narrate "<&c><s@Teams_Data.yaml_key[config.lang.you]> <s@Teams_Data.yaml_key[config.lang.noteam]> <proc[Teams_Help_Message]>"
                    - queue clear
                }
                - define flag Teams_Group_<player.flag[Teams_Player_Group]>_Leaders
                - if <server.flag[<def[flag]>].as_list.contains[<player>].not> {
                    - narrate "<&c><s@Teams_Data.yaml_key[config.lang.you]> <s@Teams_Data.yaml_key[config.lang.noleader]> <proc[Teams_Help_Message]>"
                    - queue clear
                }
                - define flag Teams_Group_<player.flag[Teams_Player_Group]>_Members
                - if <server.flag[<def[flag]>].size> >= <s@Teams_Data.yaml_key[config.maxmembers]> {
                    - narrate "<&c><s@Teams_Data.yaml_key[config.lang.you]> <s@Teams_Data.yaml_key[config.lang.teamfull]> <proc[Teams_Help_Message]>"
                    - queue clear
                }
                - define Target <server.match_player[<context.args.get[2]>]||null>
                - if <def[Target]> == null {
                    - narrate "<&c><s@Teams_Data.yaml_key[config.lang.noplayerfound]> <proc[Teams_Help_Message]>"
                    - queue clear
                }
                - if <def[Target]> == <player> {
                    - narrate "<&c><s@Teams_Data.yaml_key[config.lang.notvalid]> <proc[Teams_Help_Message]>"
                    - queue clear
                }
                # else if <def[target].has_flag[Teams_Player_Group]> {
                    # - narrate "<&c><def[target].name> <s@Teams_Data.yaml_key[config.lang.alreadyonteam]> <proc[Teams_Help_Message]>"
                    # - queue clear
                # }
                else if <def[target].has_flag[Teams_Player_Pending]> {
                    - narrate "<&c><def[target].name> <s@Teams_Data.yaml_key[config.lang.alreadypending]> <proc[Teams_Help_Message]>"
                    - queue clear
                }
                - define flag Teams_Group_<player.flag[Teams_Player_Group]>_Members
                - narrate "<&b><player.name> <&3><s@Teams_Data.yaml_key[config.lang.invited]> <&b><def[target].name>" targets:<server.flag[<def[flag]>].as_list.filter[is_online]>
                - flag <def[target]> Teams_Player_Pending:<player.flag[Teams_Player_Group]> duration:2m
                - define command "/<s@Teams_Data.yaml_key[config.commands.main]> (<s@Teams_Data.yaml_key[config.commands.args.accept]><&8>/<&a><s@Teams_Data.yaml_key[config.commands.args.deny]>)"
                - define lang "<s@Teams_Data.yaml_key[config.lang.you]> <s@Teams_Data.yaml_key[config.lang.invitedtoteam]>"
                - narrate "<&3><def[lang]> <&b><def[target].flag[Teams_Player_Pending]> <&a><def[command]>" targets:<def[target]>
            }
            else {
                - narrate "<&c><s@Teams_Data.yaml_key[config.lang.missargs]> <proc[Teams_Help_Message]>"
            }
        }
        # Deny
        else if <context.args.get[1]> == "<s@Teams_Data.yaml_key[config.commands.args.deny]>" {
            - if <player.has_flag[Teams_Player_Pending].not||true> {
                - narrate "<&c><s@Teams_Data.yaml_key[config.lang.you]> <s@Teams_Data.yaml_key[config.lang.nopending]> <proc[Teams_Help_Message]>"
                - queue clear
            }
            - narrate "<s@Teams_Data.yaml_key[config.lang.you]> <s@Teams_Data.yaml_key[config.lang.declinedpending]> <player.flag[Teams_Player_Pending]>"
            - define flag "Teams_Group_<player.flag[Teams_Player_Pending]>_Members"
            - narrate "<&b><player.name> <&3><s@Teams_Data.yaml_key[config.lang.declinedpending]> <&b><player.flag[Teams_Player_Pending]>" targets:<server.flag[<def[flag]>].as_list.filter[is_online]>
            - flag player Teams_Player_Pending:!
        }
        # Accept
        else if <context.args.get[1]> == "<s@Teams_Data.yaml_key[config.commands.args.accept]>" {
            - if <player.has_flag[Teams_Player_Pending].not||true> {
                - narrate "<&c><s@Teams_Data.yaml_key[config.lang.you]> <s@Teams_Data.yaml_key[config.lang.nopending]> <proc[Teams_Help_Message]>"
                - queue clear
            }
            - define flag Teams_Group_<player.flag[Teams_Player_Pending]>_Members
            - if <server.flag[<def[flag]>].size> >= <s@Teams_Data.yaml_key[config.maxmembers]> {
                - narrate "<&c><player.flag[Teams_Player_Pending]> <s@Teams_Data.yaml_key[config.lang.teamfull]> <proc[Teams_Help_Message]>"
                - queue clear
            }
            - if <player.has_flag[Teams_Player_Group]||true> {
                - inject Teams_Inject_Leave
            }
            - flag player Teams_Player_Group:<player.flag[Teams_Player_Pending]>
            - flag server "<def[flag]>:->:<player>"
            - define flag "Teams_Group_<player.flag[Teams_Player_Pending]>_Members"
            - narrate "<&b><player.name> <&3><s@Teams_Data.yaml_key[config.lang.acceptedpending]> <&b><player.flag[Teams_Player_Group]>" targets:<server.flag[<def[flag]>].as_list.filter[is_online]>
            - flag player Teams_Player_Pending:!
        }
        # Deposit
        else if <context.args.get[1]> == "<s@Teams_Data.yaml_key[config.commands.args.deposit]>" {
            - if <player.has_flag[Teams_Player_Group].not||true> {
                - narrate "<&c><s@Teams_Data.yaml_key[config.lang.you]> <s@Teams_Data.yaml_key[config.lang.noteam]> <proc[Teams_Help_Message]>"
                - queue clear
            }
            - if <context.args.size> >= 2 {
                - define deposited <context.args.get[2].as_int||null>
                - if <def[deposited]> == null {
                    - narrate "<&c><s@Teams_Data.yaml_key[config.lang.notvalid]> <proc[Teams_Help_Message]>"
                    - queue clear
                }
                - if <player.money> < <def[deposited]> {
                    - narrate "<&c><s@Teams_Data.yaml_key[config.lang.you]> <s@Teams_Data.yaml_key[config.lang.notenoughmoney]> <proc[Teams_Help_Message]>"
                    - queue clear
                }
                - if <def[deposited]> < 0 {
                    - narrate "<&c><s@Teams_Data.yaml_key[config.lang.nonegative]> <proc[Teams_Help_Message]>"
                    - queue clear
                }
                - take money quantity:<def[deposited]>
                - define flag Teams_Group_<player.flag[Teams_Player_Group]>_Bank
                - define total <server.flag[<def[flag]>].add_int[<def[deposited]>]>
                - flag server "<def[flag]>:<def[total]>"
                - define flag "Teams_Group_<player.flag[Teams_Player_Group]>_Members"
                - narrate "<&b><player.name> <&3><s@Teams_Data.yaml_key[config.lang.moneydeposit1]> <&b><def[deposited]> <&3><s@Teams_Data.yaml_key[config.lang.moneydeposit2]>" targets:<server.flag[<def[flag]>].as_list.filter[is_online]>
            }
            else {
                - narrate "<&c><s@Teams_Data.yaml_key[config.lang.missargs]> <proc[Teams_Help_Message]>"
            }
        }
        # Withdraw
        else if <context.args.get[1]> == "<s@Teams_Data.yaml_key[config.commands.args.withdraw]>" {
            - if <player.has_flag[Teams_Player_Group].not||true> {
                - narrate "<&c><s@Teams_Data.yaml_key[config.lang.you]> <s@Teams_Data.yaml_key[config.lang.noteam]> <proc[Teams_Help_Message]>"
                - queue clear
            }
            - if <context.args.size> >= 2 {
                - define flag Teams_Group_<player.flag[Teams_Player_Group]>_Leaders
                - if <server.flag[<def[flag]>].as_list.contains[<player>].not||true> {
                    - narrate "<&c><s@Teams_Data.yaml_key[config.lang.you]> <s@Teams_Data.yaml_key[config.lang.noleader]> <proc[Teams_Help_Message]>"
                    - queue clear
                }
                - define flag Teams_Group_<player.flag[Teams_Player_Group]>_Bank
                - define withdrew <context.args.get[2].as_int||null>
                - if <def[withdrew]> == null {
                    - narrate "<&c><s@Teams_Data.yaml_key[config.lang.notvalid]> <proc[Teams_Help_Message]>"
                    - queue clear
                }
                - if <server.flag[<def[flag]>]> < <def[withdrew]> {
                    - narrate "<&c><s@Teams_Data.yaml_key[config.lang.you]> <s@Teams_Data.yaml_key[config.lang.notenoughmoney]> <proc[Teams_Help_Message]>"
                    - queue clear
                }
                - if <def[withdrew]> < 0 {
                    - narrate "<&c><s@Teams_Data.yaml_key[config.lang.nonegative]> <proc[Teams_Help_Message]>"
                    - queue clear
                }
                - define total <server.flag[<def[flag]>].sub_int[<def[withdrew]>]>
                - give money quantity:<def[withdrew]>
                - flag server "<def[flag]>:<def[total]>"
                - define flag "Teams_Group_<player.flag[Teams_Player_Group]>_Members"
                - narrate "<&b><player.name> <&3><s@Teams_Data.yaml_key[config.lang.moneywithdraw1]> <&b><def[withdrew]> <&3><s@Teams_Data.yaml_key[config.lang.moneywithdraw2]>" targets:<server.flag[<def[flag]>].as_list.filter[is_online]>
            }
            else {
                - narrate "<&c><s@Teams_Data.yaml_key[config.lang.missargs]> <proc[Teams_Help_Message]>"
            }
        }
        # Rename
        else if <context.args.get[1]> == "<s@Teams_Data.yaml_key[config.commands.args.rename]>" {
            - if <player.has_flag[Teams_Player_Spam]> {
                - narrate "<s@Teams_Data.yaml_key[config.lang.spamming]> <player.flag[Teams_Player_Spam].expiration.formatted>"
                - queue clear
            }
            - if <context.args.size> >= 2 {
                - define newteam "<context.args.get[2]>"
                - if <player.has_flag[Teams_Player_Group].not> {
                    - narrate "<&c><s@Teams_Data.yaml_key[config.lang.you]> <s@Teams_Data.yaml_key[config.lang.noteam]> <proc[Teams_Help_Message]>"
                    - queue clear
                }
                - define flag Teams_Group_<player.flag[Teams_Player_Group]>_Leaders
                - if <server.flag[<def[flag]>].as_list.contains[<player>].not> {
                    - narrate "<&c><s@Teams_Data.yaml_key[config.lang.you]> <s@Teams_Data.yaml_key[config.lang.noleader]> <proc[Teams_Help_Message]>"
                    - queue clear
                }
                - if <server.has_flag[Teams_Group_<def[newteam]>_Created]> {
                    - narrate "<&c><def[newteam]> <s@Teams_Data.yaml_key[config.lang.teamalreadyexist]> <proc[Teams_Help_Message]>"
                    - queue clear
                }
                - if <def[newteam].length> > <s@Teams_Data.yaml_key[config.namemaxlength]> {
                    - narrate "<&c><s@Teams_Data.yaml_key[config.lang.nametoolong]> <proc[Teams_Help_Message]>"
                    - queue clear
                }
                - if <def[newteam].length> < <s@Teams_Data.yaml_key[config.nameminlength]> {
                    - narrate "<&c><s@Teams_Data.yaml_key[config.lang.nametooshort]> <proc[Teams_Help_Message]>"
                    - queue clear
                }
                - if <def[newteam].contains_any[*|?|,|.|!|(|)|/|#|¤|%|&|/|<&nl>|<&amp>|<&cm>|<&ss>|<&sq>|<&sp>|<&nbsp>|<&dq>|<&co>|<&sc>|<&rb>|<&lb>|<&rc>|<&lc>|<&ns>|<&pc>|<&pipe>|<&ds>|<&lt>|<&gt>|<&bs>|<&at>|<&dot>]||true> {
                    - narrate "<&c><s@Teams_Data.yaml_key[config.lang.notvalid]> <proc[Teams_Help_Message]>"
                    - queue clear
                }
                - flag player Teams_Player_Spam:True duration:30s
                - define oldteam <player.flag[Teams_Player_Group]>
                - define flag1new "Teams_Group_<def[newteam]>_Kills"
                - define flag1old "Teams_Group_<def[oldteam]>_Kills"
                - flag server "<def[flag1new]>:<server.flag[<def[flag1old]>]>"
                - define flag2new "Teams_Group_<def[newteam]>_Deaths"
                - define flag2old "Teams_Group_<def[oldteam]>_Deaths"
                - flag server "<def[flag2new]>:<server.flag[<def[flag2old]>]>"
                - define flag3new "Teams_Group_<def[newteam]>_Bank"
                - define flag3old "Teams_Group_<def[oldteam]>_Bank"
                - flag server "<def[flag3new]>:<server.flag[<def[flag3old]>]>"
                - define flag4new "Teams_Group_<def[newteam]>_Rank"
                - define flag4old "Teams_Group_<def[oldteam]>_Rank"
                - flag server "<def[flag4new]>:<server.flag[<def[flag4old]>]>"
                - define flag5new "Teams_Group_<def[newteam]>_Members"
                - define flag5old "Teams_Group_<def[oldteam]>_Members"
                - foreach <server.flag[<def[flag5old]>].as_list> {
                    - flag server "<def[flag5new]>:->:<def[value]>"
                    - flag <def[value]> Teams_Player_Group:<def[newteam]>
                }
                - define flag6new "Teams_Group_<def[newteam]>_Leaders"
                - define flag6old "Teams_Group_<def[oldteam]>_Leaders"
                - foreach <server.flag[<def[flag6old]>].as_list> {
                    - flag server "<def[flag6new]>:->:<def[value]>"
                }
                - define flag7new "Teams_Group_<def[newteam]>_Created"
                - define flag7old "Teams_Group_<def[oldteam]>_Created"
                - flag server "<def[flag7new]>:<server.flag[<def[flag7old]>]>"
                - flag server Teams_Groups:->:<def[newteam]>
                - flag server Teams_Groups:<-:<def[oldteam]>
                - define flag Teams_Group_<def[oldteam]>_Kills
                - flag server "<def[flag]>:!"
                - define flag Teams_Group_<def[oldteam]>_Deaths
                - flag server "<def[flag]>:!"
                - define flag Teams_Group_<def[oldteam]>_Members
                - flag server "<def[flag]>:!"
                - define flag Teams_Group_<def[oldteam]>_Leaders
                - flag server "<def[flag]>:!"
                - define flag Teams_Group_<def[oldteam]>_Rank
                - flag server "<def[flag]>:!"
                - define flag Teams_Group_<def[oldteam]>_Bank
                - flag server "<def[flag]>:!"
                - define flag Teams_Group_<def[oldteam]>_Created
                - flag server "<def[flag]>:!"
                - announce "<&b><player.name> <&3><s@Teams_Data.yaml_key[config.lang.renamedteam1]> <&b><def[oldteam]> <&3><s@Teams_Data.yaml_key[config.lang.renamedteam2]> <&b><def[newteam]>"
        
            }
            else {
                - narrate "<&c><s@Teams_Data.yaml_key[config.lang.missargs]> <proc[Teams_Help_Message]>"
            }
        }
        # Promote
        else if <context.args.get[1]> == "<s@Teams_Data.yaml_key[config.commands.args.promote]||false>" {
            - if <player.has_flag[Teams_Player_Group].not||false> {
                - narrate "<&c><s@Teams_Data.yaml_key[config.lang.you]> <s@Teams_Data.yaml_key[config.lang.noteam]> <proc[Teams_Help_Message]>"
                - queue clear
            }
            - if <context.args.size> >= 2 {
                - define flag1 Teams_Group_<player.flag[Teams_Player_Group]>_Leaders
                - if <server.flag[<def[flag1]>].as_list.contains[<player>].not||true> {
                    - narrate "<&c><s@Teams_Data.yaml_key[config.lang.you]> <s@Teams_Data.yaml_key[config.lang.noleader]> <proc[Teams_Help_Message]>"
                    - queue clear
                }
                - define target <server.match_player[<context.args.get[2]>]||null>
                - if <def[target]> == null {
                    - narrate "<&c><s@Teams_Data.yaml_key[config.lang.noplayerfound]> <proc[Teams_Help_Message]>"
                    - queue clear
                }
                - define flag2 Teams_Group_<player.flag[Teams_Player_Group]>_Members
                - if <server.flag[<def[flag2]>].as_list.contains[<def[target]>].not> {
                    - narrate "<&c><def[target].name> <s@Teams_Data.yaml_key[config.lang.notyourside]> <proc[Teams_Help_Message]>"
                    - queue clear
                }
                - if <server.flag[<def[flag1]>].as_list.contains[<def[target]>]||true> {
                    - narrate "<&c><def[target].name> <s@Teams_Data.yaml_key[config.lang.alreadyleader]> <proc[Teams_Help_Message]>"
                    - queue clear
                }
                # Give promotion
                - flag server "<def[flag1]>:->:<def[target]>"
                - define flag "Teams_Group_<player.flag[Teams_Player_Group]>_Members"
                - narrate "<&b><player.name> <&3><s@Teams_Data.yaml_key[config.lang.promoted]> <&b><def[target].name>" targets:<server.flag[<def[flag]>].as_list.filter[is_online]>
            }
            else {
                - narrate "<&c><s@Teams_Data.yaml_key[config.lang.missargs]> <proc[Teams_Help_Message]>"
            }
        }
        # kick
        else if <context.args.get[1]> == "<s@Teams_Data.yaml_key[config.commands.args.kick]||false>" {
            - if <player.has_flag[Teams_Player_Group].not||true> {
                - narrate "<&c><s@Teams_Data.yaml_key[config.lang.you]> <s@Teams_Data.yaml_key[config.lang.noteam]> <proc[Teams_Help_Message]>"
                - queue clear
            }
            - if <context.args.size||false> >= 2 {
                - define flag1 Teams_Group_<player.flag[Teams_Player_Group]>_Leaders
                - if <server.flag[<def[flag1]>].as_list.contains[<player>].not> {
                    - narrate "<&c><s@Teams_Data.yaml_key[config.lang.you]> <s@Teams_Data.yaml_key[config.lang.noleader]> <proc[Teams_Help_Message]>"
                    - queue clear
                }
                - define target <server.match_offline_player[<context.args.get[2]>]||null>
                - if <def[target]> == null {
                    - narrate "<&c><s@Teams_Data.yaml_key[config.lang.noplayerfound]> <proc[Teams_Help_Message]>"
                    - queue clear
                }
                - define flag2 Teams_Group_<player.flag[Teams_Player_Group]>_Members
                - if <server.flag[<def[flag2]>].as_list.contains[<def[target]>].not||true> {
                    ## HOTFIX
                    - if <server.flag[<def[flag1]>].as_list.contains[<def[target]>]||true> {
                        - announce "<&c><def[target].name> er leder pÃ¥ <player.flag[Teams_Player_Group]> men ikke member!" to_flagged:Show_Errors
                        - flag server "<def[flag1]>:<-:<def[target]>"
                    }
                    ##
                    - narrate "<&c><def[target].name> <s@Teams_Data.yaml_key[config.lang.notyourside]> <proc[Teams_Help_Message]>"
                    - queue clear
                }
                - if <server.flag[<def[flag1]>].as_list.contains[<def[target]>]||true> {
                    - narrate "<&c><s@Teams_Data.yaml_key[config.lang.you]> <s@Teams_Data.yaml_key[config.lang.cannotkickleader]> <proc[Teams_Help_Message]>"
                    - queue clear
                }
                - flag server "<def[flag2]>:<-:<def[target]>"
                - flag <def[target]> Teams_Player_Group:!
                - run Teams_Kicked_player player:<def[target]>
                - if <def[target].is_online||false> {
                    - narrate "<&3><s@Teams_Data.yaml_key[config.lang.you]> <s@Teams_Data.yaml_key[config.lang.gotkicked]> <&b><player.flag[Teams_Player_Group]>" targets:<def[target]>
                }
                - define flag "Teams_Group_<player.flag[Teams_Player_Group]>_Members"
                - narrate "<&b><player.name> <&3><s@Teams_Data.yaml_key[config.lang.waskicked1]> <&b><def[target].name> <&3><s@Teams_Data.yaml_key[config.lang.waskicked2]> <&b><player.flag[Teams_Player_Group]>" targets:<server.flag[<def[flag]>].as_list.filter[is_online]>
            }
            else {
                - narrate "<&c><s@Teams_Data.yaml_key[config.lang.missargs]> <proc[Teams_Help_Message]>"
            }
        }
        else {
            - narrate "<&c><s@Teams_Data.yaml_key[config.lang.unknown]> <proc[Teams_Help_Message]>"
        }
    }
    else {
        - if <player.has_flag[Teams_Player_Group]||false> {
            - flag server Teams_Target_Menu:<player>
            - inventory open d:in@Teams_Menu_v2
            # - inventory open d:in@Teams_Menu
        }
        else {
            - inject Teams_Help_List
        }
    }
    
Teams_Kicked_player:
    type: task
    debug: false
    script:
    - flag player Teams_Player_Group:!
    
Teams_Inject_Leave:
    type: task
    debug: false
    script:
    - if <player.has_flag[Teams_Player_Spam]> {
        - narrate "<s@Teams_Data.yaml_key[config.lang.spamming]> <player.flag[Teams_Player_Spam].expiration.formatted>"
        - queue clear
    }
    - if <player.has_flag[Teams_Player_Group]> {
        - narrate "<&3><s@Teams_Data.yaml_key[config.lang.you]> <s@Teams_Data.yaml_key[config.lang.leftteam]> <&b><player.flag[Teams_Player_Group]>"
        - define team <player.flag[Teams_Player_Group]>
        - flag player Teams_Player_Group:!
        - define flag Teams_Group_<def[team]>_Members
        - flag server "<def[flag]>:<-:<player>"
        - if <server.has_flag[<def[flag]>]> {
            - if <server.flag[<def[flag]>].as_list.is_empty.not||false> {
                - narrate "<&b><player.name> <&3><s@Teams_Data.yaml_key[config.lang.leftteam]> <&b><def[team]>" targets:<server.flag[<def[flag]>].as_list.filter[is_online]>
            }
        }
        - define flag Teams_Group_<def[team]>_Leaders
        - if <server.flag[<def[flag]>].as_list.contains[<player>]> {
            - flag player Teams_Player_Spam:True duration:30s
            - flag server "<def[flag]>:<-:<player>"
            - if <server.has_flag[<def[flag]>].not> {
                - if <server.flag[<def[flag]>].as_list.is_empty||true> {
                    # Remove team
                    - define flag Teams_Group_<def[team]>_Kills
                    - flag server "<def[flag]>:!"
                    - define flag Teams_Group_<def[team]>_Deaths
                    - flag server "<def[flag]>:!"
                    - define flag Teams_Group_<def[team]>_Members
                    - if <server.has_flag[<def[flag]>]> {
                        - foreach <server.flag[<def[flag]>].as_list> {
                            - flag <def[value]> Teams_Player_Group:!
                        }
                    }
                    - flag server "<def[flag]>:!"
                    - define flag Teams_Group_<def[team]>_Leaders
                    - flag server "<def[flag]>:!"
                    - define flag Teams_Group_<def[team]>_Rank
                    - flag server "<def[flag]>:!"
                    - define flag Teams_Group_<def[team]>_Bank
                    - flag server "<def[flag]>:!"
                    - define flag Teams_Group_<def[team]>_Created
                    - flag server "<def[flag]>:!"
                    - flag server "Teams_Groups:<-:<def[team]>"
                    - announce "<&3><s@Teams_Data.yaml_key[config.lang.teamdisband1]> <&b><def[team]> <&3><s@Teams_Data.yaml_key[config.lang.teamdisband2]> <&b><player.name>"
                }
            }
        }
    }
    else {
        - narrate "<&c><s@Teams_Data.yaml_key[config.lang.you]> <s@Teams_Data.yaml_key[config.lang.noteam]> <proc[Teams_Help_Message]>"
    }
    
Teams_Chat:
    type: command
    name: teamchat
    debug: false
    description: Commands for teams.
    usage: /teamchat
    aliases:
    - tc
    # permission: ggpvp.teams
    # permission message: Sorry, <player.name>, you don't have the permission '<permission>'!
    script:
    - if <player.has_flag[Teams_Player_Group].not> {
        - narrate "<&c><s@Teams_Data.yaml_key[config.lang.you]> <s@Teams_Data.yaml_key[config.lang.noteam]> <proc[Teams_Help_Message]>"
        - queue clear
    }
    - define flag "Teams_Group_<player.flag[Teams_Player_Group]>_Members"
    - narrate "<&8>[<&c>Team-Chat<&8>] <&b><player.name><&co> <&e><context.raw_args>" targets:<server.flag[<def[flag]>].as_list.filter[is_online]>
    
# Menu

Teams_Menu_Proc:
    type: procedure
    debug: false
    definitions: item|line
    script:
    - define value "<s@Teams_Data.list_keys[config.commands.args].get[<def[item]>]>"
    - choose "<def[line]>":
        - case "1":
            - determine red_wool
        - case "2":
            - determine "<&6><&l><s@Teams_Data.yaml_key[config.commands.args.<def[value]>].to_titlecase>"
        - case "3":
            - determine "<&b><s@Teams_Data.yaml_key[config.commands.args_descriptions.<def[value]>]>"
        - default:
            - determine "Chosen default"

Teams_Menu_Proc_v2:
    type: procedure
    debug: false
    definitions: item|line
    script:
    - define target <server.flag[Teams_Target_Menu]>
    - choose "<def[item]>":
        - case "name":
            - choose "<def[line]>":
                - case "1":
                    - determine book
                - case "2":
                    - determine "<&6><&l><def[target].flag[Teams_Player_Group]>"
                - case "3":
                    - determine "<&a><s@Teams_Data.yaml_key[config.lang.moreinfo]> "
                - case "4":
                    - determine "<proc[Teams_Help_Message]>"
                - case "5":
                    - determine "<&7>"
                - case "6":
                    - determine "<&7><s@Teams_Data.yaml_key[config.lang.created]>"
                - case "7":
                    - determine "<&7><server.flag[Teams_Group_<def[target].flag[Teams_Player_Group]>_Created]>"
                - default:
                    - determine "Chosen default in <def[item]>"
        - case "kills":
            - choose "<def[line]>":
                - case "1":
                    - determine diamond_sword
                - case "2":
                    - determine "<&a><s@Teams_Data.yaml_key[config.lang.teamtotal]> <&8><&co>"
                - case "3":
                    - determine "<&c><&l><server.flag[Teams_Group_<def[target].flag[Teams_Player_Group]>_Kills].round||0> <&6><s@Teams_Data.yaml_key[config.lang.kills]>"
                - case "4":
                    - determine "<&c><&l><server.flag[Teams_Group_<def[target].flag[Teams_Player_Group]>_Deaths].round||0> <&6><s@Teams_Data.yaml_key[config.lang.deaths]>"
                - case "5":
                    - define flag1 Teams_Group_<def[target].flag[Teams_Player_Group]>_Kills
                    - define flag2 Teams_Group_<def[target].flag[Teams_Player_Group]>_Deaths
                    # <server.flag[<def[flag1]>].div[<server.flag[<def[flag2]>]>].round_to[2]||0>
                    - determine "<&c><&l><proc[Teams_KDR_Cal].context[<server.flag[<def[flag1]>]>|<server.flag[<def[flag2]>]>]> <&6><s@Teams_Data.yaml_key[config.lang.kdr]>"
                - default:
                    - determine "Chosen default in <def[item]>"
        - case "members":
            - choose "<def[line]>":
                - case "1":
                    - determine diamond_chestplate
                - case "2":
                    - determine "<&a><s@Teams_Data.yaml_key[config.lang.leaders]> <&8><&co> "
                - case "3":
                    - determine "<&3><server.flag[Teams_Group_<def[target].flag[Teams_Player_Group]>_Leaders].as_list.parse[name].separated_by[|<&3>]>"
                - case "4":
                    - determine "<&a><s@Teams_Data.yaml_key[config.lang.members]> <&8><&co> "
                - case "5":
                    ## change to foreach loop (with define)
                    - determine "<&3><server.flag[Teams_Group_<def[target].flag[Teams_Player_Group]>_Members].as_list.parse[name].separated_by[|<&3>]>"
                - case "6":
                    - determine "<&8>(<&c><server.flag[Teams_Group_<def[target].flag[Teams_Player_Group]>_Members].as_list.size><&8>/<&c><s@Teams_Data.yaml_key[config.maxmembers]><&8>)"
                - default:
                    - determine "Chosen default in <def[item]>"
        - case "rank":
            - choose "<def[line]>":
                - case "1":
                    - determine redstone
                - case "2":
                    - determine "<&a><s@Teams_Data.yaml_key[config.lang.teamrank]> <&8><&co> "
                - case "3":
                    - define teamcolor "<s@Teams_Data.yaml_key[config.ranks.colors.<server.flag[Teams_Group_<def[target].flag[Teams_Player_Group]>_Rank]>].parse_color>"
                    - determine "<def[teamcolor]><&l><s@Teams_Data.yaml_key[config.lang.level]> <server.flag[Teams_Group_<def[target].flag[Teams_Player_Group]>_Rank].round||0>"
                - case "4":
                    - define nextlvl "<&c><server.flag[Teams_Group_<def[target].flag[Teams_Player_Group]>_Kills].round><&8>/<&c><s@Teams_Data.yaml_key[config.ranks.kills.<server.flag[Teams_Group_<def[target].flag[Teams_Player_Group]>_Rank]>]> <&a><s@Teams_Data.yaml_key[config.lang.kills]>"
                    - determine "<&a><s@Teams_Data.yaml_key[config.lang.nextrank]> <&8><&co> <def[nextlvl]>"
                - default:
                    - determine "Chosen default in <def[item]>"
        - case "money":
            - choose "<def[line]>":
                - case "1":
                    - determine Nether_Star
                - case "2":
                    - determine "<&a><s@Teams_Data.yaml_key[config.lang.teambank]> <&8><&co> "
                - case "3":
                    - determine "<&c><&l><server.flag[Teams_Group_<def[target].flag[Teams_Player_Group]>_Bank]||0>"
        - default:
            - determine "Chosen default"
    
Teams_Menu_v2:
    type: inventory
    debug: false
    inventory: CHEST
    title<&8><s@Teams_Data.yaml_key[config.lang.yourteam_title]>
    size: 54
    definitions:
        name<proc[Teams_Menu_Proc_v2].context[name|1]>[display_name=<proc[Teams_Menu_Proc_v2].context[name|2]>;lore=li@<proc[Teams_Menu_Proc_v2].context[name|3]>|<proc[Teams_Menu_Proc_v2].context[name|4]>|<proc[Teams_Menu_Proc_v2].context[name|5]>|<proc[Teams_Menu_Proc_v2].context[name|6]>|<proc[Teams_Menu_Proc_v2].context[name|7]>]
        kills<proc[Teams_Menu_Proc_v2].context[kills|1]>[flags=HIDE_ATTRIBUTES;display_name=<proc[Teams_Menu_Proc_v2].context[kills|2]>;lore=li@<proc[Teams_Menu_Proc_v2].context[kills|3]>|<proc[Teams_Menu_Proc_v2].context[kills|4]>|<proc[Teams_Menu_Proc_v2].context[kills|5]>]
        members<proc[Teams_Menu_Proc_v2].context[members|1]>[display_name=<proc[Teams_Menu_Proc_v2].context[members|2]>;lore=li@<proc[Teams_Menu_Proc_v2].context[members|3]>|<proc[Teams_Menu_Proc_v2].context[members|4]>|<proc[Teams_Menu_Proc_v2].context[members|5]>|<proc[Teams_Menu_Proc_v2].context[members|6]>]
        close: i@Teams_Close
        penge<proc[Teams_Menu_Proc_v2].context[money|1]>[display_name=<proc[Teams_Menu_Proc_v2].context[money|2]>;lore=li@<proc[Teams_Menu_Proc_v2].context[money|3]>]
        rank<proc[Teams_Menu_Proc_v2].context[rank|1]>[flags=HIDE_ATTRIBUTES;display_name=<proc[Teams_Menu_Proc_v2].context[rank|2]>;lore=li@<proc[Teams_Menu_Proc_v2].context[rank|3]>|<proc[Teams_Menu_Proc_v2].context[rank|4]>]
    slots: 
    - "[] [] [] [] [] [] [] [] []"
    - "[] [] [] [] [rank] [] [] [] []"
    - "[] [] [kills] [] [] [] [members] [] []"
    - "[] [] [] [] [penge] [] [] [] []"
    - "[] [] [] [] [] [] [] [] []"
    - "[] [] [] [] [name] [] [] [] [Close]"
    
Teams_Menu:
    type: inventory
    debug: false
    inventory: CHEST
    title<&8><s@Teams_Data.yaml_key[config.lang.help_title]>
    size: 18
    definitions:
        T1<proc[Teams_Menu_Proc].context[1|1]>[display_name=<proc[Teams_Menu_Proc].context[1|2]>;lore=li@<proc[Teams_Menu_Proc].context[1|3]>]
        T2<proc[Teams_Menu_Proc].context[2|1]>[display_name=<proc[Teams_Menu_Proc].context[2|2]>;lore=li@<proc[Teams_Menu_Proc].context[2|3]>]
        T3<proc[Teams_Menu_Proc].context[3|1]>[display_name=<proc[Teams_Menu_Proc].context[3|2]>;lore=li@<proc[Teams_Menu_Proc].context[3|3]>]
        T4<proc[Teams_Menu_Proc].context[4|1]>[display_name=<proc[Teams_Menu_Proc].context[4|2]>;lore=li@<proc[Teams_Menu_Proc].context[4|3]>]
        T5<proc[Teams_Menu_Proc].context[5|1]>[display_name=<proc[Teams_Menu_Proc].context[5|2]>;lore=li@<proc[Teams_Menu_Proc].context[5|3]>]
        T6<proc[Teams_Menu_Proc].context[6|1]>[display_name=<proc[Teams_Menu_Proc].context[6|2]>;lore=li@<proc[Teams_Menu_Proc].context[6|3]>]
        T7<proc[Teams_Menu_Proc].context[7|1]>[display_name=<proc[Teams_Menu_Proc].context[7|2]>;lore=li@<proc[Teams_Menu_Proc].context[7|3]>]
        T8<proc[Teams_Menu_Proc].context[8|1]>[display_name=<proc[Teams_Menu_Proc].context[8|2]>;lore=li@<proc[Teams_Menu_Proc].context[8|3]>]
        T9<proc[Teams_Menu_Proc].context[9|1]>[display_name=<proc[Teams_Menu_Proc].context[9|2]>;lore=li@<proc[Teams_Menu_Proc].context[9|3]>]
        T10<proc[Teams_Menu_Proc].context[10|1]>[display_name=<proc[Teams_Menu_Proc].context[10|2]>;lore=li@<proc[Teams_Menu_Proc].context[10|3]>]
        Close: i@Teams_Close
    slots: 
    - "[T1] [T2] [T3] [T4] [T5] [] [] [] []"
    - "[T6] [T7] [T8] [T9] [T10] [] [] [] [Close]"
    
Teams_Close:
    type: item
    debug: false
    material: BARRIER
    display name<&a>Luk Menu
    
## TODO: MAY OR MAY NOT SORT CORRECTLY!
Teams_Proc_Sort:
    type: procedure
    debug: false
    definitions: p1|p2
    script:
    # If P2's kill score is better than P1's move P2 up, ooh that bitch is climbin! 
    - if <server.flag[Teams_Group_<def[p2]>_Kills].round||0> > <server.flag[Teams_Group_<def[p1]>_Kills].round||0> { 
        - determine 1 
    } 
    # If P1's kill score is better than P2's move P1 up, ooh that bitch is climbin! 
    else if <server.flag[Teams_Group_<def[p1]>_Kills].round||0> > <server.flag[Teams_Group_<def[p2]>_Kills].round||0> { 
        - determine -1 
    } 
    # Their kill score is equal, so do nothing... boring.. 
    else { 
        - determine 0 
    }
    
## <proc[].context[kills|death]>
    
Teams_KDR_Cal:
    type: procedure
    debug: false
    definitions: kills|death
    script:
    - if <def[death].round> == 0 {
        - determine "0"
    }
    else if <def[death].round> == <def[kills]> {
        - determine "1"
    }
    else {
        - determine "<def[kills].div[<def[death]>].round_to[2]>"
    }
    
Teams_Members_proc:
    type: procedure
    debug: false
    definitions: team
    script:
    - if <def[team].round> == 0 {
        - determine "0"
    }
    else if <def[death].round> == <def[kills]> {
        - determine "1"
    }
    else {
        - determine "<def[kills].div[<def[death]>].round_to[2]>"
    }
# <&3><server.flag[Teams_Group_<def[target].
# flag[Teams_Player_Group]>_Leaders].as_list.parse[name].
# separated_by[|<&3>]>






View History