generated from ElnuDev/go-project
Create clientSet.playerCount method
This commit is contained in:
parent
325a0dcf8c
commit
2a59a96493
1 changed files with 5 additions and 1 deletions
6
main.go
6
main.go
|
@ -66,8 +66,12 @@ func (clients clientSet) broadcast(events ...event) {
|
|||
}
|
||||
}
|
||||
|
||||
func (clients clientSet) playerCount() int {
|
||||
return len(clients.clients)
|
||||
}
|
||||
|
||||
func (clients clientSet) playerCountEvent(offset int) event {
|
||||
playerCount := len(clients.clients) + offset
|
||||
playerCount := clients.playerCount() + offset
|
||||
var data string
|
||||
if playerCount == 0 {
|
||||
data = "No players online."
|
||||
|
|
Reference in a new issue