Paste #57272: Horses Plugin

Date: 2019/08/24 02:24:31 UTC-07:00
Type: Denizen Script

View Raw Paste Download This Paste
Copy Link


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


HorseCrop:
    type: item
    debug: false
    material: i@WOODEN_AXE[unbreakable=true;flags=HIDE_UNBREAKABLE|HIDE_ATTRIBUTES]
    custom_model_data: 1
    display name: "<&f>Horse Crop"

HorsesPlayerInit:
    type: task
    debug: false
    script:
    - if <yaml[<player>].read[horses.count]||null> == null:
        - yaml id:<player> set horses.count:0

    - foreach <yaml[horses].list_keys[entities]> as :horse:
        - if <yaml[horses].read[entities.<def[horse]>.owner> == <player>:
            - if <def[horse].is_spawned>:
                - yaml id:horses set entities.<def[horse]>.spawned:true
                - spawn horse save:horseEntity

HorsesMasterInit:
    type: task
    debug: false
    script:
    # Create New File if Doesn't Exist
    - if !<server.has_file[data/entities/horses.yml]>:
        - yaml create id:horses
        - yaml savefile:data/entities/horses.yml id:horses
    # Load Old One If Already Exists
    - else:
        - yaml load:data/entities/horses.yml id:horses

HorsesCreation:
    type: task
    debug: false
    script:
    # Horse Name
    - yaml id:horses set entities.<def[horse]>.name:null
    # Horse Appearance
    - define appearance li@<def[horse].color>
    - yaml id:horses set entities.<def[horse]>.color:<def[appearance].as_list.get[1]>
    - yaml id:horses set entities.<def[horse]>.markings:<def[appearance].as_list.get[2]>
    # Horse Speed
    - yaml id:horses set entities.<def[horse]>.speed:<def[horse].speed>
    # Horse Jump
    - yaml id:horses set entities.<def[horse]>.jump_strength:<def[horse].jump_strength>
    # Hunger
    - yaml id:horses set entities.<def[horse]>.hunger:100
    - yaml id:horses set entities.<def[horse]>.hungerEnabled:true
    # Thirst
    - yaml id:horses set entities.<def[horse]>.thirst:100
    - yaml id:horses set entities.<def[horse]>.thirstEnabled:true
    # Age
    - yaml id:horses set entities.<def[horse]>.age.val:<def[horse].as_entity.age>
    - yaml id:horses set entities.<def[horse]>.age.adulthood:0
    - yaml id:horses set entities.<def[horse]>.age.enabled:true
    # Health & Max Health
    - yaml id:horses set entities.<def[horse]>.health:<def[horse].health>
    - yaml id:horses set entities.<def[horse]>.max_health:<def[horse].health.max>
    - yaml id:horses set entities.<def[horse]>.damage:true
    # Call Distance
    - yaml id:horses set entities.<def[horse]>.call_distance:16
    # Parents
    - if <context.father||null> != null:
        - if <yaml[horses].read[entities.<context.father>.gender]> == MALE:
            - yaml id:horses set entities.<def[horse]>.father:<context.father>
        - else:
            - yaml id:horses set entities.<def[horse]>.mother:<context.father>
    - else:
        - yaml id:horses set entities.<def[horse]>.father:null
    - if <context.mother||null> != null:
        - if <yaml[horses].read[entities.<context.mother>.gender]> == FEMALE:
            - yaml id:horses set entities.<def[horse]>.mother:<context.mother>
        - else:
            - yaml id:horses set entities.<def[horse]>.father:<context.mother>
    - else:
        - yaml id:horses set entities.<def[horse]>.mother:null
    # First Owner & Owner
    - yaml id:horses set entities.<def[horse]>.firstowner:null
    - yaml id:horses set entities.<def[horse]>.lastowner:null
    - yaml id:horses set entities.<def[horse]>.owner:null
    # Trusted Players
    - yaml id:horses set entities.<def[horse]>.trusted:li@
    # Gender
    - if <util.random.int[0].to[1]> == 0:
        - yaml id:horses set entities.<def[horse]>.gender:FEMALE
    - else:
        - yaml id:horses set entities.<def[horse]>.gender:MALE
    # Spawned
    - yaml id:horses set entities.<def[horse]>.spawned:true
    # Save Entity
    - yaml savefile:data/entities/horses.yml id:horses

HorsesDamaged:
    type: task
    debug: false
    script:
    # Update Health Levels
    - yaml id:horses set entities.<context.entity>.health:<context.entity.health>
    - yaml id:horses set entities.<context.entity>.max_health:<context.entity.health.max>
    # Save Entity
    - yaml savefile:data/entities/horses.yml id:horses

HorsesRemoval:
    type: task
    debug: false
    script:
    # Remove Entity From Database
    - yaml id:horses set entities.<context.entity>:!
    # Save Entity
    - yaml savefile:data/entities/horses.yml id:horses

HorsesRiderCheck:
    type: task
    debug: false
    script:
    # Check if Rider Owner or Trusted or Admin
    - if <yaml[horses].contains[entities.<context.vehicle>]>:
        - if <yaml[horses].read[entities.<context.vehicle>.owner]||null> != <context.entity>:
            - if !<yaml[horses].read[entities.<context.vehicle>.trusted].as_list.contains[<context.entity>]||null> == true:
                - if !<player.has_permission[horses.admin.ride]:
                  - determine cancelled

    - inject HorsesEntry

HorsesMasterLoop:
    type: task
    debug: false
    script:
    - flag server "horseLoop:true"
    - while <server.flag[horseLoop]> == true:
        - flag server "horseEntities:<yaml[horses].list_keys[entities]>"
        - foreach <yaml[horses].list_keys[entities]> as:horse:

            # Check YAML Changes
            - if <server.flag[horseEntities]> != <yaml[horses].list_keys[entities]>:
                - foreach stop
                - flag server "horseLoop:false"
                - flag server "horseEntities:<yaml[horses].list_keys[entities]>"
                - inject HorseMasterLoop

            - if <entities.<def[horse]>.is_spawned> == true:
              # Horse Hunger/Feeding
              - if <yaml[horses].read[entities.<def[horse]>.hungerEnabled]> == true:
                  - yaml id:horses set entities.<def[horse]>.hunger:<yaml[horses].read[entities.<def[horse]>.hunger].as_decimal.sub[0.1]>
              - if !<def[horse].as_entity.location.find.blocks[m@grass_block|m@hay_block].within[6].as_list.is_empty>:
                  - if <yaml[horses].read[entities.<def[horse]>.hunger].as_decimal> < 0:
                      - yaml id:horses set entities.<def[horse]>.hunger:0
                  - define hungerValue <yaml[horses].read[entities.<def[horse]>.hunger].as_decimal.add[1.0]>
                  - if <def[hungerValue]> > 100:
                      - define hungerValue 100
                  - yaml id:horses set entities.<def[horse]>.hunger:<def[hungerValue]>
              - if <yaml[horses].read[entities.<def[horse]>.hunger]>  < 0:
                  - hurt 2.0 <def[horse].as_entity>

              # Horse Thrist
              - if <yaml[horses].read[entities.<def[horse]>.thirstEnabled]> == true:
                  - yaml id:horses set entities.<def[horse]>.thirst:<yaml[horses].read[entities.<def[horse]>.thirst].as_decimal.sub[0.1]>
              - if !<def[horse].as_entity.location.find.blocks[m@water].within[6].as_list.is_empty>:
                  - if <yaml[horses].read[entities.<def[horse]>.thirst].as_decimal> < 0:
                      - yaml id:horses set entities.<def[horse]>.thirst:0
                  - define thirstValue <yaml[horses].read[entities.<def[horse]>.hunger].as_decimal.add[1.0]>
                  - if <def[thirstValue]> > 100:
                      - define thirstValue 100
                  - yaml id:horses set entities.<def[horse]>.hunger:<def[thirstValue]>
              - if <yaml[horses].read[entities.<def[horse]>.thirst]> < 0:
                  - hurt 1.0 <def[horse].as_entity>

        # Save Horse Entities
        - yaml savefile:data/entities/horses.yml id:horses

        # Cooldown
        - wait 1s

HorsesEntry:
    type: task
    debug: false
    script:
    - flag <context.vehicle> "speed:0"
    - adjust <context.vehicle> "speed:0"
HorsesExit:
    type: task
    debug: false
    script:
    - flag <context.vehicle> "speed:0"
    - adjust <context.vehicle> "speed:<yaml[horses].read[entities.<context.vehicle>.speed]>"

HorsesSpeedIncrease:
    type: task
    debug: true
    script:
    - if <player.vehicle.flag[speed]> < 4:
        - flag <player.vehicle> "speed:<player.vehicle.flag[speed].add[1]>"
    - inject HorsesSpeedEvaluate
HorsesSpeedDecrease:
    type: task
    debug: false
    script:
    - if <player.vehicle.flag[speed]> > 0:
        - flag <player.vehicle> "speed:<player.vehicle.flag[speed].sub[1]>"
    - inject HorsesSpeedEvaluate

HorsesSpeedEvaluate:
    type: task
    debug: false
    script:
    - define speedVariable <yaml[horses].read[entities.<player.vehicle>.speed].as_decimal.div[4]>
    - if <player.vehicle.flag[speed]> == 1:
        - adjust <player.vehicle> "speed:<def[speedVariable]>"
        - title "title:<&2>Walk" targets:<player>
    - else if <player.vehicle.flag[speed]> == 2:
        - adjust <player.vehicle> "speed:<def[speedVariable].as_decimal.mul[2]>"
        - title "title:<&2>Trot" targets:<player>
    - else if <player.vehicle.flag[speed]> == 3:
        - adjust <player.vehicle> "speed:<def[speedVariable].as_decimal.mul[3]>"
        - title "title:<&2>Canter" targets:<player>
    - else if <player.vehicle.flag[speed]> == 4:
        - adjust <player.vehicle> "speed:<def[speedVariable].as_decimal.mul[4]>"
        - title "title:<&2>Gallop" targets:<player>
    - else:
        - adjust <player.vehicle> "speed:0"
        - title "title:<&2>Halt" targets:<player>


HorsesEvents:
    type: world
    debug: true
    events:

        # Horse Master Init #
        on server preload:
        - inject HorsesMasterInit
        on reload scripts:
        - inject HorsesMasterInit

        # All Entity Mapping
        on horse spawns:
        - if !<yaml[horses].contains[entities.<context.entity>]>:
            - define horse <context.entity>
            - inject HorsesCreation
        on horse damaged:
        - if <yaml[horses].contains[entities.<context.entity>]>:
            - if <yaml[horses].read[entities.<context.entity>.damage]> == true:
                - inject HorsesDamaged
        on horse breeds:
        - if <yaml[horses].read[entities.<context.father>.gender]||null> == MALE && <yaml[horses].read[entities.<context.mother>.gender]||null> == FEMALE:
            - define horse <context.child>
            - inject HorsesCreation
        - else if <yaml[horses].read[entities.<context.mother>.gender]||null> == MALE && <yaml[horses].read[entities.<context.father>.gender]||null> == FEMALE:
            - define horse <context.child>
            - inject HorsesCreation
        - else:
            - determine cancelled
        on horse dies:
        - if <yaml[horses].contains[entities.<context.entity>]>:
            - inject HorsesRemoval
        on player enters horse:
        - inject HorsesRiderCheck
        on player exits horse:
        - inject HorsesExit
        on player left clicks with HorseCrop:
        # Usage Durability Change
        - adjust <context.item> "durability:<context.item.durability.sub[1]>"
        # Check Player Riding Horse
        - if <player.is_inside_vehicle> && <player.vehicle.entity_type||null> == HORSE:
            - inject HorsesSpeedDecrease
        on player right clicks with HorseCrop:
        # Usage Durability Change
        - adjust <context.item> "durability:<context.item.durability.sub[1]>"
        # Check Player Riding Horse
        - if <player.is_inside_vehicle> && <player.vehicle.entity_type||null> == HORSE:
            - inject HorsesSpeedIncrease

HorsesClaim:
    type: task
    debug: false
    script:
    # Make The Player The Owner
    - yaml id:horses set entities.<player.vehicle>.owner:<player>
    # Check if Horse Has First Owner
    - if <yaml[horses].read[entities.<player.vehicle>.firstowner]||null> == null:
        - yaml id:horses set entities.<player.vehicle>.owner:<player>
    # Give Horse Name
    - yaml id:horses set entities.<player.vehicle>.name:<def[horseName]>
    - adjust <player.vehicle> "custom_name:<def[horseName]>"
    - adjust <player.vehicle> "custom_name_visible:<def[horseName]>"
    # Save Horse
    - yaml savefile:data/entities/horses.yml id:horses
    # Notify Player
    - narrate "<def[prefix]> You successfully claimed your new horse <&dq><def[horseName]><&dq>, congratulations!" targets:<player>
HorsesUnClaim:
    type: task
    debug: false
    script:
    # Make Last Owner
    - yaml id:horses set entities.<player.vehicle>.lastowner:<player>
    # Remove as Owner
    - yaml id:horses set entities.<player.vehicle>.owner:null
    # Remove Horse Name
    - yaml id:horses set entities.<player.vehicle>.name:null
    - adjust <player.vehicle> "custom_name_visible:false"
    - adjust <player.vehicle> "custom_name:Horse"
    # Remove Current Trusted List
    - yaml id:horses set entities.<player.vehicle>.trusted:li@
    # Save Horse
    - yaml savefile:data/entities/horses.yml id:horses
    # Notify Player
    - narrate "<def[prefix]> You successfully unclaimed your horse." targets:<player>
    # Unmount from Horse
    - mount cancel <player>

HorsesTrust:
    type: task
    debug: false
    script:
    # Add Player to List of Trusted Players
    - yaml id:horses set entities.<player.vehicle>.trusted:<yaml[horses].read[entities.<player.vehicle>.trusted].as_list.include[<def[player]>]>
    # Save Horse
    - yaml savefile:data/entities/horses.yml id:horses
    # Notify Player
    - narrate "<def[prefix]> You have now allowed <&dq><def[player].as_player.name><&dq> to ride your horse." targets:<player>
    # Notify Trusted Player
    - narrate "<def[prefix]> You are now allowed to ride <&dq><player.vehicle.name><&dq>." targets:<def[player].as_player>
HorsesUntrust:
    type: task
    debug: false
    script:
    # Remove Player from List of Trusted Players
    - yaml id:horses set entities.<player.vehicle>.trusted:<yaml[horses].read[entities.<player.vehicle>.trusted].as_list.exclude[<def[player]>]>
    # Save Horse
    - yaml savefile:data/entities/horses.yml id:horses
    # Notify Player
    - narrate "<def[prefix]> You have now stopped <&dq><def[player].as_player.name><&dq> from being able to ride your horse." targets:<player>
    # Notify Trusted Player
    - narrate "<def[prefix]> You are no longer allowed to ride <&dq><player.vehicle.name><&dq>." targets:<def[player].as_player>

HorsesRename:
    type: task
    debug: false
    script:
    # Update Name
    - yaml id:horses set entities.<player.vehicle>.name:<context.args.get[2]>
    - adjust <player.vehicle> "custom_name:<context.args.get[2]>"
    - adjust <player.vehicle> "custom_name_visible:true"
    # Notify Player
    - narrate "<def[prefix]> Your horse's name is now <&dq><context.args.get[2]><&dq>." targets:<player>

HorsesSetJump:
    type: task
    debug: false
    script:
    # Sets the jump strength of a horse
    - yaml id:horses set entities.<player.vehicle>.jump_strength:<def[jump_strength].as_decimal>
    - adjust <player.vehicle> "jump_strength:<def[jump_strength].as_decimal>"
    # Notify Player
    - narrate "<def[prefix]> You have now set this horse's jump strength to <&dq><def[jump_strength]><&dq>." targets:<player>

HorsesSetSpeed:
    type: task
    debug: false
    script:
    # Sets the speed of a horse
    - yaml id:horses set entities.<player.vehicle>.speed:<def[speed].as_decimal>
    - adjust <player.vehicle> "speed:<def[speed].as_decimal>"
    # Notify Player
    - narrate "<def[prefix]> You have now set this horse's speed to <&dq><def[speed]><&dq>." targets:<player>

HorsesSetColor:
    type: task
    debug: false
    script:
    # Sets the color of a horse
    - yaml id:horses set entities.<player.vehicle>.color:<def[color]>
    - define appearance li@<player.vehicle.color>
    - adjust <player.vehicle> "color:<def[appearance].as_list.set[<def[color]>].at[1]>"
HorsesSetMarkings:
    type: task
    debug: false
    script:
    # Sets the marking of a horse
    - yaml id:horses set entities.<player.vehicle>.markings:<def[markings]>
    - define appearance li@<player.vehicle.color>
    - adjust <player.vehicle> "color:<def[appearance].as_list.set[<def[markings]>].at[2]>"

HorsesSetGender:
    type: task
    debug: false
    script:
    # Sets the gender of a horse
    - yaml id:horses set entities.<player.vehicle>.gender:<def[gender]>

# implement injuries and illnesses later?
# HorsesSetInjury:

# HorsesSetIllness:

HorsesHeal:
    type: task
    debug: false
    script:
    # Heals a horse
    - define health <yaml[horses].read[entities.<player.vehicle>.max_health].as_decimal>
    - yaml id:horses set entities.<player.vehicle>.health:<def[health].as_decimal>
    - adjust <player.vehicle> "health:<def[health].as_decimal>"

HorsesSetHunger:
    type: task
    debug: false
    script:
    # Sets the hunger of a horse
    - yaml id:horses set entities.<player.vehicle>.hunger:<def[hunger].as_decimal>

HorsesSetThirst:
    type: task
    debug: false
    script:
    # Sets the thirst of a horse
    - yaml id:horses set entities.<player.vehicle>.thirst:<def[thirst].as_decimal>

HorsesDelete:
    type: task
    debug: false
    script:
    # Get Owner & Name before Deletion
    - define name <yaml[horses].read[entities.<player.vehicle>.name]>
    - define owner <yaml[horses].read[entities.<player.vehicle>.owner]>
    # Delete Horse from YAML
    - yaml id:horses set entities.<player.vehicle>:!
    # Remove Horse from Server
    - remove <player.vehicle>
    # Notify Remover & Owner if Different
    - narrate "<def[prefix]> You successfully deleted the horse." targets:<player>
    - if <player> != <def[owner]>:
        - narrate "<def[prefix]> Your horse <&dq><def[name]><&dq> has been permanently deleted." targets:<def[owner].as_player>

HorsesCommand:
    type: command
    debug: true
    name: horses
    aliases:
    - horse
    script:
    - define prefix "<&f>[<&6>Horses<&f>] <&7>"
    - define permission_error "<def[prefix]> You do not have permission to use this command."
    - define riding_error "<def[prefix]> You must be riding a horse to use this command."
    - if !<context.server>:
        - if !<context.args.is_empty>:
            - if <context.args.get[1]> == "CLAIM":
                - if <player.has_permission[horses.claim]>:
                    # Check if Player is Riding Horse
                    - if <player.is_inside_vehicle>:
                        - if <player.vehicle.entity_type||null> == HORSE:
                            # Check if Horse is Tamed
                            - if <player.vehicle.is_tamed>:
                                # Check if Horse Already Owned
                                - if <yaml[horses].read[entities.<player.vehicle>.owner]||null> == null:
                                    # Check if Name Specified
                                    - if <context.args.get[2]||null> != null:
                                        - define horseName <context.args.get[2]>
                                    - else:
                                        - define horseName <yaml[horses].read[names].as_list.random>
                                    - inject HorsesClaim
                                # Horse Already Owned
                                - else:
                                    - narrate "<def[prefix]> This horse is already owned by another player." targets:<player>
                            # Horse Not Tamed
                            - else:
                                - narrate "<def[prefix]> You must tame this horse before you can claim it." targets:<player>
                        # Player Not Riding Horse
                        - else:
                            - narrate "<def[prefix]> You can only use this command on a horse." targets:<player>
                    - else:
                        - narrate "<def[riding_error]>" targets:<player>
                - else:
                    - narrate "<def[permission_error]>" targets:<player>
            - else if <context.args.get[1]> == "UNCLAIM":
                - if <player.has_permission[horses.unclaim]>:
                    # Check if Player is Riding Horse
                    - if <player.is_inside_vehicle>:
                        - if <player.vehicle.entity_type||null> == HORSE:
                            # Check if Horse Belongs to Player
                            - if <yaml[horses].read[entities.<player.vehicle>.owner]> == <player>:
                                - inject HorsesUnclaim
                            # Horse Does Not Belong to Player
                            - else:
                                - narrate "<def[prefix]> This horse does not belong to you." targets:<player>
                    # Player Not Riding Horse
                        - else:
                            - narrate "<def[prefix]> You can only use this command on a horse." targets:<player>
                    - else:
                        - narrate "<def[riding_error]>" targets:<player>
                - else:
                    - narrate "<def[permission_error]>" targets:<player>
            - else if <context.args.get[1]> == "INFO":
                # Check Player Has Permission
                - if <player.has_permission[horses.info]>:
                    # Check Player Riding Horse
                    - if <player.is_inside_vehicle> && <player.vehicle.entity_type||null> == HORSE:

                    - else:
                        - narrate "<def[riding_error]>" targets:<player>
                - else:
                    - narrate "<def[permission_error]>" targets:<player>
            - else if <context.args.get[1]> == "RENAME":
                - if <player.has_permission[horses.rename]>:
                  # Check Player Riding Horse
                    - if <player.is_inside_vehicle> && <player.vehicle.entity_type||null> == HORSE:
                    # Check if Horse Belongs to Player
                        - if <yaml[horses].read[entities.<player.vehicle>.owner]||null> == <player>:
                      # Check if Horse Name Specified
                            - if <context.args.get[2]||null> != null:
                        # Rename Horse
                                - inject HorsesRename
                            - else:
                                - narrate "<def[prefix]> You must specify a name for your horse to rename. Usage: /horse rename <&lt>name<&gt>" targets:<player>
                        - else:
                            - narrate "<def[prefix]> This horse does not belong to you." targets:<player>
                    - else:
                        - narrate "<def[riding_error]>" targets:<player>
                - else:
                    - narrate "<def[permission_error]>" targets:<player>
            - else if <context.args.get[1]> == "LIST":
                - if <player.has_permission[horses.list]>:

                - else:
                    - narrate "<def[permission_error]>" targets:<player>
            - else if <context.args.get[1]> == "FOALS":
                - if <player.has_permission[horses.foals]>:

                - else:
                    - narrate "<def[permission_error]>" targets:<player>
            - else if <context.args.get[1]> == "HERE":
                - if <player.has_permission[horses.here]>:

                - else:
                    - narrate "<def[permission_error]>" targets:<player>
            - else if <context.args.get[1]> == "GIVE":
                - if <player.has_permission[horses.give]>:

                - else:
                    - narrate "<def[permission_error]>" targets:<player>
            - else if <context.args.get[1]> == "ACCEPT":
                - if <player.has_permission[horses.accept]>:

                - else:
                    - narrate "<def[permission_error]>" targets:<player>
            - else if <context.args.get[1]> == "DENY":
                - if <player.has_permission[horses.deny]>:

                - else:
                    - narrate "<def[permission_error]>" targets:<player>
            - else if <context.args.get[1]> == "TRUST":
                - if <player.has_permission[horses.trust]>:
                    # Check Player Riding Horse
                    - if <player.is_inside_vehicle> && <player.vehicle.entity_type||null> == HORSE:
                        # Check if Player Specified
                        - if <context.args.get[2]||null> != null:
                            # Check Player Exists
                            - if <player[<context.args.get[2]>]||null> != null:
                                - define player <player[<context.args.get[2]>]>
                                # Trust Player to Horse
                                - inject HorsesTrust
                            - else:
                                - narrate "<def[prefix]> The player you have specified does not exist, please check your spelling and try again." targets:<player>
                        - else:
                            - narrate "<def[prefix]> You must specify a player you want to trust to ride this horse. Usage: /horse trust <&lt>player<&gt>" targets:<player>
                    - else:
                        - narrate "<def[riding_error]>" targets:<player>
                - else:
                    - narrate "<def[permission_error]>" targets:<player>
            - else if <context.args.get[1]> == "UNTRUST":
                - if <player.has_permission[horses.untrust]>:
                   # Check Player Riding Horse
                    - if <player.is_inside_vehicle> && <player.vehicle.entity_type||null> == HORSE:
                        # Check if Player Specified
                        - if <context.args.get[2]||null> != null:
                            # Check Player Exists
                            - if <player[<context.args.get[2]>]||null> != null:
                                - define player <player[<context.args.get[2]>]>
                                # Trust Player to Horse
                                - inject HorsesUntrust
                            - else:
                                - narrate "<def[prefix]> The player you have specified does not exist, please check your spelling and try again." targets:<player>
                        - else:
                            - narrate "<def[prefix]> You must specify a player you want to trust to ride this horse. Usage: /horse trust <&lt>player<&gt>" targets:<player>
                    - else:
                        - narrate "<def[riding_error]>" targets:<player>
                - else:
                    - narrate "<def[permission_error]>" targets:<player>
            - else if <context.args.get[1]> == "ADMIN":
                - if <player.has_permission[horses.admin]>:
                    - if <context.args.get[2]||null> == null:
                        - narrate "<def[prefix]> You need to specify an administrative command to run." targets:<player>
                    - else if <context.args.get[2]> == "SETJUMP":
                        - if <player.has_permission[horses.admin.setjump]>:
                            - if <player.is_inside_vehicle> && <player.vehicle.entity_type||null> == HORSE:
                                - if <context.args.get[3]||null> != null:
                                    - if <context.args.get[3].is_decimal>:
                                        - define jump_strength <context.args.get[3].as_decimal>
                                        - inject HorsesSetJump
                                    - else:
                                        - narrate "<def[prefix]> The jump strength you have specified is not a valid number, please try again." targets:<player>
                                - else:
                                    - narrate "<def[prefix]> You must specify a number you want to set the jump strenth to. Usage: /horse admin setjump <&lt>jump_strength<&gt>" targets:<player>
                            - else:
                                - narrate "<def[riding_error]>" targets:<player>
                        - else:
                            - narrate "<def[permission_error]>" targets:<player>
                    - else if <context.args.get[2]> == "SETSPEED":
                        - if <player.has_permission[horses.admin.setspeed]>:
                            - if <player.is_inside_vehicle> && <player.vehicle.entity_type||null> == HORSE:
                                - if <context.args.get[3]||null> != null:
                                    - if <context.args.get[3].is_decimal>:
                                        - define speed <context.args.get[3].as_decimal>
                                        - inject HorsesSetSpeed
                                    - else:
                                        - narrate "<def[prefix]> The speed you have specified is not a valid number, please try again." targets:<player>
                                - else:
                                    - narrate "<def[prefix]> You must specify a number you want to set the speed to. Usage: /horse admin setspeed <&lt>speed<&gt>" targets:<player>
                            - else:
                                - narrate "<def[riding_error]>" targets:<player>
                        - else:
                            - narrate "<def[permission_error]>" targets:<player>
                    - else if <context.args.get[2]> == "SETCOLOR":
                        - if <player.has_permission[horses.admin.setcolor]>:
                            - if <player.is_inside_vehicle> && <player.vehicle.entity_type||null> == HORSE:
                                - if <context.args.get[3]||null> != null:
                                    - define color <context.args.get[3]>
                                    - inject HorsesSetColor
                                - else:
                                    - narrate "<def[prefix]> You must specify a color you want to set. Usage: /horse admin setcolor <&lt>color<&gt>" targets:<player>
                            - else:
                                - narrate "<def[riding_error]>" targets:<player>
                        - else:
                            - narrate "<def[permission_error]>" targets:<player>
                    - else if <context.args.get[2]> == "SETMARKINGS":
                        - if <player.has_permission[horses.admin.setmarkings]>:
                            - if <player.is_inside_vehicle> && <player.vehicle.entity_type||null> == HORSE:
                                - if <context.args.get[3]||null> != null:
                                    - define markings <context.args.get[3]>
                                    - inject HorsesSetMarkings
                                - else:
                                    - narrate "<def[prefix]> You must specify a markings you want to set. Usage: /horse admin setmarkings <&lt>markings<&gt>" targets:<player>
                            - else:
                                - narrate "<def[riding_error]>" targets:<player>
                        - else:
                            - narrate "<def[permission_error]>" targets:<player>
                    - else if <context.args.get[2]> == "SETGENDER":
                        - if <player.has_permission[horses.admin.setgender]>:
                            - if <player.is_inside_vehicle> && <player.vehicle.entity_type||null> == HORSE:
                                - if <context.args.get[3]||null> != null:
                                    - define gender <context.args.get[3]>
                                    - inject HorsesSetGender
                                - else:
                                    - narrate "<def[prefix]> You must specify a markings you want to set. Usage: /horse admin setgender <&lt>gender<&gt>" targets:<player>
                            - else:
                                - narrate "<def[riding_error]>" targets:<player>
                        - else:
                            - narrate "<def[permission_error]>" targets:<player>
                    - else if <context.args.get[2]> == "SETINJURY":
                        - if <player.has_permission[horses.admin.setinjury]>:

                        - else:
                            - narrate "<def[permission_error]>" targets:<player>
                    - else if <context.args.get[2]> == "SETILLNESS":
                        - if <player.has_permission[horses.admin.setillness]>:

                        - else:
                            - narrate "<def[permission_error]>" targets:<player>
                    - else if <context.args.get[2]> == "HEAL":
                        - if <player.has_permission[horses.admin.heal]>:
                            - if <player.is_inside_vehicle> && <player.vehicle.entity_type||null> == HORSE:
                                - inject HorsesHeal
                            - else:
                                - narrate "<def[riding_error]>" targets:<player>
                        - else:
                            - narrate "<def[permission_error]>" targets:<player>
                    - else if <context.args.get[1]> == "SETHUNGER":
                        - if <player.has_permission[horses.admin.sethunger]>:
                            - if <player.is_inside_vehicle> && <player.vehicle.entity_type||null> == HORSE:
                                - if <yaml[horses].read[entities.<player.vehicle>.hungerEnabled]>:
                                    - if <context.args.get[3]||null> != null:
                                        - if <context.args.get[3].is_decimal>:
                                            - define hunger <context.args.get[3].as_decimal>
                                            - if <def[hunger].as_decimal> < 0 || <def[thirst].as_decimal> > 100:
                                                - narrate "<def[prefix]> The hunger must be from 0 to 100." targets:<player>
                                            - else:
                                                - inject HorsesSetHunger
                                        - else:
                                            - narrate "<def[prefix]> The hunger you have specified is not a valid number, please try again." targets:<player>
                                    - else:
                                        - narrate "<def[prefix]> You must specify a number you want to set the hunger to. Usage: /horses admin sethunger <&lt>hunger<&gt>" targets:<player>
                                - else:
                                    - narrate "<def[prefix]> This horse does not have hunger enabled." targets:<player>
                            - else:
                                - narrate "<def[riding_error]>"
                        - else:
                            - narrate "<def[permission_error]>" targets:<player>
                    - else if <context.args.get[1]> == "SETTHIRST":
                        - if <player.has_permission[horses.admin.setthirst]>:
                            - if <player.is_inside_vehicle> && <player.vehicle.entity_type||null> == HORSE:
                                - if <yaml[horses].read[entities.<player.vehicle>.thirstEnabled]>:
                                    - if <context.args.get[3]||null> != null:
                                        - if <context.args.get[3].is_decimal>:
                                            - define thirst <context.args.get[3].as_decimal>
                                            - if <def[thirst].as_decimal> < 0 || <def[thirst].as_decimal> > 100:
                                                - narrate "<def[prefix]> The thirst must be from 0 to 100" targets:<player>
                                            - else:
                                                - inject HorsesSetThirst
                                        - else:
                                            - narrate "<def[prefix]> The thirst you have specified is not a valid number, please try again." targets:<player>
                                    - else:
                                        - narrate "<def[prefix]> You must specify a number you want to set the hunger to. Usage: /horses admin setthirst <&lt>setthirst<&gt>" targets:<player>
                                - else:
                                    - narrate "<def[prefix]> This horse does not have thirst enabled." targets:<player>
                            - else:
                                - narrate "<def[riding_error]>"
                        - else:
                            - narrate "<def[permission_error]>" targets:<player>
                    - else if <context.args.get[1]> == "DELETE":
                        - if <player.has_permission[horses.admin.delete]>:
                            # Check Riding Horse
                            - if <player.is_inside_vehicle> && <player.vehicle.entity_type||null> == HORSE:
                                # Delete Horse
                                - inject HorsesDelete
                            - else:
                                - "<def[riding_error]>" targets:<player>
                        - else:
                            - narrate <def[permission_error]> targets:<player>
                    - else:
                        - narrate "<def[prefix]> Unknown command. Type <&dq>/horses help<&dq> for help." targets:<player>
                    - else:
                        - narrate "<def[prefix]> Unknown command. Type <&dq>/horses help<&dq> for help." targets:<player>
                - else:
                    - narrate "<def[permission_error]>" targets:<player>
        - else:
            - narrate "<def[prefix]> No Argument Specified. Type <&dq>/horses help<&dq> for help." targets:<player>