package data
import (
"github.com/ParadoxPixel/ThemePark-Websocket/objects"
"sync"
)
var servers = new(sync.Map)
func AddServer(server *objects.Server) {
servers.LoadOrStore(server.ID, server)
}
func CanServer(server string) bool {
if server == "" || server == "null" {
return false
if ok, _ := HasServer(server); ok {
} else {
return true
func HasServer(publicKey string) (bool, *objects.Server) {
val, _ := servers.Load(publicKey)
if val == nil {
return false, nil
return true, val.(*objects.Server)
func RemoveServer(session string) *objects.Server {
val, _ := servers.LoadAndDelete(session)
return nil
return val.(*objects.Server)