Auto load floodgate key if floodgate installed and set authtype (#454)

* Added floodgate key auto loading for Bukkit

* Added floodgate key auto loading for Bungee

* Added floodgate key auto loading for Velocity and fixed key location

* Moved key loading to common
This commit is contained in:
rtm516 2020-05-03 21:30:20 +01:00 committed by GitHub
parent 692e46146c
commit 9c6ac1b41c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 99 additions and 7 deletions

View file

@ -25,8 +25,9 @@
package org.geysermc.platform.bungeecord;
import net.md_5.bungee.api.plugin.Plugin;
import net.md_5.bungee.config.Configuration;
import org.geysermc.common.FloodgateKeyLoader;
import org.geysermc.common.IGeyserConfiguration;
import java.io.File;
@ -46,6 +47,8 @@ public class GeyserBungeeConfiguration implements IGeyserConfiguration {
private Map<String, BungeeUserAuthenticationInfo> userAuthInfo = new HashMap<>();
private Path floodgateKey;
public GeyserBungeeConfiguration(File dataFolder, Configuration config) {
this.dataFolder = dataFolder;
this.config = config;
@ -62,6 +65,11 @@ public class GeyserBungeeConfiguration implements IGeyserConfiguration {
}
}
public void loadFloodgate(GeyserBungeePlugin plugin) {
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);
}
@Override
public BungeeBedrockConfiguration getBedrock() {
return bedrockConfig;
@ -109,7 +117,7 @@ public class GeyserBungeeConfiguration implements IGeyserConfiguration {
@Override
public Path getFloodgateKeyFile() {
return Paths.get(dataFolder.toString(), config.getString("floodgate-key-file", "public-key.pem"));
return floodgateKey;
}
@Override

View file

@ -116,6 +116,9 @@ public class GeyserBungeePlugin extends Plugin implements IGeyserBootstrap {
}
this.geyserLogger = new GeyserBungeeLogger(getLogger(), geyserConfig.isDebugMode());
geyserConfig.loadFloodgate(this);
this.connector = GeyserConnector.start(PlatformType.BUNGEECORD, this);
this.geyserCommandManager = new GeyserBungeeCommandManager(connector);