@zardoy/flying-squid 0.0.137 → 0.0.138

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -277,9 +277,27 @@ const server = function (serv, options) {
277
277
  return;
278
278
  eyeBusy.add(player);
279
279
  try {
280
- const target = await nearestStronghold(player.world, player.position.x, player.position.z);
280
+ const world = player.world;
281
+ // say why there is nothing to point at (the eye is not used up in these cases)
282
+ if (world.environment !== 'normal') {
283
+ player.chat?.('The eye of ender only points to strongholds in the overworld.');
284
+ return;
285
+ }
286
+ if (!world.strongholds) {
287
+ player.chat?.(`This world has no strongholds (world generator: ${world.generatorName ?? 'unknown'}, only the noise generator makes them).`);
288
+ return;
289
+ }
290
+ let target;
291
+ try {
292
+ target = await nearestStronghold(world, player.position.x, player.position.z);
293
+ }
294
+ catch (e) {
295
+ serv.warn?.('stronghold search failed: ' + e.message);
296
+ player.chat?.('The stronghold search failed: ' + e.message);
297
+ return;
298
+ }
281
299
  if (!target) {
282
- player.chat?.('The eye has nothing to point at here.');
300
+ player.chat?.('No stronghold was found in this world.');
283
301
  return;
284
302
  }
285
303
  const start = player.position.offset(0, 1.62 * 0.5 + 0.2, 0);
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@zardoy/flying-squid",
3
3
  "description": "A minecraft server written in TS",
4
- "version": "0.0.137",
4
+ "version": "0.0.138",
5
5
  "main": "dist/index.js",
6
6
  "types": "./dist/index.d.ts",
7
7
  "bin": "dist/app.js",