creeper-ts
v1.1.0
Published
A TypeScript SDK for dissecting (vanilla) Minecraft servers and server files.
Downloads
3
Readme
creeper-ts: a TypeScript SDK for dissecting (vanilla) Minecraft servers and server files.
Prerequisites
- node >=10
Install
npm install creeper-ts
Run tests
npm run test
Examples
Update the 'level-name' property in server.properties
import { useServerFs, useServerProps } from 'creeper-ts'
function main(rootDir: string, newLevelName: string) {
const { loadFromDisk } = useServerFs()
const { loadFromFs, writeToFs } = useServerProps()
const fs = loadFromDisk(config.serverDir)
const props = loadFromFs(fs)
props.set('level-name', newLevelName)
writeToFs(props, fs)
}
main('/data/minecraft', 'new-world')
Load a server from disk
import { useServer } from 'creeper-ts'
function main(rootDir: string): Server {
const { loadServer } = useServer()
return loadServer({ rootDir })
}
main('/data/minecraft')
Serialize server props
function main () {
const server = createServer()
const { serialize } = useServerProps()
server.props.set('level-name', 'creeper-world')
const propsString = serialize(server.props)
console.log(propsString)
// Outputs: level-name=creeper-world
}
Author
👤 LordSequoia
- Website: https://seqmc.com
- Github: @lordsequoia
Show your support
Give a ⭐️ if this project helped you!
This README was generated with ❤️ by readme-md-generator