proper /changeworld overworld|nether command implemented

This commit is contained in:
Romain Beaumont 2015-10-25 23:58:30 +01:00
parent 939a404050
commit 69819b880e
3 changed files with 11 additions and 14 deletions

View file

@ -363,10 +363,6 @@ The world object which the player is in (use serv.overworld, serv.netherworld, s
- gamemode: Gamemode of the world (Default is player gamemode)
- difficulty: Difficulty of world. Default is 0 (easiest)
- dimension: Dimension of world. 0 is Overworld, -1 is Nether, 1 is End (Default is 0)
- position: Position player spawns, default is their default spawn point
- yaw: Yaw in which they spawn, default is 0
- pitch: Pitch in which they spawn, default is 0
#### player.spawnAPlayer(spawnedPlayer)

View file

@ -263,6 +263,16 @@ function inject(serv, player) {
}
});
base.add({
base: 'changeworld',
info: 'to change world',
usage: '/changeworld overworld|nether',
action(world) {
if(world=="nether") player.changeWorld(serv.netherworld, {dimension: -1});
if(world=="overworld") player.changeWorld(serv.overworld, {dimension: 0});
}
});
serv.commands = base;
player.handleCommand = function(str) {

View file

@ -92,7 +92,7 @@ function inject(serv, player) {
}
async function changeWorld(world, opt) {
if(player.world == world) return Promise.resolve();
opt = opt || {};
player.world = world;
player.loadedChunks={};
@ -121,13 +121,4 @@ function inject(serv, player) {
player.sendRestMap = sendRestMap;
player.sendSpawnPosition = sendSpawnPosition;
player.spawnAPlayer = spawnAPlayer;
player.on('chat', function(message) {
if (message == 'world') {
player.changeWorld(serv.netherworld, {
position: new vec3(0, 60, 0),
dimension: -1
});
}
});
}