aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristine Dodrill <xena@yolo-swag.com>2015-06-23 12:30:17 -0700
committerChristine Dodrill <xena@yolo-swag.com>2015-06-23 12:30:17 -0700
commit2ab3d79feeb67b50f4b685c5e0286e2d36ccddc8 (patch)
tree935c33eba74215fa14ac909474392271ad7eade4
parent4b9a6cd3d59be6086ee7b00d888be4bbb46e3d79 (diff)
downloadx-2ab3d79feeb67b50f4b685c5e0286e2d36ccddc8.tar.xz
x-2ab3d79feeb67b50f4b685c5e0286e2d36ccddc8.zip
Add minecraft rcon client
-rw-r--r--mcrcon/.gitignore1
-rw-r--r--mcrcon/main.go32
2 files changed, 33 insertions, 0 deletions
diff --git a/mcrcon/.gitignore b/mcrcon/.gitignore
new file mode 100644
index 0000000..9247261
--- /dev/null
+++ b/mcrcon/.gitignore
@@ -0,0 +1 @@
+mcrcon
diff --git a/mcrcon/main.go b/mcrcon/main.go
new file mode 100644
index 0000000..1c5ebd6
--- /dev/null
+++ b/mcrcon/main.go
@@ -0,0 +1,32 @@
+package main
+
+import (
+ "flag"
+ "fmt"
+ "log"
+ "strings"
+
+ "github.com/bearbin/mcgorcon"
+)
+
+var (
+ host = flag.String("host", "127.0.0.1", "server hostname")
+ port = flag.Int("port", 25575, "rcon port")
+ password = flag.String("pass", "swag", "rcon password")
+)
+
+func main() {
+ flag.Parse()
+
+ client, err := mcgorcon.Dial(*host, *port, *password)
+ if err != nil {
+ log.Fatal(err)
+ }
+
+ data, err := client.SendCommand(strings.Join(flag.Args(), " "))
+ if err != nil {
+ log.Fatal(err)
+ }
+
+ fmt.Println(data)
+}