3
0
Mirror von https://github.com/IntellectualSites/FastAsyncWorldEdit.git synchronisiert 2024-11-19 09:20:08 +01:00

fix: ensure config-legacy.yml is created before accessed (#2752)

* fix: ensure config-legacy.yml is created before accessed

* Stop error attempting to load FAWE config if it doesn't exist
Dieser Commit ist enthalten in:
Jordan 2024-06-13 20:31:45 +02:00 committet von GitHub
Ursprung 865cc55a0e
Commit 031fdf2efd
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: B5690EEEBB952194
3 geänderte Dateien mit 8 neuen und 4 gelöschten Zeilen

Datei anzeigen

@ -137,6 +137,10 @@ public class WorldEditPlugin extends JavaPlugin {
//noinspection ResultOfMethodCallIgnored //noinspection ResultOfMethodCallIgnored
getDataFolder().mkdirs(); getDataFolder().mkdirs();
//FAWE start - Migrate from config-legacy to worldedit-config
migrateLegacyConfig();
//FAWE end
//FAWE start - Modify WorldEdit config name //FAWE start - Modify WorldEdit config name
config = new BukkitConfiguration(new YAMLProcessor(new File(getDataFolder(), "worldedit-config.yml"), true), this); config = new BukkitConfiguration(new YAMLProcessor(new File(getDataFolder(), "worldedit-config.yml"), true), this);
// Load config before we say we've loaded platforms as it is used in listeners of the event // Load config before we say we've loaded platforms as it is used in listeners of the event
@ -151,10 +155,6 @@ public class WorldEditPlugin extends JavaPlugin {
platform = new BukkitServerInterface(this, getServer()); platform = new BukkitServerInterface(this, getServer());
worldEdit.getPlatformManager().register(platform); worldEdit.getPlatformManager().register(platform);
//FAWE start - Migrate from config-legacy to worldedit-config
migrateLegacyConfig();
//FAWE end
//FAWE start - Setup permission attachments //FAWE start - Setup permission attachments
permissionAttachmentManager = new BukkitPermissionAttachmentManager(this); permissionAttachmentManager = new BukkitPermissionAttachmentManager(this);
//FAWE end //FAWE end

Datei anzeigen

@ -100,6 +100,9 @@ public class Config {
} }
public boolean load(File file) { public boolean load(File file) {
if (!file.exists()) {
return false;
}
existingMigrateNodes = new ArrayList<>(); existingMigrateNodes = new ArrayList<>();
YamlConfiguration yml = YamlConfiguration.loadConfiguration(file); YamlConfiguration yml = YamlConfiguration.loadConfiguration(file);
for (String key : yml.getKeys(true)) { for (String key : yml.getKeys(true)) {

Datei anzeigen

@ -68,6 +68,7 @@ public class YamlConfiguration extends FileConfiguration {
LOGGER.error("Could not read {}\n" + "Renamed to {}", file, dest.getAbsolutePath(), ex); LOGGER.error("Could not read {}\n" + "Renamed to {}", file, dest.getAbsolutePath(), ex);
} catch (final IOException e) { } catch (final IOException e) {
e.printStackTrace(); e.printStackTrace();
ex.printStackTrace();
} }
} }