Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add extension update folder #4929

Open
wants to merge 15 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,34 @@ protected void loadAllExtensions(@NonNull ExtensionManager extensionManager) {
Map<String, GeyserExtensionContainer> loadedExtensions = new LinkedHashMap<>();

Pattern[] extensionFilters = this.extensionFilters();
List<Path> extensionPaths = Files.walk(extensionsDirectory).toList();

Path updateDirectory = extensionsDirectory.resolve("update");
if (Files.isDirectory(updateDirectory)) {
List<Path> extensionUpdatePaths = Files.list(updateDirectory).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);

// Overwrite the extension with the new jar
Files.move(path, extensionsDirectory.resolve(path.getFileName()), StandardCopyOption.REPLACE_EXISTING);
rtm516 marked this conversation as resolved.
Show resolved Hide resolved
} 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;
Expand Down
2 changes: 1 addition & 1 deletion core/src/main/resources/languages