From 80b8d18c315261ea9079b7833c0165236be25368 Mon Sep 17 00:00:00 2001 From: Camotoy <20743703+Camotoy@users.noreply.github.com> Date: Sat, 17 Jul 2021 09:43:25 -0400 Subject: [PATCH] Replace more instances of String#split with BlockUtils#getCleanIdentifier --- .../translators/inventory/holder/BlockInventoryHolder.java | 5 +++-- .../connector/registry/populator/BlockRegistryPopulator.java | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/inventory/holder/BlockInventoryHolder.java b/connector/src/main/java/org/geysermc/connector/network/translators/inventory/holder/BlockInventoryHolder.java index bb633780a..da14bdc70 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/inventory/holder/BlockInventoryHolder.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/inventory/holder/BlockInventoryHolder.java @@ -39,6 +39,7 @@ import org.geysermc.connector.inventory.Inventory; import org.geysermc.connector.network.session.GeyserSession; import org.geysermc.connector.network.translators.inventory.InventoryTranslator; import org.geysermc.connector.registry.BlockRegistries; +import org.geysermc.connector.utils.BlockUtils; import java.util.Collections; import java.util.HashSet; @@ -62,10 +63,10 @@ public class BlockInventoryHolder extends InventoryHolder { if (validBlocks != null) { Set validBlocksTemp = new HashSet<>(validBlocks.length + 1); Collections.addAll(validBlocksTemp, validBlocks); - validBlocksTemp.add(javaBlockIdentifier.split("\\[")[0]); + validBlocksTemp.add(BlockUtils.getCleanIdentifier(javaBlockIdentifier)); this.validBlocks = ImmutableSet.copyOf(validBlocksTemp); } else { - this.validBlocks = Collections.singleton(javaBlockIdentifier.split("\\[")[0]); + this.validBlocks = Collections.singleton(BlockUtils.getCleanIdentifier(javaBlockIdentifier)); } } diff --git a/connector/src/main/java/org/geysermc/connector/registry/populator/BlockRegistryPopulator.java b/connector/src/main/java/org/geysermc/connector/registry/populator/BlockRegistryPopulator.java index c2ce93d16..305e89a15 100644 --- a/connector/src/main/java/org/geysermc/connector/registry/populator/BlockRegistryPopulator.java +++ b/connector/src/main/java/org/geysermc/connector/registry/populator/BlockRegistryPopulator.java @@ -272,7 +272,7 @@ public class BlockRegistryPopulator { BlockStateValues.storeBlockStateValues(entry.getKey(), javaRuntimeId, entry.getValue()); - String cleanJavaIdentifier = entry.getKey().split("\\[")[0]; + String cleanJavaIdentifier = BlockUtils.getCleanIdentifier(entry.getKey()); String bedrockIdentifier = entry.getValue().get("bedrock_identifier").asText(); if (!BlockRegistries.JAVA_CLEAN_IDENTIFIERS.get().containsValue(cleanJavaIdentifier)) {