Fork of Poseidon providing Bukkit #1060 to older Beta versions (b1.0-b1.7.3)
at develop 75 lines 2.1 kB view raw
1package net.minecraft.server; 2 3import java.io.File; 4import java.io.FileInputStream; 5import java.io.InputStream; 6 7public class WorldLoader implements Convertable { 8 9 protected final File a; 10 11 public WorldLoader(File file1) { 12 if (!file1.exists()) { 13 file1.mkdirs(); 14 } 15 16 this.a = file1; 17 } 18 19 public WorldData b(String s) { 20 File file1 = new File(this.a, s); 21 22 if (!file1.exists()) { 23 return null; 24 } else { 25 File file2 = new File(file1, "level.dat"); 26 NBTTagCompound nbttagcompound; 27 NBTTagCompound nbttagcompound1; 28 29 if (file2.exists()) { 30 try { 31 nbttagcompound = CompressedStreamTools.a((InputStream) (new FileInputStream(file2))); 32 nbttagcompound1 = nbttagcompound.k("Data"); 33 return new WorldData(nbttagcompound1); 34 } catch (Exception exception) { 35 exception.printStackTrace(); 36 } 37 } 38 39 file2 = new File(file1, "level.dat_old"); 40 if (file2.exists()) { 41 try { 42 nbttagcompound = CompressedStreamTools.a((InputStream) (new FileInputStream(file2))); 43 nbttagcompound1 = nbttagcompound.k("Data"); 44 return new WorldData(nbttagcompound1); 45 } catch (Exception exception1) { 46 exception1.printStackTrace(); 47 } 48 } 49 50 return null; 51 } 52 } 53 54 protected static void a(File[] afile) { 55 for (int i = 0; i < afile.length; ++i) { 56 if (afile[i].isDirectory()) { 57 a(afile[i].listFiles()); 58 } 59 60 afile[i].delete(); 61 } 62 } 63 64 public IDataManager a(String s, boolean flag) { 65 return new PlayerNBTManager(this.a, s, flag); 66 } 67 68 public boolean isConvertable(String s) { 69 return false; 70 } 71 72 public boolean convert(String s, IProgressUpdate iprogressupdate) { 73 return false; 74 } 75}