Staff Pick: Clear Expired Flags
By
DNxCreated: 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 scriptClear_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