diff --git a/bukkit/src/main/java/us/myles/ViaVersion/bukkit/providers/BukkitViaBulkChunkTranslator.java b/bukkit/src/main/java/us/myles/ViaVersion/bukkit/providers/BukkitViaBulkChunkTranslator.java
index 25d8370b5..fd4a3a271 100644
--- a/bukkit/src/main/java/us/myles/ViaVersion/bukkit/providers/BukkitViaBulkChunkTranslator.java
+++ b/bukkit/src/main/java/us/myles/ViaVersion/bukkit/providers/BukkitViaBulkChunkTranslator.java
@@ -3,9 +3,9 @@ package us.myles.ViaVersion.bukkit.providers;
import com.google.common.collect.Lists;
import us.myles.ViaVersion.ViaVersionPlugin;
import us.myles.ViaVersion.api.Via;
+import us.myles.ViaVersion.bukkit.util.NMSUtil;
import us.myles.ViaVersion.protocols.protocol1_9to1_8.providers.BulkChunkTranslatorProvider;
import us.myles.ViaVersion.protocols.protocol1_9to1_8.storage.ClientChunks;
-import us.myles.ViaVersion.bukkit.util.NMSUtil;
import us.myles.ViaVersion.util.ReflectionUtil;
import java.lang.reflect.Method;
@@ -79,4 +79,9 @@ public class BukkitViaBulkChunkTranslator extends BulkChunkTranslatorProvider {
public boolean isFiltered(Class> packetClass) {
return packetClass.getName().endsWith("PacketPlayOutMapChunkBulk");
}
+
+ @Override
+ public boolean isPacketLevel() {
+ return false;
+ }
}
diff --git a/common/src/main/java/us/myles/ViaVersion/api/PacketWrapper.java b/common/src/main/java/us/myles/ViaVersion/api/PacketWrapper.java
index 0f4d4307a..7c3441825 100644
--- a/common/src/main/java/us/myles/ViaVersion/api/PacketWrapper.java
+++ b/common/src/main/java/us/myles/ViaVersion/api/PacketWrapper.java
@@ -358,7 +358,7 @@ public class PacketWrapper {
* Be careful not to send packets twice.
* (Sends it after current)
*
- * This method is no longer used, it's favoured to use send(Protocol) as it will handle the pipeline properly.
+ * This method is no longer used, it's favoured to use {@link #send(Class)} as it will handle the pipeline properly.
*
* @throws Exception if it fails to write
*/
diff --git a/common/src/main/java/us/myles/ViaVersion/api/protocol/ProtocolRegistry.java b/common/src/main/java/us/myles/ViaVersion/api/protocol/ProtocolRegistry.java
index b736d88bb..51f32af25 100644
--- a/common/src/main/java/us/myles/ViaVersion/api/protocol/ProtocolRegistry.java
+++ b/common/src/main/java/us/myles/ViaVersion/api/protocol/ProtocolRegistry.java
@@ -27,13 +27,13 @@ public class ProtocolRegistry {
static {
// Base Protocol
- registerProtocol(BASE_PROTOCOL, Arrays.asList(), -1);
+ registerProtocol(BASE_PROTOCOL, Collections.emptyList(), -1);
// Register built in protocols
registerProtocol(new Protocol1_9TO1_8(), Collections.singletonList(ProtocolVersion.v1_9.getId()), ProtocolVersion.v1_8.getId());
registerProtocol(new Protocol1_9_1TO1_9(), Arrays.asList(ProtocolVersion.v1_9_1.getId(), ProtocolVersion.v1_9_2.getId()), ProtocolVersion.v1_9.getId());
- registerProtocol(new Protocol1_9_3TO1_9_1_2(), Arrays.asList(ProtocolVersion.v1_9_3.getId()), ProtocolVersion.v1_9_2.getId());
+ registerProtocol(new Protocol1_9_3TO1_9_1_2(), Collections.singletonList(ProtocolVersion.v1_9_3.getId()), ProtocolVersion.v1_9_2.getId());
// Only supported for 1.9.4 server to 1.9 (nothing else)
- registerProtocol(new Protocol1_9TO1_9_1(), Arrays.asList(ProtocolVersion.v1_9.getId()), ProtocolVersion.v1_9_2.getId());
+ registerProtocol(new Protocol1_9TO1_9_1(), Collections.singletonList(ProtocolVersion.v1_9.getId()), ProtocolVersion.v1_9_2.getId());
registerProtocol(new Protocol1_9_1_2TO1_9_3_4(), Arrays.asList(ProtocolVersion.v1_9_1.getId(), ProtocolVersion.v1_9_2.getId()), ProtocolVersion.v1_9_3.getId());
registerProtocol(new Protocol1_10To1_9_3_4(), Collections.singletonList(ProtocolVersion.v1_10.getId()), ProtocolVersion.v1_9_3.getId());
diff --git a/common/src/main/java/us/myles/ViaVersion/api/type/types/CustomByteType.java b/common/src/main/java/us/myles/ViaVersion/api/type/types/CustomByteType.java
new file mode 100644
index 000000000..097209490
--- /dev/null
+++ b/common/src/main/java/us/myles/ViaVersion/api/type/types/CustomByteType.java
@@ -0,0 +1,26 @@
+package us.myles.ViaVersion.api.type.types;
+
+import io.netty.buffer.ByteBuf;
+import us.myles.ViaVersion.api.type.PartialType;
+
+public class CustomByteType extends PartialType {
+
+ public CustomByteType(Integer param) {
+ super(param, byte[].class);
+ }
+
+ @Override
+ public byte[] read(ByteBuf byteBuf, Integer integer) throws Exception {
+ if (byteBuf.readableBytes() < integer) throw new RuntimeException("Readable bytes does not match expected!");
+
+ byte[] byteArray = new byte[integer];
+ byteBuf.readBytes(byteArray);
+
+ return byteArray;
+ }
+
+ @Override
+ public void write(ByteBuf byteBuf, Integer integer, byte[] bytes) throws Exception {
+ byteBuf.writeBytes(bytes);
+ }
+}
\ No newline at end of file
diff --git a/common/src/main/java/us/myles/ViaVersion/protocols/protocol1_9to1_8/packets/WorldPackets.java b/common/src/main/java/us/myles/ViaVersion/protocols/protocol1_9to1_8/packets/WorldPackets.java
index 8139ce841..2b7301ce1 100644
--- a/common/src/main/java/us/myles/ViaVersion/protocols/protocol1_9to1_8/packets/WorldPackets.java
+++ b/common/src/main/java/us/myles/ViaVersion/protocols/protocol1_9to1_8/packets/WorldPackets.java
@@ -1,5 +1,7 @@
package us.myles.ViaVersion.protocols.protocol1_9to1_8.packets;
+import io.netty.buffer.ByteBuf;
+import io.netty.buffer.Unpooled;
import org.spacehq.opennbt.tag.builtin.CompoundTag;
import org.spacehq.opennbt.tag.builtin.StringTag;
import us.myles.ViaVersion.api.PacketWrapper;
@@ -15,6 +17,7 @@ import us.myles.ViaVersion.packets.State;
import us.myles.ViaVersion.protocols.protocol1_9to1_8.ItemRewriter;
import us.myles.ViaVersion.protocols.protocol1_9to1_8.Protocol1_9TO1_8;
import us.myles.ViaVersion.protocols.protocol1_9to1_8.chunks.Chunk1_9to1_8;
+import us.myles.ViaVersion.protocols.protocol1_9to1_8.providers.BulkChunkTranslatorProvider;
import us.myles.ViaVersion.protocols.protocol1_9to1_8.sounds.Effect;
import us.myles.ViaVersion.protocols.protocol1_9to1_8.sounds.SoundEffect;
import us.myles.ViaVersion.protocols.protocol1_9to1_8.storage.ClientChunks;
@@ -22,6 +25,9 @@ import us.myles.ViaVersion.protocols.protocol1_9to1_8.storage.EntityTracker;
import us.myles.ViaVersion.protocols.protocol1_9to1_8.storage.PlaceBlockTracker;
import us.myles.ViaVersion.protocols.protocol1_9to1_8.types.ChunkType;
+import java.io.IOException;
+import java.util.List;
+
public class WorldPackets {
public static void register(Protocol protocol) {
// Sign Update Packet
@@ -132,18 +138,26 @@ public class WorldPackets {
handler(new PacketHandler() {
@Override
public void handle(PacketWrapper wrapper) throws Exception {
-// ClientChunks clientChunks = wrapper.user().get(ClientChunks.class);
-// Chunk1_9to1_8 chunk = (Chunk1_9to1_8) wrapper.passthrough(new ChunkType(clientChunks));
-// if (chunk.isUnloadPacket())
-// wrapper.setId(0x1D);
-//
-// // eat any other data (Usually happens with unload packets)
-// wrapper.read(Type.REMAINING_BYTES);
- // TODO: Implement Bulk Chunks
- // Boolean
- // Column Count
+ wrapper.cancel(); // Cancel the packet from being sent
+ BulkChunkTranslatorProvider provider = Via.getManager().getProviders().get(BulkChunkTranslatorProvider.class);
- wrapper.cancel();
+ // Don't read the packet
+ if (!provider.isPacketLevel())
+ return;
+
+ List