func Pause() {
	if !serverPaused {
		serverPaused = true
		fmt.Println("Pausing server...")
		core.Pause()
		actions.Pause()
		database.Pause()
		if pauseCallback != nil {
			pauseCallback()
		}
		fmt.Println("Server paused")
		serverStarted = false
	}
}
////////////////////////////////////////////////////////////////////////////////////////////////////
Server actions   ////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////////////
Pause will log all Users off and prevent anyone from logging in. All rooms and their variables created by the server will remain in memory.
Same goes for rooms created by Users unless RoomDeleteOnLeave in ServerSettings is set to true.
package gopher
import (
	"context"
	"encoding/json"
	"fmt"
	"github.com/hewiefreeman/GopherGameServer/actions"
	"github.com/hewiefreeman/GopherGameServer/core"
	"github.com/hewiefreeman/GopherGameServer/database"
	"io/ioutil"
	"net/http"
	"os"
	"strconv"
	"time"
)
type ServerSettings struct {
	ServerName     string  
	MaxConnections int     
	HostName  string  
	HostAlias string  
	IP        string  
	Port      int     
	TLS         bool    
	CertFile    string  
	PrivKeyFile string  
	OriginOnly bool  
	MultiConnect   bool   
	MaxUserConns   uint8  
	KickDupOnLogin bool   
	UserRoomControl   bool  
	RoomDeleteOnLeave bool  
	EnableSqlFeatures bool    
	SqlIP             string  
	SqlPort           int     
	SqlProtocol       string  
	SqlUser           string  
	SqlPassword       string  
	SqlDatabase       string  
	EncryptionCost    int     
	CustomLoginColumn string  
	RememberMe        bool    
	EnableRecovery   bool    
	RecoveryLocation string  
	AdminLogin    string  
	AdminPassword string  
}
type serverRestore struct {
	R map[string]core.RoomRecoveryState
}
var (
	httpServer *http.Server
	settings *ServerSettings
	serverStarted  bool       = false
	serverPaused   bool       = false
	serverStopping bool       = false
	serverEndChan  chan error = make(chan error)
	startCallback         func()
	pauseCallback         func()
	stopCallback          func()
	resumeCallback        func()
	clientConnectCallback func(*http.ResponseWriter, *http.Request) bool
	version string = "1.0-BETA.2"
)
func Start(s *ServerSettings) {
	if serverStarted || serverPaused {
		return
	}
	serverStarted = true
	fmt.Println("  _______                __\n |   _   |.-----..-----.|  |--..-----..----.\n |.  |___||. _  ||. _  ||.    ||. -__||.  _|\n |.  |   ||:. . ||:. __||: |: ||:    ||: |\n |:  |   |'-----'|: |   '--'--''-----''--'\n |::.. . |       '--' - Game Server -\n '-------'\n\n ")
	fmt.Println("Starting server...")
	if s != nil {
		if !s.verify() {
			return
		}
		settings = s
	} else {
		fmt.Println("Using default settings...")
		settings = &ServerSettings{
			ServerName:     "!server!",
			MaxConnections: 0,
			HostName:  "localhost",
			HostAlias: "localhost",
			IP:        "localhost",
			Port:      8080,
			TLS:         false,
			CertFile:    "",
			PrivKeyFile: "",
			OriginOnly: false,
			MultiConnect:   false,
			KickDupOnLogin: false,
			UserRoomControl:   true,
			RoomDeleteOnLeave: true,
			EnableSqlFeatures: false,
			SqlIP:             "localhost",
			SqlPort:           3306,
			SqlProtocol:       "tcp",
			SqlUser:           "user",
			SqlPassword:       "password",
			SqlDatabase:       "database",
			EncryptionCost:    4,
			CustomLoginColumn: "",
			RememberMe:        false,
			EnableRecovery:   false,
			RecoveryLocation: "C:/",
			AdminLogin:    "admin",
			AdminPassword: "password"}
	}
	core.SettingsSet((*settings).KickDupOnLogin, (*settings).ServerName, (*settings).RoomDeleteOnLeave, (*settings).EnableSqlFeatures,
		(*settings).RememberMe, (*settings).MultiConnect, (*settings).MaxUserConns)
	core.SetServerStarted(true)
	actions.SetServerStarted(true)
	database.SetServerStarted(true)
	if (*settings).EnableSqlFeatures {
		fmt.Println("Initializing database...")
		dbErr := database.Init((*settings).SqlUser, (*settings).SqlPassword, (*settings).SqlDatabase,
			(*settings).SqlProtocol, (*settings).SqlIP, (*settings).SqlPort, (*settings).EncryptionCost,
			(*settings).RememberMe, (*settings).CustomLoginColumn)
		if dbErr != nil {
			fmt.Println("Database error:", dbErr.Error())
			fmt.Println("Shutting down...")
			return
		}
		fmt.Println("Database initialized")
	}
	if settings.EnableRecovery {
		recoverState()
	}
	if settings.TLS {
		httpServer = makeServer("/wss", settings.TLS)
	} else {
		httpServer = makeServer("/ws", settings.TLS)
	}
	if startCallback != nil {
		startCallback()
	}
	go macroListener()
	fmt.Println("Startup complete")
	doneErr := <-serverEndChan
	if doneErr != http.ErrServerClosed {
		fmt.Println("Fatal server error:", doneErr.Error())
		if !serverStopping {
			fmt.Println("Disconnecting users...")
			core.Pause()
			actions.Pause()
			database.Pause()
			if settings.EnableRecovery {
				saveState()
			}
		}
	}
	fmt.Println("Server shut-down completed")
	if stopCallback != nil {
		stopCallback()
	}
}
func (settings *ServerSettings) verify() bool {
	if settings.ServerName == "" {
		fmt.Println("ServerName in ServerSettings is required. Shutting down...")
		return false
	} else if settings.HostName == "" || settings.IP == "" || settings.Port < 1 {
		fmt.Println("HostName, IP, and Port in ServerSettings are required. Shutting down...")
		return false
	} else if settings.TLS == true && (settings.CertFile == "" || settings.PrivKeyFile == "") {
		fmt.Println("CertFile and PrivKeyFile in ServerSettings are required for a TLS connection. Shutting down...")
		return false
	} else if settings.EnableSqlFeatures == true && (settings.SqlIP == "" || settings.SqlPort < 1 || settings.SqlProtocol == "" ||
		settings.SqlUser == "" || settings.SqlPassword == "" || settings.SqlDatabase == "") {
		fmt.Println("SqlIP, SqlPort, SqlProtocol, SqlUser, SqlPassword, and SqlDatabase in ServerSettings are required for the SQL features. Shutting down...")
		return false
	} else if settings.EnableRecovery == true && settings.RecoveryLocation == "" {
		fmt.Println("RecoveryLocation in ServerSettings is required for server recovery. Shutting down...")
		return false
	} else if settings.EnableRecovery {
		if _, err := os.Stat(settings.RecoveryLocation); err != nil {
			fmt.Println("RecoveryLocation error:", err)
			fmt.Println("Shutting down...")
			return false
		}
		var d []byte
		if err := ioutil.WriteFile(settings.RecoveryLocation+"/test.txt", d, 0644); err != nil {
			fmt.Println("RecoveryLocation error:", err)
			fmt.Println("Shutting down...")
			return false
		}
		os.Remove(settings.RecoveryLocation + "/test.txt")
	} else if settings.AdminLogin == "" || settings.AdminPassword == "" {
		fmt.Println("AdminLogin and AdminPassword in ServerSettings are required. Shutting down...")
		return false
	}
	return true
}
func makeServer(handleDir string, tls bool) *http.Server {
	server := &http.Server{Addr: settings.IP + ":" + strconv.Itoa(settings.Port)}
	http.HandleFunc(handleDir, socketInitializer)
	if tls {
		go func() {
			err := server.ListenAndServeTLS(settings.CertFile, settings.PrivKeyFile)
			serverEndChan <- err
		}()
	} else {
		go func() {
			err := server.ListenAndServe()
			serverEndChan <- err
		}()
	}
	return server
}