mirror of
https://github.com/GeyserMC/Geyser.git
synced 2024-08-14 23:57:35 +00:00
The configuration is gone. Long live the config.
This commit is contained in:
parent
29f8e294ad
commit
c095c276ef
29 changed files with 159 additions and 1047 deletions
|
@ -25,14 +25,14 @@
|
|||
|
||||
package org.geysermc.geyser;
|
||||
|
||||
import org.geysermc.geyser.configuration.GeyserJacksonConfiguration;
|
||||
import org.geysermc.geyser.configuration.GeyserConfig;
|
||||
import org.geysermc.geyser.text.GeyserLocale;
|
||||
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
|
||||
public class FloodgateKeyLoader {
|
||||
public static Path getKeyPath(GeyserJacksonConfiguration config, Path floodgateDataFolder, Path geyserDataFolder, GeyserLogger logger) {
|
||||
public static Path getKeyPath(GeyserConfig config, Path floodgateDataFolder, Path geyserDataFolder, GeyserLogger logger) {
|
||||
// Always prioritize Floodgate's key, if it is installed.
|
||||
// This mostly prevents people from trying to copy the key and corrupting it in the process
|
||||
if (floodgateDataFolder != null) {
|
||||
|
@ -45,13 +45,7 @@ public class FloodgateKeyLoader {
|
|||
}
|
||||
}
|
||||
|
||||
Path floodgateKey;
|
||||
if (config.getFloodgateKeyFile().equals("public-key.pem")) {
|
||||
logger.debug("Floodgate 2.0 doesn't use a public/private key system anymore. We'll search for key.pem instead");
|
||||
floodgateKey = geyserDataFolder.resolve("key.pem");
|
||||
} else {
|
||||
floodgateKey = geyserDataFolder.resolve(config.getFloodgateKeyFile());
|
||||
}
|
||||
Path floodgateKey = geyserDataFolder.resolve(config.floodgateKeyFile());
|
||||
|
||||
if (!Files.exists(floodgateKey)) {
|
||||
logger.error(GeyserLocale.getLocaleStringLog("geyser.bootstrap.floodgate.not_installed"));
|
||||
|
|
|
@ -29,7 +29,6 @@ import org.checkerframework.checker.nullness.qual.NonNull;
|
|||
import org.checkerframework.checker.nullness.qual.Nullable;
|
||||
import org.geysermc.geyser.command.GeyserCommandManager;
|
||||
import org.geysermc.geyser.configuration.GeyserConfig;
|
||||
import org.geysermc.geyser.configuration.GeyserConfiguration;
|
||||
import org.geysermc.geyser.dump.BootstrapDumpInfo;
|
||||
import org.geysermc.geyser.level.GeyserWorldManager;
|
||||
import org.geysermc.geyser.level.WorldManager;
|
||||
|
@ -68,15 +67,6 @@ public interface GeyserBootstrap {
|
|||
*/
|
||||
void onGeyserShutdown();
|
||||
|
||||
/**
|
||||
* Returns the current GeyserConfiguration
|
||||
*
|
||||
* @return The current GeyserConfiguration
|
||||
*/
|
||||
default GeyserConfiguration getGeyserConfig() {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the current GeyserConfig
|
||||
*
|
||||
|
|
|
@ -1,191 +0,0 @@
|
|||
/*
|
||||
* Copyright (c) 2019-2024 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.configuration;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
import org.geysermc.geyser.GeyserLogger;
|
||||
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.network.CIDRMatcher;
|
||||
import org.geysermc.geyser.network.GameProtocol;
|
||||
import org.geysermc.geyser.text.GeyserLocale;
|
||||
|
||||
import java.nio.file.Path;
|
||||
import java.util.List;
|
||||
|
||||
public interface GeyserConfiguration {
|
||||
/**
|
||||
* If the config was originally 'auto' before the values changed
|
||||
*/
|
||||
void setAutoconfiguredRemote(boolean autoconfiguredRemote);
|
||||
|
||||
// Modify this when you introduce breaking changes into the config
|
||||
int CURRENT_CONFIG_VERSION = 4;
|
||||
|
||||
IBedrockConfiguration getBedrock();
|
||||
|
||||
IRemoteConfiguration getRemote();
|
||||
|
||||
List<String> getSavedUserLogins();
|
||||
|
||||
@SuppressWarnings("BooleanMethodIsAlwaysInverted")
|
||||
boolean isCommandSuggestions();
|
||||
|
||||
@JsonIgnore
|
||||
boolean isPassthroughMotd();
|
||||
|
||||
@JsonIgnore
|
||||
boolean isPassthroughPlayerCounts();
|
||||
|
||||
@JsonIgnore
|
||||
boolean isLegacyPingPassthrough();
|
||||
|
||||
int getPingPassthroughInterval();
|
||||
|
||||
boolean isForwardPlayerPing();
|
||||
|
||||
int getMaxPlayers();
|
||||
|
||||
boolean isDebugMode();
|
||||
|
||||
@Deprecated
|
||||
boolean isAllowThirdPartyCapes();
|
||||
|
||||
@Deprecated
|
||||
boolean isAllowThirdPartyEars();
|
||||
|
||||
String getShowCooldown();
|
||||
|
||||
boolean isShowCoordinates();
|
||||
|
||||
boolean isDisableBedrockScaffolding();
|
||||
|
||||
EmoteOffhandWorkaroundOption getEmoteOffhandWorkaround();
|
||||
|
||||
String getDefaultLocale();
|
||||
|
||||
Path getFloodgateKeyPath();
|
||||
|
||||
boolean isAddNonBedrockItems();
|
||||
|
||||
boolean isAboveBedrockNetherBuilding();
|
||||
|
||||
boolean isForceResourcePacks();
|
||||
|
||||
@SuppressWarnings("BooleanMethodIsAlwaysInverted")
|
||||
boolean isXboxAchievementsEnabled();
|
||||
|
||||
int getCacheImages();
|
||||
|
||||
boolean isAllowCustomSkulls();
|
||||
|
||||
int getMaxVisibleCustomSkulls();
|
||||
|
||||
int getCustomSkullRenderDistance();
|
||||
|
||||
boolean isLogPlayerIpAddresses();
|
||||
|
||||
boolean isNotifyOnNewBedrockUpdate();
|
||||
|
||||
String getUnusableSpaceBlock();
|
||||
|
||||
IMetricsInfo getMetrics();
|
||||
|
||||
int getPendingAuthenticationTimeout();
|
||||
|
||||
boolean isAutoconfiguredRemote();
|
||||
|
||||
interface IBedrockConfiguration extends BedrockListener {
|
||||
void setAddress(String address);
|
||||
|
||||
void setPort(int port);
|
||||
|
||||
void setBroadcastPort(int broadcastPort);
|
||||
|
||||
boolean isCloneRemotePort();
|
||||
|
||||
int getCompressionLevel();
|
||||
|
||||
boolean isEnableProxyProtocol();
|
||||
|
||||
List<String> getProxyProtocolWhitelistedIPs();
|
||||
|
||||
/**
|
||||
* @return Unmodifiable list of {@link CIDRMatcher}s from {@link #getProxyProtocolWhitelistedIPs()}
|
||||
*/
|
||||
List<CIDRMatcher> getWhitelistedIPsMatchers();
|
||||
}
|
||||
|
||||
interface IRemoteConfiguration extends RemoteServer {
|
||||
|
||||
void setAddress(String address);
|
||||
|
||||
void setPort(int port);
|
||||
|
||||
boolean isUseProxyProtocol();
|
||||
|
||||
boolean isForwardHost();
|
||||
|
||||
default String minecraftVersion() {
|
||||
return GameProtocol.getJavaMinecraftVersion();
|
||||
}
|
||||
|
||||
default int protocolVersion() {
|
||||
return GameProtocol.getJavaProtocolVersion();
|
||||
}
|
||||
|
||||
void setAuthType(AuthType authType);
|
||||
}
|
||||
|
||||
interface IMetricsInfo {
|
||||
|
||||
boolean isEnabled();
|
||||
|
||||
String getUniqueId();
|
||||
}
|
||||
|
||||
int getScoreboardPacketThreshold();
|
||||
|
||||
// if u have offline mode enabled pls be safe
|
||||
boolean isEnableProxyConnections();
|
||||
|
||||
int getMtu();
|
||||
|
||||
boolean isUseDirectConnection();
|
||||
|
||||
boolean isDisableCompression();
|
||||
|
||||
int getConfigVersion();
|
||||
|
||||
static void checkGeyserConfiguration(GeyserConfiguration geyserConfig, GeyserLogger geyserLogger) {
|
||||
if (geyserConfig.getConfigVersion() < CURRENT_CONFIG_VERSION) {
|
||||
geyserLogger.warning(GeyserLocale.getLocaleStringLog("geyser.bootstrap.config.outdated"));
|
||||
} else if (geyserConfig.getConfigVersion() > CURRENT_CONFIG_VERSION) {
|
||||
geyserLogger.warning(GeyserLocale.getLocaleStringLog("geyser.bootstrap.config.too_new"));
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,366 +0,0 @@
|
|||
/*
|
||||
* 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.configuration;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import com.fasterxml.jackson.core.JsonParser;
|
||||
import com.fasterxml.jackson.databind.DeserializationContext;
|
||||
import com.fasterxml.jackson.databind.JsonDeserializer;
|
||||
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
import org.geysermc.geyser.GeyserImpl;
|
||||
import org.geysermc.geyser.api.network.AuthType;
|
||||
import org.geysermc.geyser.network.CIDRMatcher;
|
||||
import org.geysermc.geyser.text.AsteriskSerializer;
|
||||
import org.geysermc.geyser.text.GeyserLocale;
|
||||
import org.geysermc.geyser.util.WebUtils;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.nio.file.Path;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Getter
|
||||
@JsonIgnoreProperties(ignoreUnknown = true)
|
||||
@SuppressWarnings("FieldMayBeFinal") // Jackson requires that the fields are not final
|
||||
public abstract class GeyserJacksonConfiguration implements GeyserConfiguration {
|
||||
|
||||
@Setter
|
||||
private boolean autoconfiguredRemote = false;
|
||||
|
||||
private BedrockConfiguration bedrock = new BedrockConfiguration();
|
||||
private RemoteConfiguration remote = new RemoteConfiguration();
|
||||
|
||||
@JsonProperty("saved-user-logins")
|
||||
private List<String> savedUserLogins = Collections.emptyList();
|
||||
|
||||
@JsonProperty("floodgate-key-file")
|
||||
private String floodgateKeyFile = "key.pem";
|
||||
|
||||
public abstract Path getFloodgateKeyPath();
|
||||
|
||||
@JsonProperty("command-suggestions")
|
||||
private boolean commandSuggestions = true;
|
||||
|
||||
@JsonProperty("passthrough-motd")
|
||||
private boolean isPassthroughMotd = false;
|
||||
|
||||
@JsonProperty("passthrough-player-counts")
|
||||
private boolean isPassthroughPlayerCounts = false;
|
||||
|
||||
@JsonProperty("legacy-ping-passthrough")
|
||||
private boolean isLegacyPingPassthrough = false;
|
||||
|
||||
@JsonProperty("ping-passthrough-interval")
|
||||
private int pingPassthroughInterval = 3;
|
||||
|
||||
@JsonProperty("forward-player-ping")
|
||||
private boolean forwardPlayerPing = false;
|
||||
|
||||
@JsonProperty("max-players")
|
||||
private int maxPlayers = 100;
|
||||
|
||||
@JsonProperty("debug-mode")
|
||||
private boolean debugMode = false;
|
||||
|
||||
@JsonProperty("allow-third-party-capes")
|
||||
private boolean allowThirdPartyCapes = false;
|
||||
|
||||
@JsonProperty("show-cooldown")
|
||||
private String showCooldown = "title";
|
||||
|
||||
@JsonProperty("show-coordinates")
|
||||
private boolean showCoordinates = true;
|
||||
|
||||
@JsonProperty("disable-bedrock-scaffolding")
|
||||
private boolean disableBedrockScaffolding = false;
|
||||
|
||||
@JsonDeserialize(using = EmoteOffhandWorkaroundOption.Deserializer.class)
|
||||
@JsonProperty("emote-offhand-workaround")
|
||||
private EmoteOffhandWorkaroundOption emoteOffhandWorkaround = EmoteOffhandWorkaroundOption.DISABLED;
|
||||
|
||||
@JsonProperty("allow-third-party-ears")
|
||||
private boolean allowThirdPartyEars = false;
|
||||
|
||||
@JsonProperty("default-locale")
|
||||
private String defaultLocale = null; // is null by default so system language takes priority
|
||||
|
||||
@JsonProperty("cache-images")
|
||||
private int cacheImages = 0;
|
||||
|
||||
@JsonProperty("allow-custom-skulls")
|
||||
private boolean allowCustomSkulls = true;
|
||||
|
||||
@JsonProperty("max-visible-custom-skulls")
|
||||
private int maxVisibleCustomSkulls = 128;
|
||||
|
||||
@JsonProperty("custom-skull-render-distance")
|
||||
private int customSkullRenderDistance = 32;
|
||||
|
||||
@JsonProperty("add-non-bedrock-items")
|
||||
private boolean addNonBedrockItems = true;
|
||||
|
||||
@JsonProperty("above-bedrock-nether-building")
|
||||
private boolean aboveBedrockNetherBuilding = false;
|
||||
|
||||
@JsonProperty("force-resource-packs")
|
||||
private boolean forceResourcePacks = true;
|
||||
|
||||
@JsonProperty("xbox-achievements-enabled")
|
||||
private boolean xboxAchievementsEnabled = false;
|
||||
|
||||
@JsonProperty("log-player-ip-addresses")
|
||||
private boolean logPlayerIpAddresses = true;
|
||||
|
||||
@JsonProperty("notify-on-new-bedrock-update")
|
||||
private boolean notifyOnNewBedrockUpdate = true;
|
||||
|
||||
@JsonProperty("unusable-space-block")
|
||||
private String unusableSpaceBlock = "minecraft:barrier";
|
||||
|
||||
private MetricsInfo metrics = new MetricsInfo();
|
||||
|
||||
@JsonProperty("pending-authentication-timeout")
|
||||
private int pendingAuthenticationTimeout = 120;
|
||||
|
||||
@JsonIgnoreProperties(ignoreUnknown = true)
|
||||
public static class BedrockConfiguration implements IBedrockConfiguration {
|
||||
@AsteriskSerializer.Asterisk(isIp = true)
|
||||
@JsonProperty("address")
|
||||
@Setter
|
||||
private String address = "0.0.0.0";
|
||||
|
||||
@Override
|
||||
public @NonNull String address() {
|
||||
return address;
|
||||
}
|
||||
|
||||
@Setter
|
||||
@JsonProperty("port")
|
||||
private int port = 19132;
|
||||
|
||||
@Override
|
||||
public int port() {
|
||||
return port;
|
||||
}
|
||||
|
||||
@Setter
|
||||
@JsonProperty("broadcast-port")
|
||||
private int broadcastPort = 0;
|
||||
|
||||
@Override
|
||||
public int broadcastPort() {
|
||||
return broadcastPort;
|
||||
}
|
||||
|
||||
@Getter
|
||||
@JsonProperty("clone-remote-port")
|
||||
private boolean cloneRemotePort = false;
|
||||
|
||||
@JsonProperty("motd1")
|
||||
private String motd1 = "GeyserMC";
|
||||
|
||||
@Override
|
||||
public String primaryMotd() {
|
||||
return motd1;
|
||||
}
|
||||
|
||||
@JsonProperty("motd2")
|
||||
private String motd2 = "Geyser";
|
||||
|
||||
@Override
|
||||
public String secondaryMotd() {
|
||||
return motd2;
|
||||
}
|
||||
|
||||
@JsonProperty("server-name")
|
||||
private String serverName = GeyserImpl.NAME;
|
||||
|
||||
@Override
|
||||
public String serverName() {
|
||||
return serverName;
|
||||
}
|
||||
|
||||
@JsonProperty("compression-level")
|
||||
private int compressionLevel = 6;
|
||||
|
||||
public int getCompressionLevel() {
|
||||
return Math.max(-1, Math.min(compressionLevel, 9));
|
||||
}
|
||||
|
||||
@Getter
|
||||
@JsonProperty("enable-proxy-protocol")
|
||||
private boolean enableProxyProtocol = false;
|
||||
|
||||
@Getter
|
||||
@JsonProperty("proxy-protocol-whitelisted-ips")
|
||||
private List<String> proxyProtocolWhitelistedIPs = Collections.emptyList();
|
||||
|
||||
@JsonIgnore
|
||||
private List<CIDRMatcher> whitelistedIPsMatchers = null;
|
||||
|
||||
@Override
|
||||
public List<CIDRMatcher> getWhitelistedIPsMatchers() {
|
||||
// Effective Java, Third Edition; Item 83: Use lazy initialization judiciously
|
||||
List<CIDRMatcher> matchers = this.whitelistedIPsMatchers;
|
||||
if (matchers == null) {
|
||||
synchronized (this) {
|
||||
// Check if proxyProtocolWhitelistedIPs contains URLs we need to fetch and parse by line
|
||||
List<String> whitelistedCIDRs = new ArrayList<>();
|
||||
for (String ip: proxyProtocolWhitelistedIPs) {
|
||||
if (!ip.startsWith("http")) {
|
||||
whitelistedCIDRs.add(ip);
|
||||
continue;
|
||||
}
|
||||
|
||||
WebUtils.getLineStream(ip).forEach(whitelistedCIDRs::add);
|
||||
}
|
||||
|
||||
this.whitelistedIPsMatchers = matchers = whitelistedCIDRs.stream()
|
||||
.map(CIDRMatcher::new)
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
}
|
||||
return Collections.unmodifiableList(matchers);
|
||||
}
|
||||
}
|
||||
|
||||
@JsonIgnoreProperties(ignoreUnknown = true)
|
||||
public static class RemoteConfiguration implements IRemoteConfiguration {
|
||||
@Setter
|
||||
@AsteriskSerializer.Asterisk(isIp = true)
|
||||
@JsonProperty("address")
|
||||
private String address = "auto";
|
||||
|
||||
@Override
|
||||
public String address() {
|
||||
return address;
|
||||
}
|
||||
|
||||
@JsonDeserialize(using = PortDeserializer.class)
|
||||
@Setter
|
||||
@JsonProperty("port")
|
||||
private int port = 25565;
|
||||
|
||||
@Override
|
||||
public int port() {
|
||||
return port;
|
||||
}
|
||||
|
||||
@Setter
|
||||
@JsonDeserialize(using = AuthTypeDeserializer.class)
|
||||
@JsonProperty("auth-type")
|
||||
private AuthType authType = AuthType.ONLINE;
|
||||
|
||||
@Override
|
||||
public @NonNull AuthType authType() {
|
||||
return authType;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean resolveSrv() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Getter
|
||||
@JsonProperty("use-proxy-protocol")
|
||||
private boolean useProxyProtocol = false;
|
||||
|
||||
@Getter
|
||||
@JsonProperty("forward-hostname")
|
||||
private boolean forwardHost = false;
|
||||
}
|
||||
|
||||
@Getter
|
||||
@JsonIgnoreProperties(ignoreUnknown = true)
|
||||
public static class MetricsInfo implements IMetricsInfo {
|
||||
private boolean enabled = true;
|
||||
|
||||
@JsonDeserialize(using = MetricsIdDeserializer.class)
|
||||
@JsonProperty("uuid")
|
||||
private String uniqueId = UUID.randomUUID().toString();
|
||||
|
||||
private static class MetricsIdDeserializer extends JsonDeserializer<String> {
|
||||
@Override
|
||||
public String deserialize(JsonParser p, DeserializationContext ctxt) throws IOException {
|
||||
String uuid = p.getValueAsString();
|
||||
if ("generateduuid".equals(uuid)) {
|
||||
// Compensate for configs not copied from the jar
|
||||
return UUID.randomUUID().toString();
|
||||
}
|
||||
return uuid;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@JsonProperty("scoreboard-packet-threshold")
|
||||
private int scoreboardPacketThreshold = 10;
|
||||
|
||||
@JsonProperty("enable-proxy-connections")
|
||||
private boolean enableProxyConnections = false;
|
||||
|
||||
@JsonProperty("mtu")
|
||||
private int mtu = 1400;
|
||||
|
||||
@JsonProperty("use-direct-connection")
|
||||
private boolean useDirectConnection = true;
|
||||
|
||||
@JsonProperty("disable-compression")
|
||||
private boolean isDisableCompression = true;
|
||||
|
||||
@JsonProperty("config-version")
|
||||
private int configVersion = 0;
|
||||
|
||||
/**
|
||||
* Ensure that the port deserializes in the config as a number no matter what.
|
||||
*/
|
||||
protected static class PortDeserializer extends JsonDeserializer<Integer> {
|
||||
@Override
|
||||
public Integer deserialize(JsonParser p, DeserializationContext ctxt) throws IOException {
|
||||
String value = p.getValueAsString();
|
||||
try {
|
||||
return Integer.parseInt(value);
|
||||
} catch (NumberFormatException e) {
|
||||
System.err.println(GeyserLocale.getLocaleStringLog("geyser.bootstrap.config.invalid_port"));
|
||||
return 25565;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static class AuthTypeDeserializer extends JsonDeserializer<AuthType> {
|
||||
@Override
|
||||
public AuthType deserialize(JsonParser p, DeserializationContext ctxt) throws IOException {
|
||||
return AuthType.getByName(p.getValueAsString());
|
||||
}
|
||||
}
|
||||
}
|
|
@ -25,15 +25,13 @@
|
|||
|
||||
package org.geysermc.geyser.configuration;
|
||||
|
||||
import org.geysermc.geyser.GeyserImpl;
|
||||
import org.spongepowered.configurate.interfaces.meta.Exclude;
|
||||
import org.spongepowered.configurate.interfaces.meta.Field;
|
||||
import org.spongepowered.configurate.interfaces.meta.Hidden;
|
||||
import org.spongepowered.configurate.interfaces.meta.defaults.DefaultBoolean;
|
||||
import org.spongepowered.configurate.objectmapping.ConfigSerializable;
|
||||
import org.spongepowered.configurate.objectmapping.meta.Comment;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
@ConfigSerializable
|
||||
public interface GeyserPluginConfig extends GeyserConfig {
|
||||
@Override
|
||||
|
@ -54,35 +52,18 @@ public interface GeyserPluginConfig extends GeyserConfig {
|
|||
@ConfigSerializable
|
||||
interface IntegratedJavaConfig extends JavaConfig {
|
||||
@Override
|
||||
@Exclude
|
||||
default String address() {
|
||||
return GeyserImpl.getInstance().getBootstrap().getServerBindAddress();
|
||||
}
|
||||
@Field
|
||||
String address();
|
||||
|
||||
@Override
|
||||
default void address(String address) {
|
||||
throw new IllegalStateException();
|
||||
}
|
||||
void address(String address);
|
||||
|
||||
@Override
|
||||
@Exclude
|
||||
default int port() {
|
||||
return GeyserImpl.getInstance().getBootstrap().getServerPort();
|
||||
}
|
||||
@Field
|
||||
int port();
|
||||
|
||||
@Override
|
||||
default void port(int port) {
|
||||
throw new IllegalStateException();
|
||||
}
|
||||
|
||||
// @Nonnull
|
||||
// @Comment("""
|
||||
// What type of authentication Bedrock players will be checked against when logging into the Java server.
|
||||
// Floodgate allows Bedrock players to join without needing a Java account. It's not recommended to change this.""")
|
||||
// @Override
|
||||
// default AuthType authType() {
|
||||
// return AuthType.FLOODGATE;
|
||||
// }
|
||||
void port(int port);
|
||||
|
||||
@Override
|
||||
@Exclude
|
||||
|
|
|
@ -36,7 +36,6 @@ import it.unimi.dsi.fastutil.objects.Object2IntOpenHashMap;
|
|||
import lombok.Getter;
|
||||
import org.cloudburstmc.protocol.bedrock.codec.BedrockCodec;
|
||||
import org.geysermc.floodgate.util.DeviceOs;
|
||||
import org.geysermc.floodgate.util.FloodgateInfoHolder;
|
||||
import org.geysermc.geyser.GeyserImpl;
|
||||
import org.geysermc.geyser.api.GeyserApi;
|
||||
import org.geysermc.geyser.api.extension.Extension;
|
||||
|
@ -61,7 +60,6 @@ import java.util.HashMap;
|
|||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import java.util.Properties;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Getter
|
||||
|
@ -75,7 +73,6 @@ public class DumpInfo {
|
|||
private final String systemEncoding;
|
||||
private final GitInfo gitInfo;
|
||||
private final GeyserConfig config;
|
||||
private final Floodgate floodgate;
|
||||
private final Object2IntMap<DeviceOs> userPlatforms;
|
||||
private final int connectionAttempts;
|
||||
private final HashInfo hashInfo;
|
||||
|
@ -96,7 +93,6 @@ public class DumpInfo {
|
|||
this.gitInfo = new GitInfo(GeyserImpl.BUILD_NUMBER, GeyserImpl.COMMIT.substring(0, 7), GeyserImpl.COMMIT, GeyserImpl.BRANCH, GeyserImpl.REPOSITORY);
|
||||
|
||||
this.config = GeyserImpl.getInstance().config();
|
||||
this.floodgate = new Floodgate();
|
||||
|
||||
String md5Hash = "unknown";
|
||||
String sha256Hash = "unknown";
|
||||
|
@ -233,17 +229,6 @@ public class DumpInfo {
|
|||
}
|
||||
}
|
||||
|
||||
@Getter
|
||||
public static class Floodgate {
|
||||
private final Properties gitInfo;
|
||||
private final Object config;
|
||||
|
||||
Floodgate() {
|
||||
this.gitInfo = FloodgateInfoHolder.getGitProperties();
|
||||
this.config = FloodgateInfoHolder.getConfig();
|
||||
}
|
||||
}
|
||||
|
||||
@Getter
|
||||
public static class LogsInfo {
|
||||
private String link;
|
||||
|
|
|
@ -115,7 +115,7 @@ import org.geysermc.geyser.api.network.AuthType;
|
|||
import org.geysermc.geyser.api.network.RemoteServer;
|
||||
import org.geysermc.geyser.api.util.PlatformType;
|
||||
import org.geysermc.geyser.command.GeyserCommandSource;
|
||||
import org.geysermc.geyser.configuration.GeyserConfiguration;
|
||||
import org.geysermc.geyser.configuration.GeyserConfig;
|
||||
import org.geysermc.geyser.entity.EntityDefinitions;
|
||||
import org.geysermc.geyser.entity.GeyserEntityData;
|
||||
import org.geysermc.geyser.entity.attribute.GeyserAttributeType;
|
||||
|
@ -600,7 +600,7 @@ public class GeyserSession implements GeyserConnection, GeyserCommandSource {
|
|||
|
||||
/**
|
||||
* A cache of IDs from ClientboundKeepAlivePackets that have been sent to the Bedrock client, but haven't been returned to the server.
|
||||
* Only used if {@link GeyserConfiguration#isForwardPlayerPing()} is enabled.
|
||||
* Only used if {@link GeyserConfig#forwardPlayerPing()} is enabled.
|
||||
*/
|
||||
private final Queue<Long> keepAliveCache = new ConcurrentLinkedQueue<>();
|
||||
|
||||
|
|
|
@ -27,7 +27,7 @@ package org.geysermc.geyser.session.cache;
|
|||
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import org.geysermc.geyser.configuration.GeyserConfiguration;
|
||||
import org.geysermc.geyser.configuration.GeyserConfig;
|
||||
import org.geysermc.geyser.session.GeyserSession;
|
||||
import org.geysermc.geyser.util.CooldownUtils;
|
||||
|
||||
|
@ -72,7 +72,7 @@ public class PreferencesCache {
|
|||
* If {@link #prefersShowCoordinates} is true, coordinates will be shown, unless either of the following conditions apply: <br>
|
||||
* <br>
|
||||
* {@link GeyserSession#isReducedDebugInfo()} is enabled
|
||||
* {@link GeyserConfiguration#isShowCoordinates()} is disabled
|
||||
* {@link GeyserConfig#showCoordinates()} is disabled
|
||||
*/
|
||||
public void updateShowCoordinates() {
|
||||
allowShowCoordinates = !session.isReducedDebugInfo() && session.getGeyser().config().showCoordinates();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue