mirror of
https://github.com/GeyserMC/Geyser.git
synced 2024-08-14 23:57:35 +00:00
Implemented ViaProxy bootstrap (#4201)
* Implemented ViaProxy bootstrap
* Applied requested changes to code
* Override indra settings to Java 17
* Removed explicit java source/target version
* Added ViaProxy artifact to build.yml
* Added ViaProxy artifact to pullrequest.yml
* Updated ViaProxy API usage
* Implemented floodgate support for ViaProxy
* Depend on stable ViaProxy release
* Initialize command manager and ping passthrough before Geyser#start
* Revert "Initialize command manager and ping passthrough before Geyser#start"
This reverts commit 39356071c4
.
* Some ping passthrough improvements
* Merged code properly
* Updated ViaProxy API usage
* Implemented better command handling
* Updated ViaProxy and Geyser API usage
* Combine bootstrap and plugin into one class
* Minor code improvements
* Call Geyser shutdown on plugin disable
* Only call disable if Geyser was enabled once
* Don't send two shutdown done messages
* Use setter for enabled boolean
This commit is contained in:
parent
8b170d656e
commit
aca368e332
16 changed files with 559 additions and 20 deletions
|
@ -44,9 +44,6 @@ import org.checkerframework.checker.nullness.qual.NonNull;
|
|||
import org.checkerframework.checker.nullness.qual.Nullable;
|
||||
import org.cloudburstmc.protocol.bedrock.codec.BedrockCodec;
|
||||
import org.geysermc.api.Geyser;
|
||||
import org.geysermc.geyser.api.command.CommandSource;
|
||||
import org.geysermc.geyser.api.util.MinecraftVersion;
|
||||
import org.geysermc.geyser.api.util.PlatformType;
|
||||
import org.geysermc.cumulus.form.Form;
|
||||
import org.geysermc.cumulus.form.util.FormBuilder;
|
||||
import org.geysermc.erosion.packet.Packets;
|
||||
|
@ -56,12 +53,15 @@ import org.geysermc.floodgate.crypto.Base64Topping;
|
|||
import org.geysermc.floodgate.crypto.FloodgateCipher;
|
||||
import org.geysermc.floodgate.news.NewsItemAction;
|
||||
import org.geysermc.geyser.api.GeyserApi;
|
||||
import org.geysermc.geyser.api.command.CommandSource;
|
||||
import org.geysermc.geyser.api.event.EventBus;
|
||||
import org.geysermc.geyser.api.event.EventRegistrar;
|
||||
import org.geysermc.geyser.api.event.lifecycle.*;
|
||||
import org.geysermc.geyser.api.network.AuthType;
|
||||
import org.geysermc.geyser.api.network.BedrockListener;
|
||||
import org.geysermc.geyser.api.network.RemoteServer;
|
||||
import org.geysermc.geyser.api.util.MinecraftVersion;
|
||||
import org.geysermc.geyser.api.util.PlatformType;
|
||||
import org.geysermc.geyser.command.GeyserCommandManager;
|
||||
import org.geysermc.geyser.configuration.GeyserConfiguration;
|
||||
import org.geysermc.geyser.entity.EntityDefinitions;
|
||||
|
@ -169,6 +169,12 @@ public class GeyserImpl implements GeyserApi {
|
|||
*/
|
||||
private volatile boolean isReloading;
|
||||
|
||||
/**
|
||||
* Determines if Geyser is currently enabled. This is used to determine if {@link #disable()} should be called during {@link #shutdown()}.
|
||||
*/
|
||||
@Setter
|
||||
private boolean isEnabled;
|
||||
|
||||
private GeyserImpl(PlatformType platformType, GeyserBootstrap bootstrap) {
|
||||
instance = this;
|
||||
|
||||
|
@ -344,15 +350,17 @@ public class GeyserImpl implements GeyserApi {
|
|||
logger.info("Broadcast port set from system property: " + parsedPort);
|
||||
}
|
||||
|
||||
boolean floodgatePresent = bootstrap.testFloodgatePluginPresent();
|
||||
if (config.getRemote().authType() == AuthType.FLOODGATE && !floodgatePresent) {
|
||||
logger.severe(GeyserLocale.getLocaleStringLog("geyser.bootstrap.floodgate.not_installed") + " "
|
||||
+ GeyserLocale.getLocaleStringLog("geyser.bootstrap.floodgate.disabling"));
|
||||
return;
|
||||
} else if (config.isAutoconfiguredRemote() && floodgatePresent) {
|
||||
// Floodgate installed means that the user wants Floodgate authentication
|
||||
logger.debug("Auto-setting to Floodgate authentication.");
|
||||
config.getRemote().setAuthType(AuthType.FLOODGATE);
|
||||
if (platformType != PlatformType.VIAPROXY) {
|
||||
boolean floodgatePresent = bootstrap.testFloodgatePluginPresent();
|
||||
if (config.getRemote().authType() == AuthType.FLOODGATE && !floodgatePresent) {
|
||||
logger.severe(GeyserLocale.getLocaleStringLog("geyser.bootstrap.floodgate.not_installed") + " "
|
||||
+ GeyserLocale.getLocaleStringLog("geyser.bootstrap.floodgate.disabling"));
|
||||
return;
|
||||
} else if (config.isAutoconfiguredRemote() && floodgatePresent) {
|
||||
// Floodgate installed means that the user wants Floodgate authentication
|
||||
logger.debug("Auto-setting to Floodgate authentication.");
|
||||
config.getRemote().setAuthType(AuthType.FLOODGATE);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -639,12 +647,14 @@ public class GeyserImpl implements GeyserApi {
|
|||
|
||||
Registries.RESOURCE_PACKS.get().clear();
|
||||
|
||||
bootstrap.getGeyserLogger().info(GeyserLocale.getLocaleStringLog("geyser.core.shutdown.done"));
|
||||
this.setEnabled(false);
|
||||
}
|
||||
|
||||
public void shutdown() {
|
||||
shuttingDown = true;
|
||||
this.disable();
|
||||
if (isEnabled) {
|
||||
this.disable();
|
||||
}
|
||||
this.commandManager().getCommands().clear();
|
||||
|
||||
// Disable extensions, fire the shutdown event
|
||||
|
@ -777,6 +787,7 @@ public class GeyserImpl implements GeyserApi {
|
|||
} else {
|
||||
instance.initialize();
|
||||
}
|
||||
instance.setEnabled(true);
|
||||
}
|
||||
|
||||
public GeyserLogger getLogger() {
|
||||
|
|
|
@ -51,7 +51,7 @@ public class JavaLoginDisconnectTranslator extends PacketTranslator<ClientboundL
|
|||
if (testForOutdatedServer(disconnectReason)) {
|
||||
String locale = session.locale();
|
||||
PlatformType platform = session.getGeyser().getPlatformType();
|
||||
String outdatedType = (platform == PlatformType.BUNGEECORD || platform == PlatformType.VELOCITY) ?
|
||||
String outdatedType = (platform == PlatformType.BUNGEECORD || platform == PlatformType.VELOCITY || platform == PlatformType.VIAPROXY) ?
|
||||
"geyser.network.remote.outdated.proxy" : "geyser.network.remote.outdated.server";
|
||||
disconnectMessage = GeyserLocale.getPlayerLocaleString(outdatedType, locale, GameProtocol.getJavaVersions().get(0)) + '\n'
|
||||
+ GeyserLocale.getPlayerLocaleString("geyser.network.remote.original_disconnect_message", locale, serverDisconnectMessage);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue