geforkt von Mirrors/FastAsyncWorldEdit
Clean up other compiler warnings
Dieser Commit ist enthalten in:
Ursprung
94ebb81e92
Commit
4b5b7b8003
@ -348,20 +348,18 @@ public class WorldEditPlugin extends JavaPlugin //implements TabCompleter
|
|||||||
protected void createDefaultConfiguration(String name) {
|
protected void createDefaultConfiguration(String name) {
|
||||||
File actual = new File(getDataFolder(), name);
|
File actual = new File(getDataFolder(), name);
|
||||||
if (!actual.exists()) {
|
if (!actual.exists()) {
|
||||||
InputStream input = null;
|
try (JarFile file = new JarFile(getFile())) {
|
||||||
try {
|
|
||||||
JarFile file = new JarFile(getFile());
|
|
||||||
ZipEntry copy = file.getEntry("defaults/" + name);
|
ZipEntry copy = file.getEntry("defaults/" + name);
|
||||||
if (copy == null) throw new FileNotFoundException();
|
if (copy == null) throw new FileNotFoundException();
|
||||||
input = file.getInputStream(copy);
|
copyDefaultConfig(file.getInputStream(copy), actual, name);
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
getLogger().severe("Unable to read default configuration: " + name);
|
getLogger().severe("Unable to read default configuration: " + name);
|
||||||
}
|
}
|
||||||
if (input != null) {
|
}
|
||||||
FileOutputStream output = null;
|
}
|
||||||
|
|
||||||
try {
|
private void copyDefaultConfig(InputStream input, File actual, String name) {
|
||||||
output = new FileOutputStream(actual);
|
try (FileOutputStream output = new FileOutputStream(actual)) {
|
||||||
byte[] buf = new byte[8192];
|
byte[] buf = new byte[8192];
|
||||||
int length;
|
int length;
|
||||||
while ((length = input.read(buf)) > 0) {
|
while ((length = input.read(buf)) > 0) {
|
||||||
@ -371,18 +369,6 @@ public class WorldEditPlugin extends JavaPlugin //implements TabCompleter
|
|||||||
getLogger().info("Default configuration file written: " + name);
|
getLogger().info("Default configuration file written: " + name);
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
getLogger().log(Level.WARNING, "Failed to write default config file", e);
|
getLogger().log(Level.WARNING, "Failed to write default config file", e);
|
||||||
} finally {
|
|
||||||
try {
|
|
||||||
input.close();
|
|
||||||
} catch (IOException ignored) {}
|
|
||||||
|
|
||||||
try {
|
|
||||||
if (output != null) {
|
|
||||||
output.close();
|
|
||||||
}
|
|
||||||
} catch (IOException ignored) {}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -97,7 +97,7 @@ public class ListTagBuilder {
|
|||||||
*
|
*
|
||||||
* @return a new builder
|
* @return a new builder
|
||||||
*/
|
*/
|
||||||
public static <T extends Tag> ListTagBuilder createWith(T ... entries) {
|
public static ListTagBuilder createWith(Tag... entries) {
|
||||||
checkNotNull(entries);
|
checkNotNull(entries);
|
||||||
|
|
||||||
if (entries.length == 0) {
|
if (entries.length == 0) {
|
||||||
|
@ -85,7 +85,7 @@ public final class FileDialogUtil {
|
|||||||
if (index == -1 || index == path.length() - 1) {
|
if (index == -1 || index == path.length() - 1) {
|
||||||
return false;
|
return false;
|
||||||
} else {
|
} else {
|
||||||
return exts.contains(path.indexOf(index + 1));
|
return exts.contains(path.substring(index + 1));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -133,9 +133,10 @@ public class Snapshot implements Comparable<Snapshot> {
|
|||||||
public boolean containsWorld(String worldname) {
|
public boolean containsWorld(String worldname) {
|
||||||
try {
|
try {
|
||||||
if (file.getName().toLowerCase().endsWith(".zip")) {
|
if (file.getName().toLowerCase().endsWith(".zip")) {
|
||||||
ZipFile entry = new ZipFile(file);
|
try (ZipFile entry = new ZipFile(file)) {
|
||||||
return (entry.getEntry(worldname) != null
|
return (entry.getEntry(worldname) != null
|
||||||
|| entry.getEntry(worldname + "/level.dat") != null);
|
|| entry.getEntry(worldname + "/level.dat") != null);
|
||||||
|
}
|
||||||
} else if (file.getName().toLowerCase().endsWith(".tar.bz2")
|
} else if (file.getName().toLowerCase().endsWith(".tar.bz2")
|
||||||
|| file.getName().toLowerCase().endsWith(".tar.gz")
|
|| file.getName().toLowerCase().endsWith(".tar.gz")
|
||||||
|| file.getName().toLowerCase().endsWith(".tar")) {
|
|| file.getName().toLowerCase().endsWith(".tar")) {
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren