Paste #67084: just a test

Date: 2020/04/07 05:55:38 UTC-07:00
Type: Denizen Script

View Raw Paste Download This Paste
Copy Link


World_Yaml_Test:
    type: world
    debug: true
    events:
        on player logs in:
        - define player_file <player.name>_<player.uuid>
        - define player_path /player_dir/<[player_file]>.yml

        # create or load
        - if !<server.has_file[<[player_file]>]>:
            - yaml create id:<[player_file]>
        - else:
            - yaml load:<[player_path]> id:<[player_file]>

        # set, save and unload
        - yaml id:<[player_file]> set login:++
        - yaml savefile:<[player_path]> id:<[player_file]>
        - yaml unload id:<[player_file]>

        on player quits:
        - define player_file <player.name>_<player.uuid>
        - define player_path /player_dir/<[player_file]>.yml

        # set, save and unload
        - yaml id:<[player_file]> set logout:++
        - yaml savefile:<[player_path]> id:<[player_file]>
        - yaml unload id:<[player_file]>