Paste #40133: Diff note for paste #40132

Date: 2017/02/21 16:34:59 UTC-08:00
Type: Diff Report

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


 XPCoreEvents:
   type: world
   debug: true
   events:
     on server start:
     - run locally start instantly
     on player logs in:
     - run locally SQLCheck instantly
     on player quit:
     - run locally SQLUpdate instantly
     on restart command:
     - run locally SQLUpdateShutdown instantly
     on stop command:
     - run locally SQLUpdateShutdown instantly
     on shutdown command:
     - run locally SQLUpdateShutdown instantly
   SQLCheck:
     - if !<server.list_sql_connections.contains[Server]> {
       - announce "<&c>XPCore<&co> Not connected to the SQL database!" to_console
       - queue clear
       }
     - define uuid '<player.uuid||null>'
     - define db '<yaml[XPCore_config].read[config.MySQL.database]||null>' 
     - sql id:%db% "query:SELECT COUNT(PLAYERUUID) FROM XPCore WHERE PLAYERUUID='%uuid%';" save:idcount
     - define idcount '<entry[idcount].result.get[1].split[/].get[1].unescaped||null>'
     - define db '<yaml[XPCore_config].read[config.MySQL.database]||null>'
     - if <def[idcount].is[==].to[0]> {
       - announce "<&b>XPCore<&co> <&a>Creating player record for %uuid%" to_console
       - define statement "INSERT INTO %tableName% (PLAYERUUID) VALUES ('%uuid%');"
       - inject s@SQLManager_Offline p:managedUpdateStatement
       }
       else if <def[idcount].is[==].to[1]> {
       - announce "<&b>XPCore<&co> <&a>Found player record for %uuid%" to_console
       }
       else {
       - announce "<&b>XPCore<&co> <&c>Something went wrong checking the XPCore table for %uuid%!" to_console
       - queue clear
       }
     - if !<player.has_flag[currencyreset]> {
       - flag <player> xp:500  
       - flag <player> medallions:0
       - flag <player> playpoints:0
       - flag <player> tournamentpoints:0
       - flag <player> normalpacks:0
       - flag <player> superpacks:0
       - flag <player> donated:0
       - flag <player> currencyreset
       }
   SQLUpdate:
     - if !<server.list_sql_connections.contains[Server]> {
       - announce "<&c>XPCore<&co> Not connected to the SQL database!" to_console
       - queue clear
       }
     - define uuid '<player.uuid||null>'
     - define db '<yaml[config].read[config.MySQL.database]||null>'
     - define xp '<player.flag[xp]>'
     - define medallions '<player.flag[medallions]>'
     - define playpoints '<player.flag[playpoints]>'
     - define tournamentpoints '<player.flag[tournamentpoints]>'
     - define normalpacks '<player.flag[normalpacks]>'
     - define superpacks '<player.flag[superpacks]>'
     - sql id:%db% "query:SELECT * FROM XPCore WHERE PLAYERUUID='%uuid%';" save:record
     - define statement "UPDATE XPCore SET xp = %xp%, SET medallions = %medallions%, SET playpoints = %playpoints%, SET tournamentpoints = %tournamentpoints%, normalpacks = %normalpacks%, SET superpacks = %superpacks%, WHERE playeruuid='%uuid%';"
     - inject s@SQLManager_Offline p:managedUpdateStatement
     - ~bungeetag <bungee.list_servers>:
       - flag <player> xp:<player.flag[xp]>
       - flag <player> medallions:<player.flag[medallions]>
       - flag <player> playpoints:<player.flag[playpoints]>
       - flag <player> tournamentpoints:<player.flag[tournamentpoints]>
       - flag <player> normalpacks:<player.flag[normalpacks]>
       - flag <player> superpacks:<player.flag[superpacks]>
   
   SQLUpdateShutdown:
     - if !<server.list_sql_connections.contains[Server]> {
       - announce "<&c>XPCore<&co> Not connected to the SQL database!" to_console
       - queue clear
       }
     - foreach <server.list_online_players>:
       - define uuid '<player.uuid||null>'
       - define db '<yaml[config].read[config.MySQL.database]||null>'
       - define xp '<player.flag[xp]>'
       - define medallions '<player.flag[medallions]>'
       - define playpoints '<player.flag[playpoints]>'
       - define tournamentpoints '<player.flag[tournamentpoints]>'
       - define normalpacks '<player.flag[normalpacks]>'
       - define superpacks '<player.flag[superpacks]>'
       - sql id:%db% "query:SELECT * FROM XPCore WHERE PLAYERUUID='%uuid%';" save:record
       - define statement "UPDATE XPCore SET xp = %xp%, SET medallions = %medallions%, SET playpoints = %playpoints%, SET tournamentpoints = %tournamentpoints%, normalpacks = %normalpacks%, SET superpacks = %superpacks%, WHERE playeruuid='%uuid%';"
       - inject s@SQLManager_Offline p:managedUpdateStatement
       - ~bungeetag <bungee.list_servers>:
         - flag <player> xp:<player.flag[xp]>
         - flag <player> medallions:<player.flag[medallions]>
         - flag <player> playpoints:<player.flag[playpoints]>
         - flag <player> tournamentpoints:<player.flag[tournamentpoints]>
         - flag <player> normalpacks:<player.flag[normalpacks]>
         - flag <player> superpacks:<player.flag[superpacks]>
     
   start: 
     - define yamlName 'XPCore' 
     - define scriptName '<script.name>'
     - if <yaml.list.contains[%yamlName%_config]> { 
       - yaml unload 'id:%yamlName%_config' 
       } 
     - yaml 'load:scripts/%yamlName%.yml' 'id:%yamlName%_config' 
     - if !<yaml.list.contains[%yamlName%]> { 
       - announce "<&c>XPCore<&co><&b> An error occurred while loading %yamlName%!" to_console 
       - announce "<&b>XPCore<&co><&3> Aborting..." to_console 
       - inject s@%scriptName% p:unload 
       }
     - define config XPCore_Configurations
     - define structure XPCoreSQL
     - define db '<s@XPCore_Configurations.yaml_key[config.MySQL.database]||false>' 
     - repeat 5: 
       - if <yaml.list.contains[SQLManager_Offline].not> { 
         - announce to_console "XPCore<&co> Waiting for SQLManager to come online..." 
         - wait 1s 
         } 
     - if <yaml.list.contains[SQLManager_Offline].not> { 
       - announce to_console "XPCore<&co> SQLManager FAILED!" 
       - announce to_console "XPCore<&co> Aborting startup!" 
       - queue clear 
       } 
     - define status '<yaml[SQLManager_Offline].read[Offline_Cache.databases.%db%.status]||null>' 
     - if <def[status].is[==].to[connecting]> { 
       - announce "<&b>SQLManager<&co><&c> Already attempting to reconnect to %db% database!" to_console 
       } 
       else { 
       - yaml set 'id:SQLManager_Offline' 'Offline_Cache.databases.%db%.status:connecting' 
       - yaml 'savefile:SQLManager/cache.yml' 'id:SQLManager_Offline' 
       - inject s@SQLManager 
-      } 
+      }
-reconnected to. 
   unload: 
     - ^if <yaml.list.contains[%yamlName%_config]> { 
       - announce "<&b>XPCore<&co><&3> Unloading config.yml file..." to_console 
       - yaml unload 'id:%yamlName%_config' 
       } 
 
-XPCoreSQL: 
+XPCoreSQL:
   type: task 
   debug: true
   tables: 
     XPCoreValues: 
       columns: 
         ID: INT NOT NULL AUTO_INCREMENT PRIMARY KEY 
         PLAYERUUID: varchar(255) NOT NULL UNIQUE 
         XP: int 
         CLAIMEDCODES: tinyint 
         RANK: varchar(25) 
         NORMALPACKS: TINYINT NOT NULL DEFAULT '0' 
         SUPERPACKS: TINYINT NOT NULL DEFAULT '0' 
         MEDALLIONS: INT NOT NULL DEFAULT '0' 
         PLAYPOINTS: INT NOT NULL DEFAULT '0' 
         TOURNAMENTPOINTS: SMALLINT NOT NULL DEFAULT '0' 
 
 XPCore_Configurations:
   type: yaml data 
   config: 
     MySQL: 
       connection: 
         retry: 3 
         retryDelay: 10s 
         keepAlive: 5m 
         host: localhost 
         port: 3306 
         username: root 
         password: ThisPWsucks123 
       database: Server 
       tables: 
         XPCoreValues: XPCore 
 
 DonateInterest:
   type: world
   debug: true
   events:
     on system time 00:00:
     - foreach <server.list_players>:
       - define donations <player.flag[donated].as_int>
       - if <def[donations].is[EQUALS].than[0]> {
         - queue clear
         }
       - if <def[donations].sub[365].is[MORE].than[0]> {
         - define interest <def[donations].sub[365].power[<el@1.div[3]>].div[266].add[1.05]>
         } else {
         - define interest <def[donations].sub[365].mul[-1].power[<el@1.div[3]>].mul[-1].div[266].add[1.05]>
         }
       - define earnings <def[donations].mul[<def[interest]>].round_down>
       - flag <player> xp:+:<def[earnings]>
       - narrate '<&2>=<&6>=<&2>=<&6>=<&2>=<&6>=<&2>=<&6>=<&2>=<&6>=<&2>-<&6>-<&2>-<&6>-<&2>-<&6>-<&2>-<&6>-<&2>-<&6>-<&2>-<&6>-<&2>-<&6>-<&2>-<&6>-<&2>-<&6>-<&2>-<&6>-<&2>-<&6>-<&2>-<&6>-<&2>-<&6>-<&2>-<&6>-<&2>-<&6>-<&2>-<&6>-<&2>=<&6>=<&2>=<&6>=<&2>=<&6>=<&2>=<&6>=<&2>=<&6>='
       - narrate '           <&a>Daily /donate interests have been applied!'
       - narrate '<&2>=<&6>=<&2>=<&6>=<&2>=<&6>=<&2>=<&6>=<&2>=<&6>=<&2>-<&6>-<&2>-<&6>-<&2>-<&6>-<&2>-<&6>-<&2>-<&6>-<&2>-<&6>-<&2>-<&6>-<&2>-<&6>-<&2>-<&6>-<&2>-<&6>-<&2>-<&6>-<&2>-<&6>-<&2>-<&6>-<&2>-<&6>-<&2>-<&6>-<&2>-<&6>-<&2>=<&6>=<&2>=<&6>=<&2>=<&6>=<&2>=<&6>=<&2>=<&6>='
       - narrate "<&a>You<&sq>ve donated XP <&b><def[donations]> <&a>times and received <&b><def[earnings]> <&a>XP back!"
 
 
 ##### COMMANDS #####
 Setcodecommand:
   type: command
   name: setcode
   usage: /setcode code xp|medallions|playpoints|tournamentpoints|normalpack|superpack amount length(days)
   description: Manually sets a server-wide code for rewards.
   script:
   - if !<player.is_op||<context.server>> { 
     - narrate "<&c>You do not have permission for that command." 
     - queue clear 
     }
   - if <context.args.size.is[OR_LESS].than[3]> || <li@xp|medallions|playpoints|tournamentpoints|normalpack|superpack.contains[<context.args.get[2]>]> || !<context.args.get[3].is[matches].to[number]> || !<context.args.get[4].is[matches].to[number]>{
     - narrate "<&c>Usage<&co> /setcode code xp|medallions|playpoints|tournamentpoints|normalpack|superpack amount length(days)"
     - queue clear
     }
     else {
     - flag server servercodes:->:<context.args.get[1]> duration:<context.args.get[4].as_int.in_days>
     - flag server <context.args.get[1]>:|:<context.args.get[3].as_int>|<context.args.get[2]> duration:<context.args.get[4].as_int.in_days>
     }
 Claimcodecommand:
   type: command
   name: claimcode
   usage: /claimcode code
   description: Claims a code for rewards.
   script:
   - if <context.args.size.is[EQUALS].than[0]> {
     - narrate "<&c>Usage<&co> /claimcode code"
     - queue clear
     }
   - if <player.has_flag[<context.args.get[1]>]> {
     - narrate "<&c>You have already claimed this code!"
     - queue clear
     }
   - if <server.list_flags[servercodes].contains_case_sensitive[<context.args.get[1]>]> && <server.has_flag[<context.args.get[1]>]> {
     - define codetype <server.list_flags[<context.args.get[1]>].get[2]>
     - choose "<def[codetype]>" {
       - case "<def[codetype].contains_text[xp]>" {
         - flag <player> xp:+:<server.flag[<context.args.get[1]>].get[1].as_int>
         - flag <player> <context.args.get[1]> duration:<server.flag[<context.args.get[1]>].expiration>
         }
       - case "<def[codetype].contains_text[medallions]>" {
         - flag <player> medallions:+:<server.flag[<context.args.get[1]>].get[1].as_int>
         - flag <player> <context.args.get[1]> duration:<server.flag[<context.args.get[1]>].expiration>
         }
       - case "<def[codetype].contains_text[playpoints]>" {
         - flag <player> playpoints:+:<server.flag[<context.args.get[1]>].get[1].as_int>
         - flag <player> <context.args.get[1]> duration:<server.flag[<context.args.get[1]>].expiration>
         }
       - case "<def[codetype].contains_text[tournamentpoints]>" {
         - flag <player> tournamentpoints:+:<server.flag[<context.args.get[1]>].get[1].as_int>
         - flag <player> <context.args.get[1]> duration:<server.flag[<context.args.get[1]>].expiration>
         }
       - case "<def[codetype].contains_text[normalpack]>" {
         - flag <player> tournamentpoints:+:<server.flag[<context.args.get[1]>].get[1].as_int>
         - flag <player> <context.args.get[1]> duration:<server.flag[<context.args.get[1]>].expiration>
         }
       - case "<def[codetype].contains_text[superpack]>" {
         - flag <player> tournamentpoints:+:<server.flag[<context.args.get[1]>].get[1].as_int>
         - flag <player> <context.args.get[1]> duration:<server.flag[<context.args.get[1]>].expiration>
         }
     } else {
       - narrate "<&c>That is not a valid code!"
       - queue clear
       }
     
 Usepackcommand:
   type: command
   name: usepack
   usage: /usepack normal|super
   description: Uses an XP-Pack.
   script:
   - if <context.args.size.is[EQUALS].than[0]> || !<li@super|normal.contains[<context.args.get[1]>]> {
     - narrate "<&c>Usage<&co> /usepack normal|super"
     - queue clear
     }
   - if <context.args.get[1].contains_text[normal]> {
     - if <player.flag[normalpacks]>  == 0 {
       - narrate "<&c>You don<&sq>t have any Normal XP-Packs!"
       - queue clear
       } 
       else if <server.name.contains_text[shift]> {
       - bungee <bungee.list_servers.filter[contains_text[shift]]>
         - flag server normalxppack duration:30m  
       }
       else {
       - flag server normalxppack duration:30m
       }
     }
     else if <context.args.get[1].contains_text[super]> {
     - if <player.flag[superpacks]>  == 0 {
       - narrate "<&c>You don<&sq>t have any Super XP-Packs!"
       - queue clear
       }
       else if <server.name.contains_text[shift]> {
       - bungee <bungee.list_servers.filter[contains_text[shift]]>
         - flag server superxppack duration:30m  
       }
       else {
       - flag server superxppack duration:30m
       }
     }
 XPCommand:
   type: command
   name: XP
   usage: /xp
   description: Checks your XP balance
   aliases:
   - bal
   - money
   - currency
   - medallions
   - playpoints
   - tournamentpoints
   - xppack
   script:
   - inventory open d:in@PlayerProfile   
 Donatecommand:
   type: command
   name: donate
   usage: /donate player amount
   description: Donates XP to another player.
   permission: xpcraft.donate
   permission message: <&c>Sorry, this command is premium only. Purchase a rank in the store to gain access!
   script:
   - if <context.args.size.is[EQUALS].than[0]> {
     - narrate "<&a>You<&sq>ve donated XP to other players <&b><player.flag[donated].as_int> <&a>times!"
     - queue clear
     }
   - if <context.args.size.is[EQUALS].than[1]> || !<context.args.get[2].is[matches].to[number]> {
     - narrate "<&c>Usage<&co> /donate player amount"
     - queue clear
     }
   - if <player.flag[xp].as_int.is[LESS].than[<context.args.get[2].as_int>]> {
     - narrate "<&c>You don<&sq>t have enough XP!"
     - queue clear
     }
   - if <context.args.get[1].contains_text[<player.name>]> {
     - narrate "<&c>(`-ะด-) ....seriously?"
     - queue clear
     }
   - if <player.has_flag[donationcooldown]> {
     - narrate "<&c>You have already donated XP today. You will be able to use this command again in <player.flag[donationcooldown].expiration.formatted>."
     - queue clear
     }
   - define arg1 <server.match_offline_player[<context.args.get[1]>]||null>
   - if <def[arg1]> == null {
     - narrate "<&c>Usage<&co> /donate player amount"
     - queue clear
     }
   - define donationtimes <player.flag[donated].as_int>
   - define minimum <def[donationtimes].power[<def[donationtimes].power[0.025]>].round_down>
   - if <context.args.get[2].as_int.is[LESS].than[<def[minimum]>]> {
     - narrate "<&c>The current minimum XP you can donate is <&b><def[minimum]><&c>!"
     - queue clear
     } else {
     - flag <def[arg1]> xp:+:<context.args.get[2].as_int>
     - flag <player> xp:-:<context.args.get[2].as_int>
     - flag <player> donated:+:1
     - flag <player> donationcooldown duration:24h
     - narrate "<&a>Donated <&B><context.args.get[2]> <&A>XP to <context.args.get[1]>!" target:<player>
     - if <def[arg1].is_online> {
       - narrate "<&a><player.name> has donated <&b><context.args.get[2].as_int> <&a>XP to you!" target:<def[arg1]>
       }
 #    - run Achievements instantly
     }
 SetXPcommand:
   type: command
   name: setxp
   usage: /setxp player amount
   description: Changes the amount of XP in a player's account.
   script:
   - if !<player.is_op||<context.server>> { 
     - narrate "<&c>You do not have permission for that command." 
     - queue clear 
     }
   - if <context.args.size.is[OR_LESS].than[1]> || !<context.args.get[2].is[matches].to[number]> {
     - narrate "<&c>Usage: /setxp player amount"
     - queue clear
     }
   - define arg1 <server.match_offline_player[<context.args.get[1]>]||null>
   - if <def[arg1]> == null {
     - narrate "<&c>Usage: /setxp player amount"
     - queue clear
     } else {
     - flag <server.match_offline_player[<context.args.get[1]>]> xp:<context.args.get[2].as_int>
     - narrate "<&a><context.args.get[1]> now has <&B><context.args.get[2]> <&A>XP!"
     }
 AddXPcommand:
   type: command
   name: addxp
   usage: /addxp player amount
   description: Adds XP to a player's account.
   script:
   - if !<player.is_op||<context.server>> { 
     - narrate "<&c>You do not have permission for that command." 
     - queue clear 
     }
   - if <context.args.size.is[OR_LESS].than[1]> || !<context.args.get[2].is[matches].to[number]> {
     - narrate "<&c>Usage<&co> /addxp player amount"
     - queue clear
     }
   - define arg1 <server.match_offline_player[<context.args.get[1]>]||null>
   - if <def[arg1]> == null {
     - narrate "<&c>Usage<&co> /addxp player amount"
     - queue clear
     } else {
     - flag <server.match_offline_player[<context.args.get[1]>]> xp:+:<context.args.get[2].as_int>
     - narrate "<&a>Added <context.args.get[2]> XP to <&B><context.args.get[1]><&sq>s <&A>account!"
     }
 RemoveXPcommand:
   type: command
   name: removexp
   usage: /removexp player amount
   description: Removes XP from a player's account.
   script:
   - if !<player.is_op||<context.server>> { 
     - narrate "<&c>You do not have permission for that command." 
     - queue clear 
     }
   - if <context.args.size.is[OR_LESS].than[1]> || !<context.args.get[2].is[matches].to[number]> {
     - narrate "<&c>Usage<&co> /removexp player amount"
     - queue clear
     }
   - define arg1 <server.match_offline_player[<context.args.get[1]>]||null>
   - if <def[arg1]> == null {
     - narrate "<&c>Usage<&co> /removexp player amount"
     - queue clear
     } else if <def[arg1].flag[xp].as_int.is[LESS].than[<context.args.get[2]> {
     - flag <def[arg1]> xp:0
     - narrate "<&B><context.args.get[1]> <&a>didn<&sq>t have enough XP...setting to 0!"
     } else {
     - flag <def[arg1]> xp:-:<context.args.get[2].as_int>
     - narrate "<&a>Removed <context.args.get[2]> XP from <&B><context.args.get[1]><&sq>s <&A>account!"
     }
 Setpackcommand:
   type: command
   name: Setpack
   usage: /setpack player normal|super amount
   description: Changes the amount of XP-packs in a player's account.
   script:
   - if !<player.is_op||<context.server>> { 
     - narrate "<&c>You do not have permission for that command." 
     - queue clear 
     }
   - if <context.args.size.is[OR_LESS].than[2]> || !<li@super|normal.contains[<context.args.get[2]>]> || !<context.args.get[3].is[matches].to[number]> || <def[arg1]> == null {
     - narrate "<&c>Usage<&co> /setpack player normal|super amount"
     - queue clear
     }
   - define arg1 <server.match_offline_player[<context.args.get[1]>]||null>
   - if <def[arg1]> == null {
     - narrate "<&c>Usage<&co> /setpack player normal|super amount"
     - queue clear
     } else if <context.args.get[2].contains_text[normal]> {
     - flag <server.match_offline_player[<context.args.get[1]>]> normalpacks:<context.args.get[3].as_int>
     - narrate "<&a><context.args.get[1]> now has <context.args.get[3]> Normal XP-packs!"
     } else if <context.args.get[2].contains_text[super]> {
     - flag <server.match_offline_player[<context.args.get[1]>]> superpacks:<context.args.get[3].as_int>
     - narrate "<&a><context.args.get[1]> now has <context.args.get[3]> Super XP-packs!"
     }
 Addpackcommand:
   type: command
   name: Addpack
   usage: /addpack player normal|super amount
   description: Adds XP-packs to a player's account.
   script:
   - if !<player.is_op||<context.server>> { 
     - narrate "<&c>You do not have permission for that command." 
     - queue clear 
     }
   - if <context.args.size.is[OR_LESS].than[2]> || !<li@super|normal.contains[<context.args.get[2]>]> || !<context.args.get[3].is[matches].to[number]> || <def[arg1]> == null {
     - narrate "<&c>Usage<&co> /addpack player normal|super amount"
     - queue clear
     }
   - define arg1 <server.match_offline_player[<context.args.get[1]>]||null>
   - if <def[arg1]> == null {
     - narrate "<&c>Usage<&co> /addpack player normal|super amount"
     - queue clear
     } else if <context.args.get[2].contains_text[normal]> {
     - flag <server.match_offline_player[<context.args.get[1]>]> normalpacks:+:<context.args.get[3].as_int>
     - narrate "<&a>Added <context.args.get[3]> Normal XP-packs to <&b><context.args.get[1]><&sq>s <&a>account!"
     } else if <context.args.get[2].contains_text[super]> {
     - flag <server.match_offline_player[<context.args.get[1]>]> superpacks:+:<context.args.get[3].as_int>
     - narrate "<&a>Added <context.args.get[3]> Super XP-packs to <&B><context.args.get[1]><&sq>s <&A>account!"
     }
 Removepackcommand:
   type: command
   name: Removepack
   usage: /removepack player normal|super amount
   description: Removes XP-packs from a player's account.
   script:
   - if !<player.is_op||<context.server>> { 
     - narrate "<&c>You do not have permission for that command." 
     - queue clear 
     }
   - define arg1 <server.match_offline_player[<context.args.get[1]>]||null>
   - if <context.args.size.is[OR_LESS].than[2]> || !<li@super|normal.contains[<context.args.get[2]>]> || !<context.args.get[3].is[matches].to[number]> || <def[arg1]> == null {
     - narrate "<&c>Usage<&co> /removepack player normal|super amount"
     - queue clear
     } else if <context.args.get[2].contains_text[normal]> {
       - if <def[arg1].flag[normalpacks].as_int.is[LESS].than[<context.args.get[3]>]> {
         - flag <def[arg1]> normalpacks:0
         - narrate "<&B><context.args.get[1]> <&a>didn<&sq>t have enough Normal XP-Packs...setting to 0!"
         } else {
         - flag <def[arg1]> normalpacks:-:<context.args.get[3].as_int>
         - narrate "<&a>Removed <context.args.get[3]> Normal XP-packs from <&B><def[arg1].as_player.name><&sq>s <&a>account!"
         }
     } else if <context.args.get[2].contains_text[super]> {
       - if <def[arg1].flag[superpacks].as_int.is[LESS].than[<context.args.get[3]>]> {
         - flag <def[arg1]> superpacks:0
         - narrate "<&B><context.args.get[1]> <&a>didn<&sq>t have enough Super XP-Packs...setting to 0!"
         } else {
         - flag <def[arg1]> superpacks:-:<context.args.get[3].as_int>
         - narrate "<&a>Removed <context.args.get[3]> Super XP-packs from <&B><def[arg1].as_player.name><&sq>s <&a>account!"
         }
       }
 SetMedallionscommand:
   type: command
   name: setmedallions
   usage: /setmedallions player amount
   description: Changes the amount of Medallions in a player's account.
   script:
   - if !<player.is_op||<context.server>> { 
     - narrate "<&c>You do not have permission for that command." 
     - queue clear 
     }
   - if <context.args.size.is[OR_LESS].than[1]> || !<context.args.get[2].is[matches].to[number]> {
     - narrate "<&c>Usage<&co> /setmedallions player amount"
     - queue clear
     }
   - define arg1 <server.match_offline_player[<context.args.get[1]>]||null>
   - if <def[arg1]> == null {
     - narrate "<&c>Usage<&co> /setmedallions player amount"
     - queue clear
     } else {
     - flag <server.match_offline_player[<context.args.get[1]>]> medallions:<context.args.get[2].as_int>
     - narrate "<&a><context.args.get[1]> now has <&B><context.args.get[2]> <&A>Medallions!"
     }
 AddMedallionscommand:
   type: command
   name: addxp
   usage: /addmedallions player amount
   description: Adds XP to a player's account.
   script:
   - if !<player.is_op||<context.server>> { 
     - narrate "<&c>You do not have permission for that command." 
     - queue clear 
     }
   - if <context.args.size.is[OR_LESS].than[1]> || !<context.args.get[2].is[matches].to[number]> {
     - narrate "<&c>Usage<&co> /addmedallions player amount"
     - queue clear
     }
   - define arg1 <server.match_offline_player[<context.args.get[1]>]||null>
   - if <def[arg1]> == null {
     - narrate "<&c>Usage<&co> /addmedallions player amount"
     - queue clear
     } else {
     - flag <server.match_offline_player[<context.args.get[1]>]> medallions:+:<context.args.get[2].as_int>
     - narrate "<&a>Added <context.args.get[2]> Medallions to <&B><context.args.get[1]><&sq>s <&A>account!"
     }
 RemoveMedallionscommand:
   type: command
   name: removeMedallions
   usage: /removeMedallions player amount
   description: Removes Medallions from a player's account.
   script:
   - if !<player.is_op||<context.server>> { 
     - narrate "<&c>You do not have permission for that command." 
     - queue clear 
     }
   - if <context.args.size.is[OR_LESS].than[1]> || !<context.args.get[2].is[matches].to[number]> {
     - narrate "<&c>Usage<&co> /removeMedallions player amount"
     - queue clear
     }
   - define arg1 <server.match_offline_player[<context.args.get[1]>]||null>
   - if <def[arg1]> == null {
     - narrate "<&c>Usage<&co> /removeMedallions player amount"
     - queue clear
     } else if <def[arg1].flag[Medallions].as_int.is[LESS].than[<context.args.get[2]> {
     - flag <def[arg1]> Medallions:0
     - narrate "<&B><context.args.get[1]> <&a>didn<&sq>t have enough Medallions...setting to 0!"
     } else {
     - flag <def[arg1]> Medallions:-:<context.args.get[2].as_int>
     - narrate "<&a>Removed <context.args.get[2]> Medallions from <&B><context.args.get[1]><&sq>s <&A>account!"
     }
 SetPlayPointscommand:
   type: command
   name: setPlayPoints
   usage: /setPlayPoints player amount
   description: Changes the amount of PlayPoints in a player's account.
   script:
   - if !<player.is_op||<context.server>> { 
     - narrate "<&c>You do not have permission for that command." 
     - queue clear 
     }
   - if <context.args.size.is[OR_LESS].than[1]> || !<context.args.get[2].is[matches].to[number]> {
     - narrate "<&c>Usage<&co> /setPlayPoints player amount"
     - queue clear
     }
   - define arg1 <server.match_offline_player[<context.args.get[1]>]||null>
   - if <def[arg1]> == null {
     - narrate "<&c>Usage<&co> /setPlayPoints player amount"
     - queue clear
     } else {
     - flag <server.match_offline_player[<context.args.get[1]>]> PlayPoints:<context.args.get[2].as_int>
     - narrate "<&a><context.args.get[1]> now has <&B><context.args.get[2]> <&A>Play Points!"
     }
 AddPlayPointscommand:
   type: command
   name: addPlayPoints
   usage: /addPlayPoints player amount
   description: Adds PlayPoints to a player's account.
   script:
   - if !<player.is_op||<context.server>> { 
     - narrate "<&c>You do not have permission for that command." 
     - queue clear 
     }
   - if <context.args.size.is[OR_LESS].than[1]> || !<context.args.get[2].is[matches].to[number]> {
     - narrate "<&c>Usage<&co> /addPlayPoints player amount"
     - queue clear
     }
   - define arg1 <server.match_offline_player[<context.args.get[1]>]||null>
   - if <def[arg1]> == null {
     - narrate "<&c>Usage<&co> /addPlayPoints player amount"
     - queue clear
     } else {
     - flag <server.match_offline_player[<context.args.get[1]>]> PlayPoints:+:<context.args.get[2].as_int>
     - narrate "<&a>Added <context.args.get[2]> Play Points to <&B><context.args.get[1]><&sq>s <&A>account!"
     }
 RemovePlayPointscommand:
   type: command
   name: removePlayPoints
   usage: /removePlayPoints player amount
   description: Removes PlayPoints from a player's account.
   script:
   - if !<player.is_op||<context.server>> { 
     - narrate "<&c>You do not have permission for that command." 
     - queue clear 
     }
   - if <context.args.size.is[OR_LESS].than[1]> || !<context.args.get[2].is[matches].to[number]> {
     - narrate "<&c>Usage<&co> /removePlayPoints player amount"
     - queue clear
     }
   - define arg1 <server.match_offline_player[<context.args.get[1]>]||null>
   - if <def[arg1]> == null {
     - narrate "<&c>Usage<&co> /removePlayPoints player amount"
     - queue clear
     } else if <def[arg1].flag[PlayPoints].as_int.is[LESS].than[<context.args.get[2]> {
     - flag <def[arg1]> PlayPoints:0
     - narrate "<&B><context.args.get[1]> <&a>didn<&sq>t have enough Play Points...setting to 0!"
     } else {
     - flag <def[arg1]> PlayPoints:-:<context.args.get[2].as_int>
     - narrate "<&a>Removed <context.args.get[2]> Play Points from <&B><context.args.get[1]><&sq>s <&A>account!"
     }
 SetTournamentPointscommand:
   type: command
   name: setTournamentPoints
   usage: /setTournamentPoints player amount
   description: Changes the amount of TournamentPoints in a player's account.
   script:
   - if !<player.is_op||<context.server>> { 
     - narrate "<&c>You do not have permission for that command." 
     - queue clear 
     }
   - if <context.args.size.is[OR_LESS].than[1]> || !<context.args.get[2].is[matches].to[number]> {
     - narrate "<&c>Usage<&co> /setTournamentPoints player amount"
     - queue clear
     }
   - define arg1 <server.match_offline_player[<context.args.get[1]>]||null>
   - if <def[arg1]> == null {
     - narrate "<&c>Usage<&co> /setTournamentPoints player amount"
     - queue clear
     } else {
     - flag <server.match_offline_player[<context.args.get[1]>]> TournamentPoints:<context.args.get[2].as_int>
     - narrate "<&a><context.args.get[1]> now has <&B><context.args.get[2]> <&A>Tournament Points!"
     }
 AddTournamentPointscommand:
   type: command
   name: addTournamentPoints
   usage: /addTournamentPoints player amount
   description: Adds TournamentPoints to a player's account.
   script:
   - if !<player.is_op||<context.server>> { 
     - narrate "<&c>You do not have permission for that command." 
     - queue clear 
     }
   - if <context.args.size.is[OR_LESS].than[1]> || !<context.args.get[2].is[matches].to[number]> {
     - narrate "<&c>Usage<&co> /addTournament Points player amount"
     - queue clear
     }
   - define arg1 <server.match_offline_player[<context.args.get[1]>]||null>
   - if <def[arg1]> == null {
     - narrate "<&c>Usage<&co> /addTournamentPoints player amount"
     - queue clear
     } else {
     - flag <server.match_offline_player[<context.args.get[1]>]> TournamentPoints:+:<context.args.get[2].as_int>
     - narrate "<&a>Added <context.args.get[2]> Tournament Points to <&B><context.args.get[1]><&sq>s <&A>account!"
     }
 RemoveTournamentPointscommand:
   type: command
   name: removeTournamentPoints
   usage: /removeTournamentPoints player amount
   description: Removes TournamentPoints from a player's account.
   script:
   - if !<player.is_op||<context.server>> { 
     - narrate "<&c>You do not have permission for that command." 
     - queue clear 
     }
   - if <context.args.size.is[OR_LESS].than[1]> || !<context.args.get[2].is[matches].to[number]> {
     - narrate "<&c>Usage<&co> /removeTournamentPoints player amount"
     - queue clear
     }
   - define arg1 <server.match_offline_player[<context.args.get[1]>]||null>
   - if <def[arg1]> == null {
     - narrate "<&c>Usage<&co> /removeTournamentPoints player amount"
     - queue clear
     } else if <def[arg1].flag[TournamentPoints].as_int.is[LESS].than[<context.args.get[2]> {
     - flag <def[arg1]> TournamentPoints:0
     - narrate "<&B><context.args.get[1]> <&a>didn<&sq>t have enough Tournament Points...setting to 0!"
     } else {
     - flag <def[arg1]> TournamentPoints:-:<context.args.get[2].as_int>
     - narrate "<&a>Removed <context.args.get[2]> Tournament Points from <&B><context.args.get[1]><&sq>s <&A>account!"
     }