Add extension update folder

This commit is contained in:
rtm516 2024-08-02 16:00:23 +01:00
parent 3d7e62a408
commit d3c5961547
No known key found for this signature in database
GPG key ID: 331715B8B007C67A
2 changed files with 25 additions and 2 deletions

View file

@ -164,7 +164,30 @@ public class GeyserExtensionLoader extends ExtensionLoader {
Map<String, GeyserExtensionContainer> loadedExtensions = new LinkedHashMap<>();
Pattern[] extensionFilters = this.extensionFilters();
List<Path> extensionPaths = Files.walk(extensionsDirectory).toList();
List<Path> 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<Path> extensionPaths = Files.list(extensionsDirectory).toList();
extensionPaths.forEach(path -> {
if (Files.isDirectory(path)) {
return;

@ -1 +1 @@
Subproject commit 60b20023a92f084aba895ab0336e70fa7fb311fb
Subproject commit 8c4b92445bf48f7104f9ab1708efdd3b6acf1f2c