66 lines
4.0 KiB
Diff
66 lines
4.0 KiB
Diff
--- a/net/minecraft/server/Main.java
|
|
+++ b/net/minecraft/server/Main.java
|
|
@@ -71,6 +71,8 @@
|
|
OptionSpec<Integer> optionspec11 = optionparser.accepts("port").withRequiredArg().ofType(Integer.class).defaultsTo(-1);
|
|
OptionSpec<String> optionspec12 = optionparser.accepts("serverId").withRequiredArg();
|
|
OptionSpec<String> optionspec13 = optionparser.nonOptions();
|
|
+ optionparser.accepts("allowUpdates").withRequiredArg().ofType(Boolean.class).defaultsTo(Boolean.TRUE); // Forge: allow mod updates to proceed
|
|
+ optionparser.accepts("gameDir").withRequiredArg().ofType(File.class).defaultsTo(new File(".")); //Forge: Consume this argument, we use it in the launcher, and the client side.
|
|
|
|
try {
|
|
OptionSet optionset = optionparser.parse(p_main_0_);
|
|
@@ -78,33 +80,38 @@
|
|
optionparser.printHelpOn(System.err);
|
|
return;
|
|
}
|
|
+ Path path1 = Paths.get("eula.txt");
|
|
+ ServerEula servereula = new ServerEula(path1);
|
|
|
|
+ if (!servereula.func_154346_a()) {
|
|
+ field_240759_a_.info("You need to agree to the EULA in order to run the server. Go to eula.txt for more info.");
|
|
+ return;
|
|
+ }
|
|
+
|
|
CrashReport.func_230188_h_();
|
|
Bootstrap.func_151354_b();
|
|
Bootstrap.func_218821_c();
|
|
Util.func_240994_l_();
|
|
+ if (!optionset.has(optionspec1)) net.minecraftforge.fml.server.ServerModLoader.load(); // Load mods before we load almost anything else anymore. Single spot now. Only loads if they haven't passed the initserver param
|
|
DynamicRegistries.Impl dynamicregistries$impl = DynamicRegistries.func_239770_b_();
|
|
Path path = Paths.get("server.properties");
|
|
ServerPropertiesProvider serverpropertiesprovider = new ServerPropertiesProvider(dynamicregistries$impl, path);
|
|
serverpropertiesprovider.func_219035_b();
|
|
- Path path1 = Paths.get("eula.txt");
|
|
- ServerEula servereula = new ServerEula(path1);
|
|
if (optionset.has(optionspec1)) {
|
|
field_240759_a_.info("Initialized '{}' and '{}'", path.toAbsolutePath(), path1.toAbsolutePath());
|
|
return;
|
|
}
|
|
|
|
- if (!servereula.func_154346_a()) {
|
|
- field_240759_a_.info("You need to agree to the EULA in order to run the server. Go to eula.txt for more info.");
|
|
- return;
|
|
- }
|
|
-
|
|
File file1 = new File(optionset.valueOf(optionspec9));
|
|
YggdrasilAuthenticationService yggdrasilauthenticationservice = new YggdrasilAuthenticationService(Proxy.NO_PROXY);
|
|
MinecraftSessionService minecraftsessionservice = yggdrasilauthenticationservice.createMinecraftSessionService();
|
|
GameProfileRepository gameprofilerepository = yggdrasilauthenticationservice.createProfileRepository();
|
|
PlayerProfileCache playerprofilecache = new PlayerProfileCache(gameprofilerepository, new File(file1, MinecraftServer.field_152367_a.getName()));
|
|
String s = Optional.ofNullable(optionset.valueOf(optionspec10)).orElse(serverpropertiesprovider.func_219034_a().field_219021_o);
|
|
+ if (s == null || s.isEmpty() || new File(file1, s).getAbsolutePath().equals(new File(s).getAbsolutePath())) {
|
|
+ field_240759_a_.error("Invalid world directory specified, must not be null, empty or the same directory as your universe! " + s);
|
|
+ return;
|
|
+ }
|
|
SaveFormat saveformat = SaveFormat.func_237269_a_(file1.toPath());
|
|
SaveFormat.LevelSave saveformat$levelsave = saveformat.func_237274_c_(s);
|
|
MinecraftServer.func_240777_a_(saveformat$levelsave);
|
|
@@ -169,6 +176,7 @@
|
|
Thread thread = new Thread("Server Shutdown Thread") {
|
|
public void run() {
|
|
dedicatedserver.func_71263_m(true);
|
|
+ LogManager.shutdown(); // we're manually managing the logging shutdown on the server. Make sure we do it here at the end.
|
|
}
|
|
};
|
|
thread.setUncaughtExceptionHandler(new DefaultUncaughtExceptionHandler(field_240759_a_));
|