From 6a428166e5ac6c9fc8e4bb2214978dcb5a733651 Mon Sep 17 00:00:00 2001 From: Andreas Troelsen Date: Fri, 3 Nov 2023 22:50:12 +0100 Subject: [PATCH] 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 --- src/main/java/com/garbagemule/MobArena/MASpawnThread.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/main/java/com/garbagemule/MobArena/MASpawnThread.java b/src/main/java/com/garbagemule/MobArena/MASpawnThread.java index 0eb99ea..a3adf4d 100644 --- a/src/main/java/com/garbagemule/MobArena/MASpawnThread.java +++ b/src/main/java/com/garbagemule/MobArena/MASpawnThread.java @@ -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.