3
0
Mirror von https://github.com/GeyserMC/Geyser.git synchronisiert 2024-10-05 09:20:07 +02:00

Added timestamp to BedrockData

Dieser Commit ist enthalten in:
Tim203 2021-02-16 18:54:04 +01:00
Ursprung 52ddf8c556
Commit c79979e3e3
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: 064EE9F5BF7C3EE8
3 geänderte Dateien mit 11 neuen und 10 gelöschten Zeilen

Datei anzeigen

@ -26,8 +26,8 @@
package org.geysermc.floodgate.util; package org.geysermc.floodgate.util;
import lombok.AccessLevel; import lombok.AccessLevel;
import lombok.AllArgsConstructor;
import lombok.Getter; import lombok.Getter;
import lombok.RequiredArgsConstructor;
/** /**
* This class contains the raw data send by Geyser to Floodgate or from Floodgate to Floodgate. This * This class contains the raw data send by Geyser to Floodgate or from Floodgate to Floodgate. This
@ -35,9 +35,9 @@ import lombok.Getter;
* present in the API module of the Floodgate repo) * present in the API module of the Floodgate repo)
*/ */
@Getter @Getter
@AllArgsConstructor(access = AccessLevel.PRIVATE) @RequiredArgsConstructor(access = AccessLevel.PRIVATE)
public final class BedrockData implements Cloneable { public final class BedrockData implements Cloneable {
public static final int EXPECTED_LENGTH = 12; public static final int EXPECTED_LENGTH = 13;
private final String version; private final String version;
private final String username; private final String username;
@ -53,6 +53,7 @@ public final class BedrockData implements Cloneable {
private final int subscribeId; private final int subscribeId;
private final String verifyCode; private final String verifyCode;
private final long timestamp;
private final int dataLength; private final int dataLength;
public static BedrockData of(String version, String username, String xuid, int deviceOs, public static BedrockData of(String version, String username, String xuid, int deviceOs,
@ -60,7 +61,8 @@ public final class BedrockData implements Cloneable {
LinkedPlayer linkedPlayer, boolean fromProxy, int subscribeId, LinkedPlayer linkedPlayer, boolean fromProxy, int subscribeId,
String verifyCode) { String verifyCode) {
return new BedrockData(version, username, xuid, deviceOs, languageCode, inputMode, return new BedrockData(version, username, xuid, deviceOs, languageCode, inputMode,
uiProfile, ip, linkedPlayer, fromProxy, subscribeId, verifyCode, EXPECTED_LENGTH); uiProfile, ip, linkedPlayer, fromProxy, subscribeId, verifyCode,
System.currentTimeMillis(), EXPECTED_LENGTH);
} }
public static BedrockData of(String version, String username, String xuid, int deviceOs, public static BedrockData of(String version, String username, String xuid, int deviceOs,
@ -81,12 +83,12 @@ public final class BedrockData implements Cloneable {
return new BedrockData( return new BedrockData(
split[0], split[1], split[2], Integer.parseInt(split[3]), split[4], split[0], split[1], split[2], Integer.parseInt(split[3]), split[4],
Integer.parseInt(split[5]), Integer.parseInt(split[6]), split[7], linkedPlayer, Integer.parseInt(split[5]), Integer.parseInt(split[6]), split[7], linkedPlayer,
"1".equals(split[9]), Integer.parseInt(split[10]), split[11], split.length "1".equals(split[9]), Integer.parseInt(split[10]), split[11], Long.parseLong(split[12]), split.length
); );
} }
private static BedrockData emptyData(int dataLength) { private static BedrockData emptyData(int dataLength) {
return new BedrockData(null, null, null, -1, null, -1, -1, null, null, false, -1, null, return new BedrockData(null, null, null, -1, null, -1, -1, null, null, false, -1, null, -1,
dataLength); dataLength);
} }
@ -101,7 +103,7 @@ public final class BedrockData implements Cloneable {
languageCode + '\0' + uiProfile + '\0' + inputMode + '\0' + ip + '\0' + languageCode + '\0' + uiProfile + '\0' + inputMode + '\0' + ip + '\0' +
(fromProxy ? 1 : 0) + '\0' + (fromProxy ? 1 : 0) + '\0' +
(linkedPlayer != null ? linkedPlayer.toString() : "null") + '\0' + (linkedPlayer != null ? linkedPlayer.toString() : "null") + '\0' +
subscribeId + '\0' + verifyCode; subscribeId + '\0' + verifyCode + '\0' + timestamp;
} }
@Override @Override

Datei anzeigen

@ -29,7 +29,7 @@ package org.geysermc.floodgate.util;
public enum InputMode { public enum InputMode {
UNKNOWN, UNKNOWN,
KEYBOARD_MOUSE, KEYBOARD_MOUSE,
TOUCH, // I guess Touch? TOUCH,
CONTROLLER, CONTROLLER,
VR; VR;

Datei anzeigen

@ -74,7 +74,6 @@ public final class FloodgateSkinUploader {
@Override @Override
public void onMessage(String message) { public void onMessage(String message) {
System.out.println(message);
// The reason why I don't like Jackson // The reason why I don't like Jackson
try { try {
JsonNode node = JACKSON.readTree(message); JsonNode node = JACKSON.readTree(message);
@ -109,7 +108,6 @@ public final class FloodgateSkinUploader {
String xuid = node.get("xuid").asText(); String xuid = node.get("xuid").asText();
String value = node.get("value").asText(); String value = node.get("value").asText();
String signature = node.get("signature").asText(); String signature = node.get("signature").asText();
;
GeyserSession session = connector.getPlayerByXuid(xuid); GeyserSession session = connector.getPlayerByXuid(xuid);
if (session != null) { if (session != null) {
@ -182,6 +180,7 @@ public final class FloodgateSkinUploader {
} }
private void reconnectLater(GeyserConnector connector) { private void reconnectLater(GeyserConnector connector) {
//todo doesn't work
long additionalTime = ThreadLocalRandom.current().nextInt(7); long additionalTime = ThreadLocalRandom.current().nextInt(7);
connector.getGeneralThreadPool().schedule(() -> { connector.getGeneralThreadPool().schedule(() -> {
try { try {