forked from GeyserMC/Geyser
Configuration updates (#653)
* Configuration updates The main feature of this commit is switching Bukkit and BungeeCord to using Jackson configuration. This allows comments to load. Along with this, the Jackson configs have been consolidated into one abstract class, and a check is made to ensure auth-type cannot be set to Floodgate if Floodgate is not installed. * Add deleted file; remove imports * Re-add changing of Bukkit port * Alphabetize import * Alphabetize Bungee import * Updates * Swap values in GeyserJacksonConfiguration * Add a null check for GeyserConnector in Bukkit's onDisable
This commit is contained in:
parent
7231758a19
commit
34b367bfc3
18 changed files with 223 additions and 641 deletions
|
@ -30,122 +30,30 @@ import com.fasterxml.jackson.annotation.JsonProperty;
|
|||
import com.velocitypowered.api.plugin.PluginContainer;
|
||||
import com.velocitypowered.api.proxy.ProxyServer;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import org.geysermc.connector.FloodgateKeyLoader;
|
||||
import org.geysermc.connector.GeyserConfiguration;
|
||||
import org.geysermc.connector.configuration.GeyserJacksonConfiguration;
|
||||
|
||||
import java.io.File;
|
||||
import java.nio.file.Path;
|
||||
import java.nio.file.Paths;
|
||||
import java.util.Map;
|
||||
import java.util.Optional;
|
||||
|
||||
@JsonIgnoreProperties(ignoreUnknown = true)
|
||||
@Getter
|
||||
public class GeyserVelocityConfiguration implements GeyserConfiguration {
|
||||
|
||||
private BedrockConfiguration bedrock;
|
||||
private RemoteConfiguration remote;
|
||||
@JsonIgnoreProperties(ignoreUnknown = true)
|
||||
public class GeyserVelocityConfiguration extends GeyserJacksonConfiguration {
|
||||
|
||||
@JsonProperty("floodgate-key-file")
|
||||
private String floodgateKeyFile;
|
||||
|
||||
private Map<String, UserAuthenticationInfo> userAuths;
|
||||
|
||||
@JsonProperty("command-suggestions")
|
||||
private boolean commandSuggestions;
|
||||
|
||||
@JsonProperty("passthrough-motd")
|
||||
private boolean isPassthroughMotd;
|
||||
|
||||
@JsonProperty("passthrough-player-counts")
|
||||
private boolean isPassthroughPlayerCounts;
|
||||
|
||||
@JsonProperty("legacy-ping-passthrough")
|
||||
private boolean isLegacyPingPassthrough;
|
||||
|
||||
@JsonProperty("ping-passthrough-interval")
|
||||
private int pingPassthroughInterval;
|
||||
|
||||
@JsonProperty("max-players")
|
||||
private int maxPlayers;
|
||||
|
||||
@JsonProperty("debug-mode")
|
||||
private boolean debugMode;
|
||||
|
||||
@JsonProperty("general-thread-pool")
|
||||
private int generalThreadPool;
|
||||
|
||||
@JsonProperty("allow-third-party-capes")
|
||||
private boolean allowThirdPartyCapes;
|
||||
|
||||
@JsonProperty("allow-third-party-ears")
|
||||
private boolean allowThirdPartyEars;
|
||||
|
||||
@JsonProperty("default-locale")
|
||||
private String defaultLocale;
|
||||
|
||||
@JsonProperty("cache-chunks")
|
||||
private boolean cacheChunks;
|
||||
|
||||
@JsonProperty("above-bedrock-nether-building")
|
||||
private boolean aboveBedrockNetherBuilding;
|
||||
|
||||
private MetricsInfo metrics;
|
||||
|
||||
private Path floodgateKey;
|
||||
|
||||
public void loadFloodgate(GeyserVelocityPlugin plugin, ProxyServer proxyServer, File dataFolder) {
|
||||
Optional<PluginContainer> floodgate = proxyServer.getPluginManager().getPlugin("floodgate");
|
||||
floodgate.ifPresent(it -> floodgateKey = FloodgateKeyLoader.getKey(plugin.getGeyserLogger(), this, Paths.get(dataFolder.toString(), floodgateKeyFile.isEmpty() ? floodgateKeyFile : "public-key.pem"), it, Paths.get("plugins/floodgate/")));
|
||||
}
|
||||
|
||||
@Override
|
||||
public Path getFloodgateKeyFile() {
|
||||
return floodgateKey;
|
||||
}
|
||||
|
||||
@Getter
|
||||
public static class BedrockConfiguration implements IBedrockConfiguration {
|
||||
|
||||
private String address;
|
||||
private int port;
|
||||
|
||||
private String motd1;
|
||||
private String motd2;
|
||||
public void loadFloodgate(GeyserVelocityPlugin plugin, ProxyServer proxyServer, File dataFolder) {
|
||||
Optional<PluginContainer> floodgate = proxyServer.getPluginManager().getPlugin("floodgate");
|
||||
floodgate.ifPresent(it -> floodgateKey = FloodgateKeyLoader.getKey(plugin.getGeyserLogger(), this, Paths.get(dataFolder.toString(), floodgateKeyFile.isEmpty() ? floodgateKeyFile : "public-key.pem"), it, Paths.get("plugins/floodgate/")));
|
||||
}
|
||||
|
||||
@Getter
|
||||
public static class RemoteConfiguration implements IRemoteConfiguration {
|
||||
|
||||
@Setter
|
||||
private String address;
|
||||
|
||||
@Setter
|
||||
private int port;
|
||||
|
||||
private String motd1;
|
||||
private String motd2;
|
||||
|
||||
@JsonProperty("auth-type")
|
||||
private String authType;
|
||||
}
|
||||
|
||||
@Getter
|
||||
public static class UserAuthenticationInfo implements IUserAuthenticationInfo {
|
||||
private String email;
|
||||
private String password;
|
||||
}
|
||||
|
||||
@Getter
|
||||
public static class MetricsInfo implements IMetricsInfo {
|
||||
|
||||
private boolean enabled;
|
||||
|
||||
@JsonProperty("uuid")
|
||||
private String uniqueId;
|
||||
}
|
||||
|
||||
@JsonProperty("config-version")
|
||||
private int configVersion;
|
||||
}
|
||||
|
|
|
@ -35,7 +35,7 @@ import com.velocitypowered.api.plugin.Plugin;
|
|||
|
||||
import com.velocitypowered.api.proxy.ProxyServer;
|
||||
import org.geysermc.common.PlatformType;
|
||||
import org.geysermc.connector.GeyserConfiguration;
|
||||
import org.geysermc.connector.configuration.GeyserConfiguration;
|
||||
import org.geysermc.connector.GeyserConnector;
|
||||
import org.geysermc.connector.bootstrap.GeyserBootstrap;
|
||||
import org.geysermc.connector.ping.GeyserLegacyPingPassthrough;
|
||||
|
@ -96,6 +96,11 @@ public class GeyserVelocityPlugin implements GeyserBootstrap {
|
|||
this.geyserLogger = new GeyserVelocityLogger(logger, geyserConfig.isDebugMode());
|
||||
GeyserConfiguration.checkGeyserConfiguration(geyserConfig, geyserLogger);
|
||||
|
||||
if (geyserConfig.getRemote().getAuthType().equals("floodgate") && !proxyServer.getPluginManager().getPlugin("floodgate").isPresent()) {
|
||||
geyserLogger.severe("Auth type set to Floodgate but Floodgate not found! Disabling...");
|
||||
return;
|
||||
}
|
||||
|
||||
geyserConfig.loadFloodgate(this, proxyServer, configDir);
|
||||
|
||||
this.connector = GeyserConnector.start(PlatformType.VELOCITY, this);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue