diff --git a/bukkit/pom.xml b/bukkit/pom.xml
index 924ff2f75..592e87676 100644
--- a/bukkit/pom.xml
+++ b/bukkit/pom.xml
@@ -5,7 +5,7 @@
viaversion-parent
us.myles
- 1.4.0-1.13-pre8
+ 1.4.0-1.13-pre9
4.0.0
diff --git a/bungee/pom.xml b/bungee/pom.xml
index 80f41ab7e..52b38a35c 100644
--- a/bungee/pom.xml
+++ b/bungee/pom.xml
@@ -5,7 +5,7 @@
viaversion-parent
us.myles
- 1.4.0-1.13-pre8
+ 1.4.0-1.13-pre9
4.0.0
diff --git a/common/pom.xml b/common/pom.xml
index 328c3745b..02a158aff 100644
--- a/common/pom.xml
+++ b/common/pom.xml
@@ -5,7 +5,7 @@
viaversion-parent
us.myles
- 1.4.0-1.13-pre8
+ 1.4.0-1.13-pre9
4.0.0
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 4e0883eae..c566a4fca 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
@@ -6,7 +6,6 @@ import com.google.common.collect.Sets;
import us.myles.ViaVersion.api.Pair;
import us.myles.ViaVersion.api.Via;
import us.myles.ViaVersion.protocols.base.BaseProtocol;
-import us.myles.ViaVersion.protocols.base.BaseProtocol1_13;
import us.myles.ViaVersion.protocols.base.BaseProtocol1_7;
import us.myles.ViaVersion.protocols.protocol1_10to1_9_3.Protocol1_10To1_9_3_4;
import us.myles.ViaVersion.protocols.protocol1_11_1to1_11.Protocol1_11_1To1_11;
@@ -37,8 +36,7 @@ public class ProtocolRegistry {
static {
// Base Protocol
registerBaseProtocol(BASE_PROTOCOL, Range.lessThan(Integer.MIN_VALUE));
- registerBaseProtocol(new BaseProtocol1_7(), Range.lessThan(ProtocolVersion.v1_13.getId()));
- registerBaseProtocol(new BaseProtocol1_13(), Range.atLeast(ProtocolVersion.v1_13.getId()));
+ registerBaseProtocol(new BaseProtocol1_7(), Range.all());
// Register built in protocols
registerProtocol(new Protocol1_9TO1_8(), Collections.singletonList(ProtocolVersion.v1_9.getId()), ProtocolVersion.v1_8.getId());
diff --git a/common/src/main/java/us/myles/ViaVersion/api/protocol/ProtocolVersion.java b/common/src/main/java/us/myles/ViaVersion/api/protocol/ProtocolVersion.java
index 9d30ab184..6fb3db92c 100644
--- a/common/src/main/java/us/myles/ViaVersion/api/protocol/ProtocolVersion.java
+++ b/common/src/main/java/us/myles/ViaVersion/api/protocol/ProtocolVersion.java
@@ -62,7 +62,7 @@ public class ProtocolVersion {
register(v1_12 = new ProtocolVersion(335, "1.12"));
register(v1_12_1 = new ProtocolVersion(338, "1.12.1"));
register(v1_12_2 = new ProtocolVersion(340, "1.12.2"));
- register(v1_13 = new ProtocolVersion(390, "1.13-pre8"));
+ register(v1_13 = new ProtocolVersion(391, "1.13-pre9"));
register(unknown = new ProtocolVersion(-1, "UNKNOWN"));
}
diff --git a/common/src/main/java/us/myles/ViaVersion/protocols/base/BaseProtocol1_13.java b/common/src/main/java/us/myles/ViaVersion/protocols/base/BaseProtocol1_13.java
deleted file mode 100644
index 68acc9750..000000000
--- a/common/src/main/java/us/myles/ViaVersion/protocols/base/BaseProtocol1_13.java
+++ /dev/null
@@ -1,195 +0,0 @@
-package us.myles.ViaVersion.protocols.base;
-
-import com.google.common.base.Joiner;
-import com.google.gson.JsonElement;
-import com.google.gson.JsonObject;
-import com.google.gson.JsonParseException;
-import io.netty.channel.ChannelFuture;
-import io.netty.util.concurrent.Future;
-import io.netty.util.concurrent.GenericFutureListener;
-import net.md_5.bungee.api.ChatColor;
-import us.myles.ViaVersion.api.PacketWrapper;
-import us.myles.ViaVersion.api.Pair;
-import us.myles.ViaVersion.api.Via;
-import us.myles.ViaVersion.api.data.UserConnection;
-import us.myles.ViaVersion.api.protocol.Protocol;
-import us.myles.ViaVersion.api.protocol.ProtocolRegistry;
-import us.myles.ViaVersion.api.remapper.PacketHandler;
-import us.myles.ViaVersion.api.remapper.PacketRemapper;
-import us.myles.ViaVersion.api.type.Type;
-import us.myles.ViaVersion.packets.State;
-import us.myles.ViaVersion.protocols.protocol1_9to1_8.Protocol1_9TO1_8;
-import us.myles.ViaVersion.util.GsonUtil;
-
-import java.util.List;
-import java.util.UUID;
-import java.util.logging.Level;
-
-public class BaseProtocol1_13 extends Protocol {
- @Override
- protected void registerPackets() {
- /* Outgoing Packets */
-
- // Status Response Packet
- registerOutgoing(State.STATUS, 0x00, 0x00, new PacketRemapper() { // Status Response Packet
- @Override
- public void registerMap() {
- map(Type.STRING);
- handler(new PacketHandler() {
- @Override
- public void handle(PacketWrapper wrapper) throws Exception {
- ProtocolInfo info = wrapper.user().get(ProtocolInfo.class);
- String originalStatus = wrapper.get(Type.STRING, 0);
- try {
- JsonElement json = GsonUtil.getGson().fromJson(originalStatus, JsonElement.class);
- JsonObject version;
- int protocolVersion = 0; // Unknown!
-
- if (json.isJsonObject()) {
- if (json.getAsJsonObject().has("version")) {
- version = json.getAsJsonObject().get("version").getAsJsonObject();
- if (version.has("protocol")) {
- protocolVersion = ((Long) version.get("protocol").getAsLong()).intValue();
- }
- } else {
- version = new JsonObject();
- json.getAsJsonObject().add("version", version);
- }
- } else {
- // Format properly
- json = new JsonObject();
- version = new JsonObject();
- json.getAsJsonObject().add("version", version);
- }
- if (Via.getConfig().isSendSupportedVersions()) //Send supported versions
- version.add("supportedVersions", GsonUtil.getGson().toJsonTree(Via.getAPI().getSupportedVersions()));
-
- if (ProtocolRegistry.SERVER_PROTOCOL == -1) // Set the Server protocol if the detection on startup failed
- ProtocolRegistry.SERVER_PROTOCOL = protocolVersion;
- // Ensure the server has a version provider
- if (Via.getManager().getProviders().get(VersionProvider.class) == null) {
- wrapper.user().setActive(false);
- return;
- }
- int protocol = Via.getManager().getProviders().get(VersionProvider.class).getServerProtocol(wrapper.user());
- List> protocols = null;
-
- // Only allow newer clients or (1.9.2 on 1.9.4 server if the server supports it)
- if (info.getProtocolVersion() >= protocol || Via.getPlatform().isOldClientsAllowed()) {
- protocols = ProtocolRegistry.getProtocolPath(info.getProtocolVersion(), protocol);
- }
-
- if (protocols != null) {
- if (protocolVersion != 9999) {
- //Fix ServerListPlus
- version.addProperty("protocol", info.getProtocolVersion());
- }
- } else {
- // not compatible :(, *plays very sad violin*
- wrapper.user().setActive(false);
- }
-
- if (Via.getConfig().getBlockedProtocols().contains(info.getProtocolVersion()))
- version.addProperty("protocol", -1); // Show blocked versions as outdated
-
- wrapper.set(Type.STRING, 0, GsonUtil.getGson().toJson(json)); // Update value
- } catch (JsonParseException e) {
- e.printStackTrace();
- }
- }
- });
- }
- });
-
- registerOutgoing(State.STATUS, 0x01, 0x01); // Status Pong Packet
-
- registerOutgoing(State.LOGIN, 0x00, 0x00); // Login Plugin Message
- registerOutgoing(State.LOGIN, 0x01, 0x01); // Login Disconnect Packet
- registerOutgoing(State.LOGIN, 0x02, 0x02); // Encryption Request Packet
-
- // Login Success Packet
- registerOutgoing(State.LOGIN, 0x03, 0x03, new PacketRemapper() {
- @Override
- public void registerMap() {
- map(Type.STRING); // 0 - UUID as String
- map(Type.STRING); // 1 - Player Username
- handler(new PacketHandler() {
- @Override
- public void handle(PacketWrapper wrapper) throws Exception {
- ProtocolInfo info = wrapper.user().get(ProtocolInfo.class);
- info.setState(State.PLAY);
- // Save other info
- String stringUUID = wrapper.get(Type.STRING, 0);
- /*if (stringUUID.length() == 32) { // Trimmed UUIDs are 32 characters
- // Trimmed
- stringUUID = addDashes(stringUUID);
- }*/
- UUID uuid = UUID.fromString(stringUUID);
- info.setUuid(uuid);
- info.setUsername(wrapper.get(Type.STRING, 1));
- // Add to ported clients
- Via.getManager().addPortedClient(wrapper.user());
-
- if (info.getPipeline().pipes().size() == 2
- && info.getPipeline().pipes().get(1).getClass() == BaseProtocol1_13.class
- && info.getPipeline().pipes().get(0).getClass() == BaseProtocol.class) // Only base protocol
- wrapper.user().setActive(false);
-
- if (Via.getManager().isDebug()) {
- // Print out the route to console
- Via.getPlatform().getLogger().log(Level.INFO, "{0} logged in with protocol {1}, Route: {2}",
- new Object[]{
- wrapper.get(Type.STRING, 1),
- info.getProtocolVersion(),
- Joiner.on(", ").join(info.getPipeline().pipes(), ", ")
- });
- }
- }
- });
- }
- });
-
- registerOutgoing(State.LOGIN, 0x04, 0x04); // Login Set Compression Packet
-
- /* Incoming Packets */
-
- registerIncoming(State.STATUS, 0x00, 0x00); // Status Request Packet
- registerIncoming(State.STATUS, 0x01, 0x01); // Status Ping Packet
-
- registerIncoming(State.LOGIN, 0x00, 0x00); // Login Plugin Message
- // Login Start Packet
- registerIncoming(State.LOGIN, 0x01, 0x01, new PacketRemapper() {
- @Override
- public void registerMap() {
- handler(new PacketHandler() {
- @Override
- public void handle(final PacketWrapper wrapper) throws Exception {
- int protocol = wrapper.user().get(ProtocolInfo.class).getProtocolVersion();
- if (Via.getConfig().getBlockedProtocols().contains(protocol)) {
- if (!wrapper.user().getChannel().isOpen()) return;
-
- PacketWrapper disconnectPacket = new PacketWrapper(0x00, null, wrapper.user()); // Disconnect Packet
- Protocol1_9TO1_8.FIX_JSON.write(disconnectPacket, ChatColor.translateAlternateColorCodes('&', Via.getConfig().getBlockedDisconnectMsg()));
- wrapper.cancel(); // cancel current
-
- // Send and close
- ChannelFuture future = disconnectPacket.sendFuture(BaseProtocol.class);
- future.addListener(new GenericFutureListener>() {
- @Override
- public void operationComplete(Future super Void> future) throws Exception {
- wrapper.user().getChannel().close();
- }
- });
- }
- }
- });
- }
- }); // Login Start Packet
- registerIncoming(State.LOGIN, 0x02, 0x02); // Encryption Response Packet
- }
-
- @Override
- public void init(UserConnection userConnection) {
-
- }
-}
diff --git a/common/src/main/java/us/myles/ViaVersion/protocols/base/BaseProtocol1_7.java b/common/src/main/java/us/myles/ViaVersion/protocols/base/BaseProtocol1_7.java
index 468972d5c..919194d7d 100644
--- a/common/src/main/java/us/myles/ViaVersion/protocols/base/BaseProtocol1_7.java
+++ b/common/src/main/java/us/myles/ViaVersion/protocols/base/BaseProtocol1_7.java
@@ -150,6 +150,7 @@ public class BaseProtocol1_7 extends Protocol {
});
registerOutgoing(State.LOGIN, 0x03, 0x03); // Login Set Compression Packet
+ registerIncoming(State.LOGIN, 0x04, 0x04); // Plugin Request (1.13)
/* Incoming Packets */
@@ -185,6 +186,7 @@ public class BaseProtocol1_7 extends Protocol {
}
}); // Login Start Packet
registerIncoming(State.LOGIN, 0x01, 0x01); // Encryption Response Packet
+ registerIncoming(State.LOGIN, 0x02, 0x02); // Plugin Response (1.13)
}
@Override
diff --git a/common/src/main/java/us/myles/ViaVersion/protocols/protocolsnapshotto1_12_2/ProtocolSnapshotTo1_12_2.java b/common/src/main/java/us/myles/ViaVersion/protocols/protocolsnapshotto1_12_2/ProtocolSnapshotTo1_12_2.java
index 6731df531..8f13235e2 100644
--- a/common/src/main/java/us/myles/ViaVersion/protocols/protocolsnapshotto1_12_2/ProtocolSnapshotTo1_12_2.java
+++ b/common/src/main/java/us/myles/ViaVersion/protocols/protocolsnapshotto1_12_2/ProtocolSnapshotTo1_12_2.java
@@ -66,11 +66,7 @@ public class ProtocolSnapshotTo1_12_2 extends Protocol {
// Outgoing packets
- // New packet 0x0 - Login Plugin Message
- registerOutgoing(State.LOGIN, 0x0, 0x1);
- registerOutgoing(State.LOGIN, 0x1, 0x2);
- registerOutgoing(State.LOGIN, 0x2, 0x3);
- registerOutgoing(State.LOGIN, 0x3, 0x4);
+ // New packet 0x04 - Login Plugin Message
// Statistics
registerOutgoing(State.PLAY, 0x07, 0x07, new PacketRemapper() {
@@ -198,28 +194,19 @@ public class ProtocolSnapshotTo1_12_2 extends Protocol {
@Override
public void write(PacketWrapper wrapper) throws Exception {
wrapper.write(Type.VAR_INT, MappingData.blockTags.size()); // block tags
- for (Map.Entry tag : MappingData.blockTags.entrySet()) {
+ for (Map.Entry tag : MappingData.blockTags.entrySet()) {
wrapper.write(Type.STRING, tag.getKey());
- wrapper.write(Type.VAR_INT, tag.getValue().length);
- for (int id : tag.getValue()) {
- wrapper.write(Type.VAR_INT, id);
- }
+ wrapper.write(Type.VAR_INT_ARRAY, tag.getValue().clone());
}
wrapper.write(Type.VAR_INT, MappingData.itemTags.size()); // item tags
- for (Map.Entry tag : MappingData.itemTags.entrySet()) {
+ for (Map.Entry tag : MappingData.itemTags.entrySet()) {
wrapper.write(Type.STRING, tag.getKey());
- wrapper.write(Type.VAR_INT, tag.getValue().length);
- for (int id : tag.getValue()) {
- wrapper.write(Type.VAR_INT, id);
- }
+ wrapper.write(Type.VAR_INT_ARRAY, tag.getValue().clone());
}
wrapper.write(Type.VAR_INT, MappingData.fluidTags.size()); // fluid tags
- for (Map.Entry tag : MappingData.fluidTags.entrySet()) {
+ for (Map.Entry tag : MappingData.fluidTags.entrySet()) {
wrapper.write(Type.STRING, tag.getKey());
- wrapper.write(Type.VAR_INT, tag.getValue().length);
- for (int id : tag.getValue()) {
- wrapper.write(Type.VAR_INT, id);
- }
+ wrapper.write(Type.VAR_INT_ARRAY, tag.getValue().clone());
}
}
}).send(ProtocolSnapshotTo1_12_2.class);
@@ -436,7 +423,7 @@ public class ProtocolSnapshotTo1_12_2 extends Protocol {
// Incoming packets
// New packet 0x0 - Login Plugin Message
- registerIncoming(State.LOGIN, -1, 0x0, new PacketRemapper() {
+ registerIncoming(State.LOGIN, -1, 0x02, new PacketRemapper() {
@Override
public void registerMap() {
handler(new PacketHandler() {
@@ -447,8 +434,6 @@ public class ProtocolSnapshotTo1_12_2 extends Protocol {
});
}
});
- registerIncoming(State.LOGIN, 0x0, 0x1);
- registerIncoming(State.LOGIN, 0x1, 0x2);
// New 0x01 - Query Block NBT
registerIncoming(State.PLAY, -1, 0x01, new PacketRemapper() {
diff --git a/common/src/main/java/us/myles/ViaVersion/protocols/protocolsnapshotto1_12_2/data/MappingData.java b/common/src/main/java/us/myles/ViaVersion/protocols/protocolsnapshotto1_12_2/data/MappingData.java
index 1ac3a132a..712d2096e 100644
--- a/common/src/main/java/us/myles/ViaVersion/protocols/protocolsnapshotto1_12_2/data/MappingData.java
+++ b/common/src/main/java/us/myles/ViaVersion/protocols/protocolsnapshotto1_12_2/data/MappingData.java
@@ -17,9 +17,9 @@ public class MappingData {
public static Map oldToNewBlocks = new HashMap<>();
public static Map oldToNewItems = new HashMap<>();
public static Map newToOldItems = new HashMap<>();
- public static Map blockTags = new HashMap<>();
- public static Map itemTags = new HashMap<>();
- public static Map fluidTags = new HashMap<>();
+ public static Map blockTags = new HashMap<>();
+ public static Map itemTags = new HashMap<>();
+ public static Map fluidTags = new HashMap<>();
public static BiMap oldEnchantmentsIds = HashBiMap.create();
public static Map oldToNewSounds = new HashMap<>();
@@ -87,10 +87,10 @@ public class MappingData {
return null;
}
- private static void loadTags(Map output, JsonObject newTags) {
+ private static void loadTags(Map output, JsonObject newTags) {
for (Map.Entry entry : newTags.entrySet()) {
JsonArray ids = entry.getValue().getAsJsonArray();
- int[] idsArray = new int[ids.size()];
+ Integer[] idsArray = new Integer[ids.size()];
for (int i = 0; i < ids.size(); i++) {
idsArray[i] = ids.get(i).getAsInt();
}
diff --git a/jar/pom.xml b/jar/pom.xml
index 9d1097c52..5d8f89d98 100644
--- a/jar/pom.xml
+++ b/jar/pom.xml
@@ -5,7 +5,7 @@
viaversion-parent
us.myles
- 1.4.0-1.13-pre8
+ 1.4.0-1.13-pre9
4.0.0
viaversion-jar
diff --git a/pom.xml b/pom.xml
index 4a929212f..3d09f4fcb 100644
--- a/pom.xml
+++ b/pom.xml
@@ -6,7 +6,7 @@
us.myles
viaversion-parent
- 1.4.0-1.13-pre8
+ 1.4.0-1.13-pre9
pom
viaversion-parent
diff --git a/sponge-legacy/pom.xml b/sponge-legacy/pom.xml
index 335da9f3c..8cda8f1bc 100644
--- a/sponge-legacy/pom.xml
+++ b/sponge-legacy/pom.xml
@@ -5,7 +5,7 @@
viaversion-parent
us.myles
- 1.4.0-1.13-pre8
+ 1.4.0-1.13-pre9
4.0.0
diff --git a/sponge/pom.xml b/sponge/pom.xml
index c3e916332..7e862548e 100644
--- a/sponge/pom.xml
+++ b/sponge/pom.xml
@@ -5,7 +5,7 @@
viaversion-parent
us.myles
- 1.4.0-1.13-pre8
+ 1.4.0-1.13-pre9
4.0.0