forked from GeyserMC/Geyser
Use Path instead of File for floodgate key file in config
...and fix related issues with the file not being found.
This commit is contained in:
parent
c4857c6a54
commit
240f41ff03
6 changed files with 21 additions and 13 deletions
|
@ -29,6 +29,8 @@ import org.bukkit.configuration.file.FileConfiguration;
|
|||
import org.geysermc.common.IGeyserConfiguration;
|
||||
|
||||
import java.io.File;
|
||||
import java.nio.file.Path;
|
||||
import java.nio.file.Paths;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
|
@ -100,8 +102,8 @@ public class GeyserBukkitConfiguration implements IGeyserConfiguration {
|
|||
}
|
||||
|
||||
@Override
|
||||
public File getFloodgateKeyFile() {
|
||||
return new File(dataFolder.toString() + config.getString("floodgate-key-file", "public-key.pem"));
|
||||
public Path getFloodgateKeyFile() {
|
||||
return Paths.get(dataFolder.toString(), config.getString("floodgate-key-file", "public-key.pem"));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -30,6 +30,8 @@ import net.md_5.bungee.config.Configuration;
|
|||
import org.geysermc.common.IGeyserConfiguration;
|
||||
|
||||
import java.io.File;
|
||||
import java.nio.file.Path;
|
||||
import java.nio.file.Paths;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
|
@ -101,8 +103,8 @@ public class GeyserBungeeConfiguration implements IGeyserConfiguration {
|
|||
}
|
||||
|
||||
@Override
|
||||
public File getFloodgateKeyFile() {
|
||||
return new File(dataFolder, config.getString("floodgate-key-file", "public-key.pem"));
|
||||
public Path getFloodgateKeyFile() {
|
||||
return Paths.get(dataFolder.toString(), config.getString("floodgate-key-file", "public-key.pem"));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -32,6 +32,8 @@ import ninja.leaping.configurate.ConfigurationNode;
|
|||
import org.geysermc.common.IGeyserConfiguration;
|
||||
|
||||
import java.io.File;
|
||||
import java.nio.file.Path;
|
||||
import java.nio.file.Paths;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
@ -104,8 +106,8 @@ public class GeyserSpongeConfiguration implements IGeyserConfiguration {
|
|||
}
|
||||
|
||||
@Override
|
||||
public File getFloodgateKeyFile() {
|
||||
return new File(dataFolder, node.getNode("floodgate-key-file").getString("public-key.pem"));
|
||||
public Path getFloodgateKeyFile() {
|
||||
return Paths.get(dataFolder.toString(), node.getNode("floodgate-key-file").getString("public-key.pem"));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -27,10 +27,13 @@ package org.geysermc.platform.standalone;
|
|||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
|
||||
import lombok.Getter;
|
||||
|
||||
import org.geysermc.common.IGeyserConfiguration;
|
||||
|
||||
import java.io.File;
|
||||
import java.nio.file.Path;
|
||||
import java.nio.file.Paths;
|
||||
import java.util.Map;
|
||||
|
||||
@JsonIgnoreProperties(ignoreUnknown = true)
|
||||
|
@ -63,8 +66,8 @@ public class GeyserConfiguration implements IGeyserConfiguration {
|
|||
private MetricsInfo metrics;
|
||||
|
||||
@Override
|
||||
public File getFloodgateKeyFile() {
|
||||
return new File(floodgateKeyFile);
|
||||
public Path getFloodgateKeyFile() {
|
||||
return Paths.get(floodgateKeyFile);
|
||||
}
|
||||
|
||||
@Getter
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
|
||||
package org.geysermc.common;
|
||||
|
||||
import java.io.File;
|
||||
import java.nio.file.Path;
|
||||
import java.util.Map;
|
||||
|
||||
public interface IGeyserConfiguration {
|
||||
|
@ -46,7 +46,7 @@ public interface IGeyserConfiguration {
|
|||
|
||||
boolean isAllowThirdPartyCapes();
|
||||
|
||||
File getFloodgateKeyFile();
|
||||
Path getFloodgateKeyFile();
|
||||
|
||||
IMetricsInfo getMetrics();
|
||||
|
||||
|
|
|
@ -66,7 +66,6 @@ import org.geysermc.floodgate.util.EncryptionUtil;
|
|||
|
||||
import java.io.IOException;
|
||||
import java.net.InetSocketAddress;
|
||||
import java.nio.file.Paths;
|
||||
import java.security.NoSuchAlgorithmException;
|
||||
import java.security.PublicKey;
|
||||
import java.security.spec.InvalidKeySpecException;
|
||||
|
@ -190,7 +189,7 @@ public class GeyserSession implements CommandSender {
|
|||
PublicKey key = null;
|
||||
try {
|
||||
key = EncryptionUtil.getKeyFromFile(
|
||||
Paths.get(connector.getConfig().getFloodgateKeyFile().getPath()),
|
||||
connector.getConfig().getFloodgateKeyFile(),
|
||||
PublicKey.class
|
||||
);
|
||||
} catch (IOException | InvalidKeySpecException | NoSuchAlgorithmException e) {
|
||||
|
|
Loading…
Reference in a new issue