Report Spigot health error to admins.

Using the new `mobarena.admin.errors` permission, this commit provides
server owners with a way to make the infamous Spigot health error much
more visible by sending the error message to any "admins" online when
the error occurs.

Closes #764
This commit is contained in:
Andreas Troelsen 2023-11-03 22:50:12 +01:00
parent 12314f476c
commit 9e083a91de
2 changed files with 6 additions and 1 deletions

View File

@ -14,7 +14,7 @@ These changes will (most likely) be included in the next version.
### Added
- Support for chest references in item syntax. The new `inv` syntax allows for referencing container indices in the config-file. This should help bridge the gap between class chests and various other parts of the config-file, such as rewards and upgrade waves.
- Support for saved items. The new `/ma save-item` command can be used to save the currently held item to disk, which allows it to be used in various places in the config-file. This should help bridge the gap between the config-file and class chests for config-file centric setups.
- New permission `mobarena.admin.errors` for better error visibility. Players with this permission will get a message if an arena encounters an error.
- New permission `mobarena.admin.errors` for better error visibility. Players with this permission will get a message if an arena encounters an error. Currently, the only such error is the one resulting from Spigot's "max max health" setting throwing an exception when monster health is set "too high".
### Fixed
- Explosion damage caused by Exploding Sheep now correctly counts as monster damage. This means that the explosions only affect other mobs if the per-arena setting `monster-infight` is set to `true`.

View File

@ -244,6 +244,11 @@ public class MASpawnThread implements Runnable
} else {
e.setCustomName("SPIGOT ERROR");
}
for (Player p : plugin.getServer().getOnlinePlayers()) {
if (p.hasPermission("mobarena.admin.errors")) {
arena.getMessenger().tell(p, "Failed to set boss health (" + health + ") in arena " + arena.configName() + " (wave " + wave + ") because Spigot 'maxHealth' is too low. See console for details.");
}
}
}
// Switch on the type.