From aa5c3c30e13f01ffd7a4418c298bcf7ba4a1ac9d Mon Sep 17 00:00:00 2001 From: Camotoy <20743703+Camotoy@users.noreply.github.com> Date: Wed, 31 Mar 2021 14:15:55 -0400 Subject: [PATCH] Minor touchups (#2011) --- .../connector/network/session/GeyserSession.java | 10 ++++------ .../java/world/JavaPlayEffectTranslator.java | 8 +++----- .../org/geysermc/connector/utils/FireworkColor.java | 4 ++-- 3 files changed, 9 insertions(+), 13 deletions(-) diff --git a/connector/src/main/java/org/geysermc/connector/network/session/GeyserSession.java b/connector/src/main/java/org/geysermc/connector/network/session/GeyserSession.java index 436b6db11..ab01963eb 100644 --- a/connector/src/main/java/org/geysermc/connector/network/session/GeyserSession.java +++ b/connector/src/main/java/org/geysermc/connector/network/session/GeyserSession.java @@ -490,11 +490,10 @@ public class GeyserSession implements CommandSender { UpdateAttributesPacket attributesPacket = new UpdateAttributesPacket(); attributesPacket.setRuntimeEntityId(getPlayerEntity().getGeyserId()); - List attributes = new ArrayList<>(); // Default move speed // Bedrock clients move very fast by default until they get an attribute packet correcting the speed - attributes.add(new AttributeData("minecraft:movement", 0.0f, 1024f, 0.1f, 0.1f)); - attributesPacket.setAttributes(attributes); + attributesPacket.setAttributes(Collections.singletonList( + new AttributeData("minecraft:movement", 0.0f, 1024f, 0.1f, 0.1f))); upstream.sendPacket(attributesPacket); GameRulesChangedPacket gamerulePacket = new GameRulesChangedPacket(); @@ -709,7 +708,7 @@ public class GeyserSession implements CommandSender { // Let the user know there locale may take some time to download // as it has to be extracted from a JAR - if (locale.toLowerCase().equals("en_us") && !LocaleUtils.LOCALE_MAPPINGS.containsKey("en_us")) { + if (locale.equalsIgnoreCase("en_us") && !LocaleUtils.LOCALE_MAPPINGS.containsKey("en_us")) { // This should probably be left hardcoded as it will only show for en_us clients sendMessage("Loading your locale (en_us); if this isn't already downloaded, this may take some time"); } @@ -1163,7 +1162,7 @@ public class GeyserSession implements CommandSender { noClip = gameMode == GameMode.SPECTATOR; worldImmutable = gameMode == GameMode.ADVENTURE || gameMode == GameMode.SPECTATOR; - Set flags = new HashSet<>(); + Set flags = adventureSettingsPacket.getSettings(); if (canFly) { flags.add(AdventureSetting.MAY_FLY); } @@ -1182,7 +1181,6 @@ public class GeyserSession implements CommandSender { flags.add(AdventureSetting.AUTO_JUMP); - adventureSettingsPacket.getSettings().addAll(flags); sendUpstreamPacket(adventureSettingsPacket); } diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/world/JavaPlayEffectTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/world/JavaPlayEffectTranslator.java index f7285af2e..7f15213ca 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/java/world/JavaPlayEffectTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/world/JavaPlayEffectTranslator.java @@ -39,10 +39,10 @@ import org.geysermc.connector.network.translators.PacketTranslator; import org.geysermc.connector.network.translators.Translator; import org.geysermc.connector.network.translators.effect.Effect; import org.geysermc.connector.network.translators.effect.EffectRegistry; +import org.geysermc.connector.network.translators.world.block.BlockTranslator; import org.geysermc.connector.utils.LocaleUtils; -import java.util.ArrayList; -import java.util.List; +import java.util.Collections; import java.util.Locale; @Translator(packet = ServerPlayEffectPacket.class) @@ -74,10 +74,8 @@ public class JavaPlayEffectTranslator extends PacketTranslator params = new ArrayList<>(); String recordString = "%item." + soundEvent.name().toLowerCase(Locale.ROOT) + ".desc"; - params.add(LocaleUtils.getLocaleString(recordString, session.getLocale())); - textPacket.setParameters(params); + textPacket.setParameters(Collections.singletonList(LocaleUtils.getLocaleString(recordString, session.getLocale()))); session.sendUpstreamPacket(textPacket); } return; diff --git a/connector/src/main/java/org/geysermc/connector/utils/FireworkColor.java b/connector/src/main/java/org/geysermc/connector/utils/FireworkColor.java index 36eda6adc..8846e477c 100644 --- a/connector/src/main/java/org/geysermc/connector/utils/FireworkColor.java +++ b/connector/src/main/java/org/geysermc/connector/utils/FireworkColor.java @@ -69,9 +69,9 @@ public enum FireworkColor { private static final FireworkColor[] VALUES = values(); @Getter - private byte bedrockID; + private final byte bedrockID; @Getter - private int javaID; + private final int javaID; FireworkColor(byte bedrockID, int javaID) { this.bedrockID = bedrockID;