diff --git a/sp-server/src/main/java/net/lax1dude/eaglercraft/sp/CRC32.java b/sp-server/src/main/java/net/lax1dude/eaglercraft/sp/CRC32.java index 7406bf6..5277242 100644 --- a/sp-server/src/main/java/net/lax1dude/eaglercraft/sp/CRC32.java +++ b/sp-server/src/main/java/net/lax1dude/eaglercraft/sp/CRC32.java @@ -1,41 +1,39 @@ package net.lax1dude.eaglercraft.sp; -import org.teavm.classlib.java.util.zip.TChecksum; - import java.util.zip.Checksum; public class CRC32 implements Checksum { - private com.jcraft.jzlib.CRC32 impl = new com.jcraft.jzlib.CRC32(); - long tbytes; + private com.jcraft.jzlib.CRC32 impl = new com.jcraft.jzlib.CRC32(); + long tbytes; - @Override - public long getValue() { - return impl.getValue(); - } + @Override + public long getValue() { + return impl.getValue(); + } - @Override - public void reset() { - impl.reset(); - tbytes = 0; - } + @Override + public void reset() { + impl.reset(); + tbytes = 0; + } - @Override - public void update(int val) { - impl.update(new byte[] { (byte) val }, 0, 1); - } + @Override + public void update(int val) { + impl.update(new byte[] { (byte) val }, 0, 1); + } - public void update(byte[] buf) { - update(buf, 0, buf.length); - } + public void update(byte[] buf) { + update(buf, 0, buf.length); + } - @Override - public void update(byte[] buf, int off, int nbytes) { - // avoid int overflow, check null buf - if (off <= buf.length && nbytes >= 0 && off >= 0 && buf.length - off >= nbytes) { - impl.update(buf, off, nbytes); - tbytes += nbytes; - } else { - throw new ArrayIndexOutOfBoundsException(); - } - } + @Override + public void update(byte[] buf, int off, int nbytes) { + // avoid int overflow, check null buf + if (off <= buf.length && nbytes >= 0 && off >= 0 && buf.length - off >= nbytes) { + impl.update(buf, off, nbytes); + tbytes += nbytes; + } else { + throw new ArrayIndexOutOfBoundsException(); + } + } } diff --git a/sp-server/src/main/java/net/lax1dude/eaglercraft/sp/IntegratedServer.java b/sp-server/src/main/java/net/lax1dude/eaglercraft/sp/IntegratedServer.java index 5d53215..fa5ef4c 100644 --- a/sp-server/src/main/java/net/lax1dude/eaglercraft/sp/IntegratedServer.java +++ b/sp-server/src/main/java/net/lax1dude/eaglercraft/sp/IntegratedServer.java @@ -12,16 +12,39 @@ import java.util.Map; import java.util.zip.ZipEntry; import java.util.zip.ZipInputStream; -import net.minecraft.src.ChunkCoordIntPair; import org.teavm.jso.JSBody; import org.teavm.jso.JSFunctor; import org.teavm.jso.JSObject; import org.teavm.jso.typedarrays.ArrayBuffer; import org.teavm.jso.typedarrays.Uint8Array; -import net.lax1dude.eaglercraft.sp.ipc.*; +import net.lax1dude.eaglercraft.sp.ipc.IPCPacket00StartServer; +import net.lax1dude.eaglercraft.sp.ipc.IPCPacket01StopServer; +import net.lax1dude.eaglercraft.sp.ipc.IPCPacket02InitWorld; +import net.lax1dude.eaglercraft.sp.ipc.IPCPacket03DeleteWorld; +import net.lax1dude.eaglercraft.sp.ipc.IPCPacket04RenameWorld; +import net.lax1dude.eaglercraft.sp.ipc.IPCPacket05RequestData; +import net.lax1dude.eaglercraft.sp.ipc.IPCPacket06RenameWorldNBT; +import net.lax1dude.eaglercraft.sp.ipc.IPCPacket07ImportWorld; +import net.lax1dude.eaglercraft.sp.ipc.IPCPacket09RequestResponse; +import net.lax1dude.eaglercraft.sp.ipc.IPCPacket0ASetWorldDifficulty; +import net.lax1dude.eaglercraft.sp.ipc.IPCPacket0BPause; +import net.lax1dude.eaglercraft.sp.ipc.IPCPacket0CPlayerChannel; +import net.lax1dude.eaglercraft.sp.ipc.IPCPacket0DProgressUpdate; +import net.lax1dude.eaglercraft.sp.ipc.IPCPacket0EListWorlds; +import net.lax1dude.eaglercraft.sp.ipc.IPCPacket0FListFiles; +import net.lax1dude.eaglercraft.sp.ipc.IPCPacket10FileRead; +import net.lax1dude.eaglercraft.sp.ipc.IPCPacket12FileWrite; +import net.lax1dude.eaglercraft.sp.ipc.IPCPacket13FileCopyMove; +import net.lax1dude.eaglercraft.sp.ipc.IPCPacket14StringList; +import net.lax1dude.eaglercraft.sp.ipc.IPCPacket15ThrowException; +import net.lax1dude.eaglercraft.sp.ipc.IPCPacket16NBTList; +import net.lax1dude.eaglercraft.sp.ipc.IPCPacketBase; +import net.lax1dude.eaglercraft.sp.ipc.IPCPacketFFProcessKeepAlive; +import net.lax1dude.eaglercraft.sp.ipc.IPCPacketManager; import net.minecraft.src.AchievementList; import net.minecraft.src.AchievementMap; +import net.minecraft.src.ChunkCoordIntPair; import net.minecraft.src.CompressedStreamTools; import net.minecraft.src.EnumGameType; import net.minecraft.src.ILogAgent; diff --git a/sp-server/src/main/java/net/lax1dude/eaglercraft/sp/MCAConverter.java b/sp-server/src/main/java/net/lax1dude/eaglercraft/sp/MCAConverter.java index c17cd43..1931116 100644 --- a/sp-server/src/main/java/net/lax1dude/eaglercraft/sp/MCAConverter.java +++ b/sp-server/src/main/java/net/lax1dude/eaglercraft/sp/MCAConverter.java @@ -5,165 +5,179 @@ import java.io.ByteArrayOutputStream; import java.io.DataOutputStream; import java.io.IOException; import java.io.OutputStream; - -import com.jcraft.jzlib.DeflaterOutputStream; -import com.jcraft.jzlib.GZIPInputStream; -import com.jcraft.jzlib.GZIPOutputStream; -import net.minecraft.src.ChunkCoordIntPair; - import java.util.HashMap; import java.util.Map; import java.util.zip.InflaterInputStream; +import com.jcraft.jzlib.DeflaterOutputStream; +import com.jcraft.jzlib.GZIPInputStream; +import com.jcraft.jzlib.GZIPOutputStream; + +import net.minecraft.src.ChunkCoordIntPair; + public class MCAConverter { - public static void convertFromMCA(VFile dir, byte[] file, String fileName) { - VFile levelDir = new VFile(dir, "level" + (fileName.startsWith("region/") ? "0" : fileName.substring(3, fileName.indexOf('/')))); + public static void convertFromMCA(VFile dir, byte[] file, String fileName) { + VFile levelDir = new VFile(dir, + "level" + (fileName.startsWith("region/") ? "0" : fileName.substring(3, fileName.indexOf('/')))); - String[] xz = fileName.substring(fileName.lastIndexOf('r') + 2, fileName.length() - 4).split("\\."); - int gx = Integer.parseInt(xz[0]); - int gz = Integer.parseInt(xz[1]); + String[] xz = fileName.substring(fileName.lastIndexOf('r') + 2, fileName.length() - 4).split("\\."); + int gx = Integer.parseInt(xz[0]); + int gz = Integer.parseInt(xz[1]); - try { - byte[] buffer = new byte[16000]; - for (int x = 0; x < 32; ++x) { - for (int z = 0; z < 32; ++z) { - int i = ((x % 32) + (z % 32) * 32) * 4; - int offset = (((file[i] & 0xff) << 16) | ((file[i + 1] & 0xff) << 8) | (file[i + 2] & 0xff)) * 4096; - if (offset == 0 && file[i + 3] == 0) { - continue; - } - int chunkLen = (((file[offset] & 0xff) << 24) | ((file[offset + 1] & 0xff) << 16) | ((file[offset + 2] & 0xff) << 8) | (file[offset + 3] & 0xff)); - if (chunkLen == 0) continue; - byte compression = file[offset + 4]; - byte[] data = new byte[chunkLen - 1]; - System.arraycopy(file, offset + 5, data, 0, chunkLen - 1); - if (compression == 0) { - OutputStream os = new VFile(levelDir, VFSChunkLoader.getChunkPath(gx * 32 + x, gz * 32 + z) + ".dat").getOutputStream(); - GZIPOutputStream gos = new GZIPOutputStream(os); - ByteArrayInputStream bais = new ByteArrayInputStream(data); - int len; - while ((len = bais.read(buffer)) > 0) { - gos.write(buffer, 0, len); - } - gos.close(); - os.close(); - bais.close(); - } else if (compression == 2) { - OutputStream os = new VFile(levelDir, VFSChunkLoader.getChunkPath(gx * 32 + x, gz * 32 + z) + ".dat").getOutputStream(); - GZIPOutputStream gos = new GZIPOutputStream(os); - InflaterInputStream iis = new InflaterInputStream(new ByteArrayInputStream(data)); - int len; - while ((len = iis.read(buffer)) > 0) { - gos.write(buffer, 0, len); - } - gos.close(); - os.close(); - iis.close(); - } else if (compression == 1) { - new VFile(levelDir, VFSChunkLoader.getChunkPath(gx * 32 + x, gz * 32 + z) + ".dat").setAllBytes(data); - } - } - } - } catch (Throwable e) { - e.printStackTrace(); - } - } + try { + byte[] buffer = new byte[16000]; + for (int x = 0; x < 32; ++x) { + for (int z = 0; z < 32; ++z) { + int i = ((x % 32) + (z % 32) * 32) * 4; + int offset = (((file[i] & 0xff) << 16) | ((file[i + 1] & 0xff) << 8) | (file[i + 2] & 0xff)) * 4096; + if (offset == 0 && file[i + 3] == 0) { + continue; + } + int chunkLen = (((file[offset] & 0xff) << 24) | ((file[offset + 1] & 0xff) << 16) + | ((file[offset + 2] & 0xff) << 8) | (file[offset + 3] & 0xff)); + if (chunkLen == 0) + continue; + byte compression = file[offset + 4]; + byte[] data = new byte[chunkLen - 1]; + System.arraycopy(file, offset + 5, data, 0, chunkLen - 1); + if (compression == 0) { + OutputStream os = new VFile(levelDir, + VFSChunkLoader.getChunkPath(gx * 32 + x, gz * 32 + z) + ".dat").getOutputStream(); + GZIPOutputStream gos = new GZIPOutputStream(os); + ByteArrayInputStream bais = new ByteArrayInputStream(data); + int len; + while ((len = bais.read(buffer)) > 0) { + gos.write(buffer, 0, len); + } + gos.close(); + os.close(); + bais.close(); + } else if (compression == 2) { + OutputStream os = new VFile(levelDir, + VFSChunkLoader.getChunkPath(gx * 32 + x, gz * 32 + z) + ".dat").getOutputStream(); + GZIPOutputStream gos = new GZIPOutputStream(os); + InflaterInputStream iis = new InflaterInputStream(new ByteArrayInputStream(data)); + int len; + while ((len = iis.read(buffer)) > 0) { + gos.write(buffer, 0, len); + } + gos.close(); + os.close(); + iis.close(); + } else if (compression == 1) { + new VFile(levelDir, VFSChunkLoader.getChunkPath(gx * 32 + x, gz * 32 + z) + ".dat") + .setAllBytes(data); + } + } + } + } catch (Throwable e) { + e.printStackTrace(); + } + } - public static Map convertToMCA(Map regions) { - Map regionsOut = new HashMap<>(); + public static Map convertToMCA(Map regions) { + Map regionsOut = new HashMap<>(); - if (regions.size() == 0) return regionsOut; + if (regions.size() == 0) + return regionsOut; - byte[] readBuffer = new byte[16000]; + byte[] readBuffer = new byte[16000]; - try { - int timestamp = (int) System.currentTimeMillis(); + try { + int timestamp = (int) System.currentTimeMillis(); - int maxX = Integer.MIN_VALUE; - int maxZ = Integer.MIN_VALUE; - int minX = Integer.MAX_VALUE; - int minZ = Integer.MAX_VALUE; + int maxX = Integer.MIN_VALUE; + int maxZ = Integer.MIN_VALUE; + int minX = Integer.MAX_VALUE; + int minZ = Integer.MAX_VALUE; - for (ChunkCoordIntPair coords : regions.keySet()) { - if (maxX < coords.chunkXPos) maxX = coords.chunkXPos; - if (maxZ < coords.chunkZPos) maxZ = coords.chunkZPos; - if (minX > coords.chunkXPos) minX = coords.chunkXPos; - if (minZ > coords.chunkZPos) minZ = coords.chunkZPos; - } + for (ChunkCoordIntPair coords : regions.keySet()) { + if (maxX < coords.chunkXPos) + maxX = coords.chunkXPos; + if (maxZ < coords.chunkZPos) + maxZ = coords.chunkZPos; + if (minX > coords.chunkXPos) + minX = coords.chunkXPos; + if (minZ > coords.chunkZPos) + minZ = coords.chunkZPos; + } - for (int z = minZ - (32 + (minZ % 32)); z <= maxZ + (32 + (maxZ % 32)); z += 32) { - for (int x = minX - (32 + (minX % 32)); x <= maxX + (32 + (maxX % 32)); x += 32) { - ByteArrayOutputStream offsets = new ByteArrayOutputStream(); - DataOutputStream offsetsDos = new DataOutputStream(offsets); - ByteArrayOutputStream timestamps = new ByteArrayOutputStream(); - DataOutputStream timestampsDos = new DataOutputStream(timestamps); - ByteArrayOutputStream chunks = new ByteArrayOutputStream(); - DataOutputStream chunksDos = new DataOutputStream(chunks); - boolean anyChunks = false; - for (int cz = 0; cz < 32; cz++) { - for (int cx = 0; cx < 32; cx++) { - int tx = x + cx; - int tz = z + cz; + for (int z = minZ - (32 + (minZ % 32)); z <= maxZ + (32 + (maxZ % 32)); z += 32) { + for (int x = minX - (32 + (minX % 32)); x <= maxX + (32 + (maxX % 32)); x += 32) { + ByteArrayOutputStream offsets = new ByteArrayOutputStream(); + DataOutputStream offsetsDos = new DataOutputStream(offsets); + ByteArrayOutputStream timestamps = new ByteArrayOutputStream(); + DataOutputStream timestampsDos = new DataOutputStream(timestamps); + ByteArrayOutputStream chunks = new ByteArrayOutputStream(); + DataOutputStream chunksDos = new DataOutputStream(chunks); + boolean anyChunks = false; + for (int cz = 0; cz < 32; cz++) { + for (int cx = 0; cx < 32; cx++) { + int tx = x + cx; + int tz = z + cz; - byte[] region = regions.get(new ChunkCoordIntPair(tx, tz)); - if (region == null) { - offsetsDos.writeInt(0); - timestampsDos.writeInt(0); - } else { - anyChunks = true; + byte[] region = regions.get(new ChunkCoordIntPair(tx, tz)); + if (region == null) { + offsetsDos.writeInt(0); + timestampsDos.writeInt(0); + } else { + anyChunks = true; - ByteArrayInputStream bais = new ByteArrayInputStream(region); - GZIPInputStream gis = new GZIPInputStream(bais); - ByteArrayOutputStream baos = new ByteArrayOutputStream(); - DeflaterOutputStream dos = new DeflaterOutputStream(baos); - int len; - while ((len = gis.read(readBuffer)) > 0) { - dos.write(readBuffer, 0, len); - } - dos.close(); - baos.close(); - bais.close(); - gis.close(); - byte[] zlibbed = baos.toByteArray(); + ByteArrayInputStream bais = new ByteArrayInputStream(region); + GZIPInputStream gis = new GZIPInputStream(bais); + ByteArrayOutputStream baos = new ByteArrayOutputStream(); + DeflaterOutputStream dos = new DeflaterOutputStream(baos); + int len; + while ((len = gis.read(readBuffer)) > 0) { + dos.write(readBuffer, 0, len); + } + dos.close(); + baos.close(); + bais.close(); + gis.close(); + byte[] zlibbed = baos.toByteArray(); - int offset = 2 + (chunksDos.size() / 4096); - offsetsDos.write((offset >> 16) & 0xff); - offsetsDos.write((offset >> 8) & 0xff); - offsetsDos.write(offset & 0xff); - offsetsDos.write((int) Math.ceil((5 + zlibbed.length) / 4096.0)); + int offset = 2 + (chunksDos.size() / 4096); + offsetsDos.write((offset >> 16) & 0xff); + offsetsDos.write((offset >> 8) & 0xff); + offsetsDos.write(offset & 0xff); + offsetsDos.write((int) Math.ceil((5 + zlibbed.length) / 4096.0)); - timestampsDos.writeInt(timestamp); + timestampsDos.writeInt(timestamp); - chunksDos.writeInt(region.length); - chunksDos.write(2); - chunksDos.write(zlibbed); + chunksDos.writeInt(region.length); + chunksDos.write(2); + chunksDos.write(zlibbed); - int chunksSizeOff = chunksDos.size() % 4096; - if (chunksSizeOff != 0) chunksDos.write(new byte[4096 - chunksSizeOff]); - } - } - } + int chunksSizeOff = chunksDos.size() % 4096; + if (chunksSizeOff != 0) + chunksDos.write(new byte[4096 - chunksSizeOff]); + } + } + } - offsetsDos.close(); - timestampsDos.close(); - chunksDos.close(); + offsetsDos.close(); + timestampsDos.close(); + chunksDos.close(); - if (!anyChunks) continue; + if (!anyChunks) + continue; - byte[] offsetsOut = offsets.toByteArray(); - byte[] timestampsOut = timestamps.toByteArray(); - byte[] chunksOut = chunks.toByteArray(); + byte[] offsetsOut = offsets.toByteArray(); + byte[] timestampsOut = timestamps.toByteArray(); + byte[] chunksOut = chunks.toByteArray(); - byte[] regionFile = new byte[offsetsOut.length + timestampsOut.length + chunksOut.length]; - System.arraycopy(offsetsOut, 0, regionFile, 0, offsetsOut.length); - System.arraycopy(timestampsOut, 0, regionFile, offsetsOut.length, timestampsOut.length); - System.arraycopy(chunksOut, 0, regionFile, offsetsOut.length + timestampsOut.length, chunksOut.length); - regionsOut.put("r." + (x / 32) + "." + (z / 32), regionFile); - } - } - } catch (IOException e) { - e.printStackTrace(); - } - return regionsOut; - } + byte[] regionFile = new byte[offsetsOut.length + timestampsOut.length + chunksOut.length]; + System.arraycopy(offsetsOut, 0, regionFile, 0, offsetsOut.length); + System.arraycopy(timestampsOut, 0, regionFile, offsetsOut.length, timestampsOut.length); + System.arraycopy(chunksOut, 0, regionFile, offsetsOut.length + timestampsOut.length, + chunksOut.length); + regionsOut.put("r." + (x / 32) + "." + (z / 32), regionFile); + } + } + } catch (IOException e) { + e.printStackTrace(); + } + return regionsOut; + } } diff --git a/sp-server/src/main/java/net/lax1dude/eaglercraft/sp/VirtualFilesystem.java b/sp-server/src/main/java/net/lax1dude/eaglercraft/sp/VirtualFilesystem.java index ff39d30..fe102ac 100644 --- a/sp-server/src/main/java/net/lax1dude/eaglercraft/sp/VirtualFilesystem.java +++ b/sp-server/src/main/java/net/lax1dude/eaglercraft/sp/VirtualFilesystem.java @@ -15,7 +15,6 @@ import org.teavm.interop.Async; import org.teavm.interop.AsyncCallback; import org.teavm.jso.JSBody; import org.teavm.jso.JSObject; -import org.teavm.jso.dom.events.Event; import org.teavm.jso.dom.events.EventListener; import org.teavm.jso.indexeddb.EventHandler; import org.teavm.jso.indexeddb.IDBCountRequest; diff --git a/sp-server/src/main/java/net/lax1dude/eaglercraft/sp/WorkerListenThread.java b/sp-server/src/main/java/net/lax1dude/eaglercraft/sp/WorkerListenThread.java index 7f4da52..d36a8cf 100644 --- a/sp-server/src/main/java/net/lax1dude/eaglercraft/sp/WorkerListenThread.java +++ b/sp-server/src/main/java/net/lax1dude/eaglercraft/sp/WorkerListenThread.java @@ -5,6 +5,7 @@ import java.util.HashMap; import java.util.HashSet; import java.util.Iterator; import java.util.List; + import net.minecraft.server.MinecraftServer; import net.minecraft.src.NetHandler; diff --git a/sp-server/src/main/java/net/lax1dude/eaglercraft/sp/ZipOutputStream.java b/sp-server/src/main/java/net/lax1dude/eaglercraft/sp/ZipOutputStream.java index 81ec9a2..3672b5f 100644 --- a/sp-server/src/main/java/net/lax1dude/eaglercraft/sp/ZipOutputStream.java +++ b/sp-server/src/main/java/net/lax1dude/eaglercraft/sp/ZipOutputStream.java @@ -1,7 +1,7 @@ package net.lax1dude.eaglercraft.sp; -import com.jcraft.jzlib.Deflater; -import com.jcraft.jzlib.DeflaterOutputStream; +import static java.util.zip.Deflater.BEST_COMPRESSION; +import static java.util.zip.Deflater.DEFAULT_COMPRESSION; import java.io.ByteArrayOutputStream; import java.io.IOException; @@ -11,320 +11,317 @@ import java.util.List; import java.util.zip.ZipEntry; import java.util.zip.ZipException; -import static java.util.zip.Deflater.BEST_COMPRESSION; -import static java.util.zip.Deflater.DEFAULT_COMPRESSION; +import com.jcraft.jzlib.Deflater; +import com.jcraft.jzlib.DeflaterOutputStream; public class ZipOutputStream extends DeflaterOutputStream { - long LOCSIG = 0x4034b50; - long EXTSIG = 0x8074b50; - long CENSIG = 0x2014b50; - long ENDSIG = 0x6054b50; + long LOCSIG = 0x4034b50; + long EXTSIG = 0x8074b50; + long CENSIG = 0x2014b50; + long ENDSIG = 0x6054b50; - int LOCHDR = 30; - int EXTHDR = 16; + int LOCHDR = 30; + int EXTHDR = 16; - public static final int DEFLATED = 8; - public static final int STORED = 0; + public static final int DEFLATED = 8; + public static final int STORED = 0; - static final int ZIPDataDescriptorFlag = 8; - static final int ZIPLocalHeaderVersionNeeded = 20; - private String comment; - private final List entries = new ArrayList<>(); - private int compressMethod = DEFLATED; - private int compressLevel = -1; - private ByteArrayOutputStream cDir = new ByteArrayOutputStream(); - private ZipEntry currentEntry; - private final CRC32 crc = new CRC32(); - private int offset; - private int curOffset; - private int nameLength; - private byte[] nameBytes; + static final int ZIPDataDescriptorFlag = 8; + static final int ZIPLocalHeaderVersionNeeded = 20; + private String comment; + private final List entries = new ArrayList<>(); + private int compressMethod = DEFLATED; + private int compressLevel = -1; + private ByteArrayOutputStream cDir = new ByteArrayOutputStream(); + private ZipEntry currentEntry; + private final CRC32 crc = new CRC32(); + private int offset; + private int curOffset; + private int nameLength; + private byte[] nameBytes; - public ZipOutputStream(OutputStream p1) throws IOException { - super(p1, new Deflater(-1, true)); - } + public ZipOutputStream(OutputStream p1) throws IOException { + super(p1, new Deflater(-1, true)); + } - @Override - public void close() throws IOException { - if (out != null) { - finish(); - out.close(); - out = null; - } - } + @Override + public void close() throws IOException { + if (out != null) { + finish(); + out.close(); + out = null; + } + } - public void closeEntry() throws IOException { - if (cDir == null) { - throw new IOException(); - } - if (currentEntry == null) { - return; - } - if (currentEntry.getMethod() == DEFLATED) { - super.finish(); - } + public void closeEntry() throws IOException { + if (cDir == null) { + throw new IOException(); + } + if (currentEntry == null) { + return; + } + if (currentEntry.getMethod() == DEFLATED) { + super.finish(); + } - // Verify values for STORED types - if (currentEntry.getMethod() == STORED) { - if (crc.getValue() != currentEntry.getCrc()) { - throw new ZipException(); - } - if (currentEntry.getSize() != crc.tbytes) { - throw new ZipException(); - } - } - curOffset = LOCHDR; + // Verify values for STORED types + if (currentEntry.getMethod() == STORED) { + if (crc.getValue() != currentEntry.getCrc()) { + throw new ZipException(); + } + if (currentEntry.getSize() != crc.tbytes) { + throw new ZipException(); + } + } + curOffset = LOCHDR; - // Write the DataDescriptor - if (currentEntry.getMethod() != STORED) { - curOffset += EXTHDR; - writeLong(out, EXTSIG); - currentEntry.setCrc(crc.getValue()); - writeLong(out, currentEntry.getCrc()); - currentEntry.setCompressedSize(deflater.getTotalOut()); - writeLong(out, currentEntry.getCompressedSize()); - currentEntry.setSize(deflater.getTotalIn()); - writeLong(out, currentEntry.getSize()); - } - // Update the CentralDirectory - writeLong(cDir, CENSIG); - writeShort(cDir, ZIPLocalHeaderVersionNeeded); // Version created - writeShort(cDir, ZIPLocalHeaderVersionNeeded); // Version to extract - writeShort(cDir, currentEntry.getMethod() == STORED ? 0 : ZIPDataDescriptorFlag); - writeShort(cDir, currentEntry.getMethod()); - writeShort(cDir, (int) currentEntry.getTime()); - writeShort(cDir, 0); - writeLong(cDir, crc.getValue()); - if (currentEntry.getMethod() == DEFLATED) { - curOffset += writeLong(cDir, deflater.getTotalOut()); - writeLong(cDir, deflater.getTotalIn()); - } else { - curOffset += writeLong(cDir, crc.tbytes); - writeLong(cDir, crc.tbytes); - } - curOffset += writeShort(cDir, nameLength); - if (currentEntry.getExtra() != null) { - curOffset += writeShort(cDir, currentEntry.getExtra().length); - } else { - writeShort(cDir, 0); - } - String c = currentEntry.getComment(); - writeShort(cDir, c != null ? c.length() : 0); - writeShort(cDir, 0); // Disk Start - writeShort(cDir, 0); // Internal File Attributes - writeLong(cDir, 0); // External File Attributes - writeLong(cDir, offset); - cDir.write(nameBytes); - nameBytes = null; - if (currentEntry.getExtra() != null) { - cDir.write(currentEntry.getExtra()); - } - offset += curOffset; - if (c != null) { - cDir.write(c.getBytes()); - } - currentEntry = null; - crc.reset(); - deflater.end(); - deflater.init(-1, true); - } + // Write the DataDescriptor + if (currentEntry.getMethod() != STORED) { + curOffset += EXTHDR; + writeLong(out, EXTSIG); + currentEntry.setCrc(crc.getValue()); + writeLong(out, currentEntry.getCrc()); + currentEntry.setCompressedSize(deflater.getTotalOut()); + writeLong(out, currentEntry.getCompressedSize()); + currentEntry.setSize(deflater.getTotalIn()); + writeLong(out, currentEntry.getSize()); + } + // Update the CentralDirectory + writeLong(cDir, CENSIG); + writeShort(cDir, ZIPLocalHeaderVersionNeeded); // Version created + writeShort(cDir, ZIPLocalHeaderVersionNeeded); // Version to extract + writeShort(cDir, currentEntry.getMethod() == STORED ? 0 : ZIPDataDescriptorFlag); + writeShort(cDir, currentEntry.getMethod()); + writeShort(cDir, (int) currentEntry.getTime()); + writeShort(cDir, 0); + writeLong(cDir, crc.getValue()); + if (currentEntry.getMethod() == DEFLATED) { + curOffset += writeLong(cDir, deflater.getTotalOut()); + writeLong(cDir, deflater.getTotalIn()); + } else { + curOffset += writeLong(cDir, crc.tbytes); + writeLong(cDir, crc.tbytes); + } + curOffset += writeShort(cDir, nameLength); + if (currentEntry.getExtra() != null) { + curOffset += writeShort(cDir, currentEntry.getExtra().length); + } else { + writeShort(cDir, 0); + } + String c = currentEntry.getComment(); + writeShort(cDir, c != null ? c.length() : 0); + writeShort(cDir, 0); // Disk Start + writeShort(cDir, 0); // Internal File Attributes + writeLong(cDir, 0); // External File Attributes + writeLong(cDir, offset); + cDir.write(nameBytes); + nameBytes = null; + if (currentEntry.getExtra() != null) { + cDir.write(currentEntry.getExtra()); + } + offset += curOffset; + if (c != null) { + cDir.write(c.getBytes()); + } + currentEntry = null; + crc.reset(); + deflater.end(); + deflater.init(-1, true); + } - @Override - public void finish() throws IOException { - if (out == null) { - throw new IOException(); - } - if (cDir == null) { - return; - } - if (entries.size() == 0) { - throw new ZipException(); - } - if (currentEntry != null) { - closeEntry(); - } - int cdirSize = cDir.size(); - // Write Central Dir End - writeLong(cDir, ENDSIG); - writeShort(cDir, 0); // Disk Number - writeShort(cDir, 0); // Start Disk - writeShort(cDir, entries.size()); // Number of entries - writeShort(cDir, entries.size()); // Number of entries - writeLong(cDir, cdirSize); // Size of central dir - writeLong(cDir, offset); // Offset of central dir - if (comment != null) { - writeShort(cDir, comment.length()); - cDir.write(comment.getBytes()); - } else { - writeShort(cDir, 0); - } - // Write the central dir - out.write(cDir.toByteArray()); - cDir = null; + @Override + public void finish() throws IOException { + if (out == null) { + throw new IOException(); + } + if (cDir == null) { + return; + } + if (entries.size() == 0) { + throw new ZipException(); + } + if (currentEntry != null) { + closeEntry(); + } + int cdirSize = cDir.size(); + // Write Central Dir End + writeLong(cDir, ENDSIG); + writeShort(cDir, 0); // Disk Number + writeShort(cDir, 0); // Start Disk + writeShort(cDir, entries.size()); // Number of entries + writeShort(cDir, entries.size()); // Number of entries + writeLong(cDir, cdirSize); // Size of central dir + writeLong(cDir, offset); // Offset of central dir + if (comment != null) { + writeShort(cDir, comment.length()); + cDir.write(comment.getBytes()); + } else { + writeShort(cDir, 0); + } + // Write the central dir + out.write(cDir.toByteArray()); + cDir = null; - } + } - public void putNextEntry(ZipEntry ze) throws IOException { - if (currentEntry != null) { - closeEntry(); - } - if (ze.getMethod() == STORED - || (compressMethod == STORED && ze.getMethod() == -1)) { - if (ze.getCrc() == -1) { - throw new ZipException("Crc mismatch"); - } - if (ze.getSize() == -1 && ze.getCompressedSize() == -1) { - throw new ZipException("Size mismatch"); - } - if (ze.getSize() != ze.getCompressedSize() && ze.getCompressedSize() != -1 && ze.getSize() != -1) { - throw new ZipException("Size mismatch"); - } - } - if (cDir == null) { - throw new IOException("Stream is closed"); - } - if (entries.contains(ze.getName())) { - throw new ZipException("Entry already exists: " + ze.getName()); - } - nameLength = utf8Count(ze.getName()); - if (nameLength > 0xffff) { - throw new IllegalArgumentException("Name too long: " + ze.getName()); - } + public void putNextEntry(ZipEntry ze) throws IOException { + if (currentEntry != null) { + closeEntry(); + } + if (ze.getMethod() == STORED || (compressMethod == STORED && ze.getMethod() == -1)) { + if (ze.getCrc() == -1) { + throw new ZipException("Crc mismatch"); + } + if (ze.getSize() == -1 && ze.getCompressedSize() == -1) { + throw new ZipException("Size mismatch"); + } + if (ze.getSize() != ze.getCompressedSize() && ze.getCompressedSize() != -1 && ze.getSize() != -1) { + throw new ZipException("Size mismatch"); + } + } + if (cDir == null) { + throw new IOException("Stream is closed"); + } + if (entries.contains(ze.getName())) { + throw new ZipException("Entry already exists: " + ze.getName()); + } + nameLength = utf8Count(ze.getName()); + if (nameLength > 0xffff) { + throw new IllegalArgumentException("Name too long: " + ze.getName()); + } - deflater.params(compressLevel, 0); - currentEntry = ze; - entries.add(currentEntry.getName()); - if (currentEntry.getMethod() == -1) { - currentEntry.setMethod(compressMethod); - } - writeLong(out, LOCSIG); // Entry header - writeShort(out, ZIPLocalHeaderVersionNeeded); // Extraction version - writeShort(out, currentEntry.getMethod() == STORED ? 0 : ZIPDataDescriptorFlag); - writeShort(out, currentEntry.getMethod()); - if (currentEntry.getTime() == -1) { - currentEntry.setTime(System.currentTimeMillis()); - } - writeShort(out, (int) currentEntry.getTime()); - writeShort(out, 0); + deflater.params(compressLevel, 0); + currentEntry = ze; + entries.add(currentEntry.getName()); + if (currentEntry.getMethod() == -1) { + currentEntry.setMethod(compressMethod); + } + writeLong(out, LOCSIG); // Entry header + writeShort(out, ZIPLocalHeaderVersionNeeded); // Extraction version + writeShort(out, currentEntry.getMethod() == STORED ? 0 : ZIPDataDescriptorFlag); + writeShort(out, currentEntry.getMethod()); + if (currentEntry.getTime() == -1) { + currentEntry.setTime(System.currentTimeMillis()); + } + writeShort(out, (int) currentEntry.getTime()); + writeShort(out, 0); - if (currentEntry.getMethod() == STORED) { - if (currentEntry.getSize() == -1) { - currentEntry.setSize(currentEntry.getCompressedSize()); - } else if (currentEntry.getCompressedSize() == -1) { - currentEntry.setCompressedSize(currentEntry.getSize()); - } - writeLong(out, currentEntry.getCrc()); - writeLong(out, currentEntry.getSize()); - writeLong(out, currentEntry.getSize()); - } else { - writeLong(out, 0); - writeLong(out, 0); - writeLong(out, 0); - } - writeShort(out, nameLength); - writeShort(out, currentEntry.getExtra() != null ? currentEntry.getExtra().length : 0); - nameBytes = toUTF8Bytes(currentEntry.getName(), nameLength); - out.write(nameBytes); - if (currentEntry.getExtra() != null) { - out.write(currentEntry.getExtra()); - } - } + if (currentEntry.getMethod() == STORED) { + if (currentEntry.getSize() == -1) { + currentEntry.setSize(currentEntry.getCompressedSize()); + } else if (currentEntry.getCompressedSize() == -1) { + currentEntry.setCompressedSize(currentEntry.getSize()); + } + writeLong(out, currentEntry.getCrc()); + writeLong(out, currentEntry.getSize()); + writeLong(out, currentEntry.getSize()); + } else { + writeLong(out, 0); + writeLong(out, 0); + writeLong(out, 0); + } + writeShort(out, nameLength); + writeShort(out, currentEntry.getExtra() != null ? currentEntry.getExtra().length : 0); + nameBytes = toUTF8Bytes(currentEntry.getName(), nameLength); + out.write(nameBytes); + if (currentEntry.getExtra() != null) { + out.write(currentEntry.getExtra()); + } + } - public void setComment(String comment) { - if (comment.length() > 0xFFFF) { - throw new IllegalArgumentException(); - } - this.comment = comment; - } + public void setComment(String comment) { + if (comment.length() > 0xFFFF) { + throw new IllegalArgumentException(); + } + this.comment = comment; + } - public void setLevel(int level) { - if (level < DEFAULT_COMPRESSION || level > BEST_COMPRESSION) { - throw new IllegalArgumentException(); - } - compressLevel = level; - } + public void setLevel(int level) { + if (level < DEFAULT_COMPRESSION || level > BEST_COMPRESSION) { + throw new IllegalArgumentException(); + } + compressLevel = level; + } - public void setMethod(int method) { - if (method != STORED && method != DEFLATED) { - throw new IllegalArgumentException(); - } - compressMethod = method; + public void setMethod(int method) { + if (method != STORED && method != DEFLATED) { + throw new IllegalArgumentException(); + } + compressMethod = method; - } + } - private long writeLong(OutputStream os, long i) throws IOException { - // Write out the long value as an unsigned int - os.write((int) (i & 0xFF)); - os.write((int) (i >> 8) & 0xFF); - os.write((int) (i >> 16) & 0xFF); - os.write((int) (i >> 24) & 0xFF); - return i; - } + private long writeLong(OutputStream os, long i) throws IOException { + // Write out the long value as an unsigned int + os.write((int) (i & 0xFF)); + os.write((int) (i >> 8) & 0xFF); + os.write((int) (i >> 16) & 0xFF); + os.write((int) (i >> 24) & 0xFF); + return i; + } - private int writeShort(OutputStream os, int i) throws IOException { - os.write(i & 0xFF); - os.write((i >> 8) & 0xFF); - return i; + private int writeShort(OutputStream os, int i) throws IOException { + os.write(i & 0xFF); + os.write((i >> 8) & 0xFF); + return i; - } + } - /** - * Writes data for the current entry to the underlying stream. - * - * @exception IOException - * If an error occurs writing to the stream - */ - @Override - public void write(byte[] buffer, int off, int nbytes) - throws IOException { - // avoid int overflow, check null buf - if ((off < 0 || (nbytes < 0) || off > buffer.length) || (buffer.length - off < nbytes)) { - throw new IndexOutOfBoundsException(); - } + /** + * Writes data for the current entry to the underlying stream. + * + * @exception IOException If an error occurs writing to the stream + */ + @Override + public void write(byte[] buffer, int off, int nbytes) throws IOException { + // avoid int overflow, check null buf + if ((off < 0 || (nbytes < 0) || off > buffer.length) || (buffer.length - off < nbytes)) { + throw new IndexOutOfBoundsException(); + } - if (currentEntry == null) { - throw new ZipException("No active entry"); - } + if (currentEntry == null) { + throw new ZipException("No active entry"); + } - if (currentEntry.getMethod() == STORED) { - out.write(buffer, off, nbytes); - } else { - super.write(buffer, off, nbytes); - } - crc.update(buffer, off, nbytes); - } + if (currentEntry.getMethod() == STORED) { + out.write(buffer, off, nbytes); + } else { + super.write(buffer, off, nbytes); + } + crc.update(buffer, off, nbytes); + } - static int utf8Count(String value) { - int total = 0; - for (int i = value.length(); --i >= 0;) { - char ch = value.charAt(i); - if (ch < 0x80) { - total++; - } else if (ch < 0x800) { - total += 2; - } else { - total += 3; - } - } - return total; - } + static int utf8Count(String value) { + int total = 0; + for (int i = value.length(); --i >= 0;) { + char ch = value.charAt(i); + if (ch < 0x80) { + total++; + } else if (ch < 0x800) { + total += 2; + } else { + total += 3; + } + } + return total; + } - static byte[] toUTF8Bytes(String value, int length) { - byte[] result = new byte[length]; - int pos = result.length; - for (int i = value.length(); --i >= 0;) { - char ch = value.charAt(i); - if (ch < 0x80) { - result[--pos] = (byte) ch; - } else if (ch < 0x800) { - result[--pos] = (byte) (0x80 | (ch & 0x3f)); - result[--pos] = (byte) (0xc0 | (ch >> 6)); - } else { - result[--pos] = (byte) (0x80 | (ch & 0x3f)); - result[--pos] = (byte) (0x80 | ((ch >> 6) & 0x3f)); - result[--pos] = (byte) (0xe0 | (ch >> 12)); - } - } - return result; - } + static byte[] toUTF8Bytes(String value, int length) { + byte[] result = new byte[length]; + int pos = result.length; + for (int i = value.length(); --i >= 0;) { + char ch = value.charAt(i); + if (ch < 0x80) { + result[--pos] = (byte) ch; + } else if (ch < 0x800) { + result[--pos] = (byte) (0x80 | (ch & 0x3f)); + result[--pos] = (byte) (0xc0 | (ch >> 6)); + } else { + result[--pos] = (byte) (0x80 | (ch & 0x3f)); + result[--pos] = (byte) (0x80 | ((ch >> 6) & 0x3f)); + result[--pos] = (byte) (0xe0 | (ch >> 12)); + } + } + return result; + } } diff --git a/sp-server/src/main/java/net/minecraft/server/MinecraftServer.java b/sp-server/src/main/java/net/minecraft/server/MinecraftServer.java index 4573b9b..0d63416 100644 --- a/sp-server/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/sp-server/src/main/java/net/minecraft/server/MinecraftServer.java @@ -8,9 +8,9 @@ import java.util.List; import net.lax1dude.eaglercraft.sp.IntegratedServer; import net.lax1dude.eaglercraft.sp.SYS; -import net.lax1dude.eaglercraft.sp.WorkerListenThread; import net.lax1dude.eaglercraft.sp.VFSSaveHandler; import net.lax1dude.eaglercraft.sp.VFile; +import net.lax1dude.eaglercraft.sp.WorkerListenThread; import net.lax1dude.eaglercraft.sp.ipc.IPCPacket0DProgressUpdate; import net.lax1dude.eaglercraft.sp.ipc.IPCPacket14StringList; import net.minecraft.src.AxisAlignedBB; @@ -24,7 +24,6 @@ import net.minecraft.src.ICommandManager; import net.minecraft.src.ICommandSender; import net.minecraft.src.ILogAgent; import net.minecraft.src.IProgressUpdate; -import net.minecraft.src.ISaveFormat; import net.minecraft.src.ISaveHandler; import net.minecraft.src.IUpdatePlayerListBox; import net.minecraft.src.MinecraftException; diff --git a/sp-server/src/main/java/net/minecraft/src/BlockBed.java b/sp-server/src/main/java/net/minecraft/src/BlockBed.java index de54b12..eec28a9 100644 --- a/sp-server/src/main/java/net/minecraft/src/BlockBed.java +++ b/sp-server/src/main/java/net/minecraft/src/BlockBed.java @@ -1,7 +1,6 @@ package net.minecraft.src; import java.util.Iterator; -import java.util.Random; import net.lax1dude.eaglercraft.sp.EaglercraftRandom; diff --git a/sp-server/src/main/java/net/minecraft/src/CommandBase.java b/sp-server/src/main/java/net/minecraft/src/CommandBase.java index 84a46e2..25a77c2 100644 --- a/sp-server/src/main/java/net/minecraft/src/CommandBase.java +++ b/sp-server/src/main/java/net/minecraft/src/CommandBase.java @@ -4,6 +4,7 @@ import java.util.ArrayList; import java.util.Collection; import java.util.Iterator; import java.util.List; + import net.minecraft.server.MinecraftServer; public abstract class CommandBase implements ICommand { diff --git a/sp-server/src/main/java/net/minecraft/src/CommandClearInventory.java b/sp-server/src/main/java/net/minecraft/src/CommandClearInventory.java index a7aa13c..cee247a 100644 --- a/sp-server/src/main/java/net/minecraft/src/CommandClearInventory.java +++ b/sp-server/src/main/java/net/minecraft/src/CommandClearInventory.java @@ -1,6 +1,7 @@ package net.minecraft.src; import java.util.List; + import net.minecraft.server.MinecraftServer; public class CommandClearInventory extends CommandBase { diff --git a/sp-server/src/main/java/net/minecraft/src/CommandDebug.java b/sp-server/src/main/java/net/minecraft/src/CommandDebug.java index 72ab886..7a81550 100644 --- a/sp-server/src/main/java/net/minecraft/src/CommandDebug.java +++ b/sp-server/src/main/java/net/minecraft/src/CommandDebug.java @@ -1,10 +1,7 @@ package net.minecraft.src; -import java.io.File; -import java.io.FileWriter; -import java.text.SimpleDateFormat; -import java.util.Date; import java.util.List; + import net.minecraft.server.MinecraftServer; public class CommandDebug extends CommandBase { diff --git a/sp-server/src/main/java/net/minecraft/src/CommandDifficulty.java b/sp-server/src/main/java/net/minecraft/src/CommandDifficulty.java index 7409b01..44501a3 100644 --- a/sp-server/src/main/java/net/minecraft/src/CommandDifficulty.java +++ b/sp-server/src/main/java/net/minecraft/src/CommandDifficulty.java @@ -1,6 +1,7 @@ package net.minecraft.src; import java.util.List; + import net.minecraft.server.MinecraftServer; public class CommandDifficulty extends CommandBase { diff --git a/sp-server/src/main/java/net/minecraft/src/CommandEffect.java b/sp-server/src/main/java/net/minecraft/src/CommandEffect.java index 184dbc1..2edf601 100644 --- a/sp-server/src/main/java/net/minecraft/src/CommandEffect.java +++ b/sp-server/src/main/java/net/minecraft/src/CommandEffect.java @@ -1,6 +1,7 @@ package net.minecraft.src; import java.util.List; + import net.minecraft.server.MinecraftServer; public class CommandEffect extends CommandBase { diff --git a/sp-server/src/main/java/net/minecraft/src/CommandEnchant.java b/sp-server/src/main/java/net/minecraft/src/CommandEnchant.java index 2127a37..f4dc016 100644 --- a/sp-server/src/main/java/net/minecraft/src/CommandEnchant.java +++ b/sp-server/src/main/java/net/minecraft/src/CommandEnchant.java @@ -1,6 +1,7 @@ package net.minecraft.src; import java.util.List; + import net.minecraft.server.MinecraftServer; public class CommandEnchant extends CommandBase { diff --git a/sp-server/src/main/java/net/minecraft/src/CommandGameMode.java b/sp-server/src/main/java/net/minecraft/src/CommandGameMode.java index 31b8d7b..c6a6a6d 100644 --- a/sp-server/src/main/java/net/minecraft/src/CommandGameMode.java +++ b/sp-server/src/main/java/net/minecraft/src/CommandGameMode.java @@ -1,6 +1,7 @@ package net.minecraft.src; import java.util.List; + import net.minecraft.server.MinecraftServer; public class CommandGameMode extends CommandBase { diff --git a/sp-server/src/main/java/net/minecraft/src/CommandGameRule.java b/sp-server/src/main/java/net/minecraft/src/CommandGameRule.java index 9aa4511..36cece6 100644 --- a/sp-server/src/main/java/net/minecraft/src/CommandGameRule.java +++ b/sp-server/src/main/java/net/minecraft/src/CommandGameRule.java @@ -1,6 +1,7 @@ package net.minecraft.src; import java.util.List; + import net.minecraft.server.MinecraftServer; public class CommandGameRule extends CommandBase { diff --git a/sp-server/src/main/java/net/minecraft/src/CommandGive.java b/sp-server/src/main/java/net/minecraft/src/CommandGive.java index 48aa876..4da55ca 100644 --- a/sp-server/src/main/java/net/minecraft/src/CommandGive.java +++ b/sp-server/src/main/java/net/minecraft/src/CommandGive.java @@ -1,6 +1,7 @@ package net.minecraft.src; import java.util.List; + import net.minecraft.server.MinecraftServer; public class CommandGive extends CommandBase { diff --git a/sp-server/src/main/java/net/minecraft/src/CommandHandler.java b/sp-server/src/main/java/net/minecraft/src/CommandHandler.java index df7ce0e..38ea583 100644 --- a/sp-server/src/main/java/net/minecraft/src/CommandHandler.java +++ b/sp-server/src/main/java/net/minecraft/src/CommandHandler.java @@ -6,8 +6,8 @@ import java.util.HashSet; import java.util.Iterator; import java.util.List; import java.util.Map; -import java.util.Set; import java.util.Map.Entry; +import java.util.Set; public class CommandHandler implements ICommandManager { /** Map of Strings to the ICommand objects they represent */ diff --git a/sp-server/src/main/java/net/minecraft/src/CommandHelp.java b/sp-server/src/main/java/net/minecraft/src/CommandHelp.java index fa2b5ce..898193f 100644 --- a/sp-server/src/main/java/net/minecraft/src/CommandHelp.java +++ b/sp-server/src/main/java/net/minecraft/src/CommandHelp.java @@ -4,6 +4,7 @@ import java.util.Arrays; import java.util.Collections; import java.util.List; import java.util.Map; + import net.minecraft.server.MinecraftServer; public class CommandHelp extends CommandBase { diff --git a/sp-server/src/main/java/net/minecraft/src/CommandServerEmote.java b/sp-server/src/main/java/net/minecraft/src/CommandServerEmote.java index 87c278e..5ae8502 100644 --- a/sp-server/src/main/java/net/minecraft/src/CommandServerEmote.java +++ b/sp-server/src/main/java/net/minecraft/src/CommandServerEmote.java @@ -1,6 +1,7 @@ package net.minecraft.src; import java.util.List; + import net.minecraft.server.MinecraftServer; public class CommandServerEmote extends CommandBase { diff --git a/sp-server/src/main/java/net/minecraft/src/CommandServerMessage.java b/sp-server/src/main/java/net/minecraft/src/CommandServerMessage.java index 9281430..35c18e2 100644 --- a/sp-server/src/main/java/net/minecraft/src/CommandServerMessage.java +++ b/sp-server/src/main/java/net/minecraft/src/CommandServerMessage.java @@ -2,6 +2,7 @@ package net.minecraft.src; import java.util.Arrays; import java.util.List; + import net.minecraft.server.MinecraftServer; public class CommandServerMessage extends CommandBase { diff --git a/sp-server/src/main/java/net/minecraft/src/CommandServerSay.java b/sp-server/src/main/java/net/minecraft/src/CommandServerSay.java index eadd154..7351f02 100644 --- a/sp-server/src/main/java/net/minecraft/src/CommandServerSay.java +++ b/sp-server/src/main/java/net/minecraft/src/CommandServerSay.java @@ -1,6 +1,7 @@ package net.minecraft.src; import java.util.List; + import net.minecraft.server.MinecraftServer; public class CommandServerSay extends CommandBase { diff --git a/sp-server/src/main/java/net/minecraft/src/CommandServerTp.java b/sp-server/src/main/java/net/minecraft/src/CommandServerTp.java index 757f22f..ad17194 100644 --- a/sp-server/src/main/java/net/minecraft/src/CommandServerTp.java +++ b/sp-server/src/main/java/net/minecraft/src/CommandServerTp.java @@ -1,6 +1,7 @@ package net.minecraft.src; import java.util.List; + import net.minecraft.server.MinecraftServer; public class CommandServerTp extends CommandBase { diff --git a/sp-server/src/main/java/net/minecraft/src/CommandSetSpawnpoint.java b/sp-server/src/main/java/net/minecraft/src/CommandSetSpawnpoint.java index 6f762df..89ba9fd 100644 --- a/sp-server/src/main/java/net/minecraft/src/CommandSetSpawnpoint.java +++ b/sp-server/src/main/java/net/minecraft/src/CommandSetSpawnpoint.java @@ -1,6 +1,7 @@ package net.minecraft.src; import java.util.List; + import net.minecraft.server.MinecraftServer; public class CommandSetSpawnpoint extends CommandBase { diff --git a/sp-server/src/main/java/net/minecraft/src/CommandTime.java b/sp-server/src/main/java/net/minecraft/src/CommandTime.java index c90cd2d..995555e 100644 --- a/sp-server/src/main/java/net/minecraft/src/CommandTime.java +++ b/sp-server/src/main/java/net/minecraft/src/CommandTime.java @@ -1,6 +1,7 @@ package net.minecraft.src; import java.util.List; + import net.minecraft.server.MinecraftServer; public class CommandTime extends CommandBase { diff --git a/sp-server/src/main/java/net/minecraft/src/CommandXP.java b/sp-server/src/main/java/net/minecraft/src/CommandXP.java index 01979db..a1bdf89 100644 --- a/sp-server/src/main/java/net/minecraft/src/CommandXP.java +++ b/sp-server/src/main/java/net/minecraft/src/CommandXP.java @@ -1,6 +1,7 @@ package net.minecraft.src; import java.util.List; + import net.minecraft.server.MinecraftServer; public class CommandXP extends CommandBase { diff --git a/sp-server/src/main/java/net/minecraft/src/CompressedStreamTools.java b/sp-server/src/main/java/net/minecraft/src/CompressedStreamTools.java index 218cc33..b7dbe58 100644 --- a/sp-server/src/main/java/net/minecraft/src/CompressedStreamTools.java +++ b/sp-server/src/main/java/net/minecraft/src/CompressedStreamTools.java @@ -10,7 +10,6 @@ import java.io.DataOutputStream; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; -import java.util.Collection; import com.jcraft.jzlib.Deflater; import com.jcraft.jzlib.GZIPInputStream; diff --git a/sp-server/src/main/java/net/minecraft/src/DataWatcher.java b/sp-server/src/main/java/net/minecraft/src/DataWatcher.java index ca2d22c..ed82d00 100644 --- a/sp-server/src/main/java/net/minecraft/src/DataWatcher.java +++ b/sp-server/src/main/java/net/minecraft/src/DataWatcher.java @@ -8,8 +8,6 @@ import java.util.HashMap; import java.util.Iterator; import java.util.List; import java.util.Map; -import java.util.concurrent.locks.ReadWriteLock; -import java.util.concurrent.locks.ReentrantReadWriteLock; public class DataWatcher { /** When isBlank is true the DataWatcher is not watching any objects */ diff --git a/sp-server/src/main/java/net/minecraft/src/EntityMinecart.java b/sp-server/src/main/java/net/minecraft/src/EntityMinecart.java index 2e1889b..6128e20 100644 --- a/sp-server/src/main/java/net/minecraft/src/EntityMinecart.java +++ b/sp-server/src/main/java/net/minecraft/src/EntityMinecart.java @@ -1,6 +1,7 @@ package net.minecraft.src; import java.util.List; + import net.minecraft.server.MinecraftServer; public abstract class EntityMinecart extends Entity { diff --git a/sp-server/src/main/java/net/minecraft/src/EntityPlayerMP.java b/sp-server/src/main/java/net/minecraft/src/EntityPlayerMP.java index 0feb9c7..8bb0a9f 100644 --- a/sp-server/src/main/java/net/minecraft/src/EntityPlayerMP.java +++ b/sp-server/src/main/java/net/minecraft/src/EntityPlayerMP.java @@ -9,6 +9,7 @@ import java.util.Collection; import java.util.Iterator; import java.util.LinkedList; import java.util.List; + import net.minecraft.server.MinecraftServer; public class EntityPlayerMP extends EntityPlayer implements ICrafting { diff --git a/sp-server/src/main/java/net/minecraft/src/LowerStringMap.java b/sp-server/src/main/java/net/minecraft/src/LowerStringMap.java index 420c390..787bdeb 100644 --- a/sp-server/src/main/java/net/minecraft/src/LowerStringMap.java +++ b/sp-server/src/main/java/net/minecraft/src/LowerStringMap.java @@ -5,7 +5,6 @@ import java.util.Iterator; import java.util.LinkedHashMap; import java.util.Map; import java.util.Set; -import java.util.Map.Entry; public class LowerStringMap implements Map { private final Map internalMap = new LinkedHashMap(); diff --git a/sp-server/src/main/java/net/minecraft/src/Packet51MapChunk.java b/sp-server/src/main/java/net/minecraft/src/Packet51MapChunk.java index 9d9372d..ed86b65 100644 --- a/sp-server/src/main/java/net/minecraft/src/Packet51MapChunk.java +++ b/sp-server/src/main/java/net/minecraft/src/Packet51MapChunk.java @@ -3,9 +3,6 @@ package net.minecraft.src; import java.io.DataInputStream; import java.io.DataOutputStream; import java.io.IOException; -import java.util.zip.DataFormatException; -import java.util.zip.Deflater; -import java.util.zip.Inflater; public class Packet51MapChunk extends Packet { /** The x-position of the transmitted chunk, in chunk coordinates. */ diff --git a/sp-server/src/main/java/net/minecraft/src/PlayerListBox.java b/sp-server/src/main/java/net/minecraft/src/PlayerListBox.java index 29bc118..39c8979 100644 --- a/sp-server/src/main/java/net/minecraft/src/PlayerListBox.java +++ b/sp-server/src/main/java/net/minecraft/src/PlayerListBox.java @@ -1,7 +1,9 @@ package net.minecraft.src; import java.util.Vector; + import javax.swing.JList; + import net.minecraft.server.MinecraftServer; public class PlayerListBox extends JList implements IUpdatePlayerListBox { diff --git a/sp-server/src/main/java/net/minecraft/src/PlayerManager.java b/sp-server/src/main/java/net/minecraft/src/PlayerManager.java index fd1520c..bce7fd2 100644 --- a/sp-server/src/main/java/net/minecraft/src/PlayerManager.java +++ b/sp-server/src/main/java/net/minecraft/src/PlayerManager.java @@ -2,7 +2,6 @@ package net.minecraft.src; import java.util.ArrayList; import java.util.List; -import java.util.UnknownFormatConversionException; public class PlayerManager { private final WorldServer theWorldServer; diff --git a/sp-server/src/main/java/net/minecraft/src/PlayerSelector.java b/sp-server/src/main/java/net/minecraft/src/PlayerSelector.java index 82f9c68..147f84e 100644 --- a/sp-server/src/main/java/net/minecraft/src/PlayerSelector.java +++ b/sp-server/src/main/java/net/minecraft/src/PlayerSelector.java @@ -7,6 +7,7 @@ import java.util.List; import java.util.Map; import java.util.regex.Matcher; import java.util.regex.Pattern; + import net.minecraft.server.MinecraftServer; public class PlayerSelector { diff --git a/sp-server/src/main/java/net/minecraft/src/ScoreboardSaveData.java b/sp-server/src/main/java/net/minecraft/src/ScoreboardSaveData.java index caba922..23ab38e 100644 --- a/sp-server/src/main/java/net/minecraft/src/ScoreboardSaveData.java +++ b/sp-server/src/main/java/net/minecraft/src/ScoreboardSaveData.java @@ -2,6 +2,7 @@ package net.minecraft.src; import java.util.Collection; import java.util.Iterator; + import net.minecraft.server.MinecraftServer; public class ScoreboardSaveData extends WorldSavedData { diff --git a/sp-server/src/main/java/net/minecraft/src/ServerCommandManager.java b/sp-server/src/main/java/net/minecraft/src/ServerCommandManager.java index 3c1a121..1239a05 100644 --- a/sp-server/src/main/java/net/minecraft/src/ServerCommandManager.java +++ b/sp-server/src/main/java/net/minecraft/src/ServerCommandManager.java @@ -1,6 +1,7 @@ package net.minecraft.src; import java.util.Iterator; + import net.minecraft.server.MinecraftServer; public class ServerCommandManager extends CommandHandler implements IAdminCommand { diff --git a/sp-server/src/main/java/net/minecraft/src/ServerCommandScoreboard.java b/sp-server/src/main/java/net/minecraft/src/ServerCommandScoreboard.java index 8308a93..a4661d5 100644 --- a/sp-server/src/main/java/net/minecraft/src/ServerCommandScoreboard.java +++ b/sp-server/src/main/java/net/minecraft/src/ServerCommandScoreboard.java @@ -7,6 +7,7 @@ import java.util.HashSet; import java.util.Iterator; import java.util.List; import java.util.Map; + import net.minecraft.server.MinecraftServer; public class ServerCommandScoreboard extends CommandBase { diff --git a/sp-server/src/main/java/net/minecraft/src/ServerConfigurationManager.java b/sp-server/src/main/java/net/minecraft/src/ServerConfigurationManager.java index 4f647bb..b52406a 100644 --- a/sp-server/src/main/java/net/minecraft/src/ServerConfigurationManager.java +++ b/sp-server/src/main/java/net/minecraft/src/ServerConfigurationManager.java @@ -7,8 +7,9 @@ import java.util.HashSet; import java.util.Iterator; import java.util.List; import java.util.Map; -import java.util.Set; import java.util.Map.Entry; +import java.util.Set; + import net.minecraft.server.MinecraftServer; public class ServerConfigurationManager { diff --git a/sp-server/src/main/java/net/minecraft/src/ServerScoreboard.java b/sp-server/src/main/java/net/minecraft/src/ServerScoreboard.java index c9d590c..3b08049 100644 --- a/sp-server/src/main/java/net/minecraft/src/ServerScoreboard.java +++ b/sp-server/src/main/java/net/minecraft/src/ServerScoreboard.java @@ -6,6 +6,7 @@ import java.util.HashSet; import java.util.Iterator; import java.util.List; import java.util.Set; + import net.minecraft.server.MinecraftServer; public class ServerScoreboard extends Scoreboard { diff --git a/sp-server/src/main/java/net/minecraft/src/TileEntity.java b/sp-server/src/main/java/net/minecraft/src/TileEntity.java index eeb9844..c142d5a 100644 --- a/sp-server/src/main/java/net/minecraft/src/TileEntity.java +++ b/sp-server/src/main/java/net/minecraft/src/TileEntity.java @@ -2,6 +2,7 @@ package net.minecraft.src; import java.util.HashMap; import java.util.Map; + import net.minecraft.server.MinecraftServer; public class TileEntity { diff --git a/sp-server/src/main/java/net/minecraft/src/WorldManager.java b/sp-server/src/main/java/net/minecraft/src/WorldManager.java index 45dc9a8..9c6014a 100644 --- a/sp-server/src/main/java/net/minecraft/src/WorldManager.java +++ b/sp-server/src/main/java/net/minecraft/src/WorldManager.java @@ -1,6 +1,7 @@ package net.minecraft.src; import java.util.Iterator; + import net.minecraft.server.MinecraftServer; public class WorldManager implements IWorldAccess {