From 90b88f3cbfa24db57052119ff96082c3815d3528 Mon Sep 17 00:00:00 2001 From: KennyTV <28825609+KennyTV@users.noreply.github.com> Date: Tue, 17 Dec 2019 15:03:06 +0100 Subject: [PATCH 1/4] Update readme --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 438f0d530..ac627864c 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# ViaVersion 2.2.1 - Spigot, Sponge, BungeeCord, Velocity +# ViaVersion 2.2.2 - Spigot, Sponge, BungeeCord, Velocity [![Build Status](https://travis-ci.com/ViaVersion/ViaVersion.svg?branch=master)](https://travis-ci.com/ViaVersion/ViaVersion) [![Discord](https://img.shields.io/badge/chat-on%20discord-blue.svg)](https://viaversion.com/discord) From fddbeda81e31a40de19427a02de368f8dae6a62d Mon Sep 17 00:00:00 2001 From: KennyTV <28825609+KennyTV@users.noreply.github.com> Date: Fri, 20 Dec 2019 16:29:10 +0100 Subject: [PATCH 2/4] Back to snapshot --- bukkit/pom.xml | 2 +- bungee/pom.xml | 2 +- common/pom.xml | 2 +- jar/pom.xml | 2 +- pom.xml | 2 +- sponge-legacy/pom.xml | 2 +- sponge/pom.xml | 2 +- velocity/pom.xml | 2 +- 8 files changed, 8 insertions(+), 8 deletions(-) diff --git a/bukkit/pom.xml b/bukkit/pom.xml index dd90db8b9..2f9b72580 100644 --- a/bukkit/pom.xml +++ b/bukkit/pom.xml @@ -5,7 +5,7 @@ viaversion-parent us.myles - 2.2.2 + 2.2.3-SNAPSHOT 4.0.0 diff --git a/bungee/pom.xml b/bungee/pom.xml index 4510799bf..4ab44f8ed 100644 --- a/bungee/pom.xml +++ b/bungee/pom.xml @@ -5,7 +5,7 @@ viaversion-parent us.myles - 2.2.2 + 2.2.3-SNAPSHOT 4.0.0 diff --git a/common/pom.xml b/common/pom.xml index fc434bfd4..8702fc7e4 100644 --- a/common/pom.xml +++ b/common/pom.xml @@ -5,7 +5,7 @@ viaversion-parent us.myles - 2.2.2 + 2.2.3-SNAPSHOT 4.0.0 diff --git a/jar/pom.xml b/jar/pom.xml index 8b2d6f998..abfd81dcc 100644 --- a/jar/pom.xml +++ b/jar/pom.xml @@ -5,7 +5,7 @@ viaversion-parent us.myles - 2.2.2 + 2.2.3-SNAPSHOT 4.0.0 viaversion-jar diff --git a/pom.xml b/pom.xml index 63a138cca..71746bcb6 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ us.myles viaversion-parent - 2.2.2 + 2.2.3-SNAPSHOT pom viaversion-parent diff --git a/sponge-legacy/pom.xml b/sponge-legacy/pom.xml index 69de92a70..b017da339 100644 --- a/sponge-legacy/pom.xml +++ b/sponge-legacy/pom.xml @@ -5,7 +5,7 @@ viaversion-parent us.myles - 2.2.2 + 2.2.3-SNAPSHOT 4.0.0 diff --git a/sponge/pom.xml b/sponge/pom.xml index 88f8e4702..6a804d202 100644 --- a/sponge/pom.xml +++ b/sponge/pom.xml @@ -5,7 +5,7 @@ viaversion-parent us.myles - 2.2.2 + 2.2.3-SNAPSHOT 4.0.0 diff --git a/velocity/pom.xml b/velocity/pom.xml index fefb13ce8..b2926dc5f 100644 --- a/velocity/pom.xml +++ b/velocity/pom.xml @@ -5,7 +5,7 @@ viaversion-parent us.myles - 2.2.2 + 2.2.3-SNAPSHOT 4.0.0 From 5cb5992d446abc34fe3249cfa3a2ae88fce757c8 Mon Sep 17 00:00:00 2001 From: KennyTV <28825609+KennyTV@users.noreply.github.com> Date: Fri, 20 Dec 2019 16:35:10 +0100 Subject: [PATCH 3/4] Fix Bungee injection on Java 12+ Fixes #1512 --- .../bungee/platform/BungeeViaInjector.java | 46 +++++++++++-------- 1 file changed, 28 insertions(+), 18 deletions(-) diff --git a/bungee/src/main/java/us/myles/ViaVersion/bungee/platform/BungeeViaInjector.java b/bungee/src/main/java/us/myles/ViaVersion/bungee/platform/BungeeViaInjector.java index edc66c086..7f0c0d76a 100644 --- a/bungee/src/main/java/us/myles/ViaVersion/bungee/platform/BungeeViaInjector.java +++ b/bungee/src/main/java/us/myles/ViaVersion/bungee/platform/BungeeViaInjector.java @@ -9,28 +9,43 @@ import us.myles.ViaVersion.bungee.handlers.BungeeChannelInitializer; import us.myles.ViaVersion.util.ReflectionUtil; import java.lang.reflect.Field; +import java.lang.reflect.Method; import java.lang.reflect.Modifier; import java.util.List; public class BungeeViaInjector implements ViaInjector { + @Override public void inject() throws Exception { try { - try { + Class pipelineUtils = Class.forName("net.md_5.bungee.netty.PipelineUtils"); + Field field = pipelineUtils.getDeclaredField("SERVER_CHILD"); + field.setAccessible(true); - Class pipelineUtils = Class.forName("net.md_5.bungee.netty.PipelineUtils"); - Field field = pipelineUtils.getDeclaredField("SERVER_CHILD"); - field.setAccessible(true); - // Remove any final stuff - Field modifiersField = Field.class.getDeclaredField("modifiers"); - modifiersField.setAccessible(true); - modifiersField.setInt(field, field.getModifiers() & ~Modifier.FINAL); - - BungeeChannelInitializer newInit = new BungeeChannelInitializer((ChannelInitializer) field.get(null)); - field.set(null, newInit); - } catch (NoSuchFieldException e) { - throw new Exception("Unable to find core component 'childHandler', please check your plugins. issue: "); + // Remove the final modifier (unless removed by a fork) + int modifiers = field.getModifiers(); + if (Modifier.isFinal(modifiers)) { + try { + Field modifiersField = Field.class.getDeclaredField("modifiers"); + modifiersField.setAccessible(true); + modifiersField.setInt(field, modifiers & ~Modifier.FINAL); + } catch (NoSuchFieldException e) { + // Java 12 compatibility *this is fine* + Method getDeclaredFields0 = Class.class.getDeclaredMethod("getDeclaredFields0", boolean.class); + getDeclaredFields0.setAccessible(true); + Field[] fields = (Field[]) getDeclaredFields0.invoke(Field.class, false); + for (Field classField : fields) { + if ("modifiers".equals(classField.getName())) { + classField.setAccessible(true); + classField.set(field, modifiers & ~Modifier.FINAL); + break; + } + } + } } + + BungeeChannelInitializer newInit = new BungeeChannelInitializer((ChannelInitializer) field.get(null)); + field.set(null, newInit); } catch (Exception e) { Via.getPlatform().getLogger().severe("Unable to inject ViaVersion, please post these details on our GitHub and ensure you're using a compatible server version."); throw e; @@ -62,11 +77,6 @@ public class BungeeViaInjector implements ViaInjector { Class pipelineUtils = Class.forName("net.md_5.bungee.netty.PipelineUtils"); Field field = pipelineUtils.getDeclaredField("SERVER_CHILD"); field.setAccessible(true); - // Remove any final stuff - Field modifiersField = Field.class.getDeclaredField("modifiers"); - modifiersField.setAccessible(true); - modifiersField.setInt(field, field.getModifiers() & ~Modifier.FINAL); - return (ChannelInitializer) field.get(null); } From c704813a6c2762c9120754427327da042ee3728a Mon Sep 17 00:00:00 2001 From: Gerrygames Date: Tue, 14 Jan 2020 17:51:39 +0100 Subject: [PATCH 4/4] 1.15.2-pre1 --- bukkit/pom.xml | 2 +- bungee/pom.xml | 2 +- common/pom.xml | 2 +- .../ViaVersion/api/protocol/ProtocolRegistry.java | 1 + .../ViaVersion/api/protocol/ProtocolVersion.java | 2 ++ .../Protocol1_15_2To1_15_1.java | 15 +++++++++++++++ jar/pom.xml | 2 +- pom.xml | 2 +- sponge-legacy/pom.xml | 2 +- sponge/pom.xml | 2 +- velocity/pom.xml | 2 +- 11 files changed, 26 insertions(+), 8 deletions(-) create mode 100644 common/src/main/java/us/myles/ViaVersion/protocols/protocol1_15_2to1_15_1/Protocol1_15_2To1_15_1.java diff --git a/bukkit/pom.xml b/bukkit/pom.xml index 2f9b72580..53296875a 100644 --- a/bukkit/pom.xml +++ b/bukkit/pom.xml @@ -5,7 +5,7 @@ viaversion-parent us.myles - 2.2.3-SNAPSHOT + 2.2.3-1.15.2-pre1 4.0.0 diff --git a/bungee/pom.xml b/bungee/pom.xml index 4ab44f8ed..251c2dd0f 100644 --- a/bungee/pom.xml +++ b/bungee/pom.xml @@ -5,7 +5,7 @@ viaversion-parent us.myles - 2.2.3-SNAPSHOT + 2.2.3-1.15.2-pre1 4.0.0 diff --git a/common/pom.xml b/common/pom.xml index 8702fc7e4..463f021a8 100644 --- a/common/pom.xml +++ b/common/pom.xml @@ -5,7 +5,7 @@ viaversion-parent us.myles - 2.2.3-SNAPSHOT + 2.2.3-1.15.2-pre1 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 db34588d7..37353b116 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 @@ -75,6 +75,7 @@ public class ProtocolRegistry { registerProtocol(new Protocol1_15To1_14_4(), Collections.singletonList(ProtocolVersion.v1_15.getId()), ProtocolVersion.v1_14_4.getId()); registerProtocol(new Protocol1_15_1To1_15(), Collections.singletonList(ProtocolVersion.v1_15_1.getId()), ProtocolVersion.v1_15.getId()); + registerProtocol(new Protocol1_15_1To1_15(), Collections.singletonList(ProtocolVersion.v1_15_2.getId()), ProtocolVersion.v1_15_1.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 3890db713..94a37b9c5 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 @@ -42,6 +42,7 @@ public class ProtocolVersion { public static final ProtocolVersion v1_14_4; public static final ProtocolVersion v1_15; public static final ProtocolVersion v1_15_1; + public static final ProtocolVersion v1_15_2; public static final ProtocolVersion unknown; private final int id; @@ -80,6 +81,7 @@ public class ProtocolVersion { register(v1_14_4 = new ProtocolVersion(498, "1.14.4")); register(v1_15 = new ProtocolVersion(573, "1.15")); register(v1_15_1 = new ProtocolVersion(575, "1.15.1")); + register(v1_15_2 = new ProtocolVersion(576, "1.15.2")); register(unknown = new ProtocolVersion(-1, "UNKNOWN")); } diff --git a/common/src/main/java/us/myles/ViaVersion/protocols/protocol1_15_2to1_15_1/Protocol1_15_2To1_15_1.java b/common/src/main/java/us/myles/ViaVersion/protocols/protocol1_15_2to1_15_1/Protocol1_15_2To1_15_1.java new file mode 100644 index 000000000..8a6b08b40 --- /dev/null +++ b/common/src/main/java/us/myles/ViaVersion/protocols/protocol1_15_2to1_15_1/Protocol1_15_2To1_15_1.java @@ -0,0 +1,15 @@ +package us.myles.ViaVersion.protocols.protocol1_15_2to1_15_1; + +import us.myles.ViaVersion.api.data.UserConnection; +import us.myles.ViaVersion.api.protocol.Protocol; + +public class Protocol1_15_2To1_15_1 extends Protocol { + + @Override + protected void registerPackets() { + } + + @Override + public void init(UserConnection user) { + } +} diff --git a/jar/pom.xml b/jar/pom.xml index abfd81dcc..dd0e2288e 100644 --- a/jar/pom.xml +++ b/jar/pom.xml @@ -5,7 +5,7 @@ viaversion-parent us.myles - 2.2.3-SNAPSHOT + 2.2.3-1.15.2-pre1 4.0.0 viaversion-jar diff --git a/pom.xml b/pom.xml index 71746bcb6..bd5bc7cf4 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ us.myles viaversion-parent - 2.2.3-SNAPSHOT + 2.2.3-1.15.2-pre1 pom viaversion-parent diff --git a/sponge-legacy/pom.xml b/sponge-legacy/pom.xml index b017da339..9373ec598 100644 --- a/sponge-legacy/pom.xml +++ b/sponge-legacy/pom.xml @@ -5,7 +5,7 @@ viaversion-parent us.myles - 2.2.3-SNAPSHOT + 2.2.3-1.15.2-pre1 4.0.0 diff --git a/sponge/pom.xml b/sponge/pom.xml index 6a804d202..4460ad89b 100644 --- a/sponge/pom.xml +++ b/sponge/pom.xml @@ -5,7 +5,7 @@ viaversion-parent us.myles - 2.2.3-SNAPSHOT + 2.2.3-1.15.2-pre1 4.0.0 diff --git a/velocity/pom.xml b/velocity/pom.xml index b2926dc5f..c552f3892 100644 --- a/velocity/pom.xml +++ b/velocity/pom.xml @@ -5,7 +5,7 @@ viaversion-parent us.myles - 2.2.3-SNAPSHOT + 2.2.3-1.15.2-pre1 4.0.0