mirror of
https://github.com/plexusorg/Plex-FAWE.git
synced 2024-12-23 09:47:38 +00:00
Address a few deprecations
This commit is contained in:
parent
01dff32597
commit
6e8cc06637
@ -279,7 +279,7 @@ public class WorldEditPlugin extends JavaPlugin { //implements TabCompleter
|
|||||||
config.load();
|
config.load();
|
||||||
// Create schematics folder
|
// Create schematics folder
|
||||||
WorldEdit worldEdit = WorldEdit.getInstance();
|
WorldEdit worldEdit = WorldEdit.getInstance();
|
||||||
File dir = worldEdit.getWorkingDirectoryFile(worldEdit.getConfiguration().saveDir);
|
File dir = worldEdit.getWorkingDirectoryPath(worldEdit.getConfiguration().saveDir).toFile();
|
||||||
dir.mkdirs();
|
dir.mkdirs();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -46,7 +46,7 @@ public class SchemSync implements Runnable {
|
|||||||
.getFile(Fawe.imp().getDirectory(), Settings.IMP.PATHS.TOKENS, "tokens.txt");
|
.getFile(Fawe.imp().getDirectory(), Settings.IMP.PATHS.TOKENS, "tokens.txt");
|
||||||
this.worldEdit = WorldEdit.getInstance();
|
this.worldEdit = WorldEdit.getInstance();
|
||||||
LocalConfiguration config = worldEdit.getConfiguration();
|
LocalConfiguration config = worldEdit.getConfiguration();
|
||||||
this.working = worldEdit.getWorkingDirectoryFile(config.saveDir);
|
this.working = worldEdit.getWorkingDirectoryPath(config.saveDir).toFile();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void loadTokens() {
|
private void loadTokens() {
|
||||||
|
@ -121,12 +121,11 @@ public class ChunkCommands {
|
|||||||
throw new StopExecutionException(TextComponent.of("Couldn't find world folder for this world."));
|
throw new StopExecutionException(TextComponent.of("Couldn't find world folder for this world."));
|
||||||
}
|
}
|
||||||
|
|
||||||
File chunkFile = worldEdit.getWorkingDirectoryFile(DELCHUNKS_FILE_NAME);
|
Path chunkPath = worldEdit.getWorkingDirectoryPath(DELCHUNKS_FILE_NAME);
|
||||||
Path chunkPath = chunkFile.toPath();
|
|
||||||
ChunkDeletionInfo currentInfo = null;
|
ChunkDeletionInfo currentInfo = null;
|
||||||
if (Files.exists(chunkPath)) {
|
if (Files.exists(chunkPath)) {
|
||||||
try {
|
try {
|
||||||
currentInfo = ChunkDeleter.readInfo(chunkFile.toPath());
|
currentInfo = ChunkDeleter.readInfo(chunkPath);
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
throw new StopExecutionException(TextComponent.of("Error reading existing chunk file."));
|
throw new StopExecutionException(TextComponent.of("Error reading existing chunk file."));
|
||||||
}
|
}
|
||||||
|
@ -189,7 +189,7 @@ public class SchematicCommands {
|
|||||||
uri = URI.create(fileName);
|
uri = URI.create(fileName);
|
||||||
} else {
|
} else {
|
||||||
final LocalConfiguration config = this.worldEdit.getConfiguration();
|
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;
|
File root = Settings.IMP.PATHS.PER_PLAYER_SCHEMATICS ? new File(working, player.getUniqueId().toString()) : working;
|
||||||
uri = new File(root, fileName).toURI();
|
uri = new File(root, fileName).toURI();
|
||||||
}
|
}
|
||||||
@ -248,7 +248,7 @@ public class SchematicCommands {
|
|||||||
in = Channels.newInputStream(byteChannel);
|
in = Channels.newInputStream(byteChannel);
|
||||||
uri = url.toURI();
|
uri = url.toURI();
|
||||||
} else {
|
} 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 dir = Settings.IMP.PATHS.PER_PLAYER_SCHEMATICS ? new File(saveDir, actor.getUniqueId().toString()) : saveDir;
|
||||||
File file;
|
File file;
|
||||||
if (filename.startsWith("#")) {
|
if (filename.startsWith("#")) {
|
||||||
@ -279,7 +279,7 @@ public class SchematicCommands {
|
|||||||
}
|
}
|
||||||
if (file == null || !file.exists()) {
|
if (file == null || !file.exists()) {
|
||||||
if (!filename.contains("../")) {
|
if (!filename.contains("../")) {
|
||||||
dir = this.worldEdit.getWorkingDirectoryFile(config.saveDir);
|
dir = this.worldEdit.getWorkingDirectoryPath(config.saveDir).toFile();
|
||||||
file = MainUtil.resolve(dir, filename, format, false);
|
file = MainUtil.resolve(dir, filename, format, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -330,7 +330,7 @@ public class SchematicCommands {
|
|||||||
boolean global) throws WorldEditException {
|
boolean global) throws WorldEditException {
|
||||||
LocalConfiguration config = worldEdit.getConfiguration();
|
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) {
|
if (!global && Settings.IMP.PATHS.PER_PLAYER_SCHEMATICS) {
|
||||||
dir = new File(dir, actor.getUniqueId().toString());
|
dir = new File(dir, actor.getUniqueId().toString());
|
||||||
@ -350,7 +350,7 @@ public class SchematicCommands {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (filename.startsWith("../")) {
|
if (filename.startsWith("../")) {
|
||||||
dir = worldEdit.getWorkingDirectoryFile(config.saveDir);
|
dir = worldEdit.getWorkingDirectoryPath(config.saveDir).toFile();
|
||||||
filename = filename.substring(3);
|
filename = filename.substring(3);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -402,7 +402,7 @@ public class SchematicCommands {
|
|||||||
@CommandPermissions({"worldedit.schematic.move", "worldedit.schematic.move.other"})
|
@CommandPermissions({"worldedit.schematic.move", "worldedit.schematic.move.other"})
|
||||||
public void move(Player player, LocalSession session, String directory) throws WorldEditException, IOException {
|
public void move(Player player, LocalSession session, String directory) throws WorldEditException, IOException {
|
||||||
LocalConfiguration config = worldEdit.getConfiguration();
|
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 dir = Settings.IMP.PATHS.PER_PLAYER_SCHEMATICS ? new File(working, player.getUniqueId().toString()) : working;
|
||||||
File destDir = new File(dir, directory);
|
File destDir = new File(dir, directory);
|
||||||
if (!MainUtil.isInSubDirectory(working, destDir)) {
|
if (!MainUtil.isInSubDirectory(working, destDir)) {
|
||||||
@ -510,7 +510,7 @@ public class SchematicCommands {
|
|||||||
}
|
}
|
||||||
String pageCommand = "/" + arguments.get();
|
String pageCommand = "/" + arguments.get();
|
||||||
LocalConfiguration config = worldEdit.getConfiguration();
|
LocalConfiguration config = worldEdit.getConfiguration();
|
||||||
File dir = worldEdit.getWorkingDirectoryFile(config.saveDir);
|
File dir = worldEdit.getWorkingDirectoryPath(config.saveDir).toFile();
|
||||||
|
|
||||||
String schemCmd = "//schematic";
|
String schemCmd = "//schematic";
|
||||||
String loadSingle = schemCmd + " load";
|
String loadSingle = schemCmd + " load";
|
||||||
@ -628,7 +628,7 @@ public class SchematicCommands {
|
|||||||
@Arg(desc = "File name.")
|
@Arg(desc = "File name.")
|
||||||
String filename) throws WorldEditException, IOException {
|
String filename) throws WorldEditException, IOException {
|
||||||
LocalConfiguration config = worldEdit.getConfiguration();
|
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;
|
File dir = Settings.IMP.PATHS.PER_PLAYER_SCHEMATICS ? new File(working, actor.getUniqueId().toString()) : working;
|
||||||
List<File> files = new ArrayList<>();
|
List<File> files = new ArrayList<>();
|
||||||
|
|
||||||
|
@ -76,7 +76,7 @@ public class ScriptingCommands {
|
|||||||
|
|
||||||
session.setLastScript(filename);
|
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");
|
File f = worldEdit.getSafeOpenFile(player, dir, filename, "js", "js");
|
||||||
|
|
||||||
worldEdit.runScript(player, f, Stream.concat(Stream.of(filename), args.stream())
|
worldEdit.runScript(player, f, Stream.concat(Stream.of(filename), args.stream())
|
||||||
@ -106,7 +106,7 @@ public class ScriptingCommands {
|
|||||||
return;
|
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");
|
File f = worldEdit.getSafeOpenFile(player, dir, lastScript, "js", "js");
|
||||||
|
|
||||||
worldEdit.runScript(player, f, Stream.concat(Stream.of(lastScript), args.stream())
|
worldEdit.runScript(player, f, Stream.concat(Stream.of(lastScript), args.stream())
|
||||||
|
@ -195,7 +195,7 @@ public class ClipboardFormats {
|
|||||||
player.print(Caption.of("fawe.error.no-perm", "worldedit.schematic.load.other"));
|
player.print(Caption.of("fawe.error.no-perm", "worldedit.schematic.load.other"));
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
File working = worldEdit.getWorkingDirectoryFile(config.saveDir);
|
File working = worldEdit.getWorkingDirectoryPath(config.saveDir).toFile();
|
||||||
File dir = Settings.IMP.PATHS.PER_PLAYER_SCHEMATICS
|
File dir = Settings.IMP.PATHS.PER_PLAYER_SCHEMATICS
|
||||||
? new File(working, player.getUniqueId().toString()) : working;
|
? new File(working, player.getUniqueId().toString()) : working;
|
||||||
File f;
|
File f;
|
||||||
@ -230,7 +230,7 @@ public class ClipboardFormats {
|
|||||||
}
|
}
|
||||||
if (f == null || !f.exists()) {
|
if (f == null || !f.exists()) {
|
||||||
if (!input.contains("../")) {
|
if (!input.contains("../")) {
|
||||||
dir = worldEdit.getWorkingDirectoryFile(config.saveDir);
|
dir = worldEdit.getWorkingDirectoryPath(config.saveDir).toFile();
|
||||||
f = MainUtil.resolve(dir, input, format, true);
|
f = MainUtil.resolve(dir, input, format, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user