- 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


Click here to create your own public paste ~ ~ click to duplicate and edit this paste


Titleprefixer
TypeDenizen Script
Date2018/12/08 10:40:37 UTC-08:00
Bymcmonkey
Other
Paste
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
6700
# Tablist/name group prefix helper, written by mcmonkey for BossManOnScreen

# CONFIG VALUES: Set them below to correct values
group_prefix_config:
    type: yaml data
    tablist_header:
    - "&cZypher&bMC"
    tablist_footer:
    - "&7Website &8>> &fwww.zyphermc.com"
    - "&7Server Store&8>> store.zyphermc.com"
    - ""
    - "&7You are on &6play.zyphermc.com"
    ranks:
    - Owner/&c
    - Manager/&3
    - Admin/&4
    - Develper/&a
    - Mod/&5
    - Builder/&e
    - Helper/&a
    - Trainee/&d
    - Member/&7

# -------------------------------
# End of config
# -------------------------------
# Start of logic
# -------------------------------

group_prefix_handler_world:
    type: world
    debug: false
    events:
        on player joins:
        - run s@group_prefix_apply_task instantly

major_group_for_proc:
    type: procedure
    debug: false
    script:
    - foreach <s@group_prefix_config.yaml_key[ranks]>:
        - if <player.in_group[<def[value].before[/]>]>:
            - determine <def[value]>/<def[loop_index]>
    - determine other
group_prefix_apply_all_task:
    type: task
    debug: false
    speed: 0
    script:
    - foreach <server.list_online_players>:
        - run s@group_prefix_apply_task instantly player:<def[value]>

group_prefix_apply_task:
    type: task
    debug: false
    speed: 0
    script:
    - define group <proc[major_group_for_proc]>
    - if <def[group]> == other:
        - queue clear
    - define group_name <def[group].before[/]>
    - define group_color <def[group].after[/].before[/].parse_color>
    - define group_index <def[group].after_last[/].pad_left[2].with[0]>
    - define team_name "AA<def[group]_index>_<def[group_name]>"
    - team name:<def[team_name]> add:<player.name> "prefix:<def[group_color]>[<def[group_name]>]<&f>"
    - adjust <player> "tab_list_info:<s@group_prefix_config.yaml_key[tablist_header].split_by[<n>]>|<s@group_prefix_config.yaml_key[tablist_footer].split_by[<n>]>"



RawRaw



Pastes made: 57250