35 lines
786 B
Go
35 lines
786 B
Go
package gamestatus
|
|
|
|
import (
|
|
"time"
|
|
|
|
"github.com/VexoraDevelopment/gamestatus/bedrock"
|
|
"github.com/VexoraDevelopment/gamestatus/java"
|
|
"github.com/VexoraDevelopment/gamestatus/source"
|
|
)
|
|
|
|
type Client struct {
|
|
Java *java.Client
|
|
Bedrock *bedrock.Client
|
|
Source *source.Client
|
|
}
|
|
|
|
func NewAll(timeout time.Duration) *Client {
|
|
return &Client{
|
|
Java: java.New(java.Options{Timeout: timeout, EnableSRV: true}),
|
|
Bedrock: bedrock.New(bedrock.Options{Timeout: timeout, EnableSRV: true}),
|
|
Source: source.New(source.Options{Timeout: timeout}),
|
|
}
|
|
}
|
|
|
|
func (c *Client) SetSourceDebug(debug bool) {
|
|
if c == nil {
|
|
return
|
|
}
|
|
timeout := 2 * time.Second
|
|
if c.Source != nil {
|
|
timeout = c.Source.Timeout()
|
|
}
|
|
c.Source = source.New(source.Options{Timeout: timeout, Debug: debug})
|
|
}
|