mirror of
https://github.com/GravitLauncher/Launcher
synced 2024-12-23 00:51:01 +03:00
Обновление конфига ServerWrapper
This commit is contained in:
parent
90103d16f4
commit
4828e8e895
1 changed files with 15 additions and 9 deletions
|
@ -33,7 +33,7 @@ public class ServerWrapper {
|
||||||
private static GsonBuilder gsonBuiler;
|
private static GsonBuilder gsonBuiler;
|
||||||
|
|
||||||
public static Path modulesDir = Paths.get(System.getProperty("serverwrapper.modulesDir", "modules"));
|
public static Path modulesDir = Paths.get(System.getProperty("serverwrapper.modulesDir", "modules"));
|
||||||
public static Path configFile = Paths.get(System.getProperty("serverwrapper.configFile", "ServerWrapper.cfg"));
|
public static Path configFile = Paths.get(System.getProperty("serverwrapper.configFile", "ServerWrapperConfig.json"));
|
||||||
public static Path publicKeyFile = Paths.get(System.getProperty("serverwrapper.publicKeyFile", "public.key"));
|
public static Path publicKeyFile = Paths.get(System.getProperty("serverwrapper.publicKeyFile", "public.key"));
|
||||||
|
|
||||||
public static boolean auth(ServerWrapper wrapper) {
|
public static boolean auth(ServerWrapper wrapper) {
|
||||||
|
@ -85,7 +85,7 @@ public static void main(String[] args) throws Throwable {
|
||||||
modulesManager.autoload(modulesDir);
|
modulesManager.autoload(modulesDir);
|
||||||
Launcher.modulesManager = modulesManager;
|
Launcher.modulesManager = modulesManager;
|
||||||
modulesManager.preInitModules();
|
modulesManager.preInitModules();
|
||||||
LogHelper.debug("Read LaunchWrapper.cfg");
|
LogHelper.debug("Read ServerWrapperConfig.json");
|
||||||
gsonBuiler = new GsonBuilder();
|
gsonBuiler = new GsonBuilder();
|
||||||
gson = gsonBuiler.create();
|
gson = gsonBuiler.create();
|
||||||
generateConfigIfNotExists();
|
generateConfigIfNotExists();
|
||||||
|
@ -144,17 +144,23 @@ private static void generateConfigIfNotExists() throws IOException {
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// Create new config
|
// Create new config
|
||||||
LogHelper.info("Creating LaunchWrapper config");
|
LogHelper.info("Creating ServerWrapper config");
|
||||||
Config newConfig;
|
Config newConfig= new Config();
|
||||||
try(Reader reader = IOHelper.newReader(IOHelper.getResourceURL("ru/gravit/launcher/server/ServerWrapper.cfg")))
|
newConfig.title = "Your profile title";
|
||||||
{
|
newConfig.projectname = "MineCraft";
|
||||||
newConfig = gson.fromJson(reader,Config.class);
|
newConfig.address = "localhost";
|
||||||
}
|
newConfig.port = 7240;
|
||||||
|
newConfig.login = "login";
|
||||||
|
newConfig.password = "password";
|
||||||
|
//try(Reader reader = IOHelper.newReader(IOHelper.getResourceURL("ru/gravit/launcher/server/ServerWrapper.cfg")))
|
||||||
|
//{
|
||||||
|
// newConfig = gson.fromJson(reader,Config.class);
|
||||||
|
//}
|
||||||
|
|
||||||
LogHelper.warning("Title is not set. Please show ServerWrapper.cfg");
|
LogHelper.warning("Title is not set. Please show ServerWrapper.cfg");
|
||||||
|
|
||||||
// Write LaunchServer config
|
// Write LaunchServer config
|
||||||
LogHelper.info("Writing LaunchWrapper config file");
|
LogHelper.info("Writing ServerWrapper config file");
|
||||||
try(Writer writer = IOHelper.newWriter(configFile))
|
try(Writer writer = IOHelper.newWriter(configFile))
|
||||||
{
|
{
|
||||||
gson.toJson(newConfig,writer);
|
gson.toJson(newConfig,writer);
|
||||||
|
|
Loading…
Reference in a new issue