diff --git a/src/main/java/com/gamingmesh/jobs/Reflections.java b/src/main/java/com/gamingmesh/jobs/Reflections.java index 3e7c9ff0..d4da3ed0 100644 --- a/src/main/java/com/gamingmesh/jobs/Reflections.java +++ b/src/main/java/com/gamingmesh/jobs/Reflections.java @@ -74,7 +74,7 @@ public class Reflections { return Class.forName("org.bukkit.craftbukkit." + Jobs.getVersionCheckManager().getVersion() + "." + nmsClassString); } - public Class getMinecraftClass(String nmsClassString) throws ClassNotFoundException { + public static Class getMinecraftClass(String nmsClassString) throws ClassNotFoundException { return Class.forName("net.minecraft.server." + Jobs.getVersionCheckManager().getVersion() + "." + nmsClassString); } diff --git a/src/main/java/com/gamingmesh/jobs/stuff/CMIScoreboardManager.java b/src/main/java/com/gamingmesh/jobs/stuff/CMIScoreboardManager.java index 3d1e08e2..bba20229 100644 --- a/src/main/java/com/gamingmesh/jobs/stuff/CMIScoreboardManager.java +++ b/src/main/java/com/gamingmesh/jobs/stuff/CMIScoreboardManager.java @@ -18,6 +18,7 @@ import org.bukkit.scoreboard.Objective; import org.bukkit.scoreboard.Scoreboard; import com.gamingmesh.jobs.Jobs; +import com.gamingmesh.jobs.Reflections; import com.gamingmesh.jobs.CMILib.VersionChecker.Version; import com.gamingmesh.jobs.container.ScoreboardInfo; @@ -211,7 +212,7 @@ public class CMIScoreboardManager { } private static Class getNMSClass(String nmsClassString) throws ClassNotFoundException { - return Class.forName("net.minecraft.server." + Jobs.getVersionCheckManager().getVersion() + "." + nmsClassString); + return Reflections.getMinecraftClass(nmsClassString); } private static Object getConnection(Player player) throws SecurityException, NoSuchMethodException, NoSuchFieldException, IllegalArgumentException, IllegalAccessException, InvocationTargetException { diff --git a/src/main/java/com/gamingmesh/jobs/stuff/ToggleBarHandling.java b/src/main/java/com/gamingmesh/jobs/stuff/ToggleBarHandling.java index c0be472e..ab6f9ebd 100644 --- a/src/main/java/com/gamingmesh/jobs/stuff/ToggleBarHandling.java +++ b/src/main/java/com/gamingmesh/jobs/stuff/ToggleBarHandling.java @@ -1,6 +1,7 @@ package com.gamingmesh.jobs.stuff; -import java.util.WeakHashMap; +import java.util.HashMap; +import java.util.Map; import java.util.Map.Entry; import org.bukkit.configuration.ConfigurationSection; @@ -11,8 +12,8 @@ import com.gamingmesh.jobs.config.YmlMaker; public class ToggleBarHandling { - static WeakHashMap actionBarToggle = new WeakHashMap<>(); - static WeakHashMap bossBarToggle = new WeakHashMap<>(); + static Map actionBarToggle = new HashMap<>(); + static Map bossBarToggle = new HashMap<>(); public static void load() { YmlMaker f = new YmlMaker(Jobs.getInstance(), "actionBarBossbar.yml"); @@ -67,17 +68,17 @@ public class ToggleBarHandling { } } - bossBarToggle.clear(); - actionBarToggle.clear(); + bossBarToggle = null; + actionBarToggle = null; f.saveConfig(); } - public static WeakHashMap getActionBarToggle() { + public static Map getActionBarToggle() { return actionBarToggle; } - public static WeakHashMap getBossBarToggle() { + public static Map getBossBarToggle() { return bossBarToggle; } } diff --git a/src/main/java/com/gamingmesh/jobs/stuff/blockLoc.java b/src/main/java/com/gamingmesh/jobs/stuff/blockLoc.java index 5ce58c37..bbd39526 100644 --- a/src/main/java/com/gamingmesh/jobs/stuff/blockLoc.java +++ b/src/main/java/com/gamingmesh/jobs/stuff/blockLoc.java @@ -64,7 +64,7 @@ public class blockLoc { y = Integer.parseInt(split[2]); z = Integer.parseInt(split[3]); return true; - } catch (Throwable e) { + } catch (NumberFormatException e) { return false; } }