Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Minor touchups #2011

Merged
merged 2 commits into from
Mar 31, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -415,10 +415,10 @@ public void connect(RemoteServer remoteServer) {

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));
List<AttributeData> attributes = Collections.singletonList(
new AttributeData("minecraft:movement", 0.0f, 1024f, 0.1f, 0.1f));
attributesPacket.setAttributes(attributes);
Camotoy marked this conversation as resolved.
Show resolved Hide resolved
upstream.sendPacket(attributesPacket);

Expand Down Expand Up @@ -624,7 +624,7 @@ public void connected(ConnectedEvent event) {

// 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");
}
Expand Down Expand Up @@ -1026,7 +1026,7 @@ public void sendAdventureSettings() {
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);
}
Expand All @@ -1045,7 +1045,6 @@ public void sendAdventureSettings() {

flags.add(AdventureSetting.AUTO_JUMP);

adventureSettingsPacket.getSettings().addAll(flags);
sendUpstreamPacket(adventureSettingsPacket);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@

package org.geysermc.connector.network.translators.java.world;

import com.github.steveice10.mc.protocol.data.game.world.effect.ParticleEffect;
import com.github.steveice10.mc.protocol.data.game.world.effect.*;
import com.github.steveice10.mc.protocol.packet.ingame.server.world.ServerPlayEffectPacket;
import com.nukkitx.math.vector.Vector3f;
Expand All @@ -38,12 +37,12 @@
import org.geysermc.connector.network.session.GeyserSession;
import org.geysermc.connector.network.translators.PacketTranslator;
import org.geysermc.connector.network.translators.Translator;
import org.geysermc.connector.network.translators.world.block.BlockTranslator;
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.Collections;
import java.util.List;
import java.util.Locale;

Expand Down Expand Up @@ -76,9 +75,8 @@ public void translate(ServerPlayEffectPacket packet, GeyserSession session) {
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()));
List<String> params = Collections.singletonList(LocaleUtils.getLocaleString(recordString, session.getLocale()));
textPacket.setParameters(params);
Camotoy marked this conversation as resolved.
Show resolved Hide resolved
session.sendUpstreamPacket(textPacket);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down