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

Remove the Bukkit legacy data folder migration code from 11 years ago #2383

Merged
merged 1 commit into from
Aug 9, 2023
Merged
Changes from all 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 @@ -19,15 +19,12 @@

package com.sk89q.worldedit.bukkit;

import com.google.common.base.Throwables;
import com.sk89q.util.yaml.YAMLProcessor;
import com.sk89q.worldedit.WorldEdit;
import com.sk89q.worldedit.util.YAMLConfiguration;
import com.sk89q.worldedit.util.report.Unreported;
import org.apache.logging.log4j.LogManager;

import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;

/**
Expand All @@ -54,32 +51,6 @@ public void load() {
WorldEdit.logger.warn("Editing without a Bukkit adapter has been enabled. You will not receive support "
+ "for any issues that arise as a result.");
}
migrateLegacyFolders();
}

private void migrateLegacyFolders() {
migrate(scriptsDir, "craftscripts");
migrate(saveDir, "schematics");
migrate("drawings", "draw.js images");
}

private void migrate(String file, String name) {
Path fromDir = Path.of(file);
if (!fromDir.toAbsolutePath().startsWith(Path.of("").toAbsolutePath())) {
throw new IllegalArgumentException("Legacy folder must be below the current working directory");
}
Path toDir = getWorkingDirectoryPath().resolve(file);
if (Files.exists(fromDir) & !Files.exists(toDir)) {
try {
Files.move(fromDir, toDir);
plugin.getLogger().info("Migrated " + name + " folder '" + file
+ "' from server root to plugin data folder.");
} catch (IOException e) {
plugin.getLogger().warning(() ->
"Error while migrating " + name + " folder! " + Throwables.getStackTraceAsString(e)
);
}
}
}

@Override
Expand Down
Loading