summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--server/commands.go21
1 files changed, 21 insertions, 0 deletions
diff --git a/server/commands.go b/server/commands.go
index 72b9413..9274a41 100644
--- a/server/commands.go
+++ b/server/commands.go
@@ -136,6 +136,22 @@ var commands = map[string]commandHandler {
}
return ""
},
+ "pos": func(ctx commandCtx) string {
+ switch pl := ctx.sender.(type) {
+ case *player:
+ pl.GetInfo(ctx.server, func(name string, state playerState) {
+ pos := entityToBlock(state.Pos)
+ pl.OnCommandOutput(ctx.server,
+ fmt.Sprintf("You are at (%d, %d, %d) in level %d.",
+ pos.X, pos.Y, pos.Z, state.LevelId,
+ ),
+ )
+ })
+ return ""
+ default:
+ return "You're not anywhere."
+ }
+ },
"createLevel": func(ctx commandCtx) string {
var (
ok = true
@@ -316,6 +332,7 @@ var commands = map[string]commandHandler {
var commandAuth = map[string]authLevel {
"tp": cheatAuth,
+ "pos": cheatAuth,
"kick": moderateAuth,
"ban": moderateAuth,
"unban": moderateAuth,
@@ -337,6 +354,10 @@ var help = map[string][]string {
"* /tp -p alice -t eve",
"* /tp -p bob 0 -1000000 0",
},
+ "pos": []string {
+ "/pos",
+ "Report coordinates and level ID",
+ },
"createLevel": []string {
"/createLevel [--gen genType] [--size size]",
"Create a level",