From 5aa4f0b7634eb7e7260c38f92776de214a2cfab4 Mon Sep 17 00:00:00 2001 From: montlikadani Date: Tue, 28 Jan 2020 17:23:47 +0100 Subject: [PATCH] Fixed NPE when MythicMobs plugin not found on plugin reload --- src/main/java/com/gamingmesh/jobs/Jobs.java | 2 +- src/main/java/com/gamingmesh/jobs/hooks/HookManager.java | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/gamingmesh/jobs/Jobs.java b/src/main/java/com/gamingmesh/jobs/Jobs.java index b9dc7377..1609c252 100644 --- a/src/main/java/com/gamingmesh/jobs/Jobs.java +++ b/src/main/java/com/gamingmesh/jobs/Jobs.java @@ -769,7 +769,7 @@ public class Jobs extends JavaPlugin { if (HookManager.getMcMMOManager().CheckmcMMO()) { HookManager.setMcMMOlistener(); } - if (HookManager.getMythicManager().Check()) { + if (HookManager.checkMythicMobs()) { HookManager.getMythicManager().registerListener(); } } diff --git a/src/main/java/com/gamingmesh/jobs/hooks/HookManager.java b/src/main/java/com/gamingmesh/jobs/hooks/HookManager.java index d0b97605..39a103c3 100644 --- a/src/main/java/com/gamingmesh/jobs/hooks/HookManager.java +++ b/src/main/java/com/gamingmesh/jobs/hooks/HookManager.java @@ -31,7 +31,7 @@ public class HookManager { setWorldGuard(); setMythicManager(); - if (Jobs.getGCManager().MythicMobsEnabled && MythicManager != null && MythicManager.Check()) + if (checkMythicMobs()) MythicManager.registerListener(); } @@ -62,6 +62,10 @@ public class HookManager { return MythicManager; } + public static boolean checkMythicMobs() { + return Jobs.getGCManager().MythicMobsEnabled && MythicManager != null && MythicManager.Check(); + } + private static boolean setWorldGuard() { if (pm.getPlugin("WorldGuard") != null && pm.isPluginEnabled("WorldGuard")) { worldGuardManager = new WorldGuardManager();