From 571e97332d0c3400f1d7d6dcd68412833d45396a Mon Sep 17 00:00:00 2001 From: rtm516 Date: Fri, 9 Aug 2024 13:35:19 +0100 Subject: [PATCH] Store file path to save on calls --- .../geysermc/geyser/extension/GeyserExtensionLoader.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/core/src/main/java/org/geysermc/geyser/extension/GeyserExtensionLoader.java b/core/src/main/java/org/geysermc/geyser/extension/GeyserExtensionLoader.java index 0b80a9448..2dabe8a4c 100644 --- a/core/src/main/java/org/geysermc/geyser/extension/GeyserExtensionLoader.java +++ b/core/src/main/java/org/geysermc/geyser/extension/GeyserExtensionLoader.java @@ -169,7 +169,7 @@ public class GeyserExtensionLoader extends ExtensionLoader { List extensionPaths; if (Files.isDirectory(updateDirectory)) { // Get the current extensions and store them in a map - Map extensionFiles = new HashMap<>(); + Map extensionFiles = new HashMap<>(); extensionPaths = Files.list(extensionsDirectory).toList(); extensionPaths.forEach(path -> { if (Files.isDirectory(path)) { @@ -188,7 +188,7 @@ public class GeyserExtensionLoader extends ExtensionLoader { GeyserExtensionDescription description = this.extensionDescription(path); // Store the file name against ID for later use - extensionFiles.put(description.id(), path.getFileName().toString()); + extensionFiles.put(description.id(), path.getFileName()); } catch (Throwable e) { // no-op } @@ -214,7 +214,7 @@ public class GeyserExtensionLoader extends ExtensionLoader { // Remove the old extension with the same ID if it exists if (extensionFiles.containsKey(description.id())) { - Files.delete(extensionsDirectory.resolve(extensionFiles.get(description.id()))); + Files.delete(extensionFiles.get(description.id())); } // Overwrite the extension with the new jar