Skip to content

Commit

Permalink
Remove the Bukkit legacy data folder migration code from 11 years ago (
Browse files Browse the repository at this point in the history
  • Loading branch information
me4502 authored Aug 9, 2023
1 parent ab75fd7 commit 7f81aad
Showing 1 changed file with 0 additions and 29 deletions.
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

0 comments on commit 7f81aad

Please sign in to comment.