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

Store file path to save on calls

Dieser Commit ist enthalten in:
rtm516 2024-08-09 13:35:19 +01:00
Ursprung 23e6dbc899
Commit 571e97332d
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: 331715B8B007C67A

Datei anzeigen

@ -169,7 +169,7 @@ public class GeyserExtensionLoader extends ExtensionLoader {
List<Path> extensionPaths; List<Path> extensionPaths;
if (Files.isDirectory(updateDirectory)) { if (Files.isDirectory(updateDirectory)) {
// Get the current extensions and store them in a map // Get the current extensions and store them in a map
Map<String, String> extensionFiles = new HashMap<>(); Map<String, Path> extensionFiles = new HashMap<>();
extensionPaths = Files.list(extensionsDirectory).toList(); extensionPaths = Files.list(extensionsDirectory).toList();
extensionPaths.forEach(path -> { extensionPaths.forEach(path -> {
if (Files.isDirectory(path)) { if (Files.isDirectory(path)) {
@ -188,7 +188,7 @@ public class GeyserExtensionLoader extends ExtensionLoader {
GeyserExtensionDescription description = this.extensionDescription(path); GeyserExtensionDescription description = this.extensionDescription(path);
// Store the file name against ID for later use // Store the file name against ID for later use
extensionFiles.put(description.id(), path.getFileName().toString()); extensionFiles.put(description.id(), path.getFileName());
} catch (Throwable e) { } catch (Throwable e) {
// no-op // no-op
} }
@ -214,7 +214,7 @@ public class GeyserExtensionLoader extends ExtensionLoader {
// Remove the old extension with the same ID if it exists // Remove the old extension with the same ID if it exists
if (extensionFiles.containsKey(description.id())) { if (extensionFiles.containsKey(description.id())) {
Files.delete(extensionsDirectory.resolve(extensionFiles.get(description.id()))); Files.delete(extensionFiles.get(description.id()));
} }
// Overwrite the extension with the new jar // Overwrite the extension with the new jar