mirror of
https://github.com/plexusorg/Plex-FAWE.git
synced 2024-11-19 10:25:00 +00:00
Changed getSafe*File to accept varargs instead of arrays.
This commit is contained in:
parent
c8180e641f
commit
5d59dd764e
@ -646,7 +646,7 @@ public class WorldEdit {
|
||||
* @throws FilenameException
|
||||
*/
|
||||
public File getSafeSaveFile(LocalPlayer player, File dir, String filename,
|
||||
String defaultExt, String[] extensions)
|
||||
String defaultExt, String... extensions)
|
||||
throws FilenameException {
|
||||
return getSafeFile(player, dir, filename, defaultExt, extensions, true);
|
||||
}
|
||||
@ -666,7 +666,7 @@ public class WorldEdit {
|
||||
* @throws FilenameException
|
||||
*/
|
||||
public File getSafeOpenFile(LocalPlayer player, File dir, String filename,
|
||||
String defaultExt, String[] extensions)
|
||||
String defaultExt, String... extensions)
|
||||
throws FilenameException {
|
||||
return getSafeFile(player, dir, filename, defaultExt, extensions, false);
|
||||
}
|
||||
@ -686,6 +686,8 @@ public class WorldEdit {
|
||||
private File getSafeFile(LocalPlayer player, File dir, String filename,
|
||||
String defaultExt, String[] extensions, boolean isSave)
|
||||
throws FilenameException {
|
||||
if (extensions.length == 1 && extensions[0] == null) extensions = null;
|
||||
|
||||
File f;
|
||||
|
||||
if (filename.equals("#")) {
|
||||
|
@ -188,8 +188,7 @@ public class ClipboardCommands {
|
||||
|
||||
String filename = args.getString(0);
|
||||
File dir = we.getWorkingDirectoryFile(config.saveDir);
|
||||
File f = we.getSafeOpenFile(player, dir, filename, "schematic",
|
||||
new String[] { "schematic" });
|
||||
File f = we.getSafeOpenFile(player, dir, filename, "schematic", "schematic");
|
||||
|
||||
try {
|
||||
String filePath = f.getCanonicalPath();
|
||||
@ -226,8 +225,7 @@ public class ClipboardCommands {
|
||||
String filename = args.getString(0);
|
||||
|
||||
File dir = we.getWorkingDirectoryFile(config.saveDir);
|
||||
File f = we.getSafeSaveFile(player, dir, filename, "schematic",
|
||||
new String[] { "schematic" });
|
||||
File f = we.getSafeSaveFile(player, dir, filename, "schematic", "schematic");
|
||||
|
||||
if (!dir.exists()) {
|
||||
if (!dir.mkdir()) {
|
||||
|
@ -57,8 +57,7 @@ public class ScriptingCommands {
|
||||
session.setLastScript(name);
|
||||
|
||||
File dir = we.getWorkingDirectoryFile(we.getConfiguration().scriptsDir);
|
||||
File f = we.getSafeOpenFile(player, dir, name, "js",
|
||||
new String[] { "js" });
|
||||
File f = we.getSafeOpenFile(player, dir, name, "js", "js");
|
||||
|
||||
we.runScript(player, f, scriptArgs);
|
||||
}
|
||||
@ -91,8 +90,7 @@ public class ScriptingCommands {
|
||||
String[] scriptArgs = args.getSlice(0);
|
||||
|
||||
File dir = we.getWorkingDirectoryFile(we.getConfiguration().scriptsDir);
|
||||
File f = we.getSafeOpenFile(player, dir, lastScript, "js",
|
||||
new String[] { "js" });
|
||||
File f = we.getSafeOpenFile(player, dir, lastScript, "js", "js");
|
||||
|
||||
we.runScript(player, f, scriptArgs);
|
||||
}
|
||||
|
@ -216,7 +216,7 @@ public class CraftScriptContext extends CraftScriptEnvironment {
|
||||
@Deprecated
|
||||
public File getSafeFile(String folder, String filename) throws FilenameException {
|
||||
File dir = controller.getWorkingDirectoryFile(folder);
|
||||
return controller.getSafeOpenFile(player, dir, filename, null, null);
|
||||
return controller.getSafeOpenFile(player, dir, filename, null, (String[]) null);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -236,7 +236,7 @@ public class CraftScriptContext extends CraftScriptEnvironment {
|
||||
* @throws FilenameException
|
||||
*/
|
||||
public File getSafeOpenFile(String folder, String filename,
|
||||
String defaultExt, String[] exts)
|
||||
String defaultExt, String... exts)
|
||||
throws FilenameException {
|
||||
File dir = controller.getWorkingDirectoryFile(folder);
|
||||
return controller.getSafeOpenFile(player, dir, filename, defaultExt, exts);
|
||||
@ -259,7 +259,7 @@ public class CraftScriptContext extends CraftScriptEnvironment {
|
||||
* @throws FilenameException
|
||||
*/
|
||||
public File getSafeSaveFile(String folder, String filename,
|
||||
String defaultExt, String[] exts)
|
||||
String defaultExt, String... exts)
|
||||
throws FilenameException {
|
||||
File dir = controller.getWorkingDirectoryFile(folder);
|
||||
return controller.getSafeSaveFile(player, dir, filename, defaultExt, exts);
|
||||
|
Loading…
Reference in New Issue
Block a user