From 609cbf280f93aec69744681a03d1d9ffdde55f59 Mon Sep 17 00:00:00 2001 From: raven Date: Thu, 26 Mar 2026 14:56:18 -0500 Subject: /pos command --- server/commands.go | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'server') 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", -- cgit v1.2.3