3
0
Mirror von https://github.com/GeyserMC/Geyser.git synchronisiert 2024-11-20 15:00:11 +01:00

Check the update folder exists before trying to use it

Dieser Commit ist enthalten in:
rtm516 2024-08-02 16:07:04 +01:00
Ursprung d3c5961547
Commit 4106d24f2a
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: 331715B8B007C67A

Datei anzeigen

@ -165,27 +165,31 @@ public class GeyserExtensionLoader extends ExtensionLoader {
Pattern[] extensionFilters = this.extensionFilters();
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()) {
Path updateDirectory = extensionsDirectory.resolve("update");
if (Files.isDirectory(updateDirectory)) {
List<Path> extensionUpdatePaths = Files.list(updateDirectory).toList();
extensionUpdatePaths.forEach(path -> {
if (Files.isDirectory(path)) {
return;
}
}
try {
// Try load the description, so we know it's a valid extension
GeyserExtensionDescription description = this.extensionDescription(path);
for (Pattern filter : extensionFilters) {
if (!filter.matcher(path.getFileName().toString()).matches()) {
return;
}
}
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);
}
});
try {
// Try load the description, so we know it's a valid extension
GeyserExtensionDescription description = this.extensionDescription(path);
// Overwrite the extension with the new jar
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 -> {