summaryrefslogtreecommitdiff
path: root/server/commands.go
diff options
context:
space:
mode:
authorraven <citrons@mondecitronne.com>2026-03-26 14:56:18 -0500
committerraven <citrons@mondecitronne.com>2026-03-26 14:56:18 -0500
commit609cbf280f93aec69744681a03d1d9ffdde55f59 (patch)
treebbe2be262e0e4607bed0dd766ada58772fa1477e /server/commands.go
parent31853592678b1f796f18dc1ac803c0a188ec876c (diff)
/pos command
Diffstat (limited to 'server/commands.go')
-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",