add: test cases for rcon
This commit is contained in:
@@ -56,61 +56,17 @@ func (c *Client) Ping() error {
|
||||
|
||||
// SetWeather sets the weather in the Minecraft world
|
||||
func (c *Client) SetWeather(weather string) error {
|
||||
var command string
|
||||
switch weather {
|
||||
case "clear":
|
||||
command = "weather clear"
|
||||
case "rain":
|
||||
command = "weather rain"
|
||||
case "thunder":
|
||||
command = "weather thunder"
|
||||
default:
|
||||
return fmt.Errorf("invalid weather type: %s", weather)
|
||||
}
|
||||
|
||||
_, err := c.Execute(command)
|
||||
return err
|
||||
return fmt.Errorf("not implemented")
|
||||
}
|
||||
|
||||
// SetTime sets the time in the Minecraft world
|
||||
func (c *Client) SetTime(timeValue string) error {
|
||||
var command string
|
||||
switch timeValue {
|
||||
case "day":
|
||||
command = "time set day"
|
||||
case "night":
|
||||
command = "time set night"
|
||||
case "noon":
|
||||
command = "time set noon"
|
||||
case "midnight":
|
||||
command = "time set midnight"
|
||||
default:
|
||||
// Assume it's a numeric value
|
||||
command = fmt.Sprintf("time set %s", timeValue)
|
||||
}
|
||||
|
||||
_, err := c.Execute(command)
|
||||
return err
|
||||
return fmt.Errorf("not implemented")
|
||||
}
|
||||
|
||||
// SetDifficulty sets the difficulty level
|
||||
func (c *Client) SetDifficulty(difficulty string) error {
|
||||
var command string
|
||||
switch difficulty {
|
||||
case "peaceful":
|
||||
command = "difficulty peaceful"
|
||||
case "easy":
|
||||
command = "difficulty easy"
|
||||
case "normal":
|
||||
command = "difficulty normal"
|
||||
case "hard":
|
||||
command = "difficulty hard"
|
||||
default:
|
||||
return fmt.Errorf("invalid difficulty level: %s", difficulty)
|
||||
}
|
||||
|
||||
_, err := c.Execute(command)
|
||||
return err
|
||||
return fmt.Errorf("not implemented")
|
||||
}
|
||||
|
||||
// GetServerInfo returns basic server information
|
||||
@@ -118,14 +74,6 @@ func (c *Client) GetServerInfo() (string, error) {
|
||||
return c.Execute("version")
|
||||
}
|
||||
|
||||
// TailLogs starts tailing the server logs
|
||||
func (c *Client) TailLogs(ctx context.Context, handler func(string)) error {
|
||||
// This is a placeholder implementation
|
||||
// In a real implementation, this would need to be connected to actual log tailing
|
||||
// For now, we'll just return an error to indicate this is not implemented
|
||||
return fmt.Errorf("log tailing not implemented in this version")
|
||||
}
|
||||
|
||||
// ConnectWithTimeout attempts to connect with a timeout
|
||||
func ConnectWithTimeout(address, password string, timeout time.Duration) (*Client, error) {
|
||||
ctx, cancel := context.WithTimeout(context.Background(), timeout)
|
||||
|
||||
Reference in New Issue
Block a user