From ebb132312961766abffb7692615214ccbc34caf2 Mon Sep 17 00:00:00 2001 From: Matsv Date: Wed, 2 Aug 2017 14:08:37 +0200 Subject: [PATCH] Prepare for 1.12.1 --- all/pom.xml | 2 +- bukkit/pom.xml | 2 +- bungee/pom.xml | 2 +- core/pom.xml | 2 +- .../api/ViaBackwardsPlatform.java | 15 ++-- .../Protocol1_12To1_12_1.java | 83 +++++++++++++++++++ pom.xml | 4 +- sponge/pom.xml | 2 +- 8 files changed, 100 insertions(+), 12 deletions(-) create mode 100644 core/src/main/java/nl/matsv/viabackwards/protocol/protocol1_12to1_12_1/Protocol1_12To1_12_1.java diff --git a/all/pom.xml b/all/pom.xml index 9852836b..0dc34744 100644 --- a/all/pom.xml +++ b/all/pom.xml @@ -15,7 +15,7 @@ viabackwards-parent nl.matsv - 2.1.2-SNAPSHOT + 2.2.0-SNAPSHOT 4.0.0 diff --git a/bukkit/pom.xml b/bukkit/pom.xml index cd36c98f..10ad302c 100644 --- a/bukkit/pom.xml +++ b/bukkit/pom.xml @@ -15,7 +15,7 @@ viabackwards-parent nl.matsv - 2.1.2-SNAPSHOT + 2.2.0-SNAPSHOT 4.0.0 diff --git a/bungee/pom.xml b/bungee/pom.xml index 7900ee57..3970a09e 100644 --- a/bungee/pom.xml +++ b/bungee/pom.xml @@ -15,7 +15,7 @@ viabackwards-parent nl.matsv - 2.1.2-SNAPSHOT + 2.2.0-SNAPSHOT 4.0.0 diff --git a/core/pom.xml b/core/pom.xml index b719b518..1692bbc7 100644 --- a/core/pom.xml +++ b/core/pom.xml @@ -15,7 +15,7 @@ viabackwards-parent nl.matsv - 2.1.2-SNAPSHOT + 2.2.0-SNAPSHOT 4.0.0 diff --git a/core/src/main/java/nl/matsv/viabackwards/api/ViaBackwardsPlatform.java b/core/src/main/java/nl/matsv/viabackwards/api/ViaBackwardsPlatform.java index 514609ab..15584ee3 100644 --- a/core/src/main/java/nl/matsv/viabackwards/api/ViaBackwardsPlatform.java +++ b/core/src/main/java/nl/matsv/viabackwards/api/ViaBackwardsPlatform.java @@ -14,10 +14,12 @@ import nl.matsv.viabackwards.ViaBackwards; import nl.matsv.viabackwards.protocol.protocol1_10to1_11.Protocol1_10To1_11; import nl.matsv.viabackwards.protocol.protocol1_11to1_11_1.Protocol1_11To1_11_1; import nl.matsv.viabackwards.protocol.protocol1_12to1_11_1.Protocol1_11_1To1_12; +import nl.matsv.viabackwards.protocol.protocol1_12to1_12_1.Protocol1_12To1_12_1; import nl.matsv.viabackwards.protocol.protocol1_9_4to1_10.Protocol1_9_4To1_10; import us.myles.ViaVersion.api.protocol.ProtocolRegistry; import us.myles.ViaVersion.api.protocol.ProtocolVersion; +import java.lang.reflect.Field; import java.util.Collections; import java.util.logging.Logger; @@ -33,6 +35,7 @@ public interface ViaBackwardsPlatform { ProtocolRegistry.registerProtocol(new Protocol1_10To1_11(), Collections.singletonList(ProtocolVersion.v1_10.getId()), ProtocolVersion.v1_11.getId()); ProtocolRegistry.registerProtocol(new Protocol1_11To1_11_1(), Collections.singletonList(ProtocolVersion.v1_11.getId()), ProtocolVersion.v1_11_1.getId()); ProtocolRegistry.registerProtocol(new Protocol1_11_1To1_12(), Collections.singletonList(ProtocolVersion.v1_11_1.getId()), ProtocolVersion.v1_12.getId()); + ProtocolRegistry.registerProtocol(new Protocol1_12To1_12_1(), Collections.singletonList(ProtocolVersion.v1_12.getId()), ProtocolVersion.v1_12_1.getId()); } } @@ -45,14 +48,16 @@ public interface ViaBackwardsPlatform { // TODO remove or better implement later default boolean isOutdated() { - Class clazz = null; + boolean upToDate = false; try { - clazz = Class.forName("us.myles.ViaVersion.api.type.types.version.Types1_12"); - } catch (ClassNotFoundException e) { - e.printStackTrace(); + Class clazz = Class.forName("us.myles.ViaVersion.api.protocol.ProtocolVersion"); + Field v1_12_1 = clazz.getField("v1_12_1"); + + upToDate = (v1_12_1 != null); + } catch (ClassNotFoundException | NoSuchFieldException ignored) { } - if (clazz == null) { + if (!upToDate) { getLogger().severe("================================"); getLogger().severe("YOUR VIAVERSION IS OUTDATED"); getLogger().severe("PLEASE USE THE LATEST VERSION"); diff --git a/core/src/main/java/nl/matsv/viabackwards/protocol/protocol1_12to1_12_1/Protocol1_12To1_12_1.java b/core/src/main/java/nl/matsv/viabackwards/protocol/protocol1_12to1_12_1/Protocol1_12To1_12_1.java new file mode 100644 index 00000000..e18ce96e --- /dev/null +++ b/core/src/main/java/nl/matsv/viabackwards/protocol/protocol1_12to1_12_1/Protocol1_12To1_12_1.java @@ -0,0 +1,83 @@ +/* + * Copyright (c) 2016 Matsv + * + * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + +package nl.matsv.viabackwards.protocol.protocol1_12to1_12_1; + +import nl.matsv.viabackwards.api.BackwardsProtocol; +import us.myles.ViaVersion.api.data.UserConnection; +import us.myles.ViaVersion.packets.State; + +public class Protocol1_12To1_12_1 extends BackwardsProtocol { + @Override + protected void registerPackets() { + registerOutgoing(State.PLAY, 0x2b, -1); // TODO + registerOutgoing(State.PLAY, 0x2c, 0x2b); + registerOutgoing(State.PLAY, 0x2d, 0x2c); + registerOutgoing(State.PLAY, 0x2e, 0x2d); + registerOutgoing(State.PLAY, 0x2f, 0x2e); + registerOutgoing(State.PLAY, 0x30, 0x2f); + registerOutgoing(State.PLAY, 0x31, 0x30); + registerOutgoing(State.PLAY, 0x32, 0x31); + registerOutgoing(State.PLAY, 0x33, 0x32); + registerOutgoing(State.PLAY, 0x34, 0x33); + registerOutgoing(State.PLAY, 0x35, 0x34); + registerOutgoing(State.PLAY, 0x36, 0x35); + registerOutgoing(State.PLAY, 0x37, 0x36); + registerOutgoing(State.PLAY, 0x38, 0x37); + registerOutgoing(State.PLAY, 0x39, 0x38); + registerOutgoing(State.PLAY, 0x3a, 0x39); + registerOutgoing(State.PLAY, 0x3b, 0x3a); + registerOutgoing(State.PLAY, 0x3c, 0x3b); + registerOutgoing(State.PLAY, 0x3d, 0x3c); + registerOutgoing(State.PLAY, 0x3e, 0x3d); + registerOutgoing(State.PLAY, 0x3f, 0x3e); + registerOutgoing(State.PLAY, 0x40, 0x3f); + registerOutgoing(State.PLAY, 0x41, 0x40); + registerOutgoing(State.PLAY, 0x42, 0x41); + registerOutgoing(State.PLAY, 0x43, 0x42); + registerOutgoing(State.PLAY, 0x44, 0x43); + registerOutgoing(State.PLAY, 0x45, 0x44); + registerOutgoing(State.PLAY, 0x46, 0x45); + registerOutgoing(State.PLAY, 0x47, 0x46); + registerOutgoing(State.PLAY, 0x48, 0x47); + registerOutgoing(State.PLAY, 0x49, 0x48); + registerOutgoing(State.PLAY, 0x4a, 0x49); + registerOutgoing(State.PLAY, 0x4b, 0x4a); + registerOutgoing(State.PLAY, 0x4c, 0x4b); + registerOutgoing(State.PLAY, 0x4d, 0x4c); + registerOutgoing(State.PLAY, 0x4e, 0x4d); + registerOutgoing(State.PLAY, 0x4f, 0x4e); + + registerIncoming(State.PLAY, -1, 0x1); // TODO + registerIncoming(State.PLAY, 0x1, 0x2); + registerIncoming(State.PLAY, 0x2, 0x3); + registerIncoming(State.PLAY, 0x3, 0x4); + registerIncoming(State.PLAY, 0x4, 0x5); + registerIncoming(State.PLAY, 0x5, 0x6); + registerIncoming(State.PLAY, 0x6, 0x7); + registerIncoming(State.PLAY, 0x7, 0x8); + registerIncoming(State.PLAY, 0x8, 0x9); + registerIncoming(State.PLAY, 0x9, 0xa); + registerIncoming(State.PLAY, 0xa, 0xb); + registerIncoming(State.PLAY, 0xb, 0xc); + registerIncoming(State.PLAY, 0xc, 0xd); + registerIncoming(State.PLAY, 0xd, 0xe); + registerIncoming(State.PLAY, 0xe, 0xf); + registerIncoming(State.PLAY, 0xf, 0x10); + registerIncoming(State.PLAY, 0x10, 0x11); + registerIncoming(State.PLAY, 0x11, 0x12); + registerIncoming(State.PLAY, 0x12, -1); // TODO + } + + @Override + public void init(UserConnection userConnection) { + + } +} diff --git a/pom.xml b/pom.xml index 45cc8bfb..622ee93c 100644 --- a/pom.xml +++ b/pom.xml @@ -16,7 +16,7 @@ nl.matsv viabackwards-parent - 2.1.2-SNAPSHOT + 2.2.0-SNAPSHOT pom Allow newer clients to join older server versions. @@ -65,7 +65,7 @@ us.myles viaversion - 1.1.1-SNAPSHOT + 1.2.0-1_12_1-pre1 provided diff --git a/sponge/pom.xml b/sponge/pom.xml index 2b842e62..bc7ac86a 100644 --- a/sponge/pom.xml +++ b/sponge/pom.xml @@ -15,7 +15,7 @@ viabackwards-parent nl.matsv - 2.1.2-SNAPSHOT + 2.2.0-SNAPSHOT 4.0.0