From ce9dd8dfab7f8756adcf3e543bfeae3632347d1a Mon Sep 17 00:00:00 2001 From: Vitaly Turovsky Date: Thu, 21 Mar 2024 07:21:32 +0300 Subject: [PATCH] fix: fix warps support --- src/lib/modules/tabComplete.ts | 4 ++++ src/lib/modules/warps.ts | 5 +++-- src/lib/modules/world.ts | 3 ++- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/src/lib/modules/tabComplete.ts b/src/lib/modules/tabComplete.ts index 3a2aa9f8..fd6ddc3e 100644 --- a/src/lib/modules/tabComplete.ts +++ b/src/lib/modules/tabComplete.ts @@ -122,6 +122,10 @@ export const player = function (player: Player, serv: Server, options: Options) serv.tabComplete.add('item_enchantment', () => { return ['unbreaking', 'silk_touch', 'fortune'] }) + + serv.tabComplete.add('warps', () => { + return serv.warps.map(w => w.name) + }) } declare global { interface Server { diff --git a/src/lib/modules/warps.ts b/src/lib/modules/warps.ts index aaa71b81..a2c5b620 100644 --- a/src/lib/modules/warps.ts +++ b/src/lib/modules/warps.ts @@ -54,6 +54,7 @@ export const server = async function (serv: Server, options: Options) { info: 'Teleport to a warp', usage: '/warp [set] ', op: true, + tab: ['warps', 'warps'], commandBlock: false, parse (string, ctx) { // todo worlds support @@ -62,7 +63,7 @@ export const server = async function (serv: Server, options: Options) { return { name, set: true } } const warp = serv.warps.find(w => w.name === string) - if (!warp) return + if (!warp) return false return { name: warp.name } }, async action ({ name, set }, { player }) { @@ -80,7 +81,7 @@ export const server = async function (serv: Server, options: Options) { player.teleport(new Vec3(warp.x, warp.y, warp.z)) if (warp.yaw) player.yaw = warp.yaw if (warp.pitch) player.pitch = warp.pitch - return true + player.chat(`Teleported to ${name}. Press ctrl+a if nothing appears on your screen.`) } }) } diff --git a/src/lib/modules/world.ts b/src/lib/modules/world.ts index 8b9020ce..9df5e069 100644 --- a/src/lib/modules/world.ts +++ b/src/lib/modules/world.ts @@ -458,7 +458,8 @@ export const usedServerPathsV1 = [ 'region', 'level.dat', 'playerdata', - 'Warp files' + 'Warp files', + 'icon.png' ] declare global {