Defer writing the server.properties file until after mods have loaded to prevent config loss (#6545)

This commit is contained in:
dags 2020-03-27 23:19:34 +00:00 committed by GitHub
parent fcee09cab2
commit f6cb5268a2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 17 additions and 6 deletions

View file

@ -172,6 +172,15 @@
try {
OptionSet optionset = optionparser.parse(p_main_0_);
@@ -888,7 +913,7 @@
Path path = Paths.get("server.properties");
ServerPropertiesProvider serverpropertiesprovider = new ServerPropertiesProvider(path);
- serverpropertiesprovider.func_219035_b();
+ if (optionset.has(optionspec1) || !Files.exists(path)) serverpropertiesprovider.func_219035_b();
Path path1 = Paths.get("eula.txt");
ServerEula servereula = new ServerEula(path1);
if (optionset.has(optionspec1)) {
@@ -910,6 +935,10 @@
GameProfileRepository gameprofilerepository = yggdrasilauthenticationservice.createProfileRepository();
PlayerProfileCache playerprofilecache = new PlayerProfileCache(gameprofilerepository, new File(s, field_152367_a.getName()));

View file

@ -8,15 +8,17 @@
BufferedReader bufferedreader = new BufferedReader(new InputStreamReader(System.in, StandardCharsets.UTF_8));
String s3;
@@ -118,6 +119,7 @@
@@ -118,7 +119,9 @@
field_155771_h.warn("To start the server with more ram, launch it as \"java -Xmx1024M -Xms1024M -jar minecraft_server.jar\"");
}
+ net.minecraftforge.fml.server.ServerModLoader.begin(this);
field_155771_h.info("Loading properties");
+ this.field_71340_o.func_219033_a(properties -> ServerProperties.func_218985_a(java.nio.file.Paths.get("server.properties")));
ServerProperties serverproperties = this.field_71340_o.func_219034_a();
if (this.func_71264_H()) {
@@ -175,6 +177,7 @@
this.func_71189_e("127.0.0.1");
@@ -175,6 +178,7 @@
if (!PreYggdrasilConverter.func_219587_e(this)) {
return false;
} else {
@ -24,7 +26,7 @@
this.func_184105_a(new DedicatedPlayerList(this));
long i = Util.func_211178_c();
String s = serverproperties.field_219022_p;
@@ -196,6 +199,7 @@
@@ -196,6 +200,7 @@
SkullTileEntity.func_184293_a(this.func_152358_ax());
SkullTileEntity.func_184294_a(this.func_147130_as());
PlayerProfileCache.func_187320_a(this.func_71266_T());
@ -32,7 +34,7 @@
field_155771_h.info("Preparing level \"{}\"", (Object)this.func_71270_I());
JsonObject jsonobject = new JsonObject();
if (worldtype == WorldType.field_77138_c) {
@@ -208,6 +212,7 @@
@@ -208,6 +213,7 @@
long l = Util.func_211178_c() - i;
String s2 = String.format(Locale.ROOT, "%.3fs", (double)l / 1.0E9D);
field_155771_h.info("Done ({})! For help, type \"help\"", (Object)s2);
@ -40,7 +42,7 @@
if (serverproperties.field_219027_u != null) {
this.func_200252_aR().func_223585_a(GameRules.field_223620_w).func_223570_a(serverproperties.field_219027_u, this);
}
@@ -233,7 +238,8 @@
@@ -233,7 +239,8 @@
}
Items.field_190931_a.func_150895_a(ItemGroup.field_78027_g, NonNullList.func_191196_a());
@ -50,7 +52,7 @@
}
}
@@ -547,4 +553,9 @@
@@ -547,4 +554,9 @@
public boolean func_213199_b(GameProfile p_213199_1_) {
return false;
}