ServerEvents.tick(event => {
    let server = event.server
    let pData = server.persistentData

    // Disable spread 5 seconds after server start
    if (!pData.getBoolean('phayriosisSpreadDisabled') && server.tickCount >= 100) {
        server.runCommandSilent('phayriosis_config_set_block-spread-speed 0')
        pData.putBoolean('phayriosisSpreadDisabled', true)
    }

    // Only check day every 5 seconds
    if (server.tickCount % 100 !== 0) return

    let level = server.getLevel('minecraft:overworld')
    let day = Math.floor(level.dayTime() / 24000)

    // Enable spread on day 120
    if (day >= 120 && !pData.getBoolean('phayriosis_speed29_done')) {
        server.runCommandSilent('phayriosis_config_set_block-spread-speed 2.9')
        pData.putBoolean('phayriosis_speed29_done', true)
    }
})