From 7cbdf517135abe67d92f880d4768826427135ce7 Mon Sep 17 00:00:00 2001 From: Zrips Date: Sun, 26 May 2019 10:59:32 +0300 Subject: [PATCH] Lets catch MythicMob exception for issue with new API. Further update is needed --- .../jobs/MythicMobs/MythicMobs4.java | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/src/main/java/com/gamingmesh/jobs/MythicMobs/MythicMobs4.java b/src/main/java/com/gamingmesh/jobs/MythicMobs/MythicMobs4.java index e9ec2195..bf870564 100644 --- a/src/main/java/com/gamingmesh/jobs/MythicMobs/MythicMobs4.java +++ b/src/main/java/com/gamingmesh/jobs/MythicMobs/MythicMobs4.java @@ -47,7 +47,7 @@ public class MythicMobs4 implements MythicMobInterface { Class.forName("io.lumine.xikage.mythicmobs.MythicMobs"); } catch (ClassNotFoundException e) { // Disabling - Jobs.consoleMsg("&e[Jobs] &6MythicMobs was found - &cBut your version is outdated, please update for full support."); + Jobs.consoleMsg("&e[Jobs] &6MythicMobs was found - &cBut your version is outdated, please update for full support."); return false; } @@ -57,11 +57,23 @@ public class MythicMobs4 implements MythicMobInterface { } + static boolean failed = false; + @Override public String getDisplayName(String id) { + if (failed) + return ""; MythicMob mm = MMAPI.getMythicMob(id); - if (mm != null) - return mm.getDisplayName(); + try { + if (mm != null) + return mm.getDisplayName(); + } catch (Exception | Error e) { + if (!failed) { + failed = true; + Jobs.consoleMsg("&cEncountered error when checking MythicMob entity name. Support for mythicMobs will be suspended for time beying. Please report this issue."); + e.printStackTrace(); + } + } return ""; }