Mirror von
https://github.com/GeyserMC/Geyser.git
synchronisiert 2024-11-20 06:50:09 +01:00
Add RemoteServer API
Dieser Commit ist enthalten in:
Ursprung
1232c02c8e
Commit
9939a26a5b
@ -33,6 +33,7 @@ import org.geysermc.geyser.api.command.CommandManager;
|
|||||||
import org.geysermc.geyser.api.connection.GeyserConnection;
|
import org.geysermc.geyser.api.connection.GeyserConnection;
|
||||||
import org.geysermc.geyser.api.event.EventBus;
|
import org.geysermc.geyser.api.event.EventBus;
|
||||||
import org.geysermc.geyser.api.extension.ExtensionManager;
|
import org.geysermc.geyser.api.extension.ExtensionManager;
|
||||||
|
import org.geysermc.geyser.api.network.RemoteServer;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
@ -105,6 +106,14 @@ public interface GeyserApi extends GeyserApiBase {
|
|||||||
*/
|
*/
|
||||||
EventBus eventBus();
|
EventBus eventBus();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get's the default {@link RemoteServer} configured
|
||||||
|
* within the config file that is used by default.
|
||||||
|
*
|
||||||
|
* @return the default remote server used within Geyser
|
||||||
|
*/
|
||||||
|
RemoteServer getDefaultRemoteServer();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the current {@link GeyserApiBase} instance.
|
* Gets the current {@link GeyserApiBase} instance.
|
||||||
*
|
*
|
||||||
|
@ -23,20 +23,15 @@
|
|||||||
* @link https://github.com/GeyserMC/Geyser
|
* @link https://github.com/GeyserMC/Geyser
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package org.geysermc.geyser.session.auth;
|
package org.geysermc.geyser.api.network;
|
||||||
|
|
||||||
import com.fasterxml.jackson.core.JsonParser;
|
|
||||||
import com.fasterxml.jackson.databind.DeserializationContext;
|
|
||||||
import com.fasterxml.jackson.databind.JsonDeserializer;
|
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
|
|
||||||
@Getter
|
@Getter
|
||||||
public enum AuthType {
|
public enum AuthType {
|
||||||
OFFLINE,
|
OFFLINE,
|
||||||
ONLINE,
|
ONLINE,
|
||||||
FLOODGATE;
|
HYBRID;
|
||||||
|
|
||||||
public static final AuthType[] VALUES = values();
|
public static final AuthType[] VALUES = values();
|
||||||
|
|
||||||
@ -60,11 +55,4 @@ public enum AuthType {
|
|||||||
}
|
}
|
||||||
return ONLINE;
|
return ONLINE;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class Deserializer extends JsonDeserializer<AuthType> {
|
|
||||||
@Override
|
|
||||||
public AuthType deserialize(JsonParser p, DeserializationContext ctxt) throws IOException {
|
|
||||||
return getByName(p.getValueAsString());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
@ -0,0 +1,67 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2019-2022 GeyserMC. http://geysermc.org
|
||||||
|
*
|
||||||
|
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
* of this software and associated documentation files (the "Software"), to deal
|
||||||
|
* in the Software without restriction, including without limitation the rights
|
||||||
|
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
* copies of the Software, and to permit persons to whom the Software is
|
||||||
|
* furnished to do so, subject to the following conditions:
|
||||||
|
*
|
||||||
|
* The above copyright notice and this permission notice shall be included in
|
||||||
|
* all copies or substantial portions of the Software.
|
||||||
|
*
|
||||||
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||||
|
* THE SOFTWARE.
|
||||||
|
*
|
||||||
|
* @author GeyserMC
|
||||||
|
* @link https://github.com/GeyserMC/Geyser
|
||||||
|
*/
|
||||||
|
|
||||||
|
package org.geysermc.geyser.api.network;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Represents the Java server that Geyser is connecting to.
|
||||||
|
*/
|
||||||
|
public interface RemoteServer {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the IP address of the remote server.
|
||||||
|
*
|
||||||
|
* @return the IP address of the remote server
|
||||||
|
*/
|
||||||
|
String address();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the port of the remote server.
|
||||||
|
*
|
||||||
|
* @return the port of the remote server
|
||||||
|
*/
|
||||||
|
int port();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the protocol version of the remote server.
|
||||||
|
*
|
||||||
|
* @return the protocol version of the remote server
|
||||||
|
*/
|
||||||
|
int protocolVersion();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the Minecraft version of the remote server.
|
||||||
|
*
|
||||||
|
* @return the Minecraft version of the remote server
|
||||||
|
*/
|
||||||
|
String minecraftVersion();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the {@link AuthType} required by the remote server.
|
||||||
|
*
|
||||||
|
* @return the auth type required by the remote server
|
||||||
|
*/
|
||||||
|
AuthType authType();
|
||||||
|
}
|
@ -32,7 +32,7 @@ import org.geysermc.common.PlatformType;
|
|||||||
import org.geysermc.geyser.GeyserImpl;
|
import org.geysermc.geyser.GeyserImpl;
|
||||||
import org.geysermc.geyser.GeyserBootstrap;
|
import org.geysermc.geyser.GeyserBootstrap;
|
||||||
import org.geysermc.geyser.command.GeyserCommandManager;
|
import org.geysermc.geyser.command.GeyserCommandManager;
|
||||||
import org.geysermc.geyser.session.auth.AuthType;
|
import org.geysermc.geyser.api.network.AuthType;
|
||||||
import org.geysermc.geyser.configuration.GeyserConfiguration;
|
import org.geysermc.geyser.configuration.GeyserConfiguration;
|
||||||
import org.geysermc.geyser.dump.BootstrapDumpInfo;
|
import org.geysermc.geyser.dump.BootstrapDumpInfo;
|
||||||
import org.geysermc.geyser.ping.GeyserLegacyPingPassthrough;
|
import org.geysermc.geyser.ping.GeyserLegacyPingPassthrough;
|
||||||
@ -109,13 +109,13 @@ public class GeyserBungeePlugin extends Plugin implements GeyserBootstrap {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (geyserConfig.getRemote().getAuthType() == AuthType.FLOODGATE && getProxy().getPluginManager().getPlugin("floodgate") == null) {
|
if (geyserConfig.getRemote().getAuthType() == AuthType.HYBRID && getProxy().getPluginManager().getPlugin("floodgate") == null) {
|
||||||
geyserLogger.severe(GeyserLocale.getLocaleStringLog("geyser.bootstrap.floodgate.not_installed") + " " + GeyserLocale.getLocaleStringLog("geyser.bootstrap.floodgate.disabling"));
|
geyserLogger.severe(GeyserLocale.getLocaleStringLog("geyser.bootstrap.floodgate.not_installed") + " " + GeyserLocale.getLocaleStringLog("geyser.bootstrap.floodgate.disabling"));
|
||||||
return;
|
return;
|
||||||
} else if (geyserConfig.isAutoconfiguredRemote() && getProxy().getPluginManager().getPlugin("floodgate") != null) {
|
} else if (geyserConfig.isAutoconfiguredRemote() && getProxy().getPluginManager().getPlugin("floodgate") != null) {
|
||||||
// Floodgate installed means that the user wants Floodgate authentication
|
// Floodgate installed means that the user wants Floodgate authentication
|
||||||
geyserLogger.debug("Auto-setting to Floodgate authentication.");
|
geyserLogger.debug("Auto-setting to Floodgate authentication.");
|
||||||
geyserConfig.getRemote().setAuthType(AuthType.FLOODGATE);
|
geyserConfig.getRemote().setAuthType(AuthType.HYBRID);
|
||||||
}
|
}
|
||||||
|
|
||||||
geyserConfig.loadFloodgate(this);
|
geyserConfig.loadFloodgate(this);
|
||||||
|
@ -31,7 +31,7 @@ import org.bukkit.entity.Player;
|
|||||||
import org.bukkit.event.server.ServerListPingEvent;
|
import org.bukkit.event.server.ServerListPingEvent;
|
||||||
import org.bukkit.util.CachedServerIcon;
|
import org.bukkit.util.CachedServerIcon;
|
||||||
import org.geysermc.geyser.ping.GeyserPingInfo;
|
import org.geysermc.geyser.ping.GeyserPingInfo;
|
||||||
import org.geysermc.geyser.network.MinecraftProtocol;
|
import org.geysermc.geyser.network.GameProtocol;
|
||||||
import org.geysermc.geyser.ping.IGeyserPingPassthrough;
|
import org.geysermc.geyser.ping.IGeyserPingPassthrough;
|
||||||
|
|
||||||
import javax.annotation.Nonnull;
|
import javax.annotation.Nonnull;
|
||||||
@ -52,7 +52,7 @@ public class GeyserSpigotPingPassthrough implements IGeyserPingPassthrough {
|
|||||||
Bukkit.getPluginManager().callEvent(event);
|
Bukkit.getPluginManager().callEvent(event);
|
||||||
GeyserPingInfo geyserPingInfo = new GeyserPingInfo(event.getMotd(),
|
GeyserPingInfo geyserPingInfo = new GeyserPingInfo(event.getMotd(),
|
||||||
new GeyserPingInfo.Players(event.getMaxPlayers(), event.getNumPlayers()),
|
new GeyserPingInfo.Players(event.getMaxPlayers(), event.getNumPlayers()),
|
||||||
new GeyserPingInfo.Version(Bukkit.getVersion(), MinecraftProtocol.getJavaProtocolVersion()) // thanks Spigot for not exposing this, just default to latest
|
new GeyserPingInfo.Version(Bukkit.getVersion(), GameProtocol.getJavaProtocolVersion()) // thanks Spigot for not exposing this, just default to latest
|
||||||
);
|
);
|
||||||
Bukkit.getOnlinePlayers().stream().map(Player::getName).forEach(geyserPingInfo.getPlayerList()::add);
|
Bukkit.getOnlinePlayers().stream().map(Player::getName).forEach(geyserPingInfo.getPlayerList()::add);
|
||||||
return geyserPingInfo;
|
return geyserPingInfo;
|
||||||
|
@ -40,7 +40,7 @@ import org.geysermc.geyser.command.GeyserCommandManager;
|
|||||||
import org.geysermc.geyser.configuration.GeyserConfiguration;
|
import org.geysermc.geyser.configuration.GeyserConfiguration;
|
||||||
import org.geysermc.geyser.dump.BootstrapDumpInfo;
|
import org.geysermc.geyser.dump.BootstrapDumpInfo;
|
||||||
import org.geysermc.geyser.level.WorldManager;
|
import org.geysermc.geyser.level.WorldManager;
|
||||||
import org.geysermc.geyser.network.MinecraftProtocol;
|
import org.geysermc.geyser.network.GameProtocol;
|
||||||
import org.geysermc.geyser.ping.GeyserLegacyPingPassthrough;
|
import org.geysermc.geyser.ping.GeyserLegacyPingPassthrough;
|
||||||
import org.geysermc.geyser.ping.IGeyserPingPassthrough;
|
import org.geysermc.geyser.ping.IGeyserPingPassthrough;
|
||||||
import org.geysermc.geyser.platform.spigot.command.GeyserSpigotCommandExecutor;
|
import org.geysermc.geyser.platform.spigot.command.GeyserSpigotCommandExecutor;
|
||||||
@ -49,7 +49,7 @@ import org.geysermc.geyser.platform.spigot.command.SpigotCommandSource;
|
|||||||
import org.geysermc.geyser.platform.spigot.world.GeyserPistonListener;
|
import org.geysermc.geyser.platform.spigot.world.GeyserPistonListener;
|
||||||
import org.geysermc.geyser.platform.spigot.world.GeyserSpigotBlockPlaceListener;
|
import org.geysermc.geyser.platform.spigot.world.GeyserSpigotBlockPlaceListener;
|
||||||
import org.geysermc.geyser.platform.spigot.world.manager.*;
|
import org.geysermc.geyser.platform.spigot.world.manager.*;
|
||||||
import org.geysermc.geyser.session.auth.AuthType;
|
import org.geysermc.geyser.api.network.AuthType;
|
||||||
import org.geysermc.geyser.text.GeyserLocale;
|
import org.geysermc.geyser.text.GeyserLocale;
|
||||||
import org.geysermc.geyser.util.FileUtils;
|
import org.geysermc.geyser.util.FileUtils;
|
||||||
|
|
||||||
@ -136,14 +136,14 @@ public class GeyserSpigotPlugin extends JavaPlugin implements GeyserBootstrap {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (geyserConfig.getRemote().getAuthType() == AuthType.FLOODGATE && Bukkit.getPluginManager().getPlugin("floodgate") == null) {
|
if (geyserConfig.getRemote().getAuthType() == AuthType.HYBRID && Bukkit.getPluginManager().getPlugin("floodgate") == null) {
|
||||||
geyserLogger.severe(GeyserLocale.getLocaleStringLog("geyser.bootstrap.floodgate.not_installed") + " " + GeyserLocale.getLocaleStringLog("geyser.bootstrap.floodgate.disabling"));
|
geyserLogger.severe(GeyserLocale.getLocaleStringLog("geyser.bootstrap.floodgate.not_installed") + " " + GeyserLocale.getLocaleStringLog("geyser.bootstrap.floodgate.disabling"));
|
||||||
this.getPluginLoader().disablePlugin(this);
|
this.getPluginLoader().disablePlugin(this);
|
||||||
return;
|
return;
|
||||||
} else if (geyserConfig.isAutoconfiguredRemote() && Bukkit.getPluginManager().getPlugin("floodgate") != null) {
|
} else if (geyserConfig.isAutoconfiguredRemote() && Bukkit.getPluginManager().getPlugin("floodgate") != null) {
|
||||||
// Floodgate installed means that the user wants Floodgate authentication
|
// Floodgate installed means that the user wants Floodgate authentication
|
||||||
geyserLogger.debug("Auto-setting to Floodgate authentication.");
|
geyserLogger.debug("Auto-setting to Floodgate authentication.");
|
||||||
geyserConfig.getRemote().setAuthType(AuthType.FLOODGATE);
|
geyserConfig.getRemote().setAuthType(AuthType.HYBRID);
|
||||||
}
|
}
|
||||||
|
|
||||||
geyserConfig.loadFloodgate(this);
|
geyserConfig.loadFloodgate(this);
|
||||||
@ -344,7 +344,7 @@ public class GeyserSpigotPlugin extends JavaPlugin implements GeyserBootstrap {
|
|||||||
*/
|
*/
|
||||||
private boolean isViaVersionNeeded() {
|
private boolean isViaVersionNeeded() {
|
||||||
ProtocolVersion serverVersion = getServerProtocolVersion();
|
ProtocolVersion serverVersion = getServerProtocolVersion();
|
||||||
List<ProtocolPathEntry> protocolList = Via.getManager().getProtocolManager().getProtocolPath(MinecraftProtocol.getJavaProtocolVersion(),
|
List<ProtocolPathEntry> protocolList = Via.getManager().getProtocolManager().getProtocolPath(GameProtocol.getJavaProtocolVersion(),
|
||||||
serverVersion.getVersion());
|
serverVersion.getVersion());
|
||||||
if (protocolList == null) {
|
if (protocolList == null) {
|
||||||
// No translation needed!
|
// No translation needed!
|
||||||
|
@ -29,7 +29,7 @@ import com.viaversion.viaversion.api.Via;
|
|||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.UnsafeValues;
|
import org.bukkit.UnsafeValues;
|
||||||
import org.geysermc.geyser.GeyserLogger;
|
import org.geysermc.geyser.GeyserLogger;
|
||||||
import org.geysermc.geyser.network.MinecraftProtocol;
|
import org.geysermc.geyser.network.GameProtocol;
|
||||||
import org.geysermc.geyser.text.GeyserLocale;
|
import org.geysermc.geyser.text.GeyserLocale;
|
||||||
|
|
||||||
import java.lang.reflect.InvocationTargetException;
|
import java.lang.reflect.InvocationTargetException;
|
||||||
@ -48,7 +48,7 @@ public final class GeyserSpigotVersionChecker {
|
|||||||
try {
|
try {
|
||||||
// This method is only present on later versions of Paper
|
// This method is only present on later versions of Paper
|
||||||
UnsafeValues.class.getMethod("getProtocolVersion");
|
UnsafeValues.class.getMethod("getProtocolVersion");
|
||||||
if (Bukkit.getUnsafe().getProtocolVersion() != MinecraftProtocol.getJavaProtocolVersion()) {
|
if (Bukkit.getUnsafe().getProtocolVersion() != GameProtocol.getJavaProtocolVersion()) {
|
||||||
sendOutdatedMessage(logger);
|
sendOutdatedMessage(logger);
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
@ -82,7 +82,7 @@ public final class GeyserSpigotVersionChecker {
|
|||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (protocolVersion != MinecraftProtocol.getJavaProtocolVersion()) {
|
if (protocolVersion != GameProtocol.getJavaProtocolVersion()) {
|
||||||
sendOutdatedMessage(logger);
|
sendOutdatedMessage(logger);
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
@ -94,13 +94,13 @@ public final class GeyserSpigotVersionChecker {
|
|||||||
private static void checkViaVersionSupportedVersions(GeyserLogger logger) {
|
private static void checkViaVersionSupportedVersions(GeyserLogger logger) {
|
||||||
// Run after ViaVersion has obtained the server protocol version
|
// Run after ViaVersion has obtained the server protocol version
|
||||||
Via.getPlatform().runSync(() -> {
|
Via.getPlatform().runSync(() -> {
|
||||||
if (Via.getAPI().getSupportedVersions().contains(MinecraftProtocol.getJavaProtocolVersion())) {
|
if (Via.getAPI().getSupportedVersions().contains(GameProtocol.getJavaProtocolVersion())) {
|
||||||
// Via supports this protocol version; we will be able to connect.
|
// Via supports this protocol version; we will be able to connect.
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (Via.getAPI().getFullSupportedVersions().contains(MinecraftProtocol.getJavaProtocolVersion())) {
|
if (Via.getAPI().getFullSupportedVersions().contains(GameProtocol.getJavaProtocolVersion())) {
|
||||||
// ViaVersion supports our protocol, but the user has blocked them from connecting.
|
// ViaVersion supports our protocol, but the user has blocked them from connecting.
|
||||||
logger.warning(GeyserLocale.getLocaleStringLog("geyser.bootstrap.viaversion.blocked", MinecraftProtocol.getAllSupportedJavaVersions()));
|
logger.warning(GeyserLocale.getLocaleStringLog("geyser.bootstrap.viaversion.blocked", GameProtocol.getAllSupportedJavaVersions()));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// Else, presumably, ViaVersion is not updated.
|
// Else, presumably, ViaVersion is not updated.
|
||||||
@ -114,7 +114,7 @@ public final class GeyserSpigotVersionChecker {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private static void sendOutdatedMessage(GeyserLogger logger) {
|
private static void sendOutdatedMessage(GeyserLogger logger) {
|
||||||
logger.warning(GeyserLocale.getLocaleStringLog("geyser.bootstrap.no_supported_protocol", MinecraftProtocol.getAllSupportedJavaVersions(), VIAVERSION_DOWNLOAD_URL));
|
logger.warning(GeyserLocale.getLocaleStringLog("geyser.bootstrap.no_supported_protocol", GameProtocol.getAllSupportedJavaVersions(), VIAVERSION_DOWNLOAD_URL));
|
||||||
}
|
}
|
||||||
|
|
||||||
private GeyserSpigotVersionChecker() {
|
private GeyserSpigotVersionChecker() {
|
||||||
|
@ -32,7 +32,7 @@ import com.viaversion.viaversion.api.protocol.version.ProtocolVersion;
|
|||||||
import it.unimi.dsi.fastutil.ints.Int2IntMap;
|
import it.unimi.dsi.fastutil.ints.Int2IntMap;
|
||||||
import it.unimi.dsi.fastutil.ints.Int2IntOpenHashMap;
|
import it.unimi.dsi.fastutil.ints.Int2IntOpenHashMap;
|
||||||
import it.unimi.dsi.fastutil.ints.IntList;
|
import it.unimi.dsi.fastutil.ints.IntList;
|
||||||
import org.geysermc.geyser.network.MinecraftProtocol;
|
import org.geysermc.geyser.network.GameProtocol;
|
||||||
import org.geysermc.geyser.session.GeyserSession;
|
import org.geysermc.geyser.session.GeyserSession;
|
||||||
import org.geysermc.geyser.platform.spigot.GeyserSpigotPlugin;
|
import org.geysermc.geyser.platform.spigot.GeyserSpigotPlugin;
|
||||||
|
|
||||||
@ -50,7 +50,7 @@ public class GeyserSpigotLegacyNativeWorldManager extends GeyserSpigotNativeWorl
|
|||||||
IntList allBlockStates = adapter.getAllBlockStates();
|
IntList allBlockStates = adapter.getAllBlockStates();
|
||||||
oldToNewBlockId = new Int2IntOpenHashMap(allBlockStates.size());
|
oldToNewBlockId = new Int2IntOpenHashMap(allBlockStates.size());
|
||||||
ProtocolVersion serverVersion = plugin.getServerProtocolVersion();
|
ProtocolVersion serverVersion = plugin.getServerProtocolVersion();
|
||||||
List<ProtocolPathEntry> protocolList = Via.getManager().getProtocolManager().getProtocolPath(MinecraftProtocol.getJavaProtocolVersion(),
|
List<ProtocolPathEntry> protocolList = Via.getManager().getProtocolManager().getProtocolPath(GameProtocol.getJavaProtocolVersion(),
|
||||||
serverVersion.getVersion());
|
serverVersion.getVersion());
|
||||||
for (int oldBlockId : allBlockStates) {
|
for (int oldBlockId : allBlockStates) {
|
||||||
int newBlockId = oldBlockId;
|
int newBlockId = oldBlockId;
|
||||||
|
@ -38,7 +38,7 @@ import org.bukkit.entity.Player;
|
|||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
import org.bukkit.inventory.meta.BookMeta;
|
import org.bukkit.inventory.meta.BookMeta;
|
||||||
import org.bukkit.plugin.Plugin;
|
import org.bukkit.plugin.Plugin;
|
||||||
import org.geysermc.geyser.network.MinecraftProtocol;
|
import org.geysermc.geyser.network.GameProtocol;
|
||||||
import org.geysermc.geyser.session.GeyserSession;
|
import org.geysermc.geyser.session.GeyserSession;
|
||||||
import org.geysermc.geyser.translator.inventory.LecternInventoryTranslator;
|
import org.geysermc.geyser.translator.inventory.LecternInventoryTranslator;
|
||||||
import org.geysermc.geyser.level.GeyserWorldManager;
|
import org.geysermc.geyser.level.GeyserWorldManager;
|
||||||
@ -57,7 +57,7 @@ public class GeyserSpigotWorldManager extends GeyserWorldManager {
|
|||||||
/**
|
/**
|
||||||
* The current client protocol version for ViaVersion usage.
|
* The current client protocol version for ViaVersion usage.
|
||||||
*/
|
*/
|
||||||
protected static final int CLIENT_PROTOCOL_VERSION = MinecraftProtocol.getJavaProtocolVersion();
|
protected static final int CLIENT_PROTOCOL_VERSION = GameProtocol.getJavaProtocolVersion();
|
||||||
|
|
||||||
private final Plugin plugin;
|
private final Plugin plugin;
|
||||||
|
|
||||||
|
@ -26,7 +26,7 @@
|
|||||||
package org.geysermc.geyser.platform.sponge;
|
package org.geysermc.geyser.platform.sponge;
|
||||||
|
|
||||||
import org.geysermc.geyser.ping.GeyserPingInfo;
|
import org.geysermc.geyser.ping.GeyserPingInfo;
|
||||||
import org.geysermc.geyser.network.MinecraftProtocol;
|
import org.geysermc.geyser.network.GameProtocol;
|
||||||
import org.geysermc.geyser.ping.IGeyserPingPassthrough;
|
import org.geysermc.geyser.ping.IGeyserPingPassthrough;
|
||||||
import org.spongepowered.api.MinecraftVersion;
|
import org.spongepowered.api.MinecraftVersion;
|
||||||
import org.spongepowered.api.Sponge;
|
import org.spongepowered.api.Sponge;
|
||||||
@ -73,7 +73,7 @@ public class GeyserSpongePingPassthrough implements IGeyserPingPassthrough {
|
|||||||
),
|
),
|
||||||
new GeyserPingInfo.Version(
|
new GeyserPingInfo.Version(
|
||||||
event.getResponse().getVersion().getName(),
|
event.getResponse().getVersion().getName(),
|
||||||
MinecraftProtocol.getJavaProtocolVersion()) // thanks for also not exposing this sponge
|
GameProtocol.getJavaProtocolVersion()) // thanks for also not exposing this sponge
|
||||||
);
|
);
|
||||||
event.getResponse().getPlayers().get().getProfiles().stream()
|
event.getResponse().getPlayers().get().getProfiles().stream()
|
||||||
.map(GameProfile::getName)
|
.map(GameProfile::getName)
|
||||||
|
@ -45,7 +45,7 @@ import org.geysermc.geyser.ping.GeyserLegacyPingPassthrough;
|
|||||||
import org.geysermc.geyser.ping.IGeyserPingPassthrough;
|
import org.geysermc.geyser.ping.IGeyserPingPassthrough;
|
||||||
import org.geysermc.geyser.platform.velocity.command.GeyserVelocityCommandExecutor;
|
import org.geysermc.geyser.platform.velocity.command.GeyserVelocityCommandExecutor;
|
||||||
import org.geysermc.geyser.platform.velocity.command.GeyserVelocityCommandManager;
|
import org.geysermc.geyser.platform.velocity.command.GeyserVelocityCommandManager;
|
||||||
import org.geysermc.geyser.session.auth.AuthType;
|
import org.geysermc.geyser.api.network.AuthType;
|
||||||
import org.geysermc.geyser.text.GeyserLocale;
|
import org.geysermc.geyser.text.GeyserLocale;
|
||||||
import org.geysermc.geyser.util.FileUtils;
|
import org.geysermc.geyser.util.FileUtils;
|
||||||
import org.jetbrains.annotations.Nullable;
|
import org.jetbrains.annotations.Nullable;
|
||||||
@ -128,14 +128,14 @@ public class GeyserVelocityPlugin implements GeyserBootstrap {
|
|||||||
} catch (ClassNotFoundException ignored) {
|
} catch (ClassNotFoundException ignored) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (geyserConfig.getRemote().getAuthType() == AuthType.FLOODGATE && proxyServer.getPluginManager().getPlugin("floodgate").isEmpty()) {
|
if (geyserConfig.getRemote().getAuthType() == AuthType.HYBRID && proxyServer.getPluginManager().getPlugin("floodgate").isEmpty()) {
|
||||||
geyserLogger.severe(GeyserLocale.getLocaleStringLog("geyser.bootstrap.floodgate.not_installed") + " "
|
geyserLogger.severe(GeyserLocale.getLocaleStringLog("geyser.bootstrap.floodgate.not_installed") + " "
|
||||||
+ GeyserLocale.getLocaleStringLog("geyser.bootstrap.floodgate.disabling"));
|
+ GeyserLocale.getLocaleStringLog("geyser.bootstrap.floodgate.disabling"));
|
||||||
return;
|
return;
|
||||||
} else if (geyserConfig.isAutoconfiguredRemote() && proxyServer.getPluginManager().getPlugin("floodgate").isPresent()) {
|
} else if (geyserConfig.isAutoconfiguredRemote() && proxyServer.getPluginManager().getPlugin("floodgate").isPresent()) {
|
||||||
// Floodgate installed means that the user wants Floodgate authentication
|
// Floodgate installed means that the user wants Floodgate authentication
|
||||||
geyserLogger.debug("Auto-setting to Floodgate authentication.");
|
geyserLogger.debug("Auto-setting to Floodgate authentication.");
|
||||||
geyserConfig.getRemote().setAuthType(AuthType.FLOODGATE);
|
geyserConfig.getRemote().setAuthType(AuthType.HYBRID);
|
||||||
}
|
}
|
||||||
|
|
||||||
geyserConfig.loadFloodgate(this, proxyServer, configFolder.toFile());
|
geyserConfig.loadFloodgate(this, proxyServer, configFolder.toFile());
|
||||||
|
@ -56,11 +56,11 @@ public class GeyserSession {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public String getRemoteAddress() {
|
public String getRemoteAddress() {
|
||||||
return this.handle.getRemoteAddress();
|
return this.handle.remoteServer().address();
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getRemotePort() {
|
public int getRemotePort() {
|
||||||
return this.handle.getRemotePort();
|
return this.handle.remoteServer().port();
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getRenderDistance() {
|
public int getRenderDistance() {
|
||||||
|
@ -26,7 +26,7 @@
|
|||||||
package org.geysermc.geyser;
|
package org.geysermc.geyser;
|
||||||
|
|
||||||
import org.geysermc.geyser.configuration.GeyserJacksonConfiguration;
|
import org.geysermc.geyser.configuration.GeyserJacksonConfiguration;
|
||||||
import org.geysermc.geyser.session.auth.AuthType;
|
import org.geysermc.geyser.api.network.AuthType;
|
||||||
import org.geysermc.geyser.text.GeyserLocale;
|
import org.geysermc.geyser.text.GeyserLocale;
|
||||||
|
|
||||||
import java.nio.file.Files;
|
import java.nio.file.Files;
|
||||||
@ -34,7 +34,7 @@ import java.nio.file.Path;
|
|||||||
|
|
||||||
public class FloodgateKeyLoader {
|
public class FloodgateKeyLoader {
|
||||||
public static Path getKeyPath(GeyserJacksonConfiguration config, Path floodgateDataFolder, Path geyserDataFolder, GeyserLogger logger) {
|
public static Path getKeyPath(GeyserJacksonConfiguration config, Path floodgateDataFolder, Path geyserDataFolder, GeyserLogger logger) {
|
||||||
if (config.getRemote().getAuthType() != AuthType.FLOODGATE) {
|
if (config.getRemote().getAuthType() != AuthType.HYBRID) {
|
||||||
return geyserDataFolder.resolve(config.getFloodgateKeyFile());
|
return geyserDataFolder.resolve(config.getFloodgateKeyFile());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -55,6 +55,7 @@ import org.geysermc.geyser.api.event.EventBus;
|
|||||||
import org.geysermc.geyser.api.event.lifecycle.GeyserPostInitializeEvent;
|
import org.geysermc.geyser.api.event.lifecycle.GeyserPostInitializeEvent;
|
||||||
import org.geysermc.geyser.api.event.lifecycle.GeyserPreInitializeEvent;
|
import org.geysermc.geyser.api.event.lifecycle.GeyserPreInitializeEvent;
|
||||||
import org.geysermc.geyser.api.event.lifecycle.GeyserShutdownEvent;
|
import org.geysermc.geyser.api.event.lifecycle.GeyserShutdownEvent;
|
||||||
|
import org.geysermc.geyser.api.network.RemoteServer;
|
||||||
import org.geysermc.geyser.command.GeyserCommandManager;
|
import org.geysermc.geyser.command.GeyserCommandManager;
|
||||||
import org.geysermc.geyser.configuration.GeyserConfiguration;
|
import org.geysermc.geyser.configuration.GeyserConfiguration;
|
||||||
import org.geysermc.geyser.entity.EntityDefinitions;
|
import org.geysermc.geyser.entity.EntityDefinitions;
|
||||||
@ -62,6 +63,8 @@ import org.geysermc.geyser.event.GeyserEventBus;
|
|||||||
import org.geysermc.geyser.extension.GeyserExtensionManager;
|
import org.geysermc.geyser.extension.GeyserExtensionManager;
|
||||||
import org.geysermc.geyser.level.WorldManager;
|
import org.geysermc.geyser.level.WorldManager;
|
||||||
import org.geysermc.geyser.network.ConnectorServerEventHandler;
|
import org.geysermc.geyser.network.ConnectorServerEventHandler;
|
||||||
|
import org.geysermc.geyser.network.GameProtocol;
|
||||||
|
import org.geysermc.geyser.network.RemoteServerImpl;
|
||||||
import org.geysermc.geyser.pack.ResourcePack;
|
import org.geysermc.geyser.pack.ResourcePack;
|
||||||
import org.geysermc.geyser.registry.BlockRegistries;
|
import org.geysermc.geyser.registry.BlockRegistries;
|
||||||
import org.geysermc.geyser.registry.Registries;
|
import org.geysermc.geyser.registry.Registries;
|
||||||
@ -69,7 +72,7 @@ import org.geysermc.geyser.scoreboard.ScoreboardUpdater;
|
|||||||
import org.geysermc.geyser.session.GeyserSession;
|
import org.geysermc.geyser.session.GeyserSession;
|
||||||
import org.geysermc.geyser.session.PendingMicrosoftAuthentication;
|
import org.geysermc.geyser.session.PendingMicrosoftAuthentication;
|
||||||
import org.geysermc.geyser.session.SessionManager;
|
import org.geysermc.geyser.session.SessionManager;
|
||||||
import org.geysermc.geyser.session.auth.AuthType;
|
import org.geysermc.geyser.api.network.AuthType;
|
||||||
import org.geysermc.geyser.skin.FloodgateSkinUploader;
|
import org.geysermc.geyser.skin.FloodgateSkinUploader;
|
||||||
import org.geysermc.geyser.skin.SkinProvider;
|
import org.geysermc.geyser.skin.SkinProvider;
|
||||||
import org.geysermc.geyser.text.GeyserLocale;
|
import org.geysermc.geyser.text.GeyserLocale;
|
||||||
@ -83,7 +86,6 @@ import javax.naming.directory.InitialDirContext;
|
|||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.FileWriter;
|
import java.io.FileWriter;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InputStream;
|
|
||||||
import java.net.InetAddress;
|
import java.net.InetAddress;
|
||||||
import java.net.InetSocketAddress;
|
import java.net.InetSocketAddress;
|
||||||
import java.net.UnknownHostException;
|
import java.net.UnknownHostException;
|
||||||
@ -142,6 +144,8 @@ public class GeyserImpl implements GeyserApi {
|
|||||||
private final EventBus eventBus;
|
private final EventBus eventBus;
|
||||||
private final GeyserExtensionManager extensionManager;
|
private final GeyserExtensionManager extensionManager;
|
||||||
|
|
||||||
|
private final RemoteServer remoteServer;
|
||||||
|
|
||||||
private Metrics metrics;
|
private Metrics metrics;
|
||||||
|
|
||||||
private PendingMicrosoftAuthentication pendingMicrosoftAuthentication;
|
private PendingMicrosoftAuthentication pendingMicrosoftAuthentication;
|
||||||
@ -200,6 +204,14 @@ public class GeyserImpl implements GeyserApi {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this.remoteServer = new RemoteServerImpl(
|
||||||
|
config.getRemote().getAddress(),
|
||||||
|
config.getRemote().getPort(),
|
||||||
|
GameProtocol.getJavaProtocolVersion(),
|
||||||
|
GameProtocol.getJavaMinecraftVersion(),
|
||||||
|
config.getRemote().getAuthType()
|
||||||
|
);
|
||||||
|
|
||||||
double completeTime = (System.currentTimeMillis() - startupTime) / 1000D;
|
double completeTime = (System.currentTimeMillis() - startupTime) / 1000D;
|
||||||
String message = GeyserLocale.getLocaleStringLog("geyser.core.finish.done", new DecimalFormat("#.###").format(completeTime)) + " ";
|
String message = GeyserLocale.getLocaleStringLog("geyser.core.finish.done", new DecimalFormat("#.###").format(completeTime)) + " ";
|
||||||
if (isGui) {
|
if (isGui) {
|
||||||
@ -212,7 +224,7 @@ public class GeyserImpl implements GeyserApi {
|
|||||||
|
|
||||||
if (platformType == PlatformType.STANDALONE) {
|
if (platformType == PlatformType.STANDALONE) {
|
||||||
logger.warning(GeyserLocale.getLocaleStringLog("geyser.core.movement_warn"));
|
logger.warning(GeyserLocale.getLocaleStringLog("geyser.core.movement_warn"));
|
||||||
} else if (config.getRemote().getAuthType() == AuthType.FLOODGATE) {
|
} else if (config.getRemote().getAuthType() == AuthType.HYBRID) {
|
||||||
VersionCheckUtils.checkForOutdatedFloodgate(logger);
|
VersionCheckUtils.checkForOutdatedFloodgate(logger);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -270,7 +282,7 @@ public class GeyserImpl implements GeyserApi {
|
|||||||
// Ensure that PacketLib does not create an event loop for handling packets; we'll do that ourselves
|
// Ensure that PacketLib does not create an event loop for handling packets; we'll do that ourselves
|
||||||
TcpSession.USE_EVENT_LOOP_FOR_PACKETS = false;
|
TcpSession.USE_EVENT_LOOP_FOR_PACKETS = false;
|
||||||
|
|
||||||
if (config.getRemote().getAuthType() == AuthType.FLOODGATE) {
|
if (config.getRemote().getAuthType() == AuthType.HYBRID) {
|
||||||
try {
|
try {
|
||||||
Key key = new AesKeyProducer().produceFrom(config.getFloodgateKeyPath());
|
Key key = new AesKeyProducer().produceFrom(config.getFloodgateKeyPath());
|
||||||
cipher = new AesCipher(new Base64Topping());
|
cipher = new AesCipher(new Base64Topping());
|
||||||
@ -558,6 +570,11 @@ public class GeyserImpl implements GeyserApi {
|
|||||||
return this.eventBus;
|
return this.eventBus;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public RemoteServer getDefaultRemoteServer() {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
public static GeyserImpl start(PlatformType platformType, GeyserBootstrap bootstrap) {
|
public static GeyserImpl start(PlatformType platformType, GeyserBootstrap bootstrap) {
|
||||||
if (instance == null) {
|
if (instance == null) {
|
||||||
return new GeyserImpl(platformType, bootstrap);
|
return new GeyserImpl(platformType, bootstrap);
|
||||||
|
@ -30,18 +30,16 @@ import org.geysermc.common.PlatformType;
|
|||||||
import org.geysermc.geyser.GeyserImpl;
|
import org.geysermc.geyser.GeyserImpl;
|
||||||
import org.geysermc.geyser.command.GeyserCommandSource;
|
import org.geysermc.geyser.command.GeyserCommandSource;
|
||||||
import org.geysermc.geyser.command.GeyserCommand;
|
import org.geysermc.geyser.command.GeyserCommand;
|
||||||
import org.geysermc.geyser.network.MinecraftProtocol;
|
import org.geysermc.geyser.network.GameProtocol;
|
||||||
import org.geysermc.geyser.session.GeyserSession;
|
import org.geysermc.geyser.session.GeyserSession;
|
||||||
import org.geysermc.geyser.text.ChatColor;
|
import org.geysermc.geyser.text.ChatColor;
|
||||||
import org.geysermc.geyser.text.GeyserLocale;
|
import org.geysermc.geyser.text.GeyserLocale;
|
||||||
import org.geysermc.geyser.util.WebUtils;
|
import org.geysermc.geyser.util.WebUtils;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InputStream;
|
|
||||||
import java.net.URLEncoder;
|
import java.net.URLEncoder;
|
||||||
import java.nio.charset.StandardCharsets;
|
import java.nio.charset.StandardCharsets;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Properties;
|
|
||||||
|
|
||||||
public class VersionCommand extends GeyserCommand {
|
public class VersionCommand extends GeyserCommand {
|
||||||
|
|
||||||
@ -56,14 +54,14 @@ public class VersionCommand extends GeyserCommand {
|
|||||||
@Override
|
@Override
|
||||||
public void execute(GeyserSession session, GeyserCommandSource sender, String[] args) {
|
public void execute(GeyserSession session, GeyserCommandSource sender, String[] args) {
|
||||||
String bedrockVersions;
|
String bedrockVersions;
|
||||||
List<BedrockPacketCodec> supportedCodecs = MinecraftProtocol.SUPPORTED_BEDROCK_CODECS;
|
List<BedrockPacketCodec> supportedCodecs = GameProtocol.SUPPORTED_BEDROCK_CODECS;
|
||||||
if (supportedCodecs.size() > 1) {
|
if (supportedCodecs.size() > 1) {
|
||||||
bedrockVersions = supportedCodecs.get(0).getMinecraftVersion() + " - " + supportedCodecs.get(supportedCodecs.size() - 1).getMinecraftVersion();
|
bedrockVersions = supportedCodecs.get(0).getMinecraftVersion() + " - " + supportedCodecs.get(supportedCodecs.size() - 1).getMinecraftVersion();
|
||||||
} else {
|
} else {
|
||||||
bedrockVersions = MinecraftProtocol.SUPPORTED_BEDROCK_CODECS.get(0).getMinecraftVersion();
|
bedrockVersions = GameProtocol.SUPPORTED_BEDROCK_CODECS.get(0).getMinecraftVersion();
|
||||||
}
|
}
|
||||||
String javaVersions;
|
String javaVersions;
|
||||||
List<String> supportedJavaVersions = MinecraftProtocol.getJavaVersions();
|
List<String> supportedJavaVersions = GameProtocol.getJavaVersions();
|
||||||
if (supportedJavaVersions.size() > 1) {
|
if (supportedJavaVersions.size() > 1) {
|
||||||
javaVersions = supportedJavaVersions.get(0) + " - " + supportedJavaVersions.get(supportedJavaVersions.size() - 1);
|
javaVersions = supportedJavaVersions.get(0) + " - " + supportedJavaVersions.get(supportedJavaVersions.size() - 1);
|
||||||
} else {
|
} else {
|
||||||
|
@ -27,7 +27,7 @@ package org.geysermc.geyser.configuration;
|
|||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||||
import org.geysermc.geyser.GeyserLogger;
|
import org.geysermc.geyser.GeyserLogger;
|
||||||
import org.geysermc.geyser.session.auth.AuthType;
|
import org.geysermc.geyser.api.network.AuthType;
|
||||||
import org.geysermc.geyser.network.CIDRMatcher;
|
import org.geysermc.geyser.network.CIDRMatcher;
|
||||||
import org.geysermc.geyser.text.GeyserLocale;
|
import org.geysermc.geyser.text.GeyserLocale;
|
||||||
|
|
||||||
|
@ -35,7 +35,7 @@ import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
|
|||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import lombok.Setter;
|
import lombok.Setter;
|
||||||
import org.geysermc.geyser.GeyserImpl;
|
import org.geysermc.geyser.GeyserImpl;
|
||||||
import org.geysermc.geyser.session.auth.AuthType;
|
import org.geysermc.geyser.api.network.AuthType;
|
||||||
import org.geysermc.geyser.text.AsteriskSerializer;
|
import org.geysermc.geyser.text.AsteriskSerializer;
|
||||||
import org.geysermc.geyser.network.CIDRMatcher;
|
import org.geysermc.geyser.network.CIDRMatcher;
|
||||||
import org.geysermc.geyser.text.GeyserLocale;
|
import org.geysermc.geyser.text.GeyserLocale;
|
||||||
@ -208,7 +208,7 @@ public abstract class GeyserJacksonConfiguration implements GeyserConfiguration
|
|||||||
private int port = 25565;
|
private int port = 25565;
|
||||||
|
|
||||||
@Setter
|
@Setter
|
||||||
@JsonDeserialize(using = AuthType.Deserializer.class)
|
@JsonDeserialize(using = AuthTypeDeserializer.class)
|
||||||
@JsonProperty("auth-type")
|
@JsonProperty("auth-type")
|
||||||
private AuthType authType = AuthType.ONLINE;
|
private AuthType authType = AuthType.ONLINE;
|
||||||
|
|
||||||
@ -274,4 +274,11 @@ public abstract class GeyserJacksonConfiguration implements GeyserConfiguration
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static class AuthTypeDeserializer extends JsonDeserializer<AuthType> {
|
||||||
|
@Override
|
||||||
|
public AuthType deserialize(JsonParser p, DeserializationContext ctxt) throws IOException {
|
||||||
|
return AuthType.getByName(p.getValueAsString());
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -40,7 +40,7 @@ import org.geysermc.geyser.api.GeyserApi;
|
|||||||
import org.geysermc.geyser.api.extension.Extension;
|
import org.geysermc.geyser.api.extension.Extension;
|
||||||
import org.geysermc.geyser.text.AsteriskSerializer;
|
import org.geysermc.geyser.text.AsteriskSerializer;
|
||||||
import org.geysermc.geyser.configuration.GeyserConfiguration;
|
import org.geysermc.geyser.configuration.GeyserConfiguration;
|
||||||
import org.geysermc.geyser.network.MinecraftProtocol;
|
import org.geysermc.geyser.network.GameProtocol;
|
||||||
import org.geysermc.geyser.session.GeyserSession;
|
import org.geysermc.geyser.session.GeyserSession;
|
||||||
import org.geysermc.geyser.util.FileUtils;
|
import org.geysermc.geyser.util.FileUtils;
|
||||||
import org.geysermc.geyser.util.WebUtils;
|
import org.geysermc.geyser.util.WebUtils;
|
||||||
@ -216,11 +216,11 @@ public class DumpInfo {
|
|||||||
private final int javaProtocol;
|
private final int javaProtocol;
|
||||||
|
|
||||||
MCInfo() {
|
MCInfo() {
|
||||||
this.bedrockVersions = MinecraftProtocol.SUPPORTED_BEDROCK_CODECS.stream().map(BedrockPacketCodec::getMinecraftVersion).toList();
|
this.bedrockVersions = GameProtocol.SUPPORTED_BEDROCK_CODECS.stream().map(BedrockPacketCodec::getMinecraftVersion).toList();
|
||||||
this.bedrockProtocols = MinecraftProtocol.SUPPORTED_BEDROCK_CODECS.stream().map(BedrockPacketCodec::getProtocolVersion).toList();
|
this.bedrockProtocols = GameProtocol.SUPPORTED_BEDROCK_CODECS.stream().map(BedrockPacketCodec::getProtocolVersion).toList();
|
||||||
this.defaultBedrockProtocol = MinecraftProtocol.DEFAULT_BEDROCK_CODEC.getProtocolVersion();
|
this.defaultBedrockProtocol = GameProtocol.DEFAULT_BEDROCK_CODEC.getProtocolVersion();
|
||||||
this.javaVersions = MinecraftProtocol.getJavaVersions();
|
this.javaVersions = GameProtocol.getJavaVersions();
|
||||||
this.javaProtocol = MinecraftProtocol.getJavaProtocolVersion();
|
this.javaProtocol = GameProtocol.getJavaProtocolVersion();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -50,7 +50,7 @@ public class ConnectorServerEventHandler implements BedrockServerEventHandler {
|
|||||||
/*
|
/*
|
||||||
The following constants are all used to ensure the ping does not reach a length where it is unparsable by the Bedrock client
|
The following constants are all used to ensure the ping does not reach a length where it is unparsable by the Bedrock client
|
||||||
*/
|
*/
|
||||||
private static final int MINECRAFT_VERSION_BYTES_LENGTH = MinecraftProtocol.DEFAULT_BEDROCK_CODEC.getMinecraftVersion().getBytes(StandardCharsets.UTF_8).length;
|
private static final int MINECRAFT_VERSION_BYTES_LENGTH = GameProtocol.DEFAULT_BEDROCK_CODEC.getMinecraftVersion().getBytes(StandardCharsets.UTF_8).length;
|
||||||
private static final int BRAND_BYTES_LENGTH = GeyserImpl.NAME.getBytes(StandardCharsets.UTF_8).length;
|
private static final int BRAND_BYTES_LENGTH = GeyserImpl.NAME.getBytes(StandardCharsets.UTF_8).length;
|
||||||
/**
|
/**
|
||||||
* The MOTD, sub-MOTD and Minecraft version ({@link #MINECRAFT_VERSION_BYTES_LENGTH}) combined cannot reach this length.
|
* The MOTD, sub-MOTD and Minecraft version ({@link #MINECRAFT_VERSION_BYTES_LENGTH}) combined cannot reach this length.
|
||||||
@ -104,8 +104,8 @@ public class ConnectorServerEventHandler implements BedrockServerEventHandler {
|
|||||||
pong.setEdition("MCPE");
|
pong.setEdition("MCPE");
|
||||||
pong.setGameType("Survival"); // Can only be Survival or Creative as of 1.16.210.59
|
pong.setGameType("Survival"); // Can only be Survival or Creative as of 1.16.210.59
|
||||||
pong.setNintendoLimited(false);
|
pong.setNintendoLimited(false);
|
||||||
pong.setProtocolVersion(MinecraftProtocol.DEFAULT_BEDROCK_CODEC.getProtocolVersion());
|
pong.setProtocolVersion(GameProtocol.DEFAULT_BEDROCK_CODEC.getProtocolVersion());
|
||||||
pong.setVersion(MinecraftProtocol.DEFAULT_BEDROCK_CODEC.getMinecraftVersion()); // Required to not be empty as of 1.16.210.59. Can only contain . and numbers.
|
pong.setVersion(GameProtocol.DEFAULT_BEDROCK_CODEC.getMinecraftVersion()); // Required to not be empty as of 1.16.210.59. Can only contain . and numbers.
|
||||||
pong.setIpv4Port(config.getBedrock().getPort());
|
pong.setIpv4Port(config.getBedrock().getPort());
|
||||||
|
|
||||||
if (config.isPassthroughMotd() && pingInfo != null && pingInfo.getDescription() != null) {
|
if (config.isPassthroughMotd() && pingInfo != null && pingInfo.getDescription() != null) {
|
||||||
@ -167,7 +167,7 @@ public class ConnectorServerEventHandler implements BedrockServerEventHandler {
|
|||||||
@Override
|
@Override
|
||||||
public void onSessionCreation(@Nonnull BedrockServerSession bedrockServerSession) {
|
public void onSessionCreation(@Nonnull BedrockServerSession bedrockServerSession) {
|
||||||
try {
|
try {
|
||||||
bedrockServerSession.setPacketCodec(MinecraftProtocol.DEFAULT_BEDROCK_CODEC);
|
bedrockServerSession.setPacketCodec(GameProtocol.DEFAULT_BEDROCK_CODEC);
|
||||||
bedrockServerSession.setLogging(true);
|
bedrockServerSession.setLogging(true);
|
||||||
bedrockServerSession.setCompressionLevel(geyser.getConfig().getBedrock().getCompressionLevel());
|
bedrockServerSession.setCompressionLevel(geyser.getConfig().getBedrock().getCompressionLevel());
|
||||||
bedrockServerSession.setPacketHandler(new UpstreamPacketHandler(geyser, new GeyserSession(geyser, bedrockServerSession, eventLoopGroup.next())));
|
bedrockServerSession.setPacketHandler(new UpstreamPacketHandler(geyser, new GeyserSession(geyser, bedrockServerSession, eventLoopGroup.next())));
|
||||||
|
@ -37,7 +37,7 @@ import java.util.*;
|
|||||||
/**
|
/**
|
||||||
* Contains information about the supported protocols in Geyser.
|
* Contains information about the supported protocols in Geyser.
|
||||||
*/
|
*/
|
||||||
public final class MinecraftProtocol {
|
public final class GameProtocol {
|
||||||
/**
|
/**
|
||||||
* Default Bedrock codec that should act as a fallback. Should represent the latest available
|
* Default Bedrock codec that should act as a fallback. Should represent the latest available
|
||||||
* release of the game that Geyser supports.
|
* release of the game that Geyser supports.
|
||||||
@ -103,6 +103,15 @@ public final class MinecraftProtocol {
|
|||||||
return DEFAULT_JAVA_CODEC.getProtocolVersion();
|
return DEFAULT_JAVA_CODEC.getProtocolVersion();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the supported Minecraft: Java Edition version.
|
||||||
|
*
|
||||||
|
* @return the supported Minecraft: Java Edition version
|
||||||
|
*/
|
||||||
|
public static String getJavaMinecraftVersion() {
|
||||||
|
return DEFAULT_JAVA_CODEC.getMinecraftVersion();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return a string showing all supported Bedrock versions for this Geyser instance
|
* @return a string showing all supported Bedrock versions for this Geyser instance
|
||||||
*/
|
*/
|
||||||
@ -127,6 +136,6 @@ public final class MinecraftProtocol {
|
|||||||
return joiner.toString();
|
return joiner.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
private MinecraftProtocol() {
|
private GameProtocol() {
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -175,7 +175,7 @@ public class QueryPacketHandler {
|
|||||||
gameData.put("hostname", motd);
|
gameData.put("hostname", motd);
|
||||||
gameData.put("gametype", "SMP");
|
gameData.put("gametype", "SMP");
|
||||||
gameData.put("game_id", "MINECRAFT");
|
gameData.put("game_id", "MINECRAFT");
|
||||||
gameData.put("version", GeyserImpl.NAME + " (" + GeyserImpl.GIT_VERSION + ") " + MinecraftProtocol.DEFAULT_BEDROCK_CODEC.getMinecraftVersion());
|
gameData.put("version", GeyserImpl.NAME + " (" + GeyserImpl.GIT_VERSION + ") " + GameProtocol.DEFAULT_BEDROCK_CODEC.getMinecraftVersion());
|
||||||
gameData.put("plugins", "");
|
gameData.put("plugins", "");
|
||||||
gameData.put("map", map);
|
gameData.put("map", map);
|
||||||
gameData.put("numplayers", currentPlayerCount);
|
gameData.put("numplayers", currentPlayerCount);
|
||||||
|
32
core/src/main/java/org/geysermc/geyser/network/RemoteServerImpl.java
Normale Datei
32
core/src/main/java/org/geysermc/geyser/network/RemoteServerImpl.java
Normale Datei
@ -0,0 +1,32 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2019-2022 GeyserMC. http://geysermc.org
|
||||||
|
*
|
||||||
|
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
* of this software and associated documentation files (the "Software"), to deal
|
||||||
|
* in the Software without restriction, including without limitation the rights
|
||||||
|
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
* copies of the Software, and to permit persons to whom the Software is
|
||||||
|
* furnished to do so, subject to the following conditions:
|
||||||
|
*
|
||||||
|
* The above copyright notice and this permission notice shall be included in
|
||||||
|
* all copies or substantial portions of the Software.
|
||||||
|
*
|
||||||
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||||
|
* THE SOFTWARE.
|
||||||
|
*
|
||||||
|
* @author GeyserMC
|
||||||
|
* @link https://github.com/GeyserMC/Geyser
|
||||||
|
*/
|
||||||
|
|
||||||
|
package org.geysermc.geyser.network;
|
||||||
|
|
||||||
|
import org.geysermc.geyser.api.network.AuthType;
|
||||||
|
import org.geysermc.geyser.api.network.RemoteServer;
|
||||||
|
|
||||||
|
public record RemoteServerImpl(String address, int port, int protocolVersion, String minecraftVersion, AuthType authType) implements RemoteServer {
|
||||||
|
}
|
@ -33,7 +33,7 @@ import com.nukkitx.protocol.bedrock.packet.*;
|
|||||||
import com.nukkitx.protocol.bedrock.v471.Bedrock_v471;
|
import com.nukkitx.protocol.bedrock.v471.Bedrock_v471;
|
||||||
import org.geysermc.geyser.GeyserImpl;
|
import org.geysermc.geyser.GeyserImpl;
|
||||||
import org.geysermc.geyser.session.PendingMicrosoftAuthentication;
|
import org.geysermc.geyser.session.PendingMicrosoftAuthentication;
|
||||||
import org.geysermc.geyser.session.auth.AuthType;
|
import org.geysermc.geyser.api.network.AuthType;
|
||||||
import org.geysermc.geyser.configuration.GeyserConfiguration;
|
import org.geysermc.geyser.configuration.GeyserConfiguration;
|
||||||
import org.geysermc.geyser.session.GeyserSession;
|
import org.geysermc.geyser.session.GeyserSession;
|
||||||
import org.geysermc.geyser.pack.ResourcePack;
|
import org.geysermc.geyser.pack.ResourcePack;
|
||||||
@ -69,14 +69,14 @@ public class UpstreamPacketHandler extends LoggingPacketHandler {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
BedrockPacketCodec packetCodec = MinecraftProtocol.getBedrockCodec(loginPacket.getProtocolVersion());
|
BedrockPacketCodec packetCodec = GameProtocol.getBedrockCodec(loginPacket.getProtocolVersion());
|
||||||
if (packetCodec == null) {
|
if (packetCodec == null) {
|
||||||
String supportedVersions = MinecraftProtocol.getAllSupportedBedrockVersions();
|
String supportedVersions = GameProtocol.getAllSupportedBedrockVersions();
|
||||||
if (loginPacket.getProtocolVersion() > MinecraftProtocol.DEFAULT_BEDROCK_CODEC.getProtocolVersion()) {
|
if (loginPacket.getProtocolVersion() > GameProtocol.DEFAULT_BEDROCK_CODEC.getProtocolVersion()) {
|
||||||
// Too early to determine session locale
|
// Too early to determine session locale
|
||||||
session.disconnect(GeyserLocale.getLocaleStringLog("geyser.network.outdated.server", supportedVersions));
|
session.disconnect(GeyserLocale.getLocaleStringLog("geyser.network.outdated.server", supportedVersions));
|
||||||
return true;
|
return true;
|
||||||
} else if (loginPacket.getProtocolVersion() < MinecraftProtocol.DEFAULT_BEDROCK_CODEC.getProtocolVersion()) {
|
} else if (loginPacket.getProtocolVersion() < GameProtocol.DEFAULT_BEDROCK_CODEC.getProtocolVersion()) {
|
||||||
session.disconnect(GeyserLocale.getLocaleStringLog("geyser.network.outdated.client", supportedVersions));
|
session.disconnect(GeyserLocale.getLocaleStringLog("geyser.network.outdated.client", supportedVersions));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -29,7 +29,7 @@ import com.fasterxml.jackson.core.JsonParseException;
|
|||||||
import com.fasterxml.jackson.databind.JsonMappingException;
|
import com.fasterxml.jackson.databind.JsonMappingException;
|
||||||
import com.nukkitx.nbt.util.VarInts;
|
import com.nukkitx.nbt.util.VarInts;
|
||||||
import org.geysermc.geyser.GeyserImpl;
|
import org.geysermc.geyser.GeyserImpl;
|
||||||
import org.geysermc.geyser.network.MinecraftProtocol;
|
import org.geysermc.geyser.network.GameProtocol;
|
||||||
|
|
||||||
import java.io.ByteArrayOutputStream;
|
import java.io.ByteArrayOutputStream;
|
||||||
import java.io.DataInputStream;
|
import java.io.DataInputStream;
|
||||||
@ -83,7 +83,7 @@ public class GeyserLegacyPingPassthrough implements IGeyserPingPassthrough, Runn
|
|||||||
ByteArrayOutputStream byteArrayStream = new ByteArrayOutputStream();
|
ByteArrayOutputStream byteArrayStream = new ByteArrayOutputStream();
|
||||||
DataOutputStream handshake = new DataOutputStream(byteArrayStream);
|
DataOutputStream handshake = new DataOutputStream(byteArrayStream);
|
||||||
handshake.write(0x0);
|
handshake.write(0x0);
|
||||||
VarInts.writeUnsignedInt(handshake, MinecraftProtocol.getJavaProtocolVersion());
|
VarInts.writeUnsignedInt(handshake, GameProtocol.getJavaProtocolVersion());
|
||||||
VarInts.writeUnsignedInt(handshake, address.length());
|
VarInts.writeUnsignedInt(handshake, address.length());
|
||||||
handshake.writeBytes(address);
|
handshake.writeBytes(address);
|
||||||
handshake.writeShort(port);
|
handshake.writeShort(port);
|
||||||
|
@ -30,7 +30,7 @@ import it.unimi.dsi.fastutil.ints.IntOpenHashSet;
|
|||||||
import it.unimi.dsi.fastutil.ints.IntSet;
|
import it.unimi.dsi.fastutil.ints.IntSet;
|
||||||
import org.geysermc.geyser.GeyserImpl;
|
import org.geysermc.geyser.GeyserImpl;
|
||||||
import org.geysermc.geyser.inventory.item.Enchantment.JavaEnchantment;
|
import org.geysermc.geyser.inventory.item.Enchantment.JavaEnchantment;
|
||||||
import org.geysermc.geyser.network.MinecraftProtocol;
|
import org.geysermc.geyser.network.GameProtocol;
|
||||||
import org.geysermc.geyser.registry.Registries;
|
import org.geysermc.geyser.registry.Registries;
|
||||||
import org.geysermc.geyser.registry.type.EnchantmentData;
|
import org.geysermc.geyser.registry.type.EnchantmentData;
|
||||||
import org.geysermc.geyser.registry.type.ItemMapping;
|
import org.geysermc.geyser.registry.type.ItemMapping;
|
||||||
@ -77,7 +77,7 @@ public class EnchantmentRegistryLoader implements RegistryLoader<String, Map<Jav
|
|||||||
IntSet validItems = new IntOpenHashSet();
|
IntSet validItems = new IntOpenHashSet();
|
||||||
for (JsonNode itemNode : node.get("valid_items")) {
|
for (JsonNode itemNode : node.get("valid_items")) {
|
||||||
String javaIdentifier = itemNode.textValue();
|
String javaIdentifier = itemNode.textValue();
|
||||||
ItemMapping itemMapping = Registries.ITEMS.forVersion(MinecraftProtocol.DEFAULT_BEDROCK_CODEC.getProtocolVersion()).getMapping(javaIdentifier);
|
ItemMapping itemMapping = Registries.ITEMS.forVersion(GameProtocol.DEFAULT_BEDROCK_CODEC.getProtocolVersion()).getMapping(javaIdentifier);
|
||||||
if (itemMapping != null) {
|
if (itemMapping != null) {
|
||||||
validItems.add(itemMapping.getJavaId());
|
validItems.add(itemMapping.getJavaId());
|
||||||
} else {
|
} else {
|
||||||
|
@ -26,7 +26,7 @@
|
|||||||
package org.geysermc.geyser.registry.loader;
|
package org.geysermc.geyser.registry.loader;
|
||||||
|
|
||||||
import com.nukkitx.protocol.bedrock.data.inventory.PotionMixData;
|
import com.nukkitx.protocol.bedrock.data.inventory.PotionMixData;
|
||||||
import org.geysermc.geyser.network.MinecraftProtocol;
|
import org.geysermc.geyser.network.GameProtocol;
|
||||||
import org.geysermc.geyser.registry.Registries;
|
import org.geysermc.geyser.registry.Registries;
|
||||||
import org.geysermc.geyser.registry.type.ItemMapping;
|
import org.geysermc.geyser.registry.type.ItemMapping;
|
||||||
import org.geysermc.geyser.inventory.item.Potion;
|
import org.geysermc.geyser.inventory.item.Potion;
|
||||||
@ -103,7 +103,7 @@ public class PotionMixRegistryLoader implements RegistryLoader<Object, Set<Potio
|
|||||||
}
|
}
|
||||||
|
|
||||||
private static ItemMapping getNonNull(String javaIdentifier) {
|
private static ItemMapping getNonNull(String javaIdentifier) {
|
||||||
ItemMapping itemMapping = Registries.ITEMS.forVersion(MinecraftProtocol.DEFAULT_BEDROCK_CODEC.getProtocolVersion()).getMapping(javaIdentifier);
|
ItemMapping itemMapping = Registries.ITEMS.forVersion(GameProtocol.DEFAULT_BEDROCK_CODEC.getProtocolVersion()).getMapping(javaIdentifier);
|
||||||
if (itemMapping == null)
|
if (itemMapping == null)
|
||||||
throw new NullPointerException("No item entry exists for java identifier: " + javaIdentifier);
|
throw new NullPointerException("No item entry exists for java identifier: " + javaIdentifier);
|
||||||
|
|
||||||
|
@ -28,7 +28,7 @@ package org.geysermc.geyser.registry.type;
|
|||||||
import lombok.Builder;
|
import lombok.Builder;
|
||||||
import lombok.EqualsAndHashCode;
|
import lombok.EqualsAndHashCode;
|
||||||
import lombok.Value;
|
import lombok.Value;
|
||||||
import org.geysermc.geyser.network.MinecraftProtocol;
|
import org.geysermc.geyser.network.GameProtocol;
|
||||||
import org.geysermc.geyser.registry.BlockRegistries;
|
import org.geysermc.geyser.registry.BlockRegistries;
|
||||||
|
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
@ -38,7 +38,7 @@ import java.util.Set;
|
|||||||
@EqualsAndHashCode
|
@EqualsAndHashCode
|
||||||
public class ItemMapping {
|
public class ItemMapping {
|
||||||
public static final ItemMapping AIR = new ItemMapping("minecraft:air", "minecraft:air", 0, 0, 0,
|
public static final ItemMapping AIR = new ItemMapping("minecraft:air", "minecraft:air", 0, 0, 0,
|
||||||
BlockRegistries.BLOCKS.forVersion(MinecraftProtocol.DEFAULT_BEDROCK_CODEC.getProtocolVersion()).getBedrockAirId(),
|
BlockRegistries.BLOCKS.forVersion(GameProtocol.DEFAULT_BEDROCK_CODEC.getProtocolVersion()).getBedrockAirId(),
|
||||||
64, null, null, null, 0, null, false);
|
64, null, null, null, 0, null, false);
|
||||||
|
|
||||||
String javaIdentifier;
|
String javaIdentifier;
|
||||||
|
@ -78,6 +78,7 @@ import lombok.AccessLevel;
|
|||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import lombok.NonNull;
|
import lombok.NonNull;
|
||||||
import lombok.Setter;
|
import lombok.Setter;
|
||||||
|
import lombok.experimental.Accessors;
|
||||||
import org.checkerframework.common.value.qual.IntRange;
|
import org.checkerframework.common.value.qual.IntRange;
|
||||||
import org.geysermc.common.PlatformType;
|
import org.geysermc.common.PlatformType;
|
||||||
import org.geysermc.cumulus.Form;
|
import org.geysermc.cumulus.Form;
|
||||||
@ -87,6 +88,7 @@ import org.geysermc.floodgate.util.BedrockData;
|
|||||||
import org.geysermc.geyser.Constants;
|
import org.geysermc.geyser.Constants;
|
||||||
import org.geysermc.geyser.GeyserImpl;
|
import org.geysermc.geyser.GeyserImpl;
|
||||||
import org.geysermc.geyser.api.connection.GeyserConnection;
|
import org.geysermc.geyser.api.connection.GeyserConnection;
|
||||||
|
import org.geysermc.geyser.api.network.RemoteServer;
|
||||||
import org.geysermc.geyser.command.GeyserCommandSource;
|
import org.geysermc.geyser.command.GeyserCommandSource;
|
||||||
import org.geysermc.geyser.configuration.EmoteOffhandWorkaroundOption;
|
import org.geysermc.geyser.configuration.EmoteOffhandWorkaroundOption;
|
||||||
import org.geysermc.geyser.entity.attribute.GeyserAttributeType;
|
import org.geysermc.geyser.entity.attribute.GeyserAttributeType;
|
||||||
@ -106,7 +108,7 @@ import org.geysermc.geyser.registry.type.BlockMappings;
|
|||||||
import org.geysermc.geyser.registry.type.ItemMapping;
|
import org.geysermc.geyser.registry.type.ItemMapping;
|
||||||
import org.geysermc.geyser.registry.type.ItemMappings;
|
import org.geysermc.geyser.registry.type.ItemMappings;
|
||||||
import org.geysermc.geyser.session.auth.AuthData;
|
import org.geysermc.geyser.session.auth.AuthData;
|
||||||
import org.geysermc.geyser.session.auth.AuthType;
|
import org.geysermc.geyser.api.network.AuthType;
|
||||||
import org.geysermc.geyser.session.auth.BedrockClientData;
|
import org.geysermc.geyser.session.auth.BedrockClientData;
|
||||||
import org.geysermc.geyser.session.cache.*;
|
import org.geysermc.geyser.session.cache.*;
|
||||||
import org.geysermc.geyser.skin.FloodgateSkinUploader;
|
import org.geysermc.geyser.skin.FloodgateSkinUploader;
|
||||||
@ -143,14 +145,9 @@ public class GeyserSession implements GeyserConnection, GeyserCommandSource {
|
|||||||
@Setter
|
@Setter
|
||||||
private BedrockClientData clientData;
|
private BedrockClientData clientData;
|
||||||
|
|
||||||
/* Setter for GeyserConnect */
|
@Accessors(fluent = true)
|
||||||
@Setter
|
@Setter
|
||||||
private String remoteAddress;
|
private RemoteServer remoteServer;
|
||||||
@Setter
|
|
||||||
private int remotePort;
|
|
||||||
@Setter
|
|
||||||
private AuthType remoteAuthType;
|
|
||||||
/* Setter for GeyserConnect */
|
|
||||||
|
|
||||||
@Deprecated
|
@Deprecated
|
||||||
@Setter
|
@Setter
|
||||||
@ -567,9 +564,7 @@ public class GeyserSession implements GeyserConnection, GeyserCommandSource {
|
|||||||
disconnect(message);
|
disconnect(message);
|
||||||
});
|
});
|
||||||
|
|
||||||
this.remoteAddress = geyser.getConfig().getRemote().getAddress();
|
this.remoteServer = geyser.getRemoteServer();
|
||||||
this.remotePort = geyser.getConfig().getRemote().getPort();
|
|
||||||
this.remoteAuthType = geyser.getConfig().getRemote().getAuthType();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -666,7 +661,7 @@ public class GeyserSession implements GeyserConnection, GeyserCommandSource {
|
|||||||
// However, this doesn't affect the final username as Floodgate is still in charge of that.
|
// However, this doesn't affect the final username as Floodgate is still in charge of that.
|
||||||
// So if you have (for example) replace spaces enabled on Floodgate the spaces will re-appear.
|
// So if you have (for example) replace spaces enabled on Floodgate the spaces will re-appear.
|
||||||
String validUsername = username;
|
String validUsername = username;
|
||||||
if (remoteAuthType == AuthType.FLOODGATE) {
|
if (this.remoteServer.authType() == AuthType.HYBRID) {
|
||||||
validUsername = username.replace(' ', '_');
|
validUsername = username.replace(' ', '_');
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -823,17 +818,17 @@ public class GeyserSession implements GeyserConnection, GeyserCommandSource {
|
|||||||
* After getting whatever credentials needed, we attempt to join the Java server.
|
* After getting whatever credentials needed, we attempt to join the Java server.
|
||||||
*/
|
*/
|
||||||
private void connectDownstream() {
|
private void connectDownstream() {
|
||||||
boolean floodgate = this.remoteAuthType == AuthType.FLOODGATE;
|
boolean floodgate = this.remoteServer.authType() == AuthType.HYBRID;
|
||||||
|
|
||||||
// Start ticking
|
// Start ticking
|
||||||
tickThread = eventLoop.scheduleAtFixedRate(this::tick, 50, 50, TimeUnit.MILLISECONDS);
|
tickThread = eventLoop.scheduleAtFixedRate(this::tick, 50, 50, TimeUnit.MILLISECONDS);
|
||||||
|
|
||||||
if (geyser.getBootstrap().getSocketAddress() != null) {
|
if (geyser.getBootstrap().getSocketAddress() != null) {
|
||||||
// We're going to connect through the JVM and not through TCP
|
// We're going to connect through the JVM and not through TCP
|
||||||
downstream = new LocalSession(this.remoteAddress, this.remotePort,
|
downstream = new LocalSession(this.remoteServer.address(), this.remoteServer.port(),
|
||||||
geyser.getBootstrap().getSocketAddress(), upstream.getAddress().getAddress().getHostAddress(), this.protocol);
|
geyser.getBootstrap().getSocketAddress(), upstream.getAddress().getAddress().getHostAddress(), this.protocol);
|
||||||
} else {
|
} else {
|
||||||
downstream = new TcpClientSession(this.remoteAddress, this.remotePort, this.protocol);
|
downstream = new TcpClientSession(this.remoteServer.address(), this.remoteServer.port(), this.protocol);
|
||||||
disableSrvResolving();
|
disableSrvResolving();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -913,13 +908,13 @@ public class GeyserSession implements GeyserConnection, GeyserCommandSource {
|
|||||||
} else {
|
} else {
|
||||||
// Connected to an IP address
|
// Connected to an IP address
|
||||||
geyser.getLogger().info(GeyserLocale.getLocaleStringLog("geyser.network.remote.connect",
|
geyser.getLogger().info(GeyserLocale.getLocaleStringLog("geyser.network.remote.connect",
|
||||||
authData.name(), protocol.getProfile().getName(), remoteAddress));
|
authData.name(), protocol.getProfile().getName(), remoteServer.address()));
|
||||||
}
|
}
|
||||||
|
|
||||||
UUID uuid = protocol.getProfile().getId();
|
UUID uuid = protocol.getProfile().getId();
|
||||||
if (uuid == null) {
|
if (uuid == null) {
|
||||||
// Set what our UUID *probably* is going to be
|
// Set what our UUID *probably* is going to be
|
||||||
if (remoteAuthType == AuthType.FLOODGATE) {
|
if (remoteServer.authType() == AuthType.HYBRID) {
|
||||||
uuid = new UUID(0, Long.parseLong(authData.xuid()));
|
uuid = new UUID(0, Long.parseLong(authData.xuid()));
|
||||||
} else {
|
} else {
|
||||||
uuid = UUID.nameUUIDFromBytes(("OfflinePlayer:" + protocol.getProfile().getName()).getBytes(StandardCharsets.UTF_8));
|
uuid = UUID.nameUUIDFromBytes(("OfflinePlayer:" + protocol.getProfile().getName()).getBytes(StandardCharsets.UTF_8));
|
||||||
@ -949,7 +944,7 @@ public class GeyserSession implements GeyserConnection, GeyserCommandSource {
|
|||||||
String disconnectMessage;
|
String disconnectMessage;
|
||||||
Throwable cause = event.getCause();
|
Throwable cause = event.getCause();
|
||||||
if (cause instanceof UnexpectedEncryptionException) {
|
if (cause instanceof UnexpectedEncryptionException) {
|
||||||
if (remoteAuthType != AuthType.FLOODGATE) {
|
if (remoteServer.authType() != AuthType.HYBRID) {
|
||||||
// Server expects online mode
|
// Server expects online mode
|
||||||
disconnectMessage = GeyserLocale.getPlayerLocaleString("geyser.network.remote.authentication_type_mismatch", locale());
|
disconnectMessage = GeyserLocale.getPlayerLocaleString("geyser.network.remote.authentication_type_mismatch", locale());
|
||||||
// Explain that they may be looking for Floodgate.
|
// Explain that they may be looking for Floodgate.
|
||||||
@ -976,7 +971,7 @@ public class GeyserSession implements GeyserConnection, GeyserCommandSource {
|
|||||||
if (downstream instanceof LocalSession) {
|
if (downstream instanceof LocalSession) {
|
||||||
geyser.getLogger().info(GeyserLocale.getLocaleStringLog("geyser.network.remote.disconnect_internal", authData.name(), disconnectMessage));
|
geyser.getLogger().info(GeyserLocale.getLocaleStringLog("geyser.network.remote.disconnect_internal", authData.name(), disconnectMessage));
|
||||||
} else {
|
} else {
|
||||||
geyser.getLogger().info(GeyserLocale.getLocaleStringLog("geyser.network.remote.disconnect", authData.name(), remoteAddress, disconnectMessage));
|
geyser.getLogger().info(GeyserLocale.getLocaleStringLog("geyser.network.remote.disconnect", authData.name(), remoteServer.address(), disconnectMessage));
|
||||||
}
|
}
|
||||||
if (cause != null) {
|
if (cause != null) {
|
||||||
cause.printStackTrace();
|
cause.printStackTrace();
|
||||||
|
@ -34,7 +34,7 @@ import com.nukkitx.protocol.bedrock.data.skin.ImageData;
|
|||||||
import com.nukkitx.protocol.bedrock.data.skin.SerializedSkin;
|
import com.nukkitx.protocol.bedrock.data.skin.SerializedSkin;
|
||||||
import com.nukkitx.protocol.bedrock.packet.PlayerListPacket;
|
import com.nukkitx.protocol.bedrock.packet.PlayerListPacket;
|
||||||
import org.geysermc.geyser.GeyserImpl;
|
import org.geysermc.geyser.GeyserImpl;
|
||||||
import org.geysermc.geyser.session.auth.AuthType;
|
import org.geysermc.geyser.api.network.AuthType;
|
||||||
import org.geysermc.geyser.entity.type.player.PlayerEntity;
|
import org.geysermc.geyser.entity.type.player.PlayerEntity;
|
||||||
import org.geysermc.geyser.session.GeyserSession;
|
import org.geysermc.geyser.session.GeyserSession;
|
||||||
import org.geysermc.geyser.session.auth.BedrockClientData;
|
import org.geysermc.geyser.session.auth.BedrockClientData;
|
||||||
|
@ -30,7 +30,7 @@ import com.fasterxml.jackson.annotation.JsonProperty;
|
|||||||
import com.fasterxml.jackson.databind.JsonNode;
|
import com.fasterxml.jackson.databind.JsonNode;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import org.geysermc.geyser.GeyserImpl;
|
import org.geysermc.geyser.GeyserImpl;
|
||||||
import org.geysermc.geyser.network.MinecraftProtocol;
|
import org.geysermc.geyser.network.GameProtocol;
|
||||||
import org.geysermc.geyser.util.FileUtils;
|
import org.geysermc.geyser.util.FileUtils;
|
||||||
import org.geysermc.geyser.util.WebUtils;
|
import org.geysermc.geyser.util.WebUtils;
|
||||||
|
|
||||||
@ -71,7 +71,7 @@ public class MinecraftLocale {
|
|||||||
// Get the url for the latest version of the games manifest
|
// Get the url for the latest version of the games manifest
|
||||||
String latestInfoURL = "";
|
String latestInfoURL = "";
|
||||||
for (Version version : versionManifest.getVersions()) {
|
for (Version version : versionManifest.getVersions()) {
|
||||||
if (version.getId().equals(MinecraftProtocol.getJavaCodec().getMinecraftVersion())) {
|
if (version.getId().equals(GameProtocol.getJavaCodec().getMinecraftVersion())) {
|
||||||
latestInfoURL = version.getUrl();
|
latestInfoURL = version.getUrl();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -32,7 +32,7 @@ import com.nukkitx.nbt.NbtMap;
|
|||||||
import com.nukkitx.nbt.NbtMapBuilder;
|
import com.nukkitx.nbt.NbtMapBuilder;
|
||||||
import com.nukkitx.nbt.NbtType;
|
import com.nukkitx.nbt.NbtType;
|
||||||
import com.nukkitx.protocol.bedrock.data.inventory.ItemData;
|
import com.nukkitx.protocol.bedrock.data.inventory.ItemData;
|
||||||
import org.geysermc.geyser.network.MinecraftProtocol;
|
import org.geysermc.geyser.network.GameProtocol;
|
||||||
import org.geysermc.geyser.registry.Registries;
|
import org.geysermc.geyser.registry.Registries;
|
||||||
import org.geysermc.geyser.registry.type.ItemMapping;
|
import org.geysermc.geyser.registry.type.ItemMapping;
|
||||||
import org.geysermc.geyser.registry.type.ItemMappings;
|
import org.geysermc.geyser.registry.type.ItemMappings;
|
||||||
@ -80,7 +80,7 @@ public class BannerTranslator extends ItemTranslator {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public BannerTranslator() {
|
public BannerTranslator() {
|
||||||
appliedItems = Registries.ITEMS.forVersion(MinecraftProtocol.DEFAULT_BEDROCK_CODEC.getProtocolVersion())
|
appliedItems = Registries.ITEMS.forVersion(GameProtocol.DEFAULT_BEDROCK_CODEC.getProtocolVersion())
|
||||||
.getItems()
|
.getItems()
|
||||||
.values()
|
.values()
|
||||||
.stream()
|
.stream()
|
||||||
|
@ -30,7 +30,7 @@ import com.github.steveice10.opennbt.tag.builtin.ByteTag;
|
|||||||
import com.github.steveice10.opennbt.tag.builtin.CompoundTag;
|
import com.github.steveice10.opennbt.tag.builtin.CompoundTag;
|
||||||
import com.github.steveice10.opennbt.tag.builtin.Tag;
|
import com.github.steveice10.opennbt.tag.builtin.Tag;
|
||||||
import com.nukkitx.protocol.bedrock.data.inventory.ItemData;
|
import com.nukkitx.protocol.bedrock.data.inventory.ItemData;
|
||||||
import org.geysermc.geyser.network.MinecraftProtocol;
|
import org.geysermc.geyser.network.GameProtocol;
|
||||||
import org.geysermc.geyser.registry.Registries;
|
import org.geysermc.geyser.registry.Registries;
|
||||||
import org.geysermc.geyser.registry.type.ItemMapping;
|
import org.geysermc.geyser.registry.type.ItemMapping;
|
||||||
import org.geysermc.geyser.registry.type.ItemMappings;
|
import org.geysermc.geyser.registry.type.ItemMappings;
|
||||||
@ -44,7 +44,7 @@ public class CompassTranslator extends ItemTranslator {
|
|||||||
private final List<ItemMapping> appliedItems;
|
private final List<ItemMapping> appliedItems;
|
||||||
|
|
||||||
public CompassTranslator() {
|
public CompassTranslator() {
|
||||||
appliedItems = Registries.ITEMS.forVersion(MinecraftProtocol.DEFAULT_BEDROCK_CODEC.getProtocolVersion())
|
appliedItems = Registries.ITEMS.forVersion(GameProtocol.DEFAULT_BEDROCK_CODEC.getProtocolVersion())
|
||||||
.getItems()
|
.getItems()
|
||||||
.values()
|
.values()
|
||||||
.stream()
|
.stream()
|
||||||
|
@ -30,7 +30,7 @@ import com.github.steveice10.opennbt.tag.builtin.StringTag;
|
|||||||
import com.github.steveice10.opennbt.tag.builtin.Tag;
|
import com.github.steveice10.opennbt.tag.builtin.Tag;
|
||||||
import com.nukkitx.protocol.bedrock.data.inventory.ItemData;
|
import com.nukkitx.protocol.bedrock.data.inventory.ItemData;
|
||||||
import org.geysermc.geyser.GeyserImpl;
|
import org.geysermc.geyser.GeyserImpl;
|
||||||
import org.geysermc.geyser.network.MinecraftProtocol;
|
import org.geysermc.geyser.network.GameProtocol;
|
||||||
import org.geysermc.geyser.inventory.item.Potion;
|
import org.geysermc.geyser.inventory.item.Potion;
|
||||||
import org.geysermc.geyser.registry.Registries;
|
import org.geysermc.geyser.registry.Registries;
|
||||||
import org.geysermc.geyser.registry.type.ItemMapping;
|
import org.geysermc.geyser.registry.type.ItemMapping;
|
||||||
@ -45,7 +45,7 @@ public class PotionTranslator extends ItemTranslator {
|
|||||||
private final List<ItemMapping> appliedItems;
|
private final List<ItemMapping> appliedItems;
|
||||||
|
|
||||||
public PotionTranslator() {
|
public PotionTranslator() {
|
||||||
appliedItems = Registries.ITEMS.forVersion(MinecraftProtocol.DEFAULT_BEDROCK_CODEC.getProtocolVersion())
|
appliedItems = Registries.ITEMS.forVersion(GameProtocol.DEFAULT_BEDROCK_CODEC.getProtocolVersion())
|
||||||
.getItems()
|
.getItems()
|
||||||
.values()
|
.values()
|
||||||
.stream()
|
.stream()
|
||||||
|
@ -30,7 +30,7 @@ import com.github.steveice10.opennbt.tag.builtin.StringTag;
|
|||||||
import com.github.steveice10.opennbt.tag.builtin.Tag;
|
import com.github.steveice10.opennbt.tag.builtin.Tag;
|
||||||
import com.nukkitx.protocol.bedrock.data.inventory.ItemData;
|
import com.nukkitx.protocol.bedrock.data.inventory.ItemData;
|
||||||
import org.geysermc.geyser.GeyserImpl;
|
import org.geysermc.geyser.GeyserImpl;
|
||||||
import org.geysermc.geyser.network.MinecraftProtocol;
|
import org.geysermc.geyser.network.GameProtocol;
|
||||||
import org.geysermc.geyser.inventory.item.TippedArrowPotion;
|
import org.geysermc.geyser.inventory.item.TippedArrowPotion;
|
||||||
import org.geysermc.geyser.registry.Registries;
|
import org.geysermc.geyser.registry.Registries;
|
||||||
import org.geysermc.geyser.registry.type.ItemMapping;
|
import org.geysermc.geyser.registry.type.ItemMapping;
|
||||||
@ -44,12 +44,12 @@ public class TippedArrowTranslator extends ItemTranslator {
|
|||||||
|
|
||||||
private final List<ItemMapping> appliedItems;
|
private final List<ItemMapping> appliedItems;
|
||||||
|
|
||||||
private static final int TIPPED_ARROW_JAVA_ID = Registries.ITEMS.forVersion(MinecraftProtocol.DEFAULT_BEDROCK_CODEC.getProtocolVersion())
|
private static final int TIPPED_ARROW_JAVA_ID = Registries.ITEMS.forVersion(GameProtocol.DEFAULT_BEDROCK_CODEC.getProtocolVersion())
|
||||||
.getMapping("minecraft:tipped_arrow")
|
.getMapping("minecraft:tipped_arrow")
|
||||||
.getJavaId();
|
.getJavaId();
|
||||||
|
|
||||||
public TippedArrowTranslator() {
|
public TippedArrowTranslator() {
|
||||||
appliedItems = Registries.ITEMS.forVersion(MinecraftProtocol.DEFAULT_BEDROCK_CODEC.getProtocolVersion())
|
appliedItems = Registries.ITEMS.forVersion(GameProtocol.DEFAULT_BEDROCK_CODEC.getProtocolVersion())
|
||||||
.getItems()
|
.getItems()
|
||||||
.values()
|
.values()
|
||||||
.stream()
|
.stream()
|
||||||
|
@ -30,7 +30,7 @@ import com.github.steveice10.opennbt.tag.builtin.CompoundTag;
|
|||||||
import com.github.steveice10.opennbt.tag.builtin.ListTag;
|
import com.github.steveice10.opennbt.tag.builtin.ListTag;
|
||||||
import com.nukkitx.nbt.NbtMap;
|
import com.nukkitx.nbt.NbtMap;
|
||||||
import com.nukkitx.nbt.NbtMapBuilder;
|
import com.nukkitx.nbt.NbtMapBuilder;
|
||||||
import org.geysermc.geyser.network.MinecraftProtocol;
|
import org.geysermc.geyser.network.GameProtocol;
|
||||||
import org.geysermc.geyser.registry.Registries;
|
import org.geysermc.geyser.registry.Registries;
|
||||||
import org.geysermc.geyser.registry.type.ItemMapping;
|
import org.geysermc.geyser.registry.type.ItemMapping;
|
||||||
|
|
||||||
@ -48,7 +48,7 @@ public class CampfireBlockEntityTranslator extends BlockEntityTranslator {
|
|||||||
|
|
||||||
protected NbtMap getItem(CompoundTag tag) {
|
protected NbtMap getItem(CompoundTag tag) {
|
||||||
// TODO: Version independent mappings
|
// TODO: Version independent mappings
|
||||||
ItemMapping mapping = Registries.ITEMS.forVersion(MinecraftProtocol.DEFAULT_BEDROCK_CODEC.getProtocolVersion()).getMapping((String) tag.get("id").getValue());
|
ItemMapping mapping = Registries.ITEMS.forVersion(GameProtocol.DEFAULT_BEDROCK_CODEC.getProtocolVersion()).getMapping((String) tag.get("id").getValue());
|
||||||
NbtMapBuilder tagBuilder = NbtMap.builder()
|
NbtMapBuilder tagBuilder = NbtMap.builder()
|
||||||
.putString("Name", mapping.getBedrockIdentifier())
|
.putString("Name", mapping.getBedrockIdentifier())
|
||||||
.putByte("Count", (byte) tag.get("Count").getValue())
|
.putByte("Count", (byte) tag.get("Count").getValue())
|
||||||
|
@ -26,7 +26,7 @@
|
|||||||
package org.geysermc.geyser.translator.protocol.bedrock;
|
package org.geysermc.geyser.translator.protocol.bedrock;
|
||||||
|
|
||||||
import com.nukkitx.protocol.bedrock.packet.SetLocalPlayerAsInitializedPacket;
|
import com.nukkitx.protocol.bedrock.packet.SetLocalPlayerAsInitializedPacket;
|
||||||
import org.geysermc.geyser.session.auth.AuthType;
|
import org.geysermc.geyser.api.network.AuthType;
|
||||||
import org.geysermc.geyser.session.GeyserSession;
|
import org.geysermc.geyser.session.GeyserSession;
|
||||||
import org.geysermc.geyser.translator.protocol.PacketTranslator;
|
import org.geysermc.geyser.translator.protocol.PacketTranslator;
|
||||||
import org.geysermc.geyser.translator.protocol.Translator;
|
import org.geysermc.geyser.translator.protocol.Translator;
|
||||||
@ -41,7 +41,7 @@ public class BedrockSetLocalPlayerAsInitializedTranslator extends PacketTranslat
|
|||||||
if (!session.getUpstream().isInitialized()) {
|
if (!session.getUpstream().isInitialized()) {
|
||||||
session.getUpstream().setInitialized(true);
|
session.getUpstream().setInitialized(true);
|
||||||
|
|
||||||
if (session.getRemoteAuthType() == AuthType.ONLINE) {
|
if (session.remoteServer().authType() == AuthType.ONLINE) {
|
||||||
if (!session.isLoggedIn()) {
|
if (!session.isLoggedIn()) {
|
||||||
if (session.getGeyser().getConfig().getSavedUserLogins().contains(session.name())) {
|
if (session.getGeyser().getConfig().getSavedUserLogins().contains(session.name())) {
|
||||||
if (session.getGeyser().refreshTokenFor(session.name()) == null) {
|
if (session.getGeyser().refreshTokenFor(session.name()) == null) {
|
||||||
|
@ -32,7 +32,7 @@ import com.nukkitx.protocol.bedrock.packet.TransferPacket;
|
|||||||
import org.geysermc.floodgate.pluginmessage.PluginMessageChannels;
|
import org.geysermc.floodgate.pluginmessage.PluginMessageChannels;
|
||||||
import org.geysermc.geyser.GeyserImpl;
|
import org.geysermc.geyser.GeyserImpl;
|
||||||
import org.geysermc.geyser.GeyserLogger;
|
import org.geysermc.geyser.GeyserLogger;
|
||||||
import org.geysermc.geyser.session.auth.AuthType;
|
import org.geysermc.geyser.api.network.AuthType;
|
||||||
import org.geysermc.geyser.session.GeyserSession;
|
import org.geysermc.geyser.session.GeyserSession;
|
||||||
import org.geysermc.geyser.translator.protocol.PacketTranslator;
|
import org.geysermc.geyser.translator.protocol.PacketTranslator;
|
||||||
import org.geysermc.geyser.translator.protocol.Translator;
|
import org.geysermc.geyser.translator.protocol.Translator;
|
||||||
@ -49,7 +49,7 @@ public class JavaCustomPayloadTranslator extends PacketTranslator<ClientboundCus
|
|||||||
@Override
|
@Override
|
||||||
public void translate(GeyserSession session, ClientboundCustomPayloadPacket packet) {
|
public void translate(GeyserSession session, ClientboundCustomPayloadPacket packet) {
|
||||||
// The only plugin messages it has to listen for are Floodgate plugin messages
|
// The only plugin messages it has to listen for are Floodgate plugin messages
|
||||||
if (session.getRemoteAuthType() != AuthType.FLOODGATE) {
|
if (session.remoteServer().authType() != AuthType.HYBRID) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -27,7 +27,7 @@ package org.geysermc.geyser.translator.protocol.java;
|
|||||||
|
|
||||||
import com.github.steveice10.mc.auth.data.GameProfile;
|
import com.github.steveice10.mc.auth.data.GameProfile;
|
||||||
import com.github.steveice10.mc.protocol.packet.login.clientbound.ClientboundGameProfilePacket;
|
import com.github.steveice10.mc.protocol.packet.login.clientbound.ClientboundGameProfilePacket;
|
||||||
import org.geysermc.geyser.session.auth.AuthType;
|
import org.geysermc.geyser.api.network.AuthType;
|
||||||
import org.geysermc.geyser.entity.type.player.PlayerEntity;
|
import org.geysermc.geyser.entity.type.player.PlayerEntity;
|
||||||
import org.geysermc.geyser.session.GeyserSession;
|
import org.geysermc.geyser.session.GeyserSession;
|
||||||
import org.geysermc.geyser.translator.protocol.PacketTranslator;
|
import org.geysermc.geyser.translator.protocol.PacketTranslator;
|
||||||
@ -40,7 +40,7 @@ public class JavaGameProfileTranslator extends PacketTranslator<ClientboundGameP
|
|||||||
@Override
|
@Override
|
||||||
public void translate(GeyserSession session, ClientboundGameProfilePacket packet) {
|
public void translate(GeyserSession session, ClientboundGameProfilePacket packet) {
|
||||||
PlayerEntity playerEntity = session.getPlayerEntity();
|
PlayerEntity playerEntity = session.getPlayerEntity();
|
||||||
AuthType remoteAuthType = session.getRemoteAuthType();
|
AuthType remoteAuthType = session.remoteServer().authType();
|
||||||
|
|
||||||
// Required, or else Floodgate players break with Spigot chunk caching
|
// Required, or else Floodgate players break with Spigot chunk caching
|
||||||
GameProfile profile = packet.getProfile();
|
GameProfile profile = packet.getProfile();
|
||||||
@ -54,7 +54,7 @@ public class JavaGameProfileTranslator extends PacketTranslator<ClientboundGameP
|
|||||||
SkinManager.handleBedrockSkin(playerEntity, session.getClientData());
|
SkinManager.handleBedrockSkin(playerEntity, session.getClientData());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (remoteAuthType == AuthType.FLOODGATE) {
|
if (remoteAuthType == AuthType.HYBRID) {
|
||||||
// We'll send the skin upload a bit after the handshake packet (aka this packet),
|
// We'll send the skin upload a bit after the handshake packet (aka this packet),
|
||||||
// because otherwise the global server returns the data too fast.
|
// because otherwise the global server returns the data too fast.
|
||||||
session.getAuthData().upload(session.getGeyser());
|
session.getAuthData().upload(session.getGeyser());
|
||||||
|
@ -30,7 +30,7 @@ import net.kyori.adventure.text.Component;
|
|||||||
import net.kyori.adventure.text.TextComponent;
|
import net.kyori.adventure.text.TextComponent;
|
||||||
import net.kyori.adventure.text.TranslatableComponent;
|
import net.kyori.adventure.text.TranslatableComponent;
|
||||||
import org.geysermc.common.PlatformType;
|
import org.geysermc.common.PlatformType;
|
||||||
import org.geysermc.geyser.network.MinecraftProtocol;
|
import org.geysermc.geyser.network.GameProtocol;
|
||||||
import org.geysermc.geyser.session.GeyserSession;
|
import org.geysermc.geyser.session.GeyserSession;
|
||||||
import org.geysermc.geyser.text.GeyserLocale;
|
import org.geysermc.geyser.text.GeyserLocale;
|
||||||
import org.geysermc.geyser.translator.protocol.PacketTranslator;
|
import org.geysermc.geyser.translator.protocol.PacketTranslator;
|
||||||
@ -79,7 +79,7 @@ public class JavaLoginDisconnectTranslator extends PacketTranslator<ClientboundL
|
|||||||
PlatformType platform = session.getGeyser().getPlatformType();
|
PlatformType platform = session.getGeyser().getPlatformType();
|
||||||
String outdatedType = (platform == PlatformType.BUNGEECORD || platform == PlatformType.VELOCITY) ?
|
String outdatedType = (platform == PlatformType.BUNGEECORD || platform == PlatformType.VELOCITY) ?
|
||||||
"geyser.network.remote.outdated.proxy" : "geyser.network.remote.outdated.server";
|
"geyser.network.remote.outdated.proxy" : "geyser.network.remote.outdated.server";
|
||||||
disconnectMessage = GeyserLocale.getPlayerLocaleString(outdatedType, locale, MinecraftProtocol.getJavaVersions().get(0)) + '\n'
|
disconnectMessage = GeyserLocale.getPlayerLocaleString(outdatedType, locale, GameProtocol.getJavaVersions().get(0)) + '\n'
|
||||||
+ GeyserLocale.getPlayerLocaleString("geyser.network.remote.original_disconnect_message", locale, serverDisconnectMessage);
|
+ GeyserLocale.getPlayerLocaleString("geyser.network.remote.original_disconnect_message", locale, serverDisconnectMessage);
|
||||||
} else {
|
} else {
|
||||||
disconnectMessage = serverDisconnectMessage;
|
disconnectMessage = serverDisconnectMessage;
|
||||||
|
@ -35,7 +35,7 @@ import com.nukkitx.protocol.bedrock.packet.SetPlayerGameTypePacket;
|
|||||||
import org.geysermc.floodgate.pluginmessage.PluginMessageChannels;
|
import org.geysermc.floodgate.pluginmessage.PluginMessageChannels;
|
||||||
import org.geysermc.geyser.entity.type.player.PlayerEntity;
|
import org.geysermc.geyser.entity.type.player.PlayerEntity;
|
||||||
import org.geysermc.geyser.session.GeyserSession;
|
import org.geysermc.geyser.session.GeyserSession;
|
||||||
import org.geysermc.geyser.session.auth.AuthType;
|
import org.geysermc.geyser.api.network.AuthType;
|
||||||
import org.geysermc.geyser.translator.level.BiomeTranslator;
|
import org.geysermc.geyser.translator.level.BiomeTranslator;
|
||||||
import org.geysermc.geyser.translator.protocol.PacketTranslator;
|
import org.geysermc.geyser.translator.protocol.PacketTranslator;
|
||||||
import org.geysermc.geyser.translator.protocol.Translator;
|
import org.geysermc.geyser.translator.protocol.Translator;
|
||||||
@ -102,7 +102,7 @@ public class JavaLoginTranslator extends PacketTranslator<ClientboundLoginPacket
|
|||||||
session.sendDownstreamPacket(new ServerboundCustomPayloadPacket("minecraft:brand", PluginMessageUtils.getGeyserBrandData()));
|
session.sendDownstreamPacket(new ServerboundCustomPayloadPacket("minecraft:brand", PluginMessageUtils.getGeyserBrandData()));
|
||||||
|
|
||||||
// register the plugin messaging channels used in Floodgate
|
// register the plugin messaging channels used in Floodgate
|
||||||
if (session.getRemoteAuthType() == AuthType.FLOODGATE) {
|
if (session.remoteServer().authType() == AuthType.HYBRID) {
|
||||||
session.sendDownstreamPacket(new ServerboundCustomPayloadPacket("minecraft:register", PluginMessageChannels.getFloodgateRegisterData()));
|
session.sendDownstreamPacket(new ServerboundCustomPayloadPacket("minecraft:register", PluginMessageChannels.getFloodgateRegisterData()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren