diff options
| author | raven <citrons@mondecitronne.com> | 2026-03-26 14:56:18 -0500 |
|---|---|---|
| committer | raven <citrons@mondecitronne.com> | 2026-03-26 14:56:18 -0500 |
| commit | 609cbf280f93aec69744681a03d1d9ffdde55f59 (patch) | |
| tree | bbe2be262e0e4607bed0dd766ada58772fa1477e | |
| parent | 31853592678b1f796f18dc1ac803c0a188ec876c (diff) | |
/pos command
| -rw-r--r-- | server/commands.go | 21 |
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", |
