3
0
Mirror von https://github.com/ViaVersion/ViaVersion.git synchronisiert 2024-12-26 16:12:42 +01:00

Don't use netty collections

Dieser Commit ist enthalten in:
creeper123123321 2019-01-15 13:37:04 -02:00
Ursprung fa1b56a7cf
Commit 1325d53950
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: 0AC57D54786721D1

Datei anzeigen

@ -14,18 +14,13 @@ public class BlockConnectionStorage extends StoredObject {
private static Class<?> fastUtilLongObjectHashMap; private static Class<?> fastUtilLongObjectHashMap;
private static Class<?> fastUtilShortShortHashMap; private static Class<?> fastUtilShortShortHashMap;
private static Class<?> nettyLongObjectHashMap;
static { static {
try { try {
fastUtilLongObjectHashMap = Class.forName("it.unimi.dsi.fastutil.longs.Long2ObjectOpenHashMap"); fastUtilLongObjectHashMap = Class.forName("it.unimi.dsi.fastutil.longs.Long2ObjectOpenHashMap");
Via.getPlatform().getLogger().info("Using FastUtil Long2ObjectOpenHashMap for block connections"); Via.getPlatform().getLogger().info("Using FastUtil Long2ObjectOpenHashMap for block connections");
} catch (ClassNotFoundException ignored) { } catch (ClassNotFoundException ignored) {
try {
nettyLongObjectHashMap = Class.forName("io.netty.util.collection.LongObjectHashMap");
Via.getPlatform().getLogger().info("Using Netty LongObjectHashMap for block connections");
} catch (ClassNotFoundException ignored2) {
}
} }
try { try {
fastUtilShortShortHashMap = Class.forName("it.unimi.dsi.fastutil.shorts.Short2ShortOpenHashMap"); fastUtilShortShortHashMap = Class.forName("it.unimi.dsi.fastutil.shorts.Short2ShortOpenHashMap");
@ -101,13 +96,6 @@ public class BlockConnectionStorage extends StoredObject {
e.printStackTrace(); e.printStackTrace();
} }
} }
if (nettyLongObjectHashMap != null) {
try {
return (Map<Long, T>) nettyLongObjectHashMap.getConstructor().newInstance();
} catch (IllegalAccessException | InstantiationException | InvocationTargetException | NoSuchMethodException e) {
e.printStackTrace();
}
}
return new HashMap<>(); return new HashMap<>();
} }