Mirror von
https://github.com/GeyserMC/Geyser.git
synchronisiert 2024-11-04 15:20:09 +01:00
Some small changes
Dieser Commit ist enthalten in:
Ursprung
50b51f5f57
Commit
01492647fc
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -39,6 +39,7 @@
|
||||
<groupId>org.java-websocket</groupId>
|
||||
<artifactId>Java-WebSocket</artifactId>
|
||||
<version>1.5.1</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.github.CloudburstMC.Protocol</groupId>
|
||||
@ -214,11 +215,13 @@
|
||||
<groupId>org.reflections</groupId>
|
||||
<artifactId>reflections</artifactId>
|
||||
<version>0.9.11</version> <!-- This isn't the latest version to get round https://github.com/ronmamo/reflections/issues/273 -->
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.dom4j</groupId>
|
||||
<artifactId>dom4j</artifactId>
|
||||
<version>2.1.3</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>net.kyori</groupId>
|
||||
@ -254,6 +257,7 @@
|
||||
<groupId>com.github.GeyserMC</groupId>
|
||||
<artifactId>MCAuthLib</artifactId>
|
||||
<version>0e48a094f2</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
|
@ -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;
|
||||
|
@ -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) {
|
||||
|
@ -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<TeleportCache> 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;
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -52,7 +52,6 @@ public class BedrockNetworkStackLatencyTranslator extends PacketTranslator<Netwo
|
||||
// PS4 divides the network stack latency timestamp FOR US!!!
|
||||
// WTF
|
||||
if (session.getClientData().getDeviceOs().equals(DeviceOs.PS4)) {
|
||||
// Ignore the weird DeviceOS, our order is wrong and will be fixed in Floodgate 2.0
|
||||
pingId = packet.getTimestamp();
|
||||
} else {
|
||||
pingId = packet.getTimestamp() / 1000;
|
||||
|
@ -27,6 +27,7 @@ package org.geysermc.connector.network.translators.java;
|
||||
|
||||
import com.github.steveice10.mc.protocol.packet.ingame.server.ServerAdvancementTabPacket;
|
||||
import org.geysermc.connector.network.session.GeyserSession;
|
||||
import org.geysermc.connector.network.session.cache.AdvancementsCache;
|
||||
import org.geysermc.connector.network.translators.PacketTranslator;
|
||||
import org.geysermc.connector.network.translators.Translator;
|
||||
|
||||
@ -37,8 +38,8 @@ import org.geysermc.connector.network.translators.Translator;
|
||||
public class JavaAdvancementsTabTranslator extends PacketTranslator<ServerAdvancementTabPacket> {
|
||||
@Override
|
||||
public void translate(ServerAdvancementTabPacket packet, GeyserSession session) {
|
||||
session.getAdvancementsCache()
|
||||
.setCurrentAdvancementCategoryId(packet.getTabId())
|
||||
.buildAndShowListForm();
|
||||
AdvancementsCache advancementsCache = session.getAdvancementsCache();
|
||||
advancementsCache.setCurrentAdvancementCategoryId(packet.getTabId());
|
||||
advancementsCache.buildAndShowListForm();
|
||||
}
|
||||
}
|
||||
|
@ -33,6 +33,7 @@ import org.geysermc.connector.utils.StatisticsUtils;
|
||||
|
||||
@Translator(packet = ServerStatisticsPacket.class)
|
||||
public class JavaStatisticsTranslator extends PacketTranslator<ServerStatisticsPacket> {
|
||||
|
||||
@Override
|
||||
public void translate(ServerStatisticsPacket packet, GeyserSession session) {
|
||||
session.updateStatistics(packet.getStatistics());
|
||||
|
@ -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(
|
||||
|
@ -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);
|
||||
}
|
||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren