Address a few deprecations

Dieser Commit ist enthalten in:
NotMyFault 2021-04-06 18:30:29 +02:00
Ursprung 01dff32597
Commit 6e8cc06637
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: 158F5701A6AAD00C
6 geänderte Dateien mit 16 neuen und 17 gelöschten Zeilen

Datei anzeigen

@ -279,7 +279,7 @@ public class WorldEditPlugin extends JavaPlugin { //implements TabCompleter
config.load();
// Create schematics folder
WorldEdit worldEdit = WorldEdit.getInstance();
File dir = worldEdit.getWorkingDirectoryFile(worldEdit.getConfiguration().saveDir);
File dir = worldEdit.getWorkingDirectoryPath(worldEdit.getConfiguration().saveDir).toFile();
dir.mkdirs();
}

Datei anzeigen

@ -46,7 +46,7 @@ public class SchemSync implements Runnable {
.getFile(Fawe.imp().getDirectory(), Settings.IMP.PATHS.TOKENS, "tokens.txt");
this.worldEdit = WorldEdit.getInstance();
LocalConfiguration config = worldEdit.getConfiguration();
this.working = worldEdit.getWorkingDirectoryFile(config.saveDir);
this.working = worldEdit.getWorkingDirectoryPath(config.saveDir).toFile();
}
private void loadTokens() {

Datei anzeigen

@ -121,12 +121,11 @@ public class ChunkCommands {
throw new StopExecutionException(TextComponent.of("Couldn't find world folder for this world."));
}
File chunkFile = worldEdit.getWorkingDirectoryFile(DELCHUNKS_FILE_NAME);
Path chunkPath = chunkFile.toPath();
Path chunkPath = worldEdit.getWorkingDirectoryPath(DELCHUNKS_FILE_NAME);
ChunkDeletionInfo currentInfo = null;
if (Files.exists(chunkPath)) {
try {
currentInfo = ChunkDeleter.readInfo(chunkFile.toPath());
currentInfo = ChunkDeleter.readInfo(chunkPath);
} catch (IOException e) {
throw new StopExecutionException(TextComponent.of("Error reading existing chunk file."));
}

Datei anzeigen

@ -189,7 +189,7 @@ public class SchematicCommands {
uri = URI.create(fileName);
} else {
final LocalConfiguration config = this.worldEdit.getConfiguration();
File working = this.worldEdit.getWorkingDirectoryFile(config.saveDir);
File working = this.worldEdit.getWorkingDirectoryPath(config.saveDir).toFile();
File root = Settings.IMP.PATHS.PER_PLAYER_SCHEMATICS ? new File(working, player.getUniqueId().toString()) : working;
uri = new File(root, fileName).toURI();
}
@ -248,7 +248,7 @@ public class SchematicCommands {
in = Channels.newInputStream(byteChannel);
uri = url.toURI();
} else {
File saveDir = worldEdit.getWorkingDirectoryFile(config.saveDir);
File saveDir = worldEdit.getWorkingDirectoryPath(config.saveDir).toFile();
File dir = Settings.IMP.PATHS.PER_PLAYER_SCHEMATICS ? new File(saveDir, actor.getUniqueId().toString()) : saveDir;
File file;
if (filename.startsWith("#")) {
@ -279,7 +279,7 @@ public class SchematicCommands {
}
if (file == null || !file.exists()) {
if (!filename.contains("../")) {
dir = this.worldEdit.getWorkingDirectoryFile(config.saveDir);
dir = this.worldEdit.getWorkingDirectoryPath(config.saveDir).toFile();
file = MainUtil.resolve(dir, filename, format, false);
}
}
@ -330,7 +330,7 @@ public class SchematicCommands {
boolean global) throws WorldEditException {
LocalConfiguration config = worldEdit.getConfiguration();
File dir = worldEdit.getWorkingDirectoryFile(config.saveDir);
File dir = worldEdit.getWorkingDirectoryPath(config.saveDir).toFile();
if (!global && Settings.IMP.PATHS.PER_PLAYER_SCHEMATICS) {
dir = new File(dir, actor.getUniqueId().toString());
@ -350,7 +350,7 @@ public class SchematicCommands {
return;
}
if (filename.startsWith("../")) {
dir = worldEdit.getWorkingDirectoryFile(config.saveDir);
dir = worldEdit.getWorkingDirectoryPath(config.saveDir).toFile();
filename = filename.substring(3);
}
}
@ -402,7 +402,7 @@ public class SchematicCommands {
@CommandPermissions({"worldedit.schematic.move", "worldedit.schematic.move.other"})
public void move(Player player, LocalSession session, String directory) throws WorldEditException, IOException {
LocalConfiguration config = worldEdit.getConfiguration();
File working = worldEdit.getWorkingDirectoryFile(config.saveDir);
File working = worldEdit.getWorkingDirectoryPath(config.saveDir).toFile();
File dir = Settings.IMP.PATHS.PER_PLAYER_SCHEMATICS ? new File(working, player.getUniqueId().toString()) : working;
File destDir = new File(dir, directory);
if (!MainUtil.isInSubDirectory(working, destDir)) {
@ -510,7 +510,7 @@ public class SchematicCommands {
}
String pageCommand = "/" + arguments.get();
LocalConfiguration config = worldEdit.getConfiguration();
File dir = worldEdit.getWorkingDirectoryFile(config.saveDir);
File dir = worldEdit.getWorkingDirectoryPath(config.saveDir).toFile();
String schemCmd = "//schematic";
String loadSingle = schemCmd + " load";
@ -628,7 +628,7 @@ public class SchematicCommands {
@Arg(desc = "File name.")
String filename) throws WorldEditException, IOException {
LocalConfiguration config = worldEdit.getConfiguration();
File working = worldEdit.getWorkingDirectoryFile(config.saveDir);
File working = worldEdit.getWorkingDirectoryPath(config.saveDir).toFile();
File dir = Settings.IMP.PATHS.PER_PLAYER_SCHEMATICS ? new File(working, actor.getUniqueId().toString()) : working;
List<File> files = new ArrayList<>();

Datei anzeigen

@ -76,7 +76,7 @@ public class ScriptingCommands {
session.setLastScript(filename);
File dir = worldEdit.getWorkingDirectoryFile(worldEdit.getConfiguration().scriptsDir);
File dir = worldEdit.getWorkingDirectoryPath(worldEdit.getConfiguration().scriptsDir).toFile();
File f = worldEdit.getSafeOpenFile(player, dir, filename, "js", "js");
worldEdit.runScript(player, f, Stream.concat(Stream.of(filename), args.stream())
@ -106,7 +106,7 @@ public class ScriptingCommands {
return;
}
File dir = worldEdit.getWorkingDirectoryFile(worldEdit.getConfiguration().scriptsDir);
File dir = worldEdit.getWorkingDirectoryPath(worldEdit.getConfiguration().scriptsDir).toFile();
File f = worldEdit.getSafeOpenFile(player, dir, lastScript, "js", "js");
worldEdit.runScript(player, f, Stream.concat(Stream.of(lastScript), args.stream())

Datei anzeigen

@ -195,7 +195,7 @@ public class ClipboardFormats {
player.print(Caption.of("fawe.error.no-perm", "worldedit.schematic.load.other"));
return null;
}
File working = worldEdit.getWorkingDirectoryFile(config.saveDir);
File working = worldEdit.getWorkingDirectoryPath(config.saveDir).toFile();
File dir = Settings.IMP.PATHS.PER_PLAYER_SCHEMATICS
? new File(working, player.getUniqueId().toString()) : working;
File f;
@ -230,7 +230,7 @@ public class ClipboardFormats {
}
if (f == null || !f.exists()) {
if (!input.contains("../")) {
dir = worldEdit.getWorkingDirectoryFile(config.saveDir);
dir = worldEdit.getWorkingDirectoryPath(config.saveDir).toFile();
f = MainUtil.resolve(dir, input, format, true);
}
}