gekware/minecraft-server-hibernation

add single msh MOTD variable which is updated when ms changes status

gekigek99 opened this issue · 0 comments

benefits:

  • remove:

    var motd string
    switch {
    case servstats.Stats.Status == errco.SERVER_STATUS_OFFLINE || servstats.Stats.Suspended:
    motd = config.ConfigRuntime.Msh.InfoHibernation
    case servstats.Stats.Status == errco.SERVER_STATUS_STARTING:
    motd = config.ConfigRuntime.Msh.InfoStarting
    case servstats.Stats.Status == errco.SERVER_STATUS_ONLINE:
    // server can't be online if this function was called
    case servstats.Stats.Status == errco.SERVER_STATUS_STOPPING:
    motd = "minecraft server is stopping..."
    }

  • remove:

    var motd string
    switch {
    case servstats.Stats.Status == errco.SERVER_STATUS_OFFLINE || servstats.Stats.Suspended:
    motd = config.ConfigRuntime.Msh.InfoHibernation
    case servstats.Stats.Status == errco.SERVER_STATUS_STARTING:
    motd = config.ConfigRuntime.Msh.InfoStarting
    case servstats.Stats.Status == errco.SERVER_STATUS_ONLINE:
    // server can't be online if this function was called
    case servstats.Stats.Status == errco.SERVER_STATUS_STOPPING:
    motd = "minecraft server is stopping..."
    }

  • remove:

    var mes []byte
    switch servstats.Stats.Status {
    case errco.SERVER_STATUS_OFFLINE:
    mes = buildMessage(reqType, config.ConfigRuntime.Msh.InfoHibernation)
    case errco.SERVER_STATUS_STARTING:
    mes = buildMessage(reqType, config.ConfigRuntime.Msh.InfoStarting)
    case errco.SERVER_STATUS_ONLINE: // ms suspended
    mes = buildMessage(reqType, config.ConfigRuntime.Msh.InfoHibernation)
    case errco.SERVER_STATUS_STOPPING:
    mes = buildMessage(reqType, "server is stopping...\nrefresh the page")
    }