From 0e24344efdffab26479465a501371046cbf241dc Mon Sep 17 00:00:00 2001 From: NorbiPeti Date: Sun, 9 Jun 2019 23:33:23 +0200 Subject: [PATCH] PLW error handling --- .../broadcaster/GeneralEventBroadcasterModule.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/main/java/buttondevteam/discordplugin/broadcaster/GeneralEventBroadcasterModule.java b/src/main/java/buttondevteam/discordplugin/broadcaster/GeneralEventBroadcasterModule.java index 9b57812..7aafd27 100644 --- a/src/main/java/buttondevteam/discordplugin/broadcaster/GeneralEventBroadcasterModule.java +++ b/src/main/java/buttondevteam/discordplugin/broadcaster/GeneralEventBroadcasterModule.java @@ -15,20 +15,21 @@ public class GeneralEventBroadcasterModule extends Component { PlayerListWatcher.hookUp(); DPUtils.getLogger().info("Finished hooking into the player list"); hooked = true; - } catch (Exception e) { - TBMCCoreAPI.SendException("Error while hacking the player list!", e); + } catch (Exception | NoClassDefFoundError e) { + TBMCCoreAPI.SendException("Error while hacking the player list! Disable this module if you're on an incompatible version.", e); } } @Override protected void disable() { try { + if (!hooked) return; if (PlayerListWatcher.hookDown()) DPUtils.getLogger().info("Finished unhooking the player list!"); else DPUtils.getLogger().info("Didn't have the player list hooked."); hooked = false; - } catch (Exception e) { + } catch (Exception | NoClassDefFoundError e) { TBMCCoreAPI.SendException("Error while hacking the player list!", e); } }