1
0
mirror of https://github.com/GeyserMC/Geyser.git synced 2025-12-19 14:59:27 +00:00

Re-add warning about moved functionality, fix Geyser-ViaProxy

This reverts commit fbadfa574a.
This commit is contained in:
onebeastchris
2025-11-17 21:30:22 +01:00
parent 089f176267
commit 7126dc99c3
3 changed files with 32 additions and 8 deletions

View File

@@ -36,6 +36,7 @@ import net.raphimc.viaproxy.plugins.events.ConsoleCommandEvent;
import net.raphimc.viaproxy.plugins.events.ProxyStartEvent;
import net.raphimc.viaproxy.plugins.events.ProxyStopEvent;
import net.raphimc.viaproxy.plugins.events.ShouldVerifyOnlineModeEvent;
import net.raphimc.viaproxy.plugins.events.ViaProxyLoadedEvent;
import net.raphimc.viaproxy.plugins.events.types.ITyped;
import net.raphimc.viaproxy.protocoltranslator.viaproxy.ViaProxyConfig;
import org.apache.logging.log4j.LogManager;
@@ -81,10 +82,6 @@ public class GeyserViaProxyPlugin extends ViaProxyPlugin implements GeyserBootst
@Override
public void onEnable() {
ROOT_FOLDER.mkdirs();
GeyserLocale.init(this);
this.onGeyserInitialize();
ViaProxy.EVENT_MANAGER.register(this);
}
@@ -93,6 +90,12 @@ public class GeyserViaProxyPlugin extends ViaProxyPlugin implements GeyserBootst
this.onGeyserShutdown();
}
@EventHandler
private void onViaProxyLoaded(ViaProxyLoadedEvent event) {
GeyserLocale.init(this);
this.onGeyserInitialize();
}
@EventHandler
private void onConsoleCommand(final ConsoleCommandEvent event) {
final String command = event.getCommand().startsWith("/") ? event.getCommand().substring(1) : event.getCommand();
@@ -296,6 +299,7 @@ public class GeyserViaProxyPlugin extends ViaProxyPlugin implements GeyserBootst
.configFile(new File(ROOT_FOLDER, "config.yml"))
.load(configClass);
if (config != null) {
this.geyserConfig = (GeyserPluginConfig) config;
config.java().authType(Files.isRegularFile(getFloodgateKeyPath()) ? AuthType.FLOODGATE : AuthType.OFFLINE);
}
return config;

View File

@@ -131,7 +131,7 @@ public final class ConfigLoader {
CommentedConfigurationNode node = loader.load();
boolean originallyEmpty = !configFile.exists() || node.isNull();
ConfigurationTransformation.Versioned migrations = ConfigMigrations.TRANSFORMER.apply(configClass);
ConfigurationTransformation.Versioned migrations = ConfigMigrations.TRANSFORMER.apply(configClass, bootstrap);
int currentVersion = migrations.version(node);
migrations.apply(node);
int newVersion = migrations.version(node);

View File

@@ -25,6 +25,8 @@
package org.geysermc.geyser.configuration;
import org.geysermc.geyser.GeyserBootstrap;
import org.geysermc.geyser.GeyserImpl;
import org.spongepowered.configurate.ConfigurateException;
import org.spongepowered.configurate.ConfigurationNode;
import org.spongepowered.configurate.transformation.ConfigurationTransformation;
@@ -33,7 +35,7 @@ import org.spongepowered.configurate.transformation.TransformAction;
import java.util.Arrays;
import java.util.Objects;
import java.util.UUID;
import java.util.function.Function;
import java.util.function.BiFunction;
import static org.spongepowered.configurate.NodePath.path;
import static org.spongepowered.configurate.transformation.TransformAction.remove;
@@ -41,7 +43,7 @@ import static org.spongepowered.configurate.transformation.TransformAction.renam
public class ConfigMigrations {
public static final Function<Class<? extends GeyserConfig>, ConfigurationTransformation.Versioned> TRANSFORMER = (configClass) ->
public static final BiFunction<Class<? extends GeyserConfig>, GeyserBootstrap, ConfigurationTransformation.Versioned> TRANSFORMER = (configClass, bootstrap) ->
ConfigurationTransformation.versionedBuilder()
.versionKey("config-version")
.addVersion(5, ConfigurationTransformation.builder()
@@ -105,13 +107,31 @@ public class ConfigMigrations {
return new Object[]{ "gameplay", "max-visible-custom-skulls" };
})
.addAction(path("emote-offhand-workaround"), (path, value) -> {
if (Objects.equals(value.getString(), "no-emotes")) {
String previous = value.getString();
if (!Objects.equals(previous, "disabled") && bootstrap != null) {
bootstrap.getGeyserLogger().warning("The emote-offhand-workaround option has been removed from Geyser. If you still wish to have this functionality, use this Geyser extension: https://github.com/GeyserMC/EmoteOffhandExtension/");
}
if (Objects.equals(previous, "no-emotes")) {
value.set(false);
return new Object[]{ "gameplay", "show-emotes" };
}
return null;
})
// For the warning!
.addAction(path("allow-third-party-capes"), (node, value) -> {
if (bootstrap != null) {
bootstrap.getGeyserLogger().warning("Third-party ears/capes have been removed from Geyser. If you still wish to have this functionality, use this Geyser extension: https://github.com/GeyserMC/ThirdPartyCosmetics");
}
return null;
})
.addAction(path("allow-third-party-ears"), (node, value) -> {
if (bootstrap != null) {
GeyserImpl.getInstance().getLogger().warning("Third-party ears/capes have been removed from Geyser. If you still wish to have this functionality, use this Geyser extension: https://github.com/GeyserMC/ThirdPartyCosmetics");
}
return null;
})
// Advanced section
.addAction(path("cache-images"), moveTo("advanced"))
.addAction(path("scoreboard-packet-threshold"), moveTo("advanced"))