From d1c571d710ea2c14a606b6e224a76bebed967a84 Mon Sep 17 00:00:00 2001 From: Camotoy <20743703+Camotoy@users.noreply.github.com> Date: Sat, 26 Dec 2020 19:51:11 -0500 Subject: [PATCH] Fix anvil renaming (#1744) Turns out it *was* our fault. Oops. --- connector/pom.xml | 2 +- .../network/LoggingPacketHandler.java | 44 +++++++++++++++--- .../bedrock/BedrockFilterTextTranslator.java | 45 +++++++++++++++++++ 3 files changed, 85 insertions(+), 6 deletions(-) create mode 100644 connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockFilterTextTranslator.java diff --git a/connector/pom.xml b/connector/pom.xml index f2133f02..de095a33 100644 --- a/connector/pom.xml +++ b/connector/pom.xml @@ -32,7 +32,7 @@ com.github.CloudburstMC.Protocol bedrock-v422 - 87d862d69d + d41b84e86c compile diff --git a/connector/src/main/java/org/geysermc/connector/network/LoggingPacketHandler.java b/connector/src/main/java/org/geysermc/connector/network/LoggingPacketHandler.java index c41c64c7..c939f5b7 100644 --- a/connector/src/main/java/org/geysermc/connector/network/LoggingPacketHandler.java +++ b/connector/src/main/java/org/geysermc/connector/network/LoggingPacketHandler.java @@ -132,11 +132,6 @@ public class LoggingPacketHandler implements BedrockPacketHandler { return defaultHandler(packet); } - @Override - public boolean handle(EntityFallPacket packet) { - return defaultHandler(packet); - } - @Override public boolean handle(EntityPickRequestPacket packet) { return defaultHandler(packet); @@ -826,4 +821,43 @@ public class LoggingPacketHandler implements BedrockPacketHandler { public boolean handle(PositionTrackingDBServerBroadcastPacket packet) { return defaultHandler(packet); } + + // 1.16.100 new packets + + @Override + public boolean handle(MotionPredictionHintsPacket packet) { + return defaultHandler(packet); + } + + @Override + public boolean handle(AnimateEntityPacket packet) { + return defaultHandler(packet); + } + + @Override + public boolean handle(CameraShakePacket packet) { + return defaultHandler(packet); + } + + @Override + public boolean handle(PlayerFogPacket packet) { + return defaultHandler(packet); + } + + @Override + public boolean handle(CorrectPlayerMovePredictionPacket packet) { + return defaultHandler(packet); + } + + @Override + public boolean handle(ItemComponentPacket packet) { + return defaultHandler(packet); + } + + // 1.16.200 new packet + + @Override + public boolean handle(FilterTextPacket packet) { + return defaultHandler(packet); + } } \ No newline at end of file diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockFilterTextTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockFilterTextTranslator.java new file mode 100644 index 00000000..8c963076 --- /dev/null +++ b/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockFilterTextTranslator.java @@ -0,0 +1,45 @@ +/* + * Copyright (c) 2019-2020 GeyserMC. http://geysermc.org + * + * 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. + * + * @author GeyserMC + * @link https://github.com/GeyserMC/Geyser + */ + +package org.geysermc.connector.network.translators.bedrock; + +import com.nukkitx.protocol.bedrock.packet.FilterTextPacket; +import org.geysermc.connector.network.session.GeyserSession; +import org.geysermc.connector.network.translators.PacketTranslator; +import org.geysermc.connector.network.translators.Translator; + +/** + * Used to send strings to the server and filter out unwanted words. + * Java doesn't care, so we don't care, and we approve all strings. + */ +@Translator(packet = FilterTextPacket.class) +public class BedrockFilterTextTranslator extends PacketTranslator { + + @Override + public void translate(FilterTextPacket packet, GeyserSession session) { + packet.setFromServer(true); + session.sendUpstreamPacket(packet); + } +}