From fd9346d4dae7bf58ff2ecee22c32e4ac7285367b Mon Sep 17 00:00:00 2001 From: Nassim Jahnke Date: Fri, 8 Oct 2021 17:29:05 +0200 Subject: [PATCH] Use validated channel in getNewPluginChannelId Fixes #2707 --- .../protocols/protocol1_13to1_12_2/data/MappingData.java | 4 ++-- .../protocol1_13to1_12_2/packets/InventoryPackets.java | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/common/src/main/java/com/viaversion/viaversion/protocols/protocol1_13to1_12_2/data/MappingData.java b/common/src/main/java/com/viaversion/viaversion/protocols/protocol1_13to1_12_2/data/MappingData.java index 35dee9e1d..4bb4d72ba 100644 --- a/common/src/main/java/com/viaversion/viaversion/protocols/protocol1_13to1_12_2/data/MappingData.java +++ b/common/src/main/java/com/viaversion/viaversion/protocols/protocol1_13to1_12_2/data/MappingData.java @@ -139,9 +139,9 @@ public class MappingData extends MappingDataBase { int separatorIndex = newId.indexOf(':'); // Vanilla parses an empty and a missing namespace as the minecraft namespace if (separatorIndex == -1) { - newId = "minecraft:" + newId; + return "minecraft:" + newId; } else if (separatorIndex == 0) { - newId = "minecraft" + newId; + return "minecraft" + newId; } return newId; } diff --git a/common/src/main/java/com/viaversion/viaversion/protocols/protocol1_13to1_12_2/packets/InventoryPackets.java b/common/src/main/java/com/viaversion/viaversion/protocols/protocol1_13to1_12_2/packets/InventoryPackets.java index e1fa3fd8b..6fe7a3d1a 100644 --- a/common/src/main/java/com/viaversion/viaversion/protocols/protocol1_13to1_12_2/packets/InventoryPackets.java +++ b/common/src/main/java/com/viaversion/viaversion/protocols/protocol1_13to1_12_2/packets/InventoryPackets.java @@ -483,7 +483,7 @@ public class InventoryPackets extends ItemRewriter { default: String mappedChannel = Protocol1_13To1_12_2.MAPPINGS.getChannelMappings().get(old); if (mappedChannel != null) return mappedChannel; - return MappingData.isValid1_13Channel(old) ? old : null; + return MappingData.validateNewChannel(old); } }