Skip to content

Commit

Permalink
feat: add /home & /sethome
Browse files Browse the repository at this point in the history
  • Loading branch information
zardoy committed Mar 21, 2024
1 parent 5edc27b commit 43f9944
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 1 deletion.
2 changes: 1 addition & 1 deletion scripts/genTypes.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import fs from 'fs'
const targetFile = './dist/types.d.ts';
const plugins = fs.readdirSync('./dist/lib/modules').filter(f => f !== 'index')
let types = ''
types = plugins.filter(module => module.endsWith('.d.ts')).map(module => `import "./lib/plugins/${module}"`).join('\n') + '\n' + types
types = plugins.filter(module => module.endsWith('.d.ts')).map(module => `import "./lib/modules/${module}"`).join('\n') + '\n' + types
fs.writeFileSync(targetFile, types, 'utf8')

let indexTs = fs.readFileSync('./dist/index.d.ts', 'utf8')
Expand Down
22 changes: 22 additions & 0 deletions src/lib/modules/warps.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,28 @@ export const server = async function (serv: Server, options: Options) {
player.chat(`Teleported to ${name}. Press f3+a if nothing appears on your screen.`)
}
})

serv.commands.add({
base: 'home',
info: 'Teleport to your home',
usage: '/home',
op: false, // todo
commandBlock: false,
async action ({ }, { player }) {
player?.handleCommand('warp home')
}
})
serv.commands.add({
base: 'sethome',
info: 'Set your home',
usage: '/sethome',
op: false, // todo
commandBlock: false,
async action ({ }, { player }) {
player?.handleCommand('warp set home')
}
})

}

declare global {
Expand Down

0 comments on commit 43f9944

Please sign in to comment.