diff --git a/common/src/main/java/org/geysermc/floodgate/util/Base64Utils.java b/common/src/main/java/org/geysermc/floodgate/util/Base64Utils.java
index 4c527b948..326fa2590 100644
--- a/common/src/main/java/org/geysermc/floodgate/util/Base64Utils.java
+++ b/common/src/main/java/org/geysermc/floodgate/util/Base64Utils.java
@@ -25,7 +25,7 @@
package org.geysermc.floodgate.util;
-public class Base64Utils {
+public final class Base64Utils {
public static int getEncodedLength(int length) {
if (length <= 0) {
return -1;
diff --git a/common/src/main/java/org/geysermc/floodgate/util/FloodgateConfigHolder.java b/common/src/main/java/org/geysermc/floodgate/util/FloodgateConfigHolder.java
index 386213ada..d33840bb4 100644
--- a/common/src/main/java/org/geysermc/floodgate/util/FloodgateConfigHolder.java
+++ b/common/src/main/java/org/geysermc/floodgate/util/FloodgateConfigHolder.java
@@ -28,7 +28,7 @@ package org.geysermc.floodgate.util;
import lombok.Getter;
import lombok.Setter;
-public class FloodgateConfigHolder {
+public final class FloodgateConfigHolder {
@Getter
@Setter
private static Object config;
diff --git a/common/src/main/java/org/geysermc/floodgate/util/LinkedPlayer.java b/common/src/main/java/org/geysermc/floodgate/util/LinkedPlayer.java
index 7d67a44a0..f91bfafbc 100644
--- a/common/src/main/java/org/geysermc/floodgate/util/LinkedPlayer.java
+++ b/common/src/main/java/org/geysermc/floodgate/util/LinkedPlayer.java
@@ -48,7 +48,7 @@ public final class LinkedPlayer implements Cloneable {
*/
private final UUID bedrockId;
/**
- * If the LinkedPlayer is send from a different platform. For example the LinkedPlayer is from
+ * If the LinkedPlayer is sent from a different platform. For example the LinkedPlayer is from
* Bungee but the data has been sent to the Bukkit server.
*/
private boolean fromDifferentPlatform = false;
diff --git a/connector/pom.xml b/connector/pom.xml
index 1ed01a0c4..b7bfc9d3a 100644
--- a/connector/pom.xml
+++ b/connector/pom.xml
@@ -39,6 +39,7 @@
org.java-websocket
Java-WebSocket
1.5.1
+ compile
com.github.CloudburstMC.Protocol
@@ -214,11 +215,13 @@
org.reflections
reflections
0.9.11
+ compile
org.dom4j
dom4j
2.1.3
+ compile
net.kyori
@@ -254,6 +257,7 @@
com.github.GeyserMC
MCAuthLib
0e48a094f2
+ compile
diff --git a/connector/src/main/java/org/geysermc/connector/GeyserConnector.java b/connector/src/main/java/org/geysermc/connector/GeyserConnector.java
index 87a698be3..8dfa12eb4 100644
--- a/connector/src/main/java/org/geysermc/connector/GeyserConnector.java
+++ b/connector/src/main/java/org/geysermc/connector/GeyserConnector.java
@@ -109,7 +109,7 @@ public class GeyserConnector {
@Setter
private AuthType defaultAuthType;
- private TimeSyncer timeSyncer;
+ private final TimeSyncer timeSyncer;
private FloodgateCipher cipher;
private FloodgateSkinUploader skinUploader;
private final NewsHandler newsHandler;
@@ -202,6 +202,7 @@ public class GeyserConnector {
defaultAuthType = AuthType.getByName(config.getRemote().getAuthType());
+ TimeSyncer timeSyncer = null;
if (defaultAuthType == AuthType.FLOODGATE) {
timeSyncer = new TimeSyncer(Constants.NTP_SERVER);
try {
@@ -214,6 +215,7 @@ public class GeyserConnector {
logger.severe(LanguageUtils.getLocaleStringLog("geyser.auth.floodgate.bad_key"), exception);
}
}
+ this.timeSyncer = timeSyncer;
String branch = "unknown";
int buildNumber = -1;
diff --git a/connector/src/main/java/org/geysermc/connector/command/CommandManager.java b/connector/src/main/java/org/geysermc/connector/command/CommandManager.java
index 71eb2c742..f62fd8539 100644
--- a/connector/src/main/java/org/geysermc/connector/command/CommandManager.java
+++ b/connector/src/main/java/org/geysermc/connector/command/CommandManager.java
@@ -53,7 +53,7 @@ public abstract class CommandManager {
registerCommand(new VersionCommand(connector, "version", "geyser.commands.version.desc", "geyser.command.version"));
registerCommand(new SettingsCommand(connector, "settings", "geyser.commands.settings.desc", "geyser.command.settings"));
registerCommand(new StatisticsCommand(connector, "statistics", "geyser.commands.statistics.desc", "geyser.command.statistics"));
- registerCommand(new AdvancementsCommand( "advancements", "geyser.commands.advancements.desc", "geyser.command.advancements"));
+ registerCommand(new AdvancementsCommand("advancements", "geyser.commands.advancements.desc", "geyser.command.advancements"));
}
public void registerCommand(GeyserCommand command) {
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 ead9d1834..f901fe9a1 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
@@ -140,10 +140,10 @@ public class GeyserSession implements CommandSender {
private ChunkCache chunkCache;
private EntityCache entityCache;
private EntityEffectCache effectCache;
+ private final FormCache formCache;
private final PreferencesCache preferencesCache;
private final TagCache tagCache;
private WorldCache worldCache;
- private FormCache formCache;
private final Int2ObjectMap teleportMap = new Int2ObjectOpenHashMap<>();
private final PlayerInventory playerInventory;
@@ -445,12 +445,13 @@ public class GeyserSession implements CommandSender {
this.chunkCache = new ChunkCache(this);
this.entityCache = new EntityCache(this);
this.effectCache = new EntityEffectCache();
+ this.formCache = new FormCache(this);
this.preferencesCache = new PreferencesCache(this);
this.tagCache = new TagCache();
this.worldCache = new WorldCache(this);
- this.formCache = new FormCache(this);
this.collisionManager = new CollisionManager(this);
+
this.playerEntity = new SessionPlayerEntity(this);
collisionManager.updatePlayerBoundingBox(this.playerEntity.getPosition());
@@ -851,7 +852,6 @@ public class GeyserSession implements CommandSender {
this.entityCache = null;
this.effectCache = null;
this.worldCache = null;
- this.formCache = null;
closed = true;
}
diff --git a/connector/src/main/java/org/geysermc/connector/network/session/auth/BedrockClientData.java b/connector/src/main/java/org/geysermc/connector/network/session/auth/BedrockClientData.java
index d87590e5f..fc4d1164a 100644
--- a/connector/src/main/java/org/geysermc/connector/network/session/auth/BedrockClientData.java
+++ b/connector/src/main/java/org/geysermc/connector/network/session/auth/BedrockClientData.java
@@ -25,26 +25,18 @@
package org.geysermc.connector.network.session.auth;
-import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonProperty;
-import com.fasterxml.jackson.databind.JsonNode;
-import com.google.common.base.Charsets;
import lombok.Getter;
-import org.geysermc.connector.skin.SkinProvider;
import org.geysermc.floodgate.util.DeviceOs;
import org.geysermc.floodgate.util.InputMode;
import org.geysermc.floodgate.util.UiProfile;
-import java.util.Base64;
import java.util.UUID;
@JsonIgnoreProperties(ignoreUnknown = true)
@Getter
public final class BedrockClientData {
- @JsonIgnore
- private JsonNode jsonData;
-
@JsonProperty(value = "GameVersion")
private String gameVersion;
@JsonProperty(value = "ServerAddress")
@@ -115,27 +107,6 @@ public final class BedrockClientData {
@JsonProperty(value = "PlayFabId")
private String playFabId;
- public void setJsonData(JsonNode data) {
- if (this.jsonData == null && data != null) {
- this.jsonData = data;
- }
- }
-
- public boolean isAlex() {
- try {
- byte[] bytes = Base64.getDecoder().decode(geometryName.getBytes(Charsets.UTF_8));
- String geometryName =
- SkinProvider.OBJECT_MAPPER
- .readTree(bytes)
- .get("geometry").get("default")
- .asText();
- return "geometry.humanoid.customSlim".equals(geometryName);
- } catch (Exception exception) {
- exception.printStackTrace();
- return false;
- }
- }
-
public DeviceOs getDeviceOs() {
return deviceOs != null ? deviceOs : DeviceOs.UNKNOWN;
}
diff --git a/connector/src/main/java/org/geysermc/connector/network/session/cache/AdvancementsCache.java b/connector/src/main/java/org/geysermc/connector/network/session/cache/AdvancementsCache.java
index d20eb11dd..98ec5b262 100644
--- a/connector/src/main/java/org/geysermc/connector/network/session/cache/AdvancementsCache.java
+++ b/connector/src/main/java/org/geysermc/connector/network/session/cache/AdvancementsCache.java
@@ -29,7 +29,6 @@ import com.github.steveice10.mc.protocol.data.game.advancement.Advancement;
import com.github.steveice10.mc.protocol.packet.ingame.client.window.ClientAdvancementTabPacket;
import lombok.Getter;
import lombok.Setter;
-import lombok.experimental.Accessors;
import org.geysermc.connector.network.session.GeyserSession;
import org.geysermc.connector.network.translators.chat.MessageTranslator;
import org.geysermc.connector.utils.GeyserAdvancement;
@@ -58,7 +57,7 @@ public class AdvancementsCache {
/**
* Stores player's chosen advancement's ID and title for use in form creators.
*/
- @Setter @Accessors(chain = true)
+ @Setter
private String currentAdvancementCategoryId = null;
private final GeyserSession session;
diff --git a/connector/src/main/java/org/geysermc/connector/network/session/cache/FormCache.java b/connector/src/main/java/org/geysermc/connector/network/session/cache/FormCache.java
index cdd8a01ac..1cdcf228b 100644
--- a/connector/src/main/java/org/geysermc/connector/network/session/cache/FormCache.java
+++ b/connector/src/main/java/org/geysermc/connector/network/session/cache/FormCache.java
@@ -33,6 +33,7 @@ import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap;
import lombok.RequiredArgsConstructor;
import org.geysermc.connector.network.session.GeyserSession;
import org.geysermc.cumulus.Form;
+import org.geysermc.cumulus.SimpleForm;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicInteger;
@@ -58,13 +59,15 @@ public class FormCache {
formRequestPacket.setFormData(form.getJsonData());
session.sendUpstreamPacket(formRequestPacket);
- // Hack to fix the url image loading bug
- NetworkStackLatencyPacket latencyPacket = new NetworkStackLatencyPacket();
- latencyPacket.setFromServer(true);
- latencyPacket.setTimestamp(-System.currentTimeMillis());
- session.getConnector().getGeneralThreadPool().schedule(
- () -> session.sendUpstreamPacket(latencyPacket),
- 500, TimeUnit.MILLISECONDS);
+ // Hack to fix the (url) image loading bug
+ if (form instanceof SimpleForm) {
+ NetworkStackLatencyPacket latencyPacket = new NetworkStackLatencyPacket();
+ latencyPacket.setFromServer(true);
+ latencyPacket.setTimestamp(-System.currentTimeMillis());
+ session.getConnector().getGeneralThreadPool().schedule(
+ () -> session.sendUpstreamPacket(latencyPacket),
+ 500, TimeUnit.MILLISECONDS);
+ }
return windowId;
}
diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockNetworkStackLatencyTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockNetworkStackLatencyTranslator.java
index 577469fdd..208e7c75d 100644
--- a/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockNetworkStackLatencyTranslator.java
+++ b/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockNetworkStackLatencyTranslator.java
@@ -52,7 +52,6 @@ public class BedrockNetworkStackLatencyTranslator extends PacketTranslator {
@Override
public void translate(ServerAdvancementTabPacket packet, GeyserSession session) {
- session.getAdvancementsCache()
- .setCurrentAdvancementCategoryId(packet.getTabId())
- .buildAndShowListForm();
+ AdvancementsCache advancementsCache = session.getAdvancementsCache();
+ advancementsCache.setCurrentAdvancementCategoryId(packet.getTabId());
+ advancementsCache.buildAndShowListForm();
}
}
diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/JavaStatisticsTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/JavaStatisticsTranslator.java
index 5d3164c0d..247808041 100644
--- a/connector/src/main/java/org/geysermc/connector/network/translators/java/JavaStatisticsTranslator.java
+++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/JavaStatisticsTranslator.java
@@ -33,6 +33,7 @@ import org.geysermc.connector.utils.StatisticsUtils;
@Translator(packet = ServerStatisticsPacket.class)
public class JavaStatisticsTranslator extends PacketTranslator {
+
@Override
public void translate(ServerStatisticsPacket packet, GeyserSession session) {
session.updateStatistics(packet.getStatistics());
diff --git a/connector/src/main/java/org/geysermc/connector/utils/LoginEncryptionUtils.java b/connector/src/main/java/org/geysermc/connector/utils/LoginEncryptionUtils.java
index ce9f23272..d3d5fa67d 100644
--- a/connector/src/main/java/org/geysermc/connector/utils/LoginEncryptionUtils.java
+++ b/connector/src/main/java/org/geysermc/connector/utils/LoginEncryptionUtils.java
@@ -134,7 +134,6 @@ public class LoginEncryptionUtils {
JsonNode clientDataJson = JSON_MAPPER.readTree(clientJwt.getPayload().toBytes());
BedrockClientData data = JSON_MAPPER.convertValue(clientDataJson, BedrockClientData.class);
- data.setJsonData(clientDataJson);
session.setClientData(data);
if (EncryptionUtils.canUseEncryption()) {
@@ -243,7 +242,7 @@ public class LoginEncryptionUtils {
}
/**
- * Promts the user between either OAuth code login or manual password authentication
+ * Prompts the user between either OAuth code login or manual password authentication
*/
public static void buildAndShowMicrosoftAuthenticationWindow(GeyserSession session) {
session.sendForm(
diff --git a/connector/src/main/java/org/geysermc/connector/utils/StatisticsUtils.java b/connector/src/main/java/org/geysermc/connector/utils/StatisticsUtils.java
index f2181d871..e59807d75 100644
--- a/connector/src/main/java/org/geysermc/connector/utils/StatisticsUtils.java
+++ b/connector/src/main/java/org/geysermc/connector/utils/StatisticsUtils.java
@@ -180,8 +180,8 @@ public class StatisticsUtils {
session.sendForm(
builder.content(content.toString())
.button("gui.back", FormImage.Type.PATH, "textures/gui/newgui/undo")
- .responseHandler((form1, responseData1) -> {
- SimpleFormResponse response1 = form.parseResponse(responseData1);
+ .responseHandler((form1, subFormResponseData) -> {
+ SimpleFormResponse response1 = form.parseResponse(subFormResponseData);
if (response1.isCorrect()) {
buildAndSendStatisticsMenu(session);
}