Date: 2019/08/09 10:44:37 UTC-07:00
Type: Denizen 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
eco:
type: command
debug: false
name: eco
description: Manage the balance of a player.
usage: /eco <<>playerName<>> <<>operation<>> <<>quantity<>>
permission: workbench.commands.eco
default constants:
operations: li@add|sub|set
tab complete:
- if "<context.server>":
- narrate "This command is for players only."
- stop
- define player_name "<context.args.get[1]||>"
- define player_names "<server.list_players.parse[name]>"
- if "<[player_names].contains[<[player_name]>].not>":
- determine "<[player_names].filter[starts_with[<[player_name]>]]>"
- define operation "<context.args.get[2]||>"
- define operations "<script.constant[operations]>"
- if "<[operations].contains[<[operation]>].not>":
- determine "<[operations].filter[starts_with[<[operation]>]]>"
script:
- if "<context.server>":
- narrate "This command is for players only."
- stop
- define player_name "<context.args.get[1]||null>"
- if "<[player_name]>" == null:
- narrate "<&6>Enter the name of the player whose balance manage."
- narrate "<&6>Use<&co> <&c><script.yaml_key[usage].parsed><&6>."
- playsound "<player>" "sound:BLOCK_NOTE_BLOCK_HARP"
- queue clear
- define player "<server.match_offline_player[<[player_name]>]||null>"
- if "<[player]>" == null:
- narrate "<&c><[player_name]> <&6>is not the name of any player."
- playsound "<player>" "sound:BLOCK_NOTE_BLOCK_HARP"
- queue clear
- define operation "<context.args.get[2]||null>"
- if "<[operation]>" == null:
- narrate "<&6>Enter the operation to perform on <&c><[player].name>'s <&6>balance."
- narrate "<&6>Use<&co> <&c><script.yaml_key[usage].parsed><&6>."
- playsound "<player>" "sound:BLOCK_NOTE_BLOCK_HARP"
- queue clear
- define operations "<script.constant[operations]>"
- if "<[operations].contains[<[operation]>].not>":
- narrate "<&c><[operation]> <&6>is not a valid operation."
- playsound "<player>" "sound:BLOCK_NOTE_BLOCK_HARP"
- queue clear
- define quantity "<context.args.get[3]||null>"
- if "<[quantity]>" == null:
- narrate "<&6>Enter the quantity to <&c><[operation]> <&6>to <&c><[player].name>'s <&6>balance."
- narrate "<&6>Use<&co> <&c><script.yaml_key[usage].parsed><&6>."
- playsound "<player>" "sound:BLOCK_NOTE_BLOCK_HARP"
- queue clear
- if "<[quantity].is[matches].to[number].not>":
- narrate "<&c><[quantity]> <&6>is not a valid quantity."
- narrate "<&6>It must be a number."
- playsound "<player>" "sound:BLOCK_NOTE_BLOCK_HARP"
- queue clear
- define quark "<custom@quark[player=<[player]>]>"
- run quark.tasks.balance "def:<[quark]>|<[operation]>|<[quantity]>"
- narrate "<&6>You performed a <&c><[operation]> <&6>operation for <&c><[quantity]> coins."
- narrate "<&c><[player].name>'s <&6>new balance: <&c><[quark].balance> coins<&6>."
- playsound "<player>" "sound:BLOCK_NOTE_BLOCK_BELL"