mirror of
https://github.com/danbulant/flying-squid
synced 2026-07-06 11:40:46 +00:00
proper /changeworld overworld|nether command implemented
This commit is contained in:
parent
939a404050
commit
69819b880e
3 changed files with 11 additions and 14 deletions
|
|
@ -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)
|
- gamemode: Gamemode of the world (Default is player gamemode)
|
||||||
- difficulty: Difficulty of world. Default is 0 (easiest)
|
- difficulty: Difficulty of world. Default is 0 (easiest)
|
||||||
- dimension: Dimension of world. 0 is Overworld, -1 is Nether, 1 is End (Default is 0)
|
- 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)
|
#### player.spawnAPlayer(spawnedPlayer)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -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;
|
serv.commands = base;
|
||||||
|
|
||||||
player.handleCommand = function(str) {
|
player.handleCommand = function(str) {
|
||||||
|
|
|
||||||
|
|
@ -92,7 +92,7 @@ function inject(serv, player) {
|
||||||
}
|
}
|
||||||
|
|
||||||
async function changeWorld(world, opt) {
|
async function changeWorld(world, opt) {
|
||||||
|
if(player.world == world) return Promise.resolve();
|
||||||
opt = opt || {};
|
opt = opt || {};
|
||||||
player.world = world;
|
player.world = world;
|
||||||
player.loadedChunks={};
|
player.loadedChunks={};
|
||||||
|
|
@ -121,13 +121,4 @@ function inject(serv, player) {
|
||||||
player.sendRestMap = sendRestMap;
|
player.sendRestMap = sendRestMap;
|
||||||
player.sendSpawnPosition = sendSpawnPosition;
|
player.sendSpawnPosition = sendSpawnPosition;
|
||||||
player.spawnAPlayer = spawnAPlayer;
|
player.spawnAPlayer = spawnAPlayer;
|
||||||
|
|
||||||
player.on('chat', function(message) {
|
|
||||||
if (message == 'world') {
|
|
||||||
player.changeWorld(serv.netherworld, {
|
|
||||||
position: new vec3(0, 60, 0),
|
|
||||||
dimension: -1
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
Loading…
Reference in a new issue