Closed FalcoG closed 2 years ago
Do you think we could add a method to get a work by name?
Sounds good, I've added it. Here's a code example that tests byName and byUUID:
ServerCommands.register('/spawn', (player) => {
const worldTest = Worlds.getWorldByName('world_nether')
if (worldTest == null) return
// player.teleport(worldTest.getSpawnLocation())
player.sendMessage('You have been teleported to the spawn')
const uuid = worldTest.getUUID()
const uuidTest = Worlds.getWorldByUUID(uuid)
if (uuidTest != null) {
player.teleport(uuidTest.getSpawnLocation())
}
})
This creates a function which returns all available worlds.
One use case of this would be to create a "/spawn" command which will return you to the spawn point of a specific world.