Only download leveldb for conversion
This commit is contained in:
parent
a61e1fa96a
commit
b8aaeb0f8c
@ -32,6 +32,8 @@ import java.io.InputStream;
|
|||||||
import java.net.URL;
|
import java.net.URL;
|
||||||
import java.nio.channels.Channels;
|
import java.nio.channels.Channels;
|
||||||
import java.nio.channels.ReadableByteChannel;
|
import java.nio.channels.ReadableByteChannel;
|
||||||
|
import java.nio.file.Files;
|
||||||
|
import java.nio.file.StandardCopyOption;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
@ -324,16 +326,23 @@ public class ConverterFrame extends JFrame {
|
|||||||
public void run() {
|
public void run() {
|
||||||
FakePlayer console = FakePlayer.getConsole();
|
FakePlayer console = FakePlayer.getConsole();
|
||||||
try {
|
try {
|
||||||
debug("Loading nukkit.jar");
|
debug("Loading leveldb.jar");
|
||||||
File nukkit = new File("nukkit.jar");
|
File leveldb = new File("leveldb.jar");
|
||||||
if (!nukkit.exists()) {
|
if (!leveldb.exists()) {
|
||||||
debug("Downloading: http://ci.mengcraft.com:8080/job/nukkit/lastSuccessfulBuild/artifact/target/nukkit-1.0-SNAPSHOT.jar");
|
File tempFile = File.createTempFile("leveldb.jar", ".tmp");
|
||||||
URL url = new URL("http://ci.mengcraft.com:8080/job/nukkit/lastSuccessfulBuild/artifact/target/nukkit-1.0-SNAPSHOT.jar");
|
tempFile.deleteOnExit();
|
||||||
ReadableByteChannel rbc = Channels.newChannel(url.openStream());
|
String download = "https://github.com/Nukkit/Nukkit/raw/master/lib/leveldb.jar";
|
||||||
FileOutputStream fos = new FileOutputStream(nukkit);
|
debug("Downloading: " + download);
|
||||||
fos.getChannel().transferFrom(rbc, 0, Long.MAX_VALUE);
|
URL url = new URL(download);
|
||||||
|
try (InputStream is = url.openStream()) {
|
||||||
|
ReadableByteChannel rbc = Channels.newChannel(is);
|
||||||
|
FileOutputStream fos = new FileOutputStream(tempFile);
|
||||||
|
fos.getChannel().transferFrom(rbc, 0, Long.MAX_VALUE);
|
||||||
|
}
|
||||||
|
Files.copy(tempFile.toPath(), leveldb.toPath(), StandardCopyOption.REPLACE_EXISTING);
|
||||||
|
tempFile.delete();
|
||||||
}
|
}
|
||||||
MainUtil.loadURLClasspath(nukkit.toURL());
|
MainUtil.loadURLClasspath(leveldb.toURL());
|
||||||
|
|
||||||
File newWorldFile = new File(output, dirMc.getName());
|
File newWorldFile = new File(output, dirMc.getName());
|
||||||
try (MCAFile2LevelDB converter = new MCAFile2LevelDB(newWorldFile)) {
|
try (MCAFile2LevelDB converter = new MCAFile2LevelDB(newWorldFile)) {
|
||||||
|
Loading…
Reference in New Issue
Block a user