3
0
Mirror von https://github.com/GeyserMC/Geyser.git synchronisiert 2024-11-19 14:30:17 +01:00

Remove Jackson; finish config value placements

Dieser Commit ist enthalten in:
Camotoy 2024-08-29 14:39:55 -04:00
Ursprung f113c8967e
Commit 5870856ef7
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: 7EEFB66FE798081F
8 geänderte Dateien mit 38 neuen und 34 gelöschten Zeilen

Datei anzeigen

@ -13,8 +13,7 @@ dependencies {
api(projects.common) api(projects.common)
api(projects.api) api(projects.api)
// Jackson JSON and YAML serialization api(libs.yaml) // Used for extensions
api(libs.bundles.jackson)
annotationProcessor(libs.configurate.`interface`.ap) annotationProcessor(libs.configurate.`interface`.ap)
api(libs.configurate.`interface`) api(libs.configurate.`interface`)
implementation(libs.configurate.yaml) implementation(libs.configurate.yaml)

Datei anzeigen

@ -73,6 +73,7 @@ import org.geysermc.geyser.api.util.MinecraftVersion;
import org.geysermc.geyser.api.util.PlatformType; import org.geysermc.geyser.api.util.PlatformType;
import org.geysermc.geyser.configuration.GeyserConfig; import org.geysermc.geyser.configuration.GeyserConfig;
import org.geysermc.geyser.command.CommandRegistry; import org.geysermc.geyser.command.CommandRegistry;
import org.geysermc.geyser.configuration.GeyserPluginConfig;
import org.geysermc.geyser.entity.EntityDefinitions; import org.geysermc.geyser.entity.EntityDefinitions;
import org.geysermc.geyser.erosion.UnixSocketClientListener; import org.geysermc.geyser.erosion.UnixSocketClientListener;
import org.geysermc.geyser.event.GeyserEventBus; import org.geysermc.geyser.event.GeyserEventBus;
@ -322,12 +323,12 @@ public class GeyserImpl implements GeyserApi, EventRegistrar {
config.java().address(InetAddress.getLoopbackAddress().getHostAddress()); config.java().address(InetAddress.getLoopbackAddress().getHostAddress());
} }
} }
if (javaPort != -1 && config.asPluginConfig().isEmpty()) { if (javaPort != -1) {
config.java().port(javaPort); config.java().port(javaPort);
} }
boolean forceMatchServerPort = "server".equals(pluginUdpPort); boolean forceMatchServerPort = "server".equals(pluginUdpPort);
if ((config.asPluginConfig().map(pluginConfig -> pluginConfig.bedrock().cloneRemotePort()).orElse(false) || forceMatchServerPort) && javaPort != -1) { if ((config.bedrock().cloneRemotePort() || forceMatchServerPort) && javaPort != -1) {
config.bedrock().port(javaPort); config.bedrock().port(javaPort);
if (forceMatchServerPort) { if (forceMatchServerPort) {
if (geyserUdpPort.isEmpty()) { if (geyserUdpPort.isEmpty()) {
@ -388,7 +389,7 @@ public class GeyserImpl implements GeyserApi, EventRegistrar {
} }
} }
if (config.asPluginConfig().isEmpty()) { if (!(config instanceof GeyserPluginConfig)) {
String remoteAddress = config.java().address(); String remoteAddress = config.java().address();
// Filters whether it is not an IP address or localhost, because otherwise it is not possible to find out an SRV entry. // Filters whether it is not an IP address or localhost, because otherwise it is not possible to find out an SRV entry.
if (!remoteAddress.matches(IP_REGEX) && !remoteAddress.equalsIgnoreCase("localhost")) { if (!remoteAddress.matches(IP_REGEX) && !remoteAddress.equalsIgnoreCase("localhost")) {

Datei anzeigen

@ -115,7 +115,7 @@ public class ConnectionTestCommand extends GeyserCommand {
source.sendMessage("The port you are testing with (" + port + ") is not the same as you set in your Geyser configuration (" source.sendMessage("The port you are testing with (" + port + ") is not the same as you set in your Geyser configuration ("
+ config.bedrock().port() + ")"); + config.bedrock().port() + ")");
source.sendMessage("Re-run the command with the port in the config, or change the `bedrock` `port` in the config."); source.sendMessage("Re-run the command with the port in the config, or change the `bedrock` `port` in the config.");
if (config.asPluginConfig().map(plugin -> plugin.bedrock().cloneRemotePort()).orElse(false)) { if (config.bedrock().cloneRemotePort()) {
source.sendMessage("You have `clone-remote-port` enabled. This option ignores the `bedrock` `port` in the config, and uses the Java server port instead."); source.sendMessage("You have `clone-remote-port` enabled. This option ignores the `bedrock` `port` in the config, and uses the Java server port instead.");
} }
} else { } else {

Datei anzeigen

@ -25,7 +25,6 @@
package org.geysermc.geyser.command.standalone; package org.geysermc.geyser.command.standalone;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.Getter; import lombok.Getter;
import org.spongepowered.configurate.objectmapping.ConfigSerializable; import org.spongepowered.configurate.objectmapping.ConfigSerializable;
@ -34,8 +33,8 @@ import java.util.Set;
@Getter @Getter
@ConfigSerializable @ConfigSerializable
@SuppressWarnings("FieldMayBeFinal")
public class PermissionConfiguration { public class PermissionConfiguration {
@JsonProperty("default-permissions")
private Set<String> defaultPermissions = Collections.emptySet(); private Set<String> defaultPermissions = Collections.emptySet();
} }

Datei anzeigen

@ -43,7 +43,6 @@ import org.spongepowered.configurate.objectmapping.meta.Comment;
import java.util.Collections; import java.util.Collections;
import java.util.List; import java.util.List;
import java.util.Optional;
@ConfigSerializable @ConfigSerializable
public interface GeyserConfig { public interface GeyserConfig {
@ -84,6 +83,8 @@ public interface GeyserConfig {
@DefaultBoolean(true) @DefaultBoolean(true)
boolean passthroughPlayerCounts(); boolean passthroughPlayerCounts();
boolean integratedPingPassthrough();
@Comment("How often to ping the Java server to refresh MOTD and player count, in seconds.") @Comment("How often to ping the Java server to refresh MOTD and player count, in seconds.")
@DefaultNumeric(3) @DefaultNumeric(3)
int pingPassthroughInterval(); int pingPassthroughInterval();
@ -209,6 +210,12 @@ public interface GeyserConfig {
@NumericRange(from = 0, to = 65535) @NumericRange(from = 0, to = 65535)
int broadcastPort(); int broadcastPort();
@Comment("""
Some hosting services change your Java port everytime you start the server and require the same port to be used for Bedrock.
This option makes the Bedrock port the same as the Java port every time you start the server.""")
@DefaultBoolean
boolean cloneRemotePort();
void address(String address); void address(String address);
void port(int port); void port(int port);
@ -312,12 +319,4 @@ public interface GeyserConfig {
default int configVersion() { default int configVersion() {
return Constants.CONFIG_VERSION; return Constants.CONFIG_VERSION;
} }
@Exclude
default Optional<GeyserPluginConfig> asPluginConfig() {
if (this instanceof GeyserPluginConfig config) {
return Optional.of(config);
}
return Optional.empty();
}
} }

Datei anzeigen

@ -33,21 +33,9 @@ import org.spongepowered.configurate.objectmapping.meta.Comment;
@ConfigSerializable @ConfigSerializable
public interface GeyserPluginConfig extends GeyserConfig { public interface GeyserPluginConfig extends GeyserConfig {
@Override
IntegratedBedrockConfig bedrock();
@Override @Override
IntegratedJavaConfig java(); IntegratedJavaConfig java();
@ConfigSerializable
interface IntegratedBedrockConfig extends BedrockConfig {
@Comment("""
Some hosting services change your Java port everytime you start the server and require the same port to be used for Bedrock.
This option makes the Bedrock port the same as the Java port every time you start the server.""")
@DefaultBoolean
boolean cloneRemotePort();
}
@ConfigSerializable @ConfigSerializable
interface IntegratedJavaConfig extends JavaConfig { interface IntegratedJavaConfig extends JavaConfig {
@Override @Override
@ -75,6 +63,7 @@ public interface GeyserPluginConfig extends GeyserConfig {
Use server API methods to determine the Java server's MOTD and ping passthrough. Use server API methods to determine the Java server's MOTD and ping passthrough.
There is no need to disable this unless your MOTD or player count does not appear properly.""") There is no need to disable this unless your MOTD or player count does not appear properly.""")
@DefaultBoolean(true) @DefaultBoolean(true)
@Override
boolean integratedPingPassthrough(); boolean integratedPingPassthrough();
@Comment(""" @Comment("""

Datei anzeigen

@ -25,6 +25,7 @@
package org.geysermc.geyser.configuration; package org.geysermc.geyser.configuration;
import org.spongepowered.configurate.interfaces.meta.Exclude;
import org.spongepowered.configurate.interfaces.meta.defaults.DefaultNumeric; import org.spongepowered.configurate.interfaces.meta.defaults.DefaultNumeric;
import org.spongepowered.configurate.interfaces.meta.defaults.DefaultString; import org.spongepowered.configurate.interfaces.meta.defaults.DefaultString;
import org.spongepowered.configurate.interfaces.meta.range.NumericRange; import org.spongepowered.configurate.interfaces.meta.range.NumericRange;
@ -36,9 +37,21 @@ import org.spongepowered.configurate.objectmapping.meta.Comment;
*/ */
@ConfigSerializable @ConfigSerializable
public interface GeyserRemoteConfig extends GeyserConfig { public interface GeyserRemoteConfig extends GeyserConfig {
@Override
RemoteBedrock bedrock();
@Override @Override
RemoteConfig java(); RemoteConfig java();
@ConfigSerializable
interface RemoteBedrock extends BedrockConfig {
@Override
@Exclude // We can bring this back if there's a use-case but it's not really justified here.
default boolean cloneRemotePort() {
return false;
}
}
@ConfigSerializable @ConfigSerializable
interface RemoteConfig extends JavaConfig { interface RemoteConfig extends JavaConfig {
@Override @Override
@ -58,4 +71,11 @@ public interface GeyserRemoteConfig extends GeyserConfig {
This is designed to be used for forced hosts on proxies""") This is designed to be used for forced hosts on proxies""")
boolean forwardHostname(); boolean forwardHostname();
} }
@Exclude
@Override
default boolean integratedPingPassthrough() {
// Does nothing here.
return false;
}
} }

Datei anzeigen

@ -5,7 +5,7 @@ cumulus = "1.1.2"
configurate = "4.2.0-GeyserMC-SNAPSHOT" configurate = "4.2.0-GeyserMC-SNAPSHOT"
erosion = "1.1-20240521.000109-3" erosion = "1.1-20240521.000109-3"
events = "1.1-SNAPSHOT" events = "1.1-SNAPSHOT"
jackson = "2.17.0" yaml = "2.2"
fastutil = "8.5.2" fastutil = "8.5.2"
netty = "4.1.107.Final" netty = "4.1.107.Final"
netty-io-uring = "0.0.25.Final-SNAPSHOT" netty-io-uring = "0.0.25.Final-SNAPSHOT"
@ -59,9 +59,7 @@ erosion-bukkit-common = { group = "org.geysermc.erosion", name = "bukkit-common"
erosion-bukkit-nms = { group = "org.geysermc.erosion", name = "bukkit-nms", version.ref = "erosion" } erosion-bukkit-nms = { group = "org.geysermc.erosion", name = "bukkit-nms", version.ref = "erosion" }
erosion-common = { group = "org.geysermc.erosion", name = "common", version.ref = "erosion" } erosion-common = { group = "org.geysermc.erosion", name = "common", version.ref = "erosion" }
jackson-annotations = { group = "com.fasterxml.jackson.core", name = "jackson-annotations", version.ref = "jackson" } yaml = { module = "org.yaml:snakeyaml", version.ref = "yaml" }
jackson-core = { group = "com.fasterxml.jackson.core", name = "jackson-databind", version.ref = "jackson" }
jackson-dataformat-yaml = { group = "com.fasterxml.jackson.dataformat", name = "jackson-dataformat-yaml", version.ref = "jackson" }
configurate-interface-ap = { module = "org.spongepowered:configurate-extra-interface-ap", version.ref = "configurate" } configurate-interface-ap = { module = "org.spongepowered:configurate-extra-interface-ap", version.ref = "configurate" }
configurate-interface = { module = "org.spongepowered:configurate-extra-interface", version.ref = "configurate" } configurate-interface = { module = "org.spongepowered:configurate-extra-interface", version.ref = "configurate" }
@ -155,7 +153,6 @@ indra = { id = "net.kyori.indra", version.ref = "indra" }
blossom = { id = "net.kyori.blossom", version.ref = "blossom" } blossom = { id = "net.kyori.blossom", version.ref = "blossom" }
[bundles] [bundles]
jackson = [ "jackson-annotations", "jackson-core", "jackson-dataformat-yaml" ]
fastutil = [ "fastutil-int-int-maps", "fastutil-int-long-maps", "fastutil-int-byte-maps", "fastutil-int-boolean-maps", "fastutil-object-int-maps", "fastutil-object-object-maps" ] fastutil = [ "fastutil-int-int-maps", "fastutil-int-long-maps", "fastutil-int-byte-maps", "fastutil-int-boolean-maps", "fastutil-object-int-maps", "fastutil-object-object-maps" ]
adventure = [ "adventure-text-serializer-gson", "adventure-text-serializer-legacy", "adventure-text-serializer-plain" ] adventure = [ "adventure-text-serializer-gson", "adventure-text-serializer-legacy", "adventure-text-serializer-plain" ]
log4j = [ "log4j-api", "log4j-core", "log4j-slf4j2-impl" ] log4j = [ "log4j-api", "log4j-core", "log4j-slf4j2-impl" ]