make the program crash in case of errors

This commit is contained in:
Romain Beaumont 2015-10-24 22:12:11 +02:00
parent 17b65f5021
commit 24370e9d0f
3 changed files with 24 additions and 14 deletions

View file

@ -7,6 +7,7 @@ function inject(serv, player)
player._client.on('block_place', async function (packet) {
var referencePosition=new vec3(packet.location.x,packet.location.y,packet.location.z);
if (player.entity.crouching) return;
try {
var id = await serv.world.getBlockType(referencePosition);
var blockAbove = await serv.world.getBlockType(referencePosition.clone().add(new vec3(0, 1, 0)));
@ -21,6 +22,10 @@ function inject(serv, player)
slotCount: 9 * 3 + 8 // 3 rows, make nicer later
});
}
}
catch(err) {
setTimeout(function(){throw err;},0);
}
});
}

View file

@ -18,7 +18,8 @@ function inject(serv,player)
cancelDigging(pos);
else if(packet.status==0 && player.gameMode==1)
creativeDigging(pos);
});
})
.catch((err)=> setTimeout(function(){throw err;},0));
});
function diggingTime(location)

View file

@ -94,13 +94,17 @@ function inject(serv,player)
function sendRestMap()
{
player.sendingChunks=true;
sendChunksAroundPlayer(player.view).then(() => player.sendingChunks=false);
sendChunksAroundPlayer(player.view)
.then(() => player.sendingChunks=false)
.catch((err)=> setTimeout(function(){throw err;},0));
player.on("positionChanged",function(){
if(!player.sendingChunks && player.entity.position.distanceTo(player.lastPositionChunkUpdated)>16*32)
{
player.sendingChunks=true;
sendChunksAroundPlayer(player.view).then(() => player.sendingChunks=false);
sendChunksAroundPlayer(player.view)
.then(() => player.sendingChunks=false)
.catch((err)=> setTimeout(function(){throw err;},0));
}
});
}