Remove usage of Fastutil Object2Reference maps

These are only beneficial for containsValue checks.
This commit is contained in:
Camotoy 2022-09-13 16:24:08 -04:00
parent 2d7a463089
commit a99afe4418
No known key found for this signature in database
GPG key ID: 7EEFB66FE798081F
3 changed files with 6 additions and 7 deletions

View file

@ -26,7 +26,6 @@ dependencies {
implementation("com.nukkitx.fastutil", "fastutil-int-boolean-maps", Versions.fastutilVersion)
implementation("com.nukkitx.fastutil", "fastutil-object-int-maps", Versions.fastutilVersion)
implementation("com.nukkitx.fastutil", "fastutil-object-object-maps", Versions.fastutilVersion)
implementation("com.nukkitx.fastutil", "fastutil-object-reference-maps", Versions.fastutilVersion)
// Network libraries
implementation("org.java-websocket", "Java-WebSocket", Versions.websocketVersion)

View file

@ -25,8 +25,8 @@
package org.geysermc.geyser.extension;
import it.unimi.dsi.fastutil.objects.Object2ReferenceMap;
import it.unimi.dsi.fastutil.objects.Object2ReferenceOpenHashMap;
import it.unimi.dsi.fastutil.objects.Object2ObjectMap;
import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap;
import org.geysermc.geyser.api.extension.Extension;
import org.geysermc.geyser.api.extension.ExtensionDescription;
import org.geysermc.geyser.api.extension.exception.InvalidExtensionException;
@ -39,7 +39,7 @@ import java.nio.file.Path;
public class GeyserExtensionClassLoader extends URLClassLoader {
private final GeyserExtensionLoader loader;
private final Object2ReferenceMap<String, Class<?>> classes = new Object2ReferenceOpenHashMap<>();
private final Object2ObjectMap<String, Class<?>> classes = new Object2ObjectOpenHashMap<>();
public GeyserExtensionClassLoader(GeyserExtensionLoader loader, ClassLoader parent, Path path) throws MalformedURLException {
super(new URL[] { path.toUri().toURL() }, parent);

View file

@ -25,8 +25,8 @@
package org.geysermc.geyser.extension;
import it.unimi.dsi.fastutil.objects.Object2ReferenceMap;
import it.unimi.dsi.fastutil.objects.Object2ReferenceOpenHashMap;
import it.unimi.dsi.fastutil.objects.Object2ObjectMap;
import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap;
import lombok.RequiredArgsConstructor;
import org.checkerframework.checker.nullness.qual.NonNull;
import org.geysermc.api.Geyser;
@ -51,7 +51,7 @@ import java.util.stream.Stream;
public class GeyserExtensionLoader extends ExtensionLoader {
private static final Pattern[] EXTENSION_FILTERS = new Pattern[] { Pattern.compile("^.+\\.jar$") };
private final Object2ReferenceMap<String, Class<?>> classes = new Object2ReferenceOpenHashMap<>();
private final Object2ObjectMap<String, Class<?>> classes = new Object2ObjectOpenHashMap<>();
private final Map<String, GeyserExtensionClassLoader> classLoaders = new HashMap<>();
private final Map<Extension, GeyserExtensionContainer> extensionContainers = new HashMap<>();
private final Path extensionsDirectory = GeyserImpl.getInstance().getBootstrap().getConfigFolder().resolve("extensions");