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();
attributesPacket.setRuntimeEntityId(getPlayerEntity().getGeyserId());
List<AttributeData> 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<AdventureSetting> flags = new HashSet<>();
Set<AdventureSetting> 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);
}

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.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<ServerPlayEffectP
textPacket.setPlatformChatId("");
textPacket.setSourceName(null);
textPacket.setMessage("record.nowPlaying");
List<String> 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;

View file

@ -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;