- 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








The script repo is an archive of historical scripts. For modern scripts, or to post your own, please use the Scripts forum section.





Staff Pick: Clear Expired Flags


By DNx
Created: 2016/10/10 06:35:43 UTC-07:00 (8 years and 75 days ago)
Edited: 2016/10/10 06:58:36 UTC-07:00 (8 years and 75 days ago)
Likes: 0

Staff pick as of: 2016/12/07 23:37:06 UTC-08:00 (8 years and 17 days ago)
Denizen Version: 1.0.0
Script Version: 0.0.3
Description:

This task script is used to remove all expired flags from denizen saves.yml



Download script | View raw script
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
2200

Clear_Expired_Flags:
  type: task
  speed: 0t
  debug: false
  script:
  - define timing <server.current_time_millis>
  - define cleared_server_flags 0
  - foreach <server.list_flags> {
    - if !<server.has_flag[<def[value]>]> define cleared_server_flags <def[cleared_server_flags].add[1]>
    }
  - define cleared_player_flags 0
  - foreach <server.list_players> {
    - define p <def[value]>
    - foreach <def[p].list_flags> {
      - if !<def[p].has_flag[<def[value]>]> define cleared_player_flags <def[cleared_player_flags].add[1]>
      }
    }
  - execute as_server "denizen save" silent
  - debug debug "Cleared <def[cleared_server_flags]> server flags and <def[cleared_player_flags]> player flags in <server.current_time_millis.sub[<def[timing]>]>ms"







View History