mirror of
https://github.com/GeyserMC/Geyser.git
synced 2024-08-14 23:57:35 +00:00
Check the update folder exists before trying to use it
This commit is contained in:
parent
d3c5961547
commit
4106d24f2a
1 changed files with 21 additions and 17 deletions
|
@ -165,27 +165,31 @@ public class GeyserExtensionLoader extends ExtensionLoader {
|
||||||
|
|
||||||
Pattern[] extensionFilters = this.extensionFilters();
|
Pattern[] extensionFilters = this.extensionFilters();
|
||||||
|
|
||||||
List<Path> extensionUpdatePaths = Files.list(extensionsDirectory.resolve("update")).toList();
|
Path updateDirectory = extensionsDirectory.resolve("update");
|
||||||
extensionUpdatePaths.forEach(path -> {
|
if (Files.isDirectory(updateDirectory)) {
|
||||||
if (Files.isDirectory(path)) {
|
List<Path> extensionUpdatePaths = Files.list(updateDirectory).toList();
|
||||||
return;
|
extensionUpdatePaths.forEach(path -> {
|
||||||
}
|
if (Files.isDirectory(path)) {
|
||||||
|
|
||||||
for (Pattern filter : extensionFilters) {
|
|
||||||
if (!filter.matcher(path.getFileName().toString()).matches()) {
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
for (Pattern filter : extensionFilters) {
|
||||||
// Try load the description, so we know it's a valid extension
|
if (!filter.matcher(path.getFileName().toString()).matches()) {
|
||||||
GeyserExtensionDescription description = this.extensionDescription(path);
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Files.move(path, extensionsDirectory.resolve(path.getFileName()), StandardCopyOption.REPLACE_EXISTING);
|
try {
|
||||||
} catch (Throwable e) {
|
// Try load the description, so we know it's a valid extension
|
||||||
GeyserImpl.getInstance().getLogger().error(GeyserLocale.getLocaleStringLog("geyser.extensions.update.failed", path.getFileName()), e);
|
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();
|
List<Path> extensionPaths = Files.list(extensionsDirectory).toList();
|
||||||
extensionPaths.forEach(path -> {
|
extensionPaths.forEach(path -> {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue