Minor touchups (#2011)

This commit is contained in:
Camotoy 2021-03-31 14:15:55 -04:00 committed by GitHub
parent 2f42a4c630
commit aa5c3c30e1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 9 additions and 13 deletions

View file

@ -490,11 +490,10 @@ public class GeyserSession implements CommandSender {
UpdateAttributesPacket attributesPacket = new UpdateAttributesPacket(); UpdateAttributesPacket attributesPacket = new UpdateAttributesPacket();
attributesPacket.setRuntimeEntityId(getPlayerEntity().getGeyserId()); attributesPacket.setRuntimeEntityId(getPlayerEntity().getGeyserId());
List<AttributeData> attributes = new ArrayList<>();
// Default move speed // Default move speed
// Bedrock clients move very fast by default until they get an attribute packet correcting the 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(Collections.singletonList(
attributesPacket.setAttributes(attributes); new AttributeData("minecraft:movement", 0.0f, 1024f, 0.1f, 0.1f)));
upstream.sendPacket(attributesPacket); upstream.sendPacket(attributesPacket);
GameRulesChangedPacket gamerulePacket = new GameRulesChangedPacket(); 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 // Let the user know there locale may take some time to download
// as it has to be extracted from a JAR // 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 // 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"); 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; noClip = gameMode == GameMode.SPECTATOR;
worldImmutable = gameMode == GameMode.ADVENTURE || gameMode == GameMode.SPECTATOR; worldImmutable = gameMode == GameMode.ADVENTURE || gameMode == GameMode.SPECTATOR;
Set<AdventureSetting> flags = new HashSet<>(); Set<AdventureSetting> flags = adventureSettingsPacket.getSettings();
if (canFly) { if (canFly) {
flags.add(AdventureSetting.MAY_FLY); flags.add(AdventureSetting.MAY_FLY);
} }
@ -1182,7 +1181,6 @@ public class GeyserSession implements CommandSender {
flags.add(AdventureSetting.AUTO_JUMP); flags.add(AdventureSetting.AUTO_JUMP);
adventureSettingsPacket.getSettings().addAll(flags);
sendUpstreamPacket(adventureSettingsPacket); sendUpstreamPacket(adventureSettingsPacket);
} }

View file

@ -39,10 +39,10 @@ import org.geysermc.connector.network.translators.PacketTranslator;
import org.geysermc.connector.network.translators.Translator; import org.geysermc.connector.network.translators.Translator;
import org.geysermc.connector.network.translators.effect.Effect; import org.geysermc.connector.network.translators.effect.Effect;
import org.geysermc.connector.network.translators.effect.EffectRegistry; import org.geysermc.connector.network.translators.effect.EffectRegistry;
import org.geysermc.connector.network.translators.world.block.BlockTranslator;
import org.geysermc.connector.utils.LocaleUtils; import org.geysermc.connector.utils.LocaleUtils;
import java.util.ArrayList; import java.util.Collections;
import java.util.List;
import java.util.Locale; import java.util.Locale;
@Translator(packet = ServerPlayEffectPacket.class) @Translator(packet = ServerPlayEffectPacket.class)
@ -74,10 +74,8 @@ public class JavaPlayEffectTranslator extends PacketTranslator<ServerPlayEffectP
textPacket.setPlatformChatId(""); textPacket.setPlatformChatId("");
textPacket.setSourceName(null); textPacket.setSourceName(null);
textPacket.setMessage("record.nowPlaying"); textPacket.setMessage("record.nowPlaying");
List<String> params = new ArrayList<>();
String recordString = "%item." + soundEvent.name().toLowerCase(Locale.ROOT) + ".desc"; String recordString = "%item." + soundEvent.name().toLowerCase(Locale.ROOT) + ".desc";
params.add(LocaleUtils.getLocaleString(recordString, session.getLocale())); textPacket.setParameters(Collections.singletonList(LocaleUtils.getLocaleString(recordString, session.getLocale())));
textPacket.setParameters(params);
session.sendUpstreamPacket(textPacket); session.sendUpstreamPacket(textPacket);
} }
return; return;

View file

@ -69,9 +69,9 @@ public enum FireworkColor {
private static final FireworkColor[] VALUES = values(); private static final FireworkColor[] VALUES = values();
@Getter @Getter
private byte bedrockID; private final byte bedrockID;
@Getter @Getter
private int javaID; private final int javaID;
FireworkColor(byte bedrockID, int javaID) { FireworkColor(byte bedrockID, int javaID) {
this.bedrockID = bedrockID; this.bedrockID = bedrockID;