1
0
mirror of https://github.com/Zrips/Jobs.git synced 2025-01-04 23:37:49 +01:00

Should fixed issue when the bars are not loaded correctly

This caused the WeakHashMap automatically removing.
This commit is contained in:
montlikadani 2019-08-15 09:17:50 +02:00
parent f4ed34a00a
commit c164678273
4 changed files with 12 additions and 10 deletions

View File

@ -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);
}

View File

@ -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 {

View File

@ -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<String, Boolean> actionBarToggle = new WeakHashMap<>();
static WeakHashMap<String, Boolean> bossBarToggle = new WeakHashMap<>();
static Map<String, Boolean> actionBarToggle = new HashMap<>();
static Map<String, Boolean> 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<String, Boolean> getActionBarToggle() {
public static Map<String, Boolean> getActionBarToggle() {
return actionBarToggle;
}
public static WeakHashMap<String, Boolean> getBossBarToggle() {
public static Map<String, Boolean> getBossBarToggle() {
return bossBarToggle;
}
}

View File

@ -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;
}
}