Mirror von
https://github.com/GeyserMC/Geyser.git
synchronisiert 2024-12-26 16:12:46 +01:00
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
Dieser Commit ist enthalten in:
Ursprung
7231758a19
Commit
34b367bfc3
@ -25,120 +25,29 @@
|
|||||||
|
|
||||||
package org.geysermc.platform.bukkit;
|
package org.geysermc.platform.bukkit;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
|
||||||
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||||
|
import lombok.Getter;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.configuration.file.FileConfiguration;
|
|
||||||
import org.bukkit.plugin.Plugin;
|
import org.bukkit.plugin.Plugin;
|
||||||
import org.geysermc.connector.FloodgateKeyLoader;
|
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.Path;
|
||||||
import java.nio.file.Paths;
|
import java.nio.file.Paths;
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
public class GeyserBukkitConfiguration implements GeyserConfiguration {
|
@Getter
|
||||||
|
@JsonIgnoreProperties(ignoreUnknown = true)
|
||||||
|
public class GeyserBukkitConfiguration extends GeyserJacksonConfiguration {
|
||||||
|
|
||||||
private FileConfiguration config;
|
@JsonProperty("floodgate-key-file")
|
||||||
private File dataFolder;
|
private String floodgateKeyFile;
|
||||||
|
|
||||||
private BukkitBedrockConfiguration bedrockConfig;
|
|
||||||
private BukkitRemoteConfiguration remoteConfig;
|
|
||||||
private BukkitMetricsInfo metricsInfo;
|
|
||||||
|
|
||||||
private Map<String, BukkitUserAuthenticationInfo> userAuthInfo = new HashMap<>();
|
|
||||||
|
|
||||||
private Path floodgateKey;
|
private Path floodgateKey;
|
||||||
|
|
||||||
public GeyserBukkitConfiguration(File dataFolder, FileConfiguration config) {
|
|
||||||
this.dataFolder = dataFolder;
|
|
||||||
this.config = config;
|
|
||||||
|
|
||||||
bedrockConfig = new BukkitBedrockConfiguration();
|
|
||||||
remoteConfig = new BukkitRemoteConfiguration();
|
|
||||||
metricsInfo = new BukkitMetricsInfo();
|
|
||||||
|
|
||||||
if (!config.contains("userAuths"))
|
|
||||||
return;
|
|
||||||
|
|
||||||
for (String key : config.getConfigurationSection("userAuths").getKeys(false)) {
|
|
||||||
userAuthInfo.put(key, new BukkitUserAuthenticationInfo(key));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void loadFloodgate(GeyserBukkitPlugin plugin) {
|
public void loadFloodgate(GeyserBukkitPlugin plugin) {
|
||||||
Plugin floodgate = Bukkit.getPluginManager().getPlugin("floodgate-bukkit");
|
Plugin floodgate = Bukkit.getPluginManager().getPlugin("floodgate-bukkit");
|
||||||
floodgateKey = FloodgateKeyLoader.getKey(plugin.getGeyserLogger(), this, Paths.get(dataFolder.toString(), config.getString("floodgate-key-file", "public-key.pem")), floodgate, floodgate != null ? floodgate.getDataFolder().toPath() : null);
|
floodgateKey = FloodgateKeyLoader.getKey(plugin.getGeyserLogger(), this, Paths.get(plugin.getDataFolder().toString(), plugin.getConfig().getString("floodgate-key-file", "public-key.pem")), floodgate, floodgate != null ? floodgate.getDataFolder().toPath() : null);
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public IBedrockConfiguration getBedrock() {
|
|
||||||
return bedrockConfig;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public IRemoteConfiguration getRemote() {
|
|
||||||
return remoteConfig;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Map<String, BukkitUserAuthenticationInfo> getUserAuths() {
|
|
||||||
return userAuthInfo;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isCommandSuggestions() {
|
|
||||||
return config.getBoolean("command-suggestions", true);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isPassthroughMotd() {
|
|
||||||
return config.getBoolean("passthrough-motd", false);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isPassthroughPlayerCounts() {
|
|
||||||
return config.getBoolean("passthrough-player-counts", false);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isLegacyPingPassthrough() {
|
|
||||||
return config.getBoolean("legacy-ping-passthrough", false);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int getPingPassthroughInterval() {
|
|
||||||
return config.getInt("ping-passthrough-interval", 3);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int getMaxPlayers() {
|
|
||||||
return config.getInt("max-players", 10);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isDebugMode() {
|
|
||||||
return config.getBoolean("debug-mode", false);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int getGeneralThreadPool() {
|
|
||||||
return config.getInt("general-thread-pool", 32);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isAllowThirdPartyCapes() {
|
|
||||||
return config.getBoolean("allow-third-party-capes", true);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isAllowThirdPartyEars() {
|
|
||||||
return config.getBoolean("allow-third-party-ears", false);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getDefaultLocale() {
|
|
||||||
return config.getString("default-locale", "en_us");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -150,92 +59,4 @@ public class GeyserBukkitConfiguration implements GeyserConfiguration {
|
|||||||
public boolean isCacheChunks() {
|
public boolean isCacheChunks() {
|
||||||
return true; // We override this as with Bukkit, we have direct access to the server implementation
|
return true; // We override this as with Bukkit, we have direct access to the server implementation
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isAboveBedrockNetherBuilding() {
|
|
||||||
return config.getBoolean("above-bedrock-nether-building", false);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public IMetricsInfo getMetrics() {
|
|
||||||
return metricsInfo;
|
|
||||||
}
|
|
||||||
|
|
||||||
public class BukkitBedrockConfiguration implements IBedrockConfiguration {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getAddress() {
|
|
||||||
return config.getString("bedrock.address", "0.0.0.0");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int getPort() {
|
|
||||||
return config.getInt("bedrock.port", 25565);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getMotd1() {
|
|
||||||
return config.getString("bedrock.motd1", "GeyserMC");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getMotd2() {
|
|
||||||
return config.getString("bedrock.motd2", "GeyserMC");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public class BukkitRemoteConfiguration implements IRemoteConfiguration {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getAddress() {
|
|
||||||
return config.getString("remote.address", "127.0.0.1");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int getPort() {
|
|
||||||
return config.getInt("remote.port", 25565);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getAuthType() {
|
|
||||||
return config.getString("remote.auth-type", "online");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public class BukkitUserAuthenticationInfo implements IUserAuthenticationInfo {
|
|
||||||
|
|
||||||
private String key;
|
|
||||||
|
|
||||||
public BukkitUserAuthenticationInfo(String key) {
|
|
||||||
this.key = key;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getEmail() {
|
|
||||||
return config.getString("userAuths." + key + ".email");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getPassword() {
|
|
||||||
return config.getString("userAuths." + key + ".password");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public class BukkitMetricsInfo implements IMetricsInfo {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isEnabled() {
|
|
||||||
return config.getBoolean("metrics.enabled", true);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getUniqueId() {
|
|
||||||
return config.getString("metrics.uuid", "generateduuid");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int getConfigVersion() {
|
|
||||||
return config.getInt("config-version", 0);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -28,20 +28,24 @@ package org.geysermc.platform.bukkit;
|
|||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.plugin.java.JavaPlugin;
|
import org.bukkit.plugin.java.JavaPlugin;
|
||||||
import org.geysermc.common.PlatformType;
|
import org.geysermc.common.PlatformType;
|
||||||
import org.geysermc.connector.GeyserConfiguration;
|
|
||||||
import org.geysermc.connector.GeyserConnector;
|
import org.geysermc.connector.GeyserConnector;
|
||||||
import org.geysermc.connector.bootstrap.GeyserBootstrap;
|
import org.geysermc.connector.bootstrap.GeyserBootstrap;
|
||||||
import org.geysermc.connector.command.CommandManager;
|
import org.geysermc.connector.command.CommandManager;
|
||||||
|
import org.geysermc.connector.configuration.GeyserConfiguration;
|
||||||
import org.geysermc.connector.network.translators.world.WorldManager;
|
import org.geysermc.connector.network.translators.world.WorldManager;
|
||||||
import org.geysermc.connector.ping.GeyserLegacyPingPassthrough;
|
import org.geysermc.connector.ping.GeyserLegacyPingPassthrough;
|
||||||
import org.geysermc.connector.ping.IGeyserPingPassthrough;
|
import org.geysermc.connector.ping.IGeyserPingPassthrough;
|
||||||
|
import org.geysermc.connector.utils.FileUtils;
|
||||||
import org.geysermc.platform.bukkit.command.GeyserBukkitCommandExecutor;
|
import org.geysermc.platform.bukkit.command.GeyserBukkitCommandExecutor;
|
||||||
import org.geysermc.platform.bukkit.command.GeyserBukkitCommandManager;
|
import org.geysermc.platform.bukkit.command.GeyserBukkitCommandManager;
|
||||||
import org.geysermc.platform.bukkit.world.GeyserBukkitBlockPlaceListener;
|
import org.geysermc.platform.bukkit.world.GeyserBukkitBlockPlaceListener;
|
||||||
import org.geysermc.platform.bukkit.world.GeyserBukkitWorldManager;
|
import org.geysermc.platform.bukkit.world.GeyserBukkitWorldManager;
|
||||||
import us.myles.ViaVersion.api.Via;
|
import us.myles.ViaVersion.api.Via;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
import java.io.IOException;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
import java.util.logging.Level;
|
||||||
|
|
||||||
public class GeyserBukkitPlugin extends JavaPlugin implements GeyserBootstrap {
|
public class GeyserBukkitPlugin extends JavaPlugin implements GeyserBootstrap {
|
||||||
|
|
||||||
@ -56,26 +60,34 @@ public class GeyserBukkitPlugin extends JavaPlugin implements GeyserBootstrap {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onEnable() {
|
public void onEnable() {
|
||||||
saveDefaultConfig();
|
// This is manually done instead of using Bukkit methods to save the config because otherwise comments get removed
|
||||||
|
try {
|
||||||
this.geyserConfig = new GeyserBukkitConfiguration(getDataFolder(), getConfig());
|
if (!getDataFolder().exists())
|
||||||
if (geyserConfig.getMetrics().getUniqueId().equals("generateduuid")) {
|
getDataFolder().mkdir();
|
||||||
getConfig().set("metrics.uuid", UUID.randomUUID().toString());
|
File configFile = FileUtils.fileOrCopiedFromResource(new File(getDataFolder(), "config.yml"), "config.yml", (x) -> x.replaceAll("generateduuid", UUID.randomUUID().toString()));
|
||||||
saveConfig();
|
this.geyserConfig = FileUtils.loadConfig(configFile, GeyserBukkitConfiguration.class);
|
||||||
|
} catch (IOException ex) {
|
||||||
|
getLogger().log(Level.WARNING, "Failed to read/create config.yml! Make sure it's up to date and/or readable+writable!", ex);
|
||||||
|
ex.printStackTrace();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Don't change the ip if its listening on all interfaces
|
// Don't change the ip if its listening on all interfaces
|
||||||
// By default this should be 127.0.0.1 but may need to be changed in some circumstances
|
// By default this should be 127.0.0.1 but may need to be changed in some circumstances
|
||||||
if (!Bukkit.getIp().equals("0.0.0.0") && !Bukkit.getIp().equals("")) {
|
if (!Bukkit.getIp().equals("0.0.0.0") && !Bukkit.getIp().equals("")) {
|
||||||
getConfig().set("remote.address", Bukkit.getIp());
|
geyserConfig.getRemote().setAddress(Bukkit.getIp());
|
||||||
}
|
}
|
||||||
|
|
||||||
getConfig().set("remote.port", Bukkit.getPort());
|
geyserConfig.getRemote().setPort(Bukkit.getPort());
|
||||||
saveConfig();
|
|
||||||
|
|
||||||
this.geyserLogger = new GeyserBukkitLogger(getLogger(), geyserConfig.isDebugMode());
|
this.geyserLogger = new GeyserBukkitLogger(getLogger(), geyserConfig.isDebugMode());
|
||||||
GeyserConfiguration.checkGeyserConfiguration(geyserConfig, geyserLogger);
|
GeyserConfiguration.checkGeyserConfiguration(geyserConfig, geyserLogger);
|
||||||
|
|
||||||
|
if (geyserConfig.getRemote().getAuthType().equals("floodgate") && Bukkit.getPluginManager().getPlugin("floodgate-bukkit") == null) {
|
||||||
|
geyserLogger.severe("Auth type set to Floodgate but Floodgate not found! Disabling...");
|
||||||
|
this.getPluginLoader().disablePlugin(this);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
geyserConfig.loadFloodgate(this);
|
geyserConfig.loadFloodgate(this);
|
||||||
|
|
||||||
this.connector = GeyserConnector.start(PlatformType.BUKKIT, this);
|
this.connector = GeyserConnector.start(PlatformType.BUKKIT, this);
|
||||||
@ -113,6 +125,7 @@ public class GeyserBukkitPlugin extends JavaPlugin implements GeyserBootstrap {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onDisable() {
|
public void onDisable() {
|
||||||
|
if (connector != null)
|
||||||
connector.shutdown();
|
connector.shutdown();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -25,216 +25,29 @@
|
|||||||
|
|
||||||
package org.geysermc.platform.bungeecord;
|
package org.geysermc.platform.bungeecord;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
|
||||||
|
import lombok.Getter;
|
||||||
import net.md_5.bungee.api.plugin.Plugin;
|
import net.md_5.bungee.api.plugin.Plugin;
|
||||||
import net.md_5.bungee.config.Configuration;
|
import net.md_5.bungee.config.Configuration;
|
||||||
import org.geysermc.connector.FloodgateKeyLoader;
|
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.Path;
|
||||||
import java.nio.file.Paths;
|
import java.nio.file.Paths;
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
public class GeyserBungeeConfiguration implements GeyserConfiguration {
|
@Getter
|
||||||
|
@JsonIgnoreProperties(ignoreUnknown = true)
|
||||||
private File dataFolder;
|
public class GeyserBungeeConfiguration extends GeyserJacksonConfiguration {
|
||||||
private Configuration config;
|
|
||||||
|
|
||||||
private BungeeBedrockConfiguration bedrockConfig;
|
|
||||||
private BungeeRemoteConfiguration remoteConfig;
|
|
||||||
private BungeeMetricsInfo metricsInfo;
|
|
||||||
|
|
||||||
private Map<String, BungeeUserAuthenticationInfo> userAuthInfo = new HashMap<>();
|
|
||||||
|
|
||||||
private Path floodgateKey;
|
private Path floodgateKey;
|
||||||
|
|
||||||
public GeyserBungeeConfiguration(File dataFolder, Configuration config) {
|
public void loadFloodgate(GeyserBungeePlugin plugin, Configuration configuration) {
|
||||||
this.dataFolder = dataFolder;
|
|
||||||
this.config = config;
|
|
||||||
|
|
||||||
bedrockConfig = new BungeeBedrockConfiguration();
|
|
||||||
remoteConfig = new BungeeRemoteConfiguration();
|
|
||||||
metricsInfo = new BungeeMetricsInfo();
|
|
||||||
|
|
||||||
if (!config.contains("userAuths"))
|
|
||||||
return;
|
|
||||||
|
|
||||||
for (String key : config.getSection("userAuths").getKeys()) {
|
|
||||||
userAuthInfo.put(key, new BungeeUserAuthenticationInfo(key));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void loadFloodgate(GeyserBungeePlugin plugin) {
|
|
||||||
Plugin floodgate = plugin.getProxy().getPluginManager().getPlugin("floodgate-bungee");
|
Plugin floodgate = plugin.getProxy().getPluginManager().getPlugin("floodgate-bungee");
|
||||||
floodgateKey = FloodgateKeyLoader.getKey(plugin.getGeyserLogger(), this, Paths.get(dataFolder.toString(), config.getString("floodgate-key-file", "public-key.pem")), floodgate, floodgate != null ? floodgate.getDataFolder().toPath() : null);
|
floodgateKey = FloodgateKeyLoader.getKey(plugin.getGeyserLogger(), this, Paths.get(plugin.getDataFolder().toString(), configuration.getString("floodgate-key-file"), "public-key.pem"), floodgate, floodgate != null ? floodgate.getDataFolder().toPath() : null);
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public BungeeBedrockConfiguration getBedrock() {
|
|
||||||
return bedrockConfig;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public BungeeRemoteConfiguration getRemote() {
|
|
||||||
return remoteConfig;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Map<String, BungeeUserAuthenticationInfo> getUserAuths() {
|
|
||||||
return userAuthInfo;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isCommandSuggestions() {
|
|
||||||
return config.getBoolean("command-suggestions", true);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isPassthroughMotd() {
|
|
||||||
return config.getBoolean("passthrough-motd", false);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isPassthroughPlayerCounts() {
|
|
||||||
return config.getBoolean("passthrough-player-counts", false);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isLegacyPingPassthrough() {
|
|
||||||
return config.getBoolean("legacy-ping-passthrough", false);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int getPingPassthroughInterval() {
|
|
||||||
return config.getInt("ping-passthrough-interval", 3);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int getMaxPlayers() {
|
|
||||||
return config.getInt("max-players", 10);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isDebugMode() {
|
|
||||||
return config.getBoolean("debug-mode", false);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int getGeneralThreadPool() {
|
|
||||||
return config.getInt("general-thread-pool", 32);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isAllowThirdPartyCapes() {
|
|
||||||
return config.getBoolean("allow-third-party-capes", true);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isAllowThirdPartyEars() {
|
|
||||||
return config.getBoolean("allow-third-party-ears", false);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getDefaultLocale() {
|
|
||||||
return config.getString("default-locale", "en_us");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Path getFloodgateKeyFile() {
|
public Path getFloodgateKeyFile() {
|
||||||
return floodgateKey;
|
return floodgateKey;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isCacheChunks() {
|
|
||||||
return config.getBoolean("cache-chunks", false);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isAboveBedrockNetherBuilding() {
|
|
||||||
return config.getBoolean("above-bedrock-nether-building", false);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public BungeeMetricsInfo getMetrics() {
|
|
||||||
return metricsInfo;
|
|
||||||
}
|
|
||||||
|
|
||||||
public class BungeeBedrockConfiguration implements IBedrockConfiguration {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getAddress() {
|
|
||||||
return config.getString("bedrock.address", "0.0.0.0");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int getPort() {
|
|
||||||
return config.getInt("bedrock.port", 25565);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getMotd1() {
|
|
||||||
return config.getString("bedrock.motd1", "GeyserMC");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getMotd2() {
|
|
||||||
return config.getString("bedrock.motd2", "GeyserMC");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public class BungeeRemoteConfiguration implements IRemoteConfiguration {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getAddress() {
|
|
||||||
return config.getString("remote.address", "127.0.0.1");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int getPort() {
|
|
||||||
return config.getInt("remote.port", 25565);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getAuthType() {
|
|
||||||
return config.getString("remote.auth-type", "online");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public class BungeeUserAuthenticationInfo implements IUserAuthenticationInfo {
|
|
||||||
|
|
||||||
private String key;
|
|
||||||
|
|
||||||
public BungeeUserAuthenticationInfo(String key) {
|
|
||||||
this.key = key;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getEmail() {
|
|
||||||
return config.getString("userAuths." + key + ".email");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getPassword() {
|
|
||||||
return config.getString("userAuths." + key + ".password");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public class BungeeMetricsInfo implements IMetricsInfo {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isEnabled() {
|
|
||||||
return config.getBoolean("metrics.enabled", true);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getUniqueId() {
|
|
||||||
return config.getString("metrics.uuid", "generateduuid");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int getConfigVersion() {
|
|
||||||
return config.getInt("config-version", 0);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -31,20 +31,19 @@ import net.md_5.bungee.config.Configuration;
|
|||||||
import net.md_5.bungee.config.ConfigurationProvider;
|
import net.md_5.bungee.config.ConfigurationProvider;
|
||||||
import net.md_5.bungee.config.YamlConfiguration;
|
import net.md_5.bungee.config.YamlConfiguration;
|
||||||
import org.geysermc.common.PlatformType;
|
import org.geysermc.common.PlatformType;
|
||||||
import org.geysermc.connector.GeyserConfiguration;
|
|
||||||
import org.geysermc.connector.GeyserConnector;
|
import org.geysermc.connector.GeyserConnector;
|
||||||
import org.geysermc.connector.bootstrap.GeyserBootstrap;
|
import org.geysermc.connector.bootstrap.GeyserBootstrap;
|
||||||
import org.geysermc.connector.command.CommandManager;
|
import org.geysermc.connector.command.CommandManager;
|
||||||
|
import org.geysermc.connector.configuration.GeyserConfiguration;
|
||||||
import org.geysermc.connector.ping.GeyserLegacyPingPassthrough;
|
import org.geysermc.connector.ping.GeyserLegacyPingPassthrough;
|
||||||
import org.geysermc.connector.ping.IGeyserPingPassthrough;
|
import org.geysermc.connector.ping.IGeyserPingPassthrough;
|
||||||
|
import org.geysermc.connector.utils.FileUtils;
|
||||||
import org.geysermc.platform.bungeecord.command.GeyserBungeeCommandExecutor;
|
import org.geysermc.platform.bungeecord.command.GeyserBungeeCommandExecutor;
|
||||||
import org.geysermc.platform.bungeecord.command.GeyserBungeeCommandManager;
|
import org.geysermc.platform.bungeecord.command.GeyserBungeeCommandManager;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InputStream;
|
|
||||||
import java.net.InetSocketAddress;
|
import java.net.InetSocketAddress;
|
||||||
import java.nio.file.Files;
|
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
|
|
||||||
@ -62,32 +61,18 @@ public class GeyserBungeePlugin extends Plugin implements GeyserBootstrap {
|
|||||||
if (!getDataFolder().exists())
|
if (!getDataFolder().exists())
|
||||||
getDataFolder().mkdir();
|
getDataFolder().mkdir();
|
||||||
|
|
||||||
File file = new File(getDataFolder(), "config.yml");
|
|
||||||
Configuration configuration = null;
|
Configuration configuration = null;
|
||||||
|
|
||||||
if (!file.exists()) {
|
|
||||||
try (InputStream in = getResourceAsStream("config.yml")) {
|
|
||||||
Files.copy(in, file.toPath());
|
|
||||||
} catch (IOException ex) {
|
|
||||||
getLogger().log(Level.SEVERE, "Failed to read/create config.yml! Make sure it's up to date and/or readable+writable!", ex);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
try {
|
try {
|
||||||
|
if (!getDataFolder().exists())
|
||||||
|
getDataFolder().mkdir();
|
||||||
|
File configFile = FileUtils.fileOrCopiedFromResource(new File(getDataFolder(), "config.yml"), "config.yml", (x) -> x.replaceAll("generateduuid", UUID.randomUUID().toString()));
|
||||||
|
this.geyserConfig = FileUtils.loadConfig(configFile, GeyserBungeeConfiguration.class);
|
||||||
configuration = ConfigurationProvider.getProvider(YamlConfiguration.class).load(new File(getDataFolder(), "config.yml"));
|
configuration = ConfigurationProvider.getProvider(YamlConfiguration.class).load(new File(getDataFolder(), "config.yml"));
|
||||||
} catch(IOException e) {
|
} catch (IOException ex) {
|
||||||
e.printStackTrace();
|
getLogger().log(Level.WARNING, "Failed to read/create config.yml! Make sure it's up to date and/or readable+writable!", ex);
|
||||||
|
ex.printStackTrace();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (configuration == null) {
|
|
||||||
getLogger().severe("Failed to read/create config.yml! Make sure it's up to date and/or readable+writable!");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
this.geyserConfig = new GeyserBungeeConfiguration(getDataFolder(), configuration);
|
|
||||||
|
|
||||||
boolean configHasChanged = false;
|
|
||||||
|
|
||||||
if (getProxy().getConfig().getListeners().size() == 1) {
|
if (getProxy().getConfig().getListeners().size() == 1) {
|
||||||
ListenerInfo listener = getProxy().getConfig().getListeners().toArray(new ListenerInfo[0])[0];
|
ListenerInfo listener = getProxy().getConfig().getListeners().toArray(new ListenerInfo[0])[0];
|
||||||
|
|
||||||
@ -96,33 +81,21 @@ public class GeyserBungeePlugin extends Plugin implements GeyserBootstrap {
|
|||||||
// Don't change the ip if its listening on all interfaces
|
// Don't change the ip if its listening on all interfaces
|
||||||
// By default this should be 127.0.0.1 but may need to be changed in some circumstances
|
// By default this should be 127.0.0.1 but may need to be changed in some circumstances
|
||||||
if (!javaAddr.getHostString().equals("0.0.0.0") && !javaAddr.getHostString().equals("")) {
|
if (!javaAddr.getHostString().equals("0.0.0.0") && !javaAddr.getHostString().equals("")) {
|
||||||
configuration.set("remote.address", javaAddr.getHostString());
|
this.geyserConfig.getRemote().setAddress(javaAddr.getHostString());
|
||||||
}
|
}
|
||||||
|
|
||||||
configuration.set("remote.port", javaAddr.getPort());
|
this.geyserConfig.getRemote().setPort(javaAddr.getPort());
|
||||||
|
|
||||||
configHasChanged = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (geyserConfig.getMetrics().getUniqueId().equals("generateduuid")) {
|
|
||||||
configuration.set("metrics.uuid", UUID.randomUUID().toString());
|
|
||||||
|
|
||||||
configHasChanged = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (configHasChanged) {
|
|
||||||
try {
|
|
||||||
ConfigurationProvider.getProvider(YamlConfiguration.class).save(configuration, new File(getDataFolder(), "config.yml"));
|
|
||||||
} catch (IOException ex) {
|
|
||||||
getLogger().log(Level.SEVERE, "Failed to read/create config.yml! Make sure it's up to date and/or readable+writable!", ex);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
this.geyserLogger = new GeyserBungeeLogger(getLogger(), geyserConfig.isDebugMode());
|
this.geyserLogger = new GeyserBungeeLogger(getLogger(), geyserConfig.isDebugMode());
|
||||||
GeyserConfiguration.checkGeyserConfiguration(geyserConfig, geyserLogger);
|
GeyserConfiguration.checkGeyserConfiguration(geyserConfig, geyserLogger);
|
||||||
|
|
||||||
geyserConfig.loadFloodgate(this);
|
if (geyserConfig.getRemote().getAuthType().equals("floodgate") && getProxy().getPluginManager().getPlugin("floodgate-bungee") == null) {
|
||||||
|
geyserLogger.severe("Auth type set to Floodgate but Floodgate not found! Disabling...");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
geyserConfig.loadFloodgate(this, configuration);
|
||||||
|
|
||||||
this.connector = GeyserConnector.start(PlatformType.BUNGEECORD, this);
|
this.connector = GeyserConnector.start(PlatformType.BUNGEECORD, this);
|
||||||
|
|
||||||
|
@ -29,7 +29,7 @@ import lombok.AllArgsConstructor;
|
|||||||
|
|
||||||
import ninja.leaping.configurate.ConfigurationNode;
|
import ninja.leaping.configurate.ConfigurationNode;
|
||||||
|
|
||||||
import org.geysermc.connector.GeyserConfiguration;
|
import org.geysermc.connector.configuration.GeyserConfiguration;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.nio.file.Path;
|
import java.nio.file.Path;
|
||||||
|
@ -30,7 +30,7 @@ import ninja.leaping.configurate.ConfigurationNode;
|
|||||||
import ninja.leaping.configurate.loader.ConfigurationLoader;
|
import ninja.leaping.configurate.loader.ConfigurationLoader;
|
||||||
import ninja.leaping.configurate.yaml.YAMLConfigurationLoader;
|
import ninja.leaping.configurate.yaml.YAMLConfigurationLoader;
|
||||||
import org.geysermc.common.PlatformType;
|
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.GeyserConnector;
|
||||||
import org.geysermc.connector.bootstrap.GeyserBootstrap;
|
import org.geysermc.connector.bootstrap.GeyserBootstrap;
|
||||||
import org.geysermc.connector.command.CommandManager;
|
import org.geysermc.connector.command.CommandManager;
|
||||||
|
@ -26,12 +26,12 @@
|
|||||||
package org.geysermc.platform.standalone;
|
package org.geysermc.platform.standalone;
|
||||||
|
|
||||||
import org.geysermc.common.PlatformType;
|
import org.geysermc.common.PlatformType;
|
||||||
import org.geysermc.connector.ping.GeyserLegacyPingPassthrough;
|
|
||||||
import org.geysermc.connector.GeyserConfiguration;
|
|
||||||
import org.geysermc.connector.bootstrap.GeyserBootstrap;
|
|
||||||
import org.geysermc.connector.GeyserConnector;
|
import org.geysermc.connector.GeyserConnector;
|
||||||
|
import org.geysermc.connector.bootstrap.GeyserBootstrap;
|
||||||
|
import org.geysermc.connector.configuration.GeyserConfiguration;
|
||||||
import org.geysermc.connector.command.CommandManager;
|
import org.geysermc.connector.command.CommandManager;
|
||||||
import org.geysermc.connector.ping.IGeyserPingPassthrough;
|
import org.geysermc.connector.ping.IGeyserPingPassthrough;
|
||||||
|
import org.geysermc.connector.ping.GeyserLegacyPingPassthrough;
|
||||||
import org.geysermc.connector.utils.FileUtils;
|
import org.geysermc.connector.utils.FileUtils;
|
||||||
import org.geysermc.platform.standalone.command.GeyserCommandManager;
|
import org.geysermc.platform.standalone.command.GeyserCommandManager;
|
||||||
|
|
||||||
|
@ -27,110 +27,21 @@ package org.geysermc.platform.standalone;
|
|||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
|
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
|
||||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||||
|
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import org.geysermc.connector.GeyserConfiguration;
|
import org.geysermc.connector.configuration.GeyserJacksonConfiguration;
|
||||||
|
|
||||||
import java.nio.file.Path;
|
import java.nio.file.Path;
|
||||||
import java.nio.file.Paths;
|
import java.nio.file.Paths;
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
@JsonIgnoreProperties(ignoreUnknown = true)
|
|
||||||
@Getter
|
@Getter
|
||||||
public class GeyserStandaloneConfiguration implements GeyserConfiguration {
|
@JsonIgnoreProperties(ignoreUnknown = true)
|
||||||
|
public class GeyserStandaloneConfiguration extends GeyserJacksonConfiguration {
|
||||||
private BedrockConfiguration bedrock;
|
|
||||||
private RemoteConfiguration remote;
|
|
||||||
|
|
||||||
@JsonProperty("floodgate-key-file")
|
@JsonProperty("floodgate-key-file")
|
||||||
private String floodgateKeyFile;
|
private String floodgateKeyFile;
|
||||||
|
|
||||||
private Map<String, UserAuthenticationInfo> userAuths;
|
|
||||||
|
|
||||||
@JsonProperty("command-suggestions")
|
|
||||||
private boolean isCommandSuggestions;
|
|
||||||
|
|
||||||
@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 isAboveBedrockNetherBuilding;
|
|
||||||
|
|
||||||
private MetricsInfo metrics;
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Path getFloodgateKeyFile() {
|
public Path getFloodgateKeyFile() {
|
||||||
return Paths.get(floodgateKeyFile);
|
return Paths.get(floodgateKeyFile);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Getter
|
|
||||||
public static class BedrockConfiguration implements IBedrockConfiguration {
|
|
||||||
|
|
||||||
private String address;
|
|
||||||
private int port;
|
|
||||||
|
|
||||||
private String motd1;
|
|
||||||
private String motd2;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Getter
|
|
||||||
public static class RemoteConfiguration implements IRemoteConfiguration {
|
|
||||||
|
|
||||||
private String address;
|
|
||||||
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;
|
|
||||||
}
|
}
|
||||||
|
@ -30,122 +30,30 @@ import com.fasterxml.jackson.annotation.JsonProperty;
|
|||||||
import com.velocitypowered.api.plugin.PluginContainer;
|
import com.velocitypowered.api.plugin.PluginContainer;
|
||||||
import com.velocitypowered.api.proxy.ProxyServer;
|
import com.velocitypowered.api.proxy.ProxyServer;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import lombok.Setter;
|
|
||||||
import org.geysermc.connector.FloodgateKeyLoader;
|
import org.geysermc.connector.FloodgateKeyLoader;
|
||||||
import org.geysermc.connector.GeyserConfiguration;
|
import org.geysermc.connector.configuration.GeyserJacksonConfiguration;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.nio.file.Path;
|
import java.nio.file.Path;
|
||||||
import java.nio.file.Paths;
|
import java.nio.file.Paths;
|
||||||
import java.util.Map;
|
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
|
|
||||||
@JsonIgnoreProperties(ignoreUnknown = true)
|
|
||||||
@Getter
|
@Getter
|
||||||
public class GeyserVelocityConfiguration implements GeyserConfiguration {
|
@JsonIgnoreProperties(ignoreUnknown = true)
|
||||||
|
public class GeyserVelocityConfiguration extends GeyserJacksonConfiguration {
|
||||||
private BedrockConfiguration bedrock;
|
|
||||||
private RemoteConfiguration remote;
|
|
||||||
|
|
||||||
@JsonProperty("floodgate-key-file")
|
@JsonProperty("floodgate-key-file")
|
||||||
private String floodgateKeyFile;
|
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;
|
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
|
@Override
|
||||||
public Path getFloodgateKeyFile() {
|
public Path getFloodgateKeyFile() {
|
||||||
return floodgateKey;
|
return floodgateKey;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Getter
|
public void loadFloodgate(GeyserVelocityPlugin plugin, ProxyServer proxyServer, File dataFolder) {
|
||||||
public static class BedrockConfiguration implements IBedrockConfiguration {
|
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/")));
|
||||||
private String address;
|
|
||||||
private int port;
|
|
||||||
|
|
||||||
private String motd1;
|
|
||||||
private String motd2;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@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 com.velocitypowered.api.proxy.ProxyServer;
|
||||||
import org.geysermc.common.PlatformType;
|
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.GeyserConnector;
|
||||||
import org.geysermc.connector.bootstrap.GeyserBootstrap;
|
import org.geysermc.connector.bootstrap.GeyserBootstrap;
|
||||||
import org.geysermc.connector.ping.GeyserLegacyPingPassthrough;
|
import org.geysermc.connector.ping.GeyserLegacyPingPassthrough;
|
||||||
@ -96,6 +96,11 @@ public class GeyserVelocityPlugin implements GeyserBootstrap {
|
|||||||
this.geyserLogger = new GeyserVelocityLogger(logger, geyserConfig.isDebugMode());
|
this.geyserLogger = new GeyserVelocityLogger(logger, geyserConfig.isDebugMode());
|
||||||
GeyserConfiguration.checkGeyserConfiguration(geyserConfig, geyserLogger);
|
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);
|
geyserConfig.loadFloodgate(this, proxyServer, configDir);
|
||||||
|
|
||||||
this.connector = GeyserConnector.start(PlatformType.VELOCITY, this);
|
this.connector = GeyserConnector.start(PlatformType.VELOCITY, this);
|
||||||
|
@ -26,6 +26,8 @@
|
|||||||
|
|
||||||
package org.geysermc.connector;
|
package org.geysermc.connector;
|
||||||
|
|
||||||
|
import org.geysermc.connector.configuration.GeyserConfiguration;
|
||||||
|
|
||||||
import java.nio.file.Files;
|
import java.nio.file.Files;
|
||||||
import java.nio.file.Path;
|
import java.nio.file.Path;
|
||||||
|
|
||||||
|
@ -35,6 +35,7 @@ import org.geysermc.common.AuthType;
|
|||||||
import org.geysermc.common.PlatformType;
|
import org.geysermc.common.PlatformType;
|
||||||
import org.geysermc.connector.bootstrap.GeyserBootstrap;
|
import org.geysermc.connector.bootstrap.GeyserBootstrap;
|
||||||
import org.geysermc.connector.command.CommandManager;
|
import org.geysermc.connector.command.CommandManager;
|
||||||
|
import org.geysermc.connector.configuration.GeyserConfiguration;
|
||||||
import org.geysermc.connector.metrics.Metrics;
|
import org.geysermc.connector.metrics.Metrics;
|
||||||
import org.geysermc.connector.network.ConnectorServerEventHandler;
|
import org.geysermc.connector.network.ConnectorServerEventHandler;
|
||||||
import org.geysermc.connector.network.remote.RemoteServer;
|
import org.geysermc.connector.network.remote.RemoteServer;
|
||||||
|
@ -27,7 +27,7 @@
|
|||||||
package org.geysermc.connector.bootstrap;
|
package org.geysermc.connector.bootstrap;
|
||||||
|
|
||||||
import org.geysermc.connector.ping.IGeyserPingPassthrough;
|
import org.geysermc.connector.ping.IGeyserPingPassthrough;
|
||||||
import org.geysermc.connector.GeyserConfiguration;
|
import org.geysermc.connector.configuration.GeyserConfiguration;
|
||||||
import org.geysermc.connector.GeyserLogger;
|
import org.geysermc.connector.GeyserLogger;
|
||||||
import org.geysermc.connector.command.CommandManager;
|
import org.geysermc.connector.command.CommandManager;
|
||||||
import org.geysermc.connector.network.translators.world.CachedChunkManager;
|
import org.geysermc.connector.network.translators.world.CachedChunkManager;
|
||||||
|
@ -24,7 +24,9 @@
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package org.geysermc.connector;
|
package org.geysermc.connector.configuration;
|
||||||
|
|
||||||
|
import org.geysermc.connector.GeyserLogger;
|
||||||
|
|
||||||
import java.nio.file.Path;
|
import java.nio.file.Path;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
@ -0,0 +1,135 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2019-2020 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.connector.configuration;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
|
||||||
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.Setter;
|
||||||
|
|
||||||
|
import java.nio.file.Path;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
@JsonIgnoreProperties(ignoreUnknown = true)
|
||||||
|
public abstract class GeyserJacksonConfiguration implements GeyserConfiguration {
|
||||||
|
|
||||||
|
private BedrockConfiguration bedrock;
|
||||||
|
private RemoteConfiguration remote;
|
||||||
|
|
||||||
|
@JsonProperty("floodgate-key-file")
|
||||||
|
private String floodgateKeyFile;
|
||||||
|
|
||||||
|
public abstract Path getFloodgateKeyFile();
|
||||||
|
|
||||||
|
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;
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
public static class BedrockConfiguration implements IBedrockConfiguration {
|
||||||
|
|
||||||
|
private String address;
|
||||||
|
private int port;
|
||||||
|
|
||||||
|
private String motd1;
|
||||||
|
private String motd2;
|
||||||
|
}
|
||||||
|
|
||||||
|
@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;
|
||||||
|
}
|
@ -31,7 +31,7 @@ import io.netty.channel.ChannelHandlerContext;
|
|||||||
import io.netty.channel.socket.DatagramPacket;
|
import io.netty.channel.socket.DatagramPacket;
|
||||||
import org.geysermc.common.ping.GeyserPingInfo;
|
import org.geysermc.common.ping.GeyserPingInfo;
|
||||||
import org.geysermc.connector.ping.IGeyserPingPassthrough;
|
import org.geysermc.connector.ping.IGeyserPingPassthrough;
|
||||||
import org.geysermc.connector.GeyserConfiguration;
|
import org.geysermc.connector.configuration.GeyserConfiguration;
|
||||||
import org.geysermc.connector.GeyserConnector;
|
import org.geysermc.connector.GeyserConnector;
|
||||||
import org.geysermc.connector.network.session.GeyserSession;
|
import org.geysermc.connector.network.session.GeyserSession;
|
||||||
import org.geysermc.connector.utils.MessageUtils;
|
import org.geysermc.connector.utils.MessageUtils;
|
||||||
|
@ -28,7 +28,7 @@ package org.geysermc.connector.network;
|
|||||||
import com.nukkitx.protocol.bedrock.BedrockPacket;
|
import com.nukkitx.protocol.bedrock.BedrockPacket;
|
||||||
import com.nukkitx.protocol.bedrock.packet.*;
|
import com.nukkitx.protocol.bedrock.packet.*;
|
||||||
import org.geysermc.common.AuthType;
|
import org.geysermc.common.AuthType;
|
||||||
import org.geysermc.connector.GeyserConfiguration;
|
import org.geysermc.connector.configuration.GeyserConfiguration;
|
||||||
import org.geysermc.connector.GeyserConnector;
|
import org.geysermc.connector.GeyserConnector;
|
||||||
import org.geysermc.connector.network.session.GeyserSession;
|
import org.geysermc.connector.network.session.GeyserSession;
|
||||||
import org.geysermc.connector.network.translators.PacketTranslatorRegistry;
|
import org.geysermc.connector.network.translators.PacketTranslatorRegistry;
|
||||||
|
@ -33,9 +33,7 @@ import com.github.steveice10.mc.protocol.data.status.handler.ServerInfoHandler;
|
|||||||
import com.github.steveice10.packetlib.Client;
|
import com.github.steveice10.packetlib.Client;
|
||||||
import com.github.steveice10.packetlib.tcp.TcpSessionFactory;
|
import com.github.steveice10.packetlib.tcp.TcpSessionFactory;
|
||||||
import org.geysermc.common.ping.GeyserPingInfo;
|
import org.geysermc.common.ping.GeyserPingInfo;
|
||||||
import org.geysermc.connector.GeyserConfiguration;
|
|
||||||
import org.geysermc.connector.GeyserConnector;
|
import org.geysermc.connector.GeyserConnector;
|
||||||
import org.geysermc.connector.GeyserLogger;
|
|
||||||
|
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren