Merge remote-tracking branch 'origin/master' into feature/floodgate-merge

# Conflicts:
#	bootstrap/mod/src/main/java/org/geysermc/geyser/platform/mod/GeyserModBootstrap.java
#	build-logic/build.gradle.kts
#	build.gradle.kts
#	core/src/main/java/org/geysermc/geyser/GeyserImpl.java
#	settings.gradle.kts
This commit is contained in:
Tim203 2024-02-25 20:12:43 +01:00
commit a4681ca77c
No known key found for this signature in database
62 changed files with 2059 additions and 258 deletions

View file

@ -1,8 +1,7 @@
import net.kyori.blossom.BlossomExtension
plugins {
id("net.kyori.blossom")
id("net.kyori.indra.git")
alias(libs.plugins.blossom)
id("geyser.publish-conventions")
}

View file

@ -44,20 +44,20 @@ 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;
import org.geysermc.floodgate.core.FloodgatePlatform;
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;
@ -162,12 +162,17 @@ public class GeyserImpl implements GeyserApi {
@Getter
private static GeyserImpl instance;
/**
/**
* Determines if we're currently reloading. Replaces per-bootstrap reload checks
*/
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, FloodgatePlatform floodgatePlatform) {
instance = this;
@ -227,6 +232,7 @@ public class GeyserImpl implements GeyserApi {
if (ex != null) {
return;
}
MinecraftLocale.ensureEN_US();
String locale = GeyserLocale.getDefaultLocale();
if (!"en_us".equals(locale)) {
@ -356,15 +362,17 @@ public class GeyserImpl implements GeyserApi {
logger.info("Broadcast port set from system property: " + parsedPort);
}
boolean floodgatePresent = bootstrap.testFloodgatePluginPresent() || floodgateProvider != null; //todo
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() || floodgateProvider != null; //todo
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);
}
}
}
//TODO end
@ -644,12 +652,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
@ -782,6 +792,7 @@ public class GeyserImpl implements GeyserApi {
} else {
instance.initialize();
}
instance.setEnabled(true);
}
public GeyserLogger getLogger() {

View file

@ -187,7 +187,7 @@ public class SkullResourcePackManager {
ZipEntry entry = new ZipEntry("skull_resource_pack/pack_icon.png");
zipOS.putNextEntry(entry);
zipOS.write(FileUtils.readAllBytes("icon.png"));
zipOS.write(FileUtils.readAllBytes("assets/geyser/icon.png"));
zipOS.closeEntry();
}
}

View file

@ -123,7 +123,8 @@ public class PendingMicrosoftAuthentication {
public CompletableFuture<MsaAuthenticationService.MsCodeResponse> getCode(boolean offlineAccess) {
// Request the code
CompletableFuture<MsaAuthenticationService.MsCodeResponse> code = CompletableFuture.supplyAsync(() -> tryGetCode(offlineAccess));
CompletableFuture<MsaAuthenticationService.MsCodeResponse> code = CompletableFuture.supplyAsync(
() -> tryGetCode(offlineAccess));
// Once the code is received, continuously try to request the access token, profile, etc
code.thenRun(() -> performLoginAttempt(System.currentTimeMillis()));
return code;

View file

@ -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);

View file

Before

Width:  |  Height:  |  Size: 113 KiB

After

Width:  |  Height:  |  Size: 113 KiB

Before After
Before After