From ece4455130bac748fe7d9c472c4ef0c3564d8816 Mon Sep 17 00:00:00 2001 From: Myles Date: Thu, 18 May 2017 22:58:27 +0100 Subject: [PATCH 1/8] Fix chunk sending #667 --- .../ProtocolSnapshotTo1_11_1.java | 43 +++++++++++++++++-- 1 file changed, 40 insertions(+), 3 deletions(-) diff --git a/common/src/main/java/us/myles/ViaVersion/protocols/protocolsnapshotto1_11_1/ProtocolSnapshotTo1_11_1.java b/common/src/main/java/us/myles/ViaVersion/protocols/protocolsnapshotto1_11_1/ProtocolSnapshotTo1_11_1.java index 3e2a3f75a..b50522a63 100644 --- a/common/src/main/java/us/myles/ViaVersion/protocols/protocolsnapshotto1_11_1/ProtocolSnapshotTo1_11_1.java +++ b/common/src/main/java/us/myles/ViaVersion/protocols/protocolsnapshotto1_11_1/ProtocolSnapshotTo1_11_1.java @@ -93,7 +93,26 @@ public class ProtocolSnapshotTo1_11_1 extends Protocol { }); registerOutgoing(State.PLAY, 0x21, 0x22); registerOutgoing(State.PLAY, 0x22, 0x23); - registerOutgoing(State.PLAY, 0x23, 0x24); + // Join Packet + registerOutgoing(State.PLAY, 0x23, 0x24, new PacketRemapper() { + @Override + public void registerMap() { + map(Type.INT); // 0 - Entity ID + map(Type.UNSIGNED_BYTE); // 1 - Gamemode + map(Type.INT); // 2 - Dimension + + handler(new PacketHandler() { + @Override + public void handle(PacketWrapper wrapper) throws Exception { + ClientWorld clientChunks = wrapper.user().get(ClientWorld.class); + + int dimensionId = wrapper.get(Type.INT, 1); + clientChunks.setEnvironment(dimensionId); + } + }); + } + }); + registerOutgoing(State.PLAY, 0x24, 0x25); registerOutgoing(State.PLAY, 0x25, 0x26); registerOutgoing(State.PLAY, 0x26, 0x27); @@ -110,7 +129,24 @@ public class ProtocolSnapshotTo1_11_1 extends Protocol { // New packet at 0x31 registerOutgoing(State.PLAY, 0x31, 0x33); registerOutgoing(State.PLAY, 0x32, 0x34); - registerOutgoing(State.PLAY, 0x33, 0x35); + // Respawn Packet + registerOutgoing(State.PLAY, 0x33, 0x35, new PacketRemapper() { + @Override + public void registerMap() { + map(Type.INT); // 0 - Dimension ID + + handler(new PacketHandler() { + @Override + public void handle(PacketWrapper wrapper) throws Exception { + ClientWorld clientWorld = wrapper.user().get(ClientWorld.class); + + int dimensionId = wrapper.get(Type.INT, 0); + clientWorld.setEnvironment(dimensionId); + } + }); + } + }); + registerOutgoing(State.PLAY, 0x34, 0x36); registerOutgoing(State.PLAY, 0x35, 0x37); registerOutgoing(State.PLAY, 0x36, 0x38); @@ -257,6 +293,7 @@ public class ProtocolSnapshotTo1_11_1 extends Protocol { @Override public void init(UserConnection userConnection) { - + if (!userConnection.has(ClientWorld.class)) + userConnection.put(new ClientWorld(userConnection)); } } From 395d02041152989af30e332ecf2468115953793e Mon Sep 17 00:00:00 2001 From: Myles Date: Fri, 19 May 2017 22:32:21 +0100 Subject: [PATCH 2/8] Update to 1.12-pre5 --- bukkit/pom.xml | 2 +- bungee/pom.xml | 4 +- common/pom.xml | 2 +- .../api/protocol/ProtocolVersion.java | 2 +- .../ProtocolSnapshotTo1_11_1.java | 95 +++++++------------ jar/pom.xml | 2 +- pom.xml | 2 +- sponge-legacy/pom.xml | 2 +- sponge/pom.xml | 2 +- 9 files changed, 41 insertions(+), 72 deletions(-) diff --git a/bukkit/pom.xml b/bukkit/pom.xml index 987849fd2..582e3b99c 100644 --- a/bukkit/pom.xml +++ b/bukkit/pom.xml @@ -5,7 +5,7 @@ viaversion-parent us.myles - 1.0.5-1_12pre4 + 1.0.5-1_12pre5 4.0.0 diff --git a/bungee/pom.xml b/bungee/pom.xml index c701a93a4..3c514cd2e 100644 --- a/bungee/pom.xml +++ b/bungee/pom.xml @@ -5,7 +5,7 @@ viaversion-parent us.myles - 1.0.5-1_12pre4 + 1.0.5-1_12pre5 4.0.0 @@ -37,7 +37,7 @@ us.myles viaversion-common - 1.0.5-1_12pre4 + 1.0.5-1_12pre5 \ No newline at end of file diff --git a/common/pom.xml b/common/pom.xml index 98df94c14..e0dc67a7e 100644 --- a/common/pom.xml +++ b/common/pom.xml @@ -5,7 +5,7 @@ viaversion-parent us.myles - 1.0.5-1_12pre4 + 1.0.5-1_12pre5 4.0.0 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 d2c187791..2deb78434 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 @@ -55,7 +55,7 @@ public class ProtocolVersion { register(v1_10 = new ProtocolVersion(210, "1.10")); register(v1_11 = new ProtocolVersion(315, "1.11")); register(v1_11_1 = new ProtocolVersion(316, "1.11.1")); - register(snapshot = new ProtocolVersion(331, "1.12-pre4")); + register(snapshot = new ProtocolVersion(332, "1.12-pre5")); register(unknown = new ProtocolVersion(-1, "UNKNOWN")); } diff --git a/common/src/main/java/us/myles/ViaVersion/protocols/protocolsnapshotto1_11_1/ProtocolSnapshotTo1_11_1.java b/common/src/main/java/us/myles/ViaVersion/protocols/protocolsnapshotto1_11_1/ProtocolSnapshotTo1_11_1.java index b50522a63..852984c87 100644 --- a/common/src/main/java/us/myles/ViaVersion/protocols/protocolsnapshotto1_11_1/ProtocolSnapshotTo1_11_1.java +++ b/common/src/main/java/us/myles/ViaVersion/protocols/protocolsnapshotto1_11_1/ProtocolSnapshotTo1_11_1.java @@ -19,37 +19,11 @@ public class ProtocolSnapshotTo1_11_1 extends Protocol { @Override protected void registerPackets() { - // As of 1.12-pre4 + // As of 1.12-pre5 // Outgoing - // New packet at 0x08 - registerOutgoing(State.PLAY, 0x08, 0x09); - registerOutgoing(State.PLAY, 0x09, 0x0a); - registerOutgoing(State.PLAY, 0x0a, 0x0b); - registerOutgoing(State.PLAY, 0x0b, 0x0c); - // error here, 0x0c - registerOutgoing(State.PLAY, 0x0c, 0x0d); - registerOutgoing(State.PLAY, 0x0d, 0x0e); - registerOutgoing(State.PLAY, 0x0e, 0x0f); - registerOutgoing(State.PLAY, 0x0f, 0x10); - registerOutgoing(State.PLAY, 0x10, 0x11); - registerOutgoing(State.PLAY, 0x11, 0x12); - registerOutgoing(State.PLAY, 0x12, 0x13); - registerOutgoing(State.PLAY, 0x13, 0x14); - registerOutgoing(State.PLAY, 0x14, 0x15); - registerOutgoing(State.PLAY, 0x15, 0x16); - registerOutgoing(State.PLAY, 0x16, 0x17); - registerOutgoing(State.PLAY, 0x17, 0x18); - registerOutgoing(State.PLAY, 0x18, 0x19); - registerOutgoing(State.PLAY, 0x19, 0x1a); - registerOutgoing(State.PLAY, 0x1a, 0x1b); - registerOutgoing(State.PLAY, 0x1b, 0x1c); - registerOutgoing(State.PLAY, 0x1c, 0x1d); - registerOutgoing(State.PLAY, 0x1d, 0x1e); - registerOutgoing(State.PLAY, 0x1e, 0x1f); - registerOutgoing(State.PLAY, 0x1f, 0x20); // Chunk Data - registerOutgoing(State.PLAY, 0x20, 0x21, new PacketRemapper() { + registerOutgoing(State.PLAY, 0x20, 0x20, new PacketRemapper() { @Override public void registerMap() { handler(new PacketHandler() { @@ -91,10 +65,8 @@ public class ProtocolSnapshotTo1_11_1 extends Protocol { }); } }); - registerOutgoing(State.PLAY, 0x21, 0x22); - registerOutgoing(State.PLAY, 0x22, 0x23); // Join Packet - registerOutgoing(State.PLAY, 0x23, 0x24, new PacketRemapper() { + registerOutgoing(State.PLAY, 0x23, 0x23, new PacketRemapper() { @Override public void registerMap() { map(Type.INT); // 0 - Entity ID @@ -113,24 +85,17 @@ public class ProtocolSnapshotTo1_11_1 extends Protocol { } }); - registerOutgoing(State.PLAY, 0x24, 0x25); + // 0x28 moved to 0x25 + registerOutgoing(State.PLAY, 0x28, 0x25); registerOutgoing(State.PLAY, 0x25, 0x26); registerOutgoing(State.PLAY, 0x26, 0x27); registerOutgoing(State.PLAY, 0x27, 0x28); - registerOutgoing(State.PLAY, 0x28, 0x29); - registerOutgoing(State.PLAY, 0x29, 0x2a); - registerOutgoing(State.PLAY, 0x2a, 0x2b); - registerOutgoing(State.PLAY, 0x2b, 0x2c); - registerOutgoing(State.PLAY, 0x2c, 0x2d); - registerOutgoing(State.PLAY, 0x2d, 0x2e); - registerOutgoing(State.PLAY, 0x2e, 0x2f); - registerOutgoing(State.PLAY, 0x2f, 0x30); - registerOutgoing(State.PLAY, 0x30, 0x32); - // New packet at 0x31 - registerOutgoing(State.PLAY, 0x31, 0x33); - registerOutgoing(State.PLAY, 0x32, 0x34); + // New packet at 0x30 + registerOutgoing(State.PLAY, 0x30, 0x31); + registerOutgoing(State.PLAY, 0x31, 0x32); + registerOutgoing(State.PLAY, 0x32, 0x33); // Respawn Packet - registerOutgoing(State.PLAY, 0x33, 0x35, new PacketRemapper() { + registerOutgoing(State.PLAY, 0x33, 0x34, new PacketRemapper() { @Override public void registerMap() { map(Type.INT); // 0 - Dimension ID @@ -147,7 +112,8 @@ public class ProtocolSnapshotTo1_11_1 extends Protocol { } }); - registerOutgoing(State.PLAY, 0x34, 0x36); + registerOutgoing(State.PLAY, 0x34, 0x35); + // New packet at 0x36 registerOutgoing(State.PLAY, 0x35, 0x37); registerOutgoing(State.PLAY, 0x36, 0x38); registerOutgoing(State.PLAY, 0x37, 0x39); @@ -166,7 +132,7 @@ public class ProtocolSnapshotTo1_11_1 extends Protocol { registerOutgoing(State.PLAY, 0x44, 0x46); registerOutgoing(State.PLAY, 0x45, 0x47); - // Sound effect, TODO: This changed in 17w15a + // Sound effect, should work fine, might need checking for parrots? registerOutgoing(State.PLAY, 0x46, 0x48, new PacketRemapper() { @Override public void registerMap() { @@ -195,9 +161,10 @@ public class ProtocolSnapshotTo1_11_1 extends Protocol { registerOutgoing(State.PLAY, 0x47, 0x49); registerOutgoing(State.PLAY, 0x48, 0x4a); registerOutgoing(State.PLAY, 0x49, 0x4b); - registerOutgoing(State.PLAY, 0x4a, 0x4c); - registerOutgoing(State.PLAY, 0x4b, 0x4d); - // New packet at 0x4e + // New packet at 0x4c + registerOutgoing(State.PLAY, 0x4a, 0x4d); + registerOutgoing(State.PLAY, 0x4d, 0x4e); + // Incoming // New packet at 0x01 @@ -224,10 +191,12 @@ public class ProtocolSnapshotTo1_11_1 extends Protocol { registerIncoming(State.PLAY, 0x09, 0x0a); registerIncoming(State.PLAY, 0x0a, 0x0b); registerIncoming(State.PLAY, 0x0b, 0x0c); - registerIncoming(State.PLAY, 0x0c, 0x0d); - registerIncoming(State.PLAY, 0x0d, 0x0e); - registerIncoming(State.PLAY, 0x0e, 0x0f); - registerIncoming(State.PLAY, 0x0f, 0x10); + // Mojang moved 0x0D to 0x0F + registerIncoming(State.PLAY, 0x0f, 0x0d); + + registerIncoming(State.PLAY, 0x0c, 0x0e); + registerIncoming(State.PLAY, 0x0d, 0x0f); + registerIncoming(State.PLAY, 0x0e, 0x10); registerIncoming(State.PLAY, 0x10, 0x11); registerIncoming(State.PLAY, 0x11, 0x12); registerIncoming(State.PLAY, 0x12, 0x13); @@ -248,15 +217,8 @@ public class ProtocolSnapshotTo1_11_1 extends Protocol { } }); registerIncoming(State.PLAY, 0x16, 0x18); - registerIncoming(State.PLAY, 0x17, 0x19); - registerIncoming(State.PLAY, 0x18, 0x1a); - registerIncoming(State.PLAY, 0x19, 0x1b); - registerIncoming(State.PLAY, 0x1a, 0x1c); - registerIncoming(State.PLAY, 0x1b, 0x1d); - registerIncoming(State.PLAY, 0x1c, 0x1e); - registerIncoming(State.PLAY, 0x1d, 0x1f); - // New packet at 0x20 - registerIncoming(State.PLAY, 0x20, 0x20, new PacketRemapper() { + // New packet 0x19 + registerIncoming(State.PLAY, 0x19, 0x19, new PacketRemapper() { @Override public void registerMap() { handler(new PacketHandler() { @@ -268,6 +230,13 @@ public class ProtocolSnapshotTo1_11_1 extends Protocol { }); } }); + registerIncoming(State.PLAY, 0x17, 0x1a); + registerIncoming(State.PLAY, 0x18, 0x1b); + registerIncoming(State.PLAY, 0x19, 0x1c); + registerIncoming(State.PLAY, 0x1a, 0x1d); + registerIncoming(State.PLAY, 0x1b, 0x1e); + registerIncoming(State.PLAY, 0x1c, 0x1f); + registerIncoming(State.PLAY, 0x1d, 0x20); } private int getNewSoundId(int id) { //TODO Make it better, suggestions are welcome. It's ugly and hardcoded now. diff --git a/jar/pom.xml b/jar/pom.xml index bee33f9ea..ad8e15873 100644 --- a/jar/pom.xml +++ b/jar/pom.xml @@ -5,7 +5,7 @@ viaversion-parent us.myles - 1.0.5-1_12pre4 + 1.0.5-1_12pre5 4.0.0 viaversion-jar diff --git a/pom.xml b/pom.xml index fc98a860f..79a79905f 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ us.myles viaversion-parent - 1.0.5-1_12pre4 + 1.0.5-1_12pre5 pom viaversion-parent diff --git a/sponge-legacy/pom.xml b/sponge-legacy/pom.xml index 2f8d08e44..64f994be9 100644 --- a/sponge-legacy/pom.xml +++ b/sponge-legacy/pom.xml @@ -5,7 +5,7 @@ viaversion-parent us.myles - 1.0.5-1_12pre4 + 1.0.5-1_12pre5 4.0.0 diff --git a/sponge/pom.xml b/sponge/pom.xml index a078b7283..7230b6939 100644 --- a/sponge/pom.xml +++ b/sponge/pom.xml @@ -5,7 +5,7 @@ viaversion-parent us.myles - 1.0.5-1_12pre4 + 1.0.5-1_12pre5 4.0.0 From a09e8b9f4d464108fce73b48090d758c2df4e599 Mon Sep 17 00:00:00 2001 From: Myles Date: Fri, 19 May 2017 22:35:24 +0100 Subject: [PATCH 3/8] Fix comment with 1.12-pre5 --- .../protocolsnapshotto1_11_1/ProtocolSnapshotTo1_11_1.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/common/src/main/java/us/myles/ViaVersion/protocols/protocolsnapshotto1_11_1/ProtocolSnapshotTo1_11_1.java b/common/src/main/java/us/myles/ViaVersion/protocols/protocolsnapshotto1_11_1/ProtocolSnapshotTo1_11_1.java index 852984c87..64b894953 100644 --- a/common/src/main/java/us/myles/ViaVersion/protocols/protocolsnapshotto1_11_1/ProtocolSnapshotTo1_11_1.java +++ b/common/src/main/java/us/myles/ViaVersion/protocols/protocolsnapshotto1_11_1/ProtocolSnapshotTo1_11_1.java @@ -191,10 +191,10 @@ public class ProtocolSnapshotTo1_11_1 extends Protocol { registerIncoming(State.PLAY, 0x09, 0x0a); registerIncoming(State.PLAY, 0x0a, 0x0b); registerIncoming(State.PLAY, 0x0b, 0x0c); - // Mojang moved 0x0D to 0x0F + // Mojang swapped 0x0F to 0x0D registerIncoming(State.PLAY, 0x0f, 0x0d); - registerIncoming(State.PLAY, 0x0c, 0x0e); + // Mojang swapped 0x0F to 0x0D registerIncoming(State.PLAY, 0x0d, 0x0f); registerIncoming(State.PLAY, 0x0e, 0x10); registerIncoming(State.PLAY, 0x10, 0x11); From 7d001c61a8a090f556fa3a4ccf6185a4f0caa03d Mon Sep 17 00:00:00 2001 From: Myles Date: Mon, 22 May 2017 13:17:24 +0100 Subject: [PATCH 4/8] =?UTF-8?q?Fix=20packet=20id=20typo=20causing=20random?= =?UTF-8?q?=20dc=E2=80=99s=20#669?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../protocolsnapshotto1_11_1/ProtocolSnapshotTo1_11_1.java | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/common/src/main/java/us/myles/ViaVersion/protocols/protocolsnapshotto1_11_1/ProtocolSnapshotTo1_11_1.java b/common/src/main/java/us/myles/ViaVersion/protocols/protocolsnapshotto1_11_1/ProtocolSnapshotTo1_11_1.java index 64b894953..4cef64ddc 100644 --- a/common/src/main/java/us/myles/ViaVersion/protocols/protocolsnapshotto1_11_1/ProtocolSnapshotTo1_11_1.java +++ b/common/src/main/java/us/myles/ViaVersion/protocols/protocolsnapshotto1_11_1/ProtocolSnapshotTo1_11_1.java @@ -163,8 +163,7 @@ public class ProtocolSnapshotTo1_11_1 extends Protocol { registerOutgoing(State.PLAY, 0x49, 0x4b); // New packet at 0x4c registerOutgoing(State.PLAY, 0x4a, 0x4d); - registerOutgoing(State.PLAY, 0x4d, 0x4e); - + registerOutgoing(State.PLAY, 0x4b, 0x4e); // Incoming // New packet at 0x01 From ce286cf322f820e1f80d2da654a0e6c83ea5115a Mon Sep 17 00:00:00 2001 From: Myles Date: Mon, 22 May 2017 13:38:22 +0100 Subject: [PATCH 5/8] Remove unnecessary synchronising --- .../bukkit/platform/BukkitViaInjector.java | 14 ++++++-------- .../sponge/platform/SpongeViaInjector.java | 14 ++++++-------- 2 files changed, 12 insertions(+), 16 deletions(-) diff --git a/bukkit/src/main/java/us/myles/ViaVersion/bukkit/platform/BukkitViaInjector.java b/bukkit/src/main/java/us/myles/ViaVersion/bukkit/platform/BukkitViaInjector.java index 3025e18c1..29631778a 100644 --- a/bukkit/src/main/java/us/myles/ViaVersion/bukkit/platform/BukkitViaInjector.java +++ b/bukkit/src/main/java/us/myles/ViaVersion/bukkit/platform/BukkitViaInjector.java @@ -37,14 +37,12 @@ public class BukkitViaInjector implements ViaInjector { // Inject the list List wrapper = new ListWrapper((List) value) { @Override - public synchronized void handleAdd(Object o) { - synchronized (this) { - if (o instanceof ChannelFuture) { - try { - injectChannelFuture((ChannelFuture) o); - } catch (Exception e) { - e.printStackTrace(); - } + public void handleAdd(Object o) { + if (o instanceof ChannelFuture) { + try { + injectChannelFuture((ChannelFuture) o); + } catch (Exception e) { + e.printStackTrace(); } } } diff --git a/sponge/src/main/java/us/myles/ViaVersion/sponge/platform/SpongeViaInjector.java b/sponge/src/main/java/us/myles/ViaVersion/sponge/platform/SpongeViaInjector.java index a6ee44359..530eefadf 100644 --- a/sponge/src/main/java/us/myles/ViaVersion/sponge/platform/SpongeViaInjector.java +++ b/sponge/src/main/java/us/myles/ViaVersion/sponge/platform/SpongeViaInjector.java @@ -36,14 +36,12 @@ public class SpongeViaInjector implements ViaInjector { // Inject the list List wrapper = new ListWrapper((List) value) { @Override - public synchronized void handleAdd(Object o) { - synchronized (this) { - if (o instanceof ChannelFuture) { - try { - injectChannelFuture((ChannelFuture) o); - } catch (Exception e) { - e.printStackTrace(); - } + public void handleAdd(Object o) { + if (o instanceof ChannelFuture) { + try { + injectChannelFuture((ChannelFuture) o); + } catch (Exception e) { + e.printStackTrace(); } } } From 3160c076f0a44160bba1ff37ac072920f23683aa Mon Sep 17 00:00:00 2001 From: Myles Date: Mon, 22 May 2017 15:49:42 +0100 Subject: [PATCH 6/8] Add discord server --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 4306572e7..ee62161dd 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,7 @@ # ViaVersion 1.0.5 - Spigot, Sponge, BungeeCord [![Build Status](https://travis-ci.org/MylesIsCool/ViaVersion.svg?branch=master)](https://travis-ci.org/MylesIsCool/ViaVersion) [![Gitter](https://badges.gitter.im/MylesIsCool/ViaVersion.svg)](https://gitter.im/MylesIsCool/ViaVersion) +[![Discord](https://img.shields.io/badge/chat-on%20discord-blue.svg)](https://viaversion.com/discord) IRC: [#viaversion](http://irc.spi.gt/iris/?channels=viaversion) on irc.spi.gt for Support. From a818b9a9d48b259e3e72b07d30942895b4818eb4 Mon Sep 17 00:00:00 2001 From: Myles Date: Mon, 22 May 2017 15:49:42 +0100 Subject: [PATCH 7/8] Add discord server --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 9c1fa178e..5f32bee51 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,7 @@ # ViaVersion 1.0.4 - Spigot, Sponge, BungeeCord [![Build Status](https://travis-ci.org/MylesIsCool/ViaVersion.svg?branch=master)](https://travis-ci.org/MylesIsCool/ViaVersion) [![Gitter](https://badges.gitter.im/MylesIsCool/ViaVersion.svg)](https://gitter.im/MylesIsCool/ViaVersion) +[![Discord](https://img.shields.io/badge/chat-on%20discord-blue.svg)](https://viaversion.com/discord) IRC: [#viaversion](http://irc.spi.gt/iris/?channels=viaversion) on irc.spi.gt for Support. From 5b5f0dce24a0d6555dbf687acb1c9553137417dd Mon Sep 17 00:00:00 2001 From: Matsv Date: Thu, 25 May 2017 18:14:56 +0200 Subject: [PATCH 8/8] Manually hide Entity BossBars on (from 1.8.x) server switch. Fixes #666 --- .../bungee/handlers/BungeeServerHandler.java | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/bungee/src/main/java/us/myles/ViaVersion/bungee/handlers/BungeeServerHandler.java b/bungee/src/main/java/us/myles/ViaVersion/bungee/handlers/BungeeServerHandler.java index 7e77b9b6e..5bb6406ba 100644 --- a/bungee/src/main/java/us/myles/ViaVersion/bungee/handlers/BungeeServerHandler.java +++ b/bungee/src/main/java/us/myles/ViaVersion/bungee/handlers/BungeeServerHandler.java @@ -8,6 +8,7 @@ import net.md_5.bungee.event.EventHandler; import net.md_5.bungee.event.EventPriority; import us.myles.ViaVersion.api.Pair; import us.myles.ViaVersion.api.Via; +import us.myles.ViaVersion.api.boss.BossBar; import us.myles.ViaVersion.api.data.UserConnection; import us.myles.ViaVersion.api.protocol.Protocol; import us.myles.ViaVersion.api.protocol.ProtocolPipeline; @@ -15,6 +16,7 @@ import us.myles.ViaVersion.api.protocol.ProtocolRegistry; import us.myles.ViaVersion.bungee.service.ProtocolDetectorService; import us.myles.ViaVersion.bungee.storage.BungeeStorage; import us.myles.ViaVersion.protocols.base.ProtocolInfo; +import us.myles.ViaVersion.protocols.protocol1_9to1_8.storage.EntityTracker; import java.lang.reflect.Field; import java.lang.reflect.InvocationTargetException; @@ -79,6 +81,15 @@ public class BungeeServerHandler implements Listener { public void checkServerChange(ServerConnectedEvent e, UserConnection user) throws Exception { if (user == null) return; + // Manually hide ViaVersion-created BossBars if the childserver was version 1.8.x (#666) + if (user.has(EntityTracker.class)) { + EntityTracker tracker = user.get(EntityTracker.class); + + if (tracker.getBossBarMap() != null) + for (BossBar bar : tracker.getBossBarMap().values()) + bar.hide(); + } + // Handle server/version change if (user.has(BungeeStorage.class)) { BungeeStorage storage = user.get(BungeeStorage.class); ProxiedPlayer player = storage.getPlayer();