mirror of
https://github.com/Melledy/Nebula.git
synced 2025-12-14 13:24:43 +01:00
115 lines
3.2 KiB
Java
115 lines
3.2 KiB
Java
package emu.nebula;
|
|
|
|
import java.util.Set;
|
|
|
|
import lombok.Getter;
|
|
|
|
@Getter
|
|
public class Config {
|
|
public DatabaseInfo accountDatabase = new DatabaseInfo();
|
|
public DatabaseInfo gameDatabase = new DatabaseInfo();
|
|
public InternalMongoInfo internalMongoServer = new InternalMongoInfo();
|
|
public boolean useSameDatabase = true;
|
|
|
|
public KeystoreInfo keystore = new KeystoreInfo();
|
|
|
|
public HttpServerConfig httpServer = new HttpServerConfig(80);
|
|
public GameServerConfig gameServer = new GameServerConfig(80);
|
|
|
|
public ServerOptions serverOptions = new ServerOptions();
|
|
public ServerRates serverRates = new ServerRates();
|
|
public LogOptions logOptions = new LogOptions();
|
|
|
|
public String resourceDir = "./resources";
|
|
public String dataDir = "./data";
|
|
|
|
@Getter
|
|
public static class DatabaseInfo {
|
|
public String uri = "mongodb://localhost:27017";
|
|
public String collection = "nebula";
|
|
public boolean useInternal = true;
|
|
}
|
|
|
|
@Getter
|
|
public static class InternalMongoInfo {
|
|
public String address = "localhost";
|
|
public int port = 27017;
|
|
public String filePath = "database.mv";
|
|
}
|
|
|
|
@Getter
|
|
public static class KeystoreInfo {
|
|
public String path = "./keystore.p12";
|
|
public String password = "";
|
|
}
|
|
|
|
@Getter
|
|
private static class ServerConfig {
|
|
public boolean useSSL = false;
|
|
public String bindAddress = "0.0.0.0";
|
|
public int bindPort;
|
|
public String publicAddress = "127.0.0.1"; // Will return bindAddress if publicAddress is null
|
|
public Integer publicPort; // Will return bindPort if publicPort is null
|
|
|
|
public ServerConfig(int port) {
|
|
this.bindPort = port;
|
|
}
|
|
|
|
public String getPublicAddress() {
|
|
if (this.publicAddress != null && !this.publicAddress.isEmpty()) {
|
|
return this.publicAddress;
|
|
}
|
|
|
|
return this.bindAddress;
|
|
}
|
|
|
|
public int getPublicPort() {
|
|
if (this.publicPort != null && this.publicPort != 0) {
|
|
return this.publicPort;
|
|
}
|
|
|
|
return this.bindPort;
|
|
}
|
|
|
|
public String getDisplayAddress() {
|
|
return (useSSL ? "https" : "http") + "://" + getPublicAddress() + ":" + getPublicPort();
|
|
}
|
|
}
|
|
|
|
@Getter
|
|
public static class HttpServerConfig extends ServerConfig {
|
|
|
|
public HttpServerConfig(int port) {
|
|
super(port);
|
|
}
|
|
}
|
|
|
|
@Getter
|
|
public static class GameServerConfig extends ServerConfig {
|
|
|
|
public GameServerConfig(int port) {
|
|
super(port);
|
|
}
|
|
}
|
|
|
|
@Getter
|
|
public static class ServerOptions {
|
|
public Set<String> defaultPermissions = Set.of("*");
|
|
public boolean autoCreateAccount = true;
|
|
public boolean skipIntro = false;
|
|
public boolean unlockInstances = true;
|
|
}
|
|
|
|
@Getter
|
|
public static class ServerRates {
|
|
public double exp = 1.0;
|
|
}
|
|
|
|
@Getter
|
|
public static class LogOptions {
|
|
public boolean commands = true;
|
|
public boolean packets = false;
|
|
}
|
|
|
|
}
|