github.com/df-mc/dragonfly@v0.9.13/server/status.go (about)

     1  package server
     2  
     3  import (
     4  	"github.com/sandertv/gophertunnel/minecraft"
     5  )
     6  
     7  // statusProvider handles the way the server shows up in the server list. The
     8  // online players and maximum players are not changeable from outside the
     9  // server, but the server name may be changed at any time.
    10  type statusProvider struct {
    11  	name string
    12  }
    13  
    14  // ServerStatus returns the player count, max players and the server's name as
    15  // a minecraft.ServerStatus.
    16  func (s statusProvider) ServerStatus(playerCount, maxPlayers int) minecraft.ServerStatus {
    17  	return minecraft.ServerStatus{
    18  		ServerName:  s.name,
    19  		PlayerCount: playerCount,
    20  		MaxPlayers:  maxPlayers,
    21  	}
    22  }