From d3c59615471a09cbbe14faa36248256b21c3ee3f Mon Sep 17 00:00:00 2001 From: rtm516 Date: Fri, 2 Aug 2024 16:00:23 +0100 Subject: [PATCH] Add extension update folder --- .../extension/GeyserExtensionLoader.java | 25 ++++++++++++++++++- core/src/main/resources/languages | 2 +- 2 files changed, 25 insertions(+), 2 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 a56e00671..ecb756017 100644 --- a/core/src/main/java/org/geysermc/geyser/extension/GeyserExtensionLoader.java +++ b/core/src/main/java/org/geysermc/geyser/extension/GeyserExtensionLoader.java @@ -164,7 +164,30 @@ public class GeyserExtensionLoader extends ExtensionLoader { Map loadedExtensions = new LinkedHashMap<>(); Pattern[] extensionFilters = this.extensionFilters(); - List extensionPaths = Files.walk(extensionsDirectory).toList(); + + List extensionUpdatePaths = Files.list(extensionsDirectory.resolve("update")).toList(); + extensionUpdatePaths.forEach(path -> { + if (Files.isDirectory(path)) { + return; + } + + for (Pattern filter : extensionFilters) { + if (!filter.matcher(path.getFileName().toString()).matches()) { + return; + } + } + + try { + // Try load the description, so we know it's a valid extension + GeyserExtensionDescription description = this.extensionDescription(path); + + Files.move(path, extensionsDirectory.resolve(path.getFileName()), StandardCopyOption.REPLACE_EXISTING); + } catch (Throwable e) { + GeyserImpl.getInstance().getLogger().error(GeyserLocale.getLocaleStringLog("geyser.extensions.update.failed", path.getFileName()), e); + } + }); + + List extensionPaths = Files.list(extensionsDirectory).toList(); extensionPaths.forEach(path -> { if (Files.isDirectory(path)) { return; diff --git a/core/src/main/resources/languages b/core/src/main/resources/languages index 60b20023a..8c4b92445 160000 --- a/core/src/main/resources/languages +++ b/core/src/main/resources/languages @@ -1 +1 @@ -Subproject commit 60b20023a92f084aba895ab0336e70fa7fb311fb +Subproject commit 8c4b92445bf48f7104f9ab1708efdd3b6acf1f2c