@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/server/Main.java
|
||||
+++ b/net/minecraft/server/Main.java
|
||||
@@ -54,13 +54,20 @@
|
||||
@@ -58,6 +58,12 @@
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
@@ -13,16 +13,18 @@
|
||||
public class Main {
|
||||
|
||||
private static final Logger LOGGER = LogManager.getLogger();
|
||||
|
||||
@@ -65,8 +71,9 @@
|
||||
public Main() {}
|
||||
|
||||
@DontObfuscate
|
||||
- public static void main(String[] astring) {
|
||||
+ public static void main(final OptionSet optionset) { // CraftBukkit - replaces main(String[] astring)
|
||||
SharedConstants.a();
|
||||
+ /* CraftBukkit start - Replace everything
|
||||
OptionParser optionparser = new OptionParser();
|
||||
OptionSpec<Void> optionspec = optionparser.accepts("nogui");
|
||||
OptionSpec<Void> optionspec1 = optionparser.accepts("initSettings", "Initializes 'server.properties' and 'eula.txt', then quits");
|
||||
@@ -84,21 +91,23 @@
|
||||
@@ -90,20 +97,22 @@
|
||||
optionparser.printHelpOn(System.err);
|
||||
return;
|
||||
}
|
||||
@@ -33,26 +35,21 @@
|
||||
DispenserRegistry.init();
|
||||
DispenserRegistry.c();
|
||||
SystemUtils.l();
|
||||
IRegistryCustom.Dimension iregistrycustom_dimension = IRegistryCustom.b();
|
||||
- Path path = Paths.get("server.properties");
|
||||
- DedicatedServerSettings dedicatedserversettings = new DedicatedServerSettings(iregistrycustom_dimension, path);
|
||||
+ java.nio.file.Path java_nio_file_path = Paths.get("server.properties");
|
||||
+ DedicatedServerSettings dedicatedserversettings = new DedicatedServerSettings(iregistrycustom_dimension, optionset); // CraftBukkit - CLI argument support
|
||||
IRegistryCustom.Dimension iregistrycustom_dimension = IRegistryCustom.a();
|
||||
Path path = Paths.get("server.properties");
|
||||
- DedicatedServerSettings dedicatedserversettings = new DedicatedServerSettings(path);
|
||||
+ DedicatedServerSettings dedicatedserversettings = new DedicatedServerSettings(optionset); // CraftBukkit - CLI argument support
|
||||
|
||||
dedicatedserversettings.save();
|
||||
- Path path1 = Paths.get("eula.txt");
|
||||
- EULA eula = new EULA(path1);
|
||||
+ java.nio.file.Path java_nio_file_path1 = Paths.get("eula.txt");
|
||||
+ EULA eula = new EULA(java_nio_file_path1);
|
||||
Path path1 = Paths.get("eula.txt");
|
||||
EULA eula = new EULA(path1);
|
||||
|
||||
- if (optionset.has(optionspec1)) {
|
||||
- Main.LOGGER.info("Initialized '{}' and '{}'", path.toAbsolutePath(), path1.toAbsolutePath());
|
||||
+ if (optionset.has("initSettings")) { // CraftBukkit
|
||||
+ Main.LOGGER.info("Initialized '{}' and '{}'", java_nio_file_path.toAbsolutePath(), java_nio_file_path1.toAbsolutePath());
|
||||
Main.LOGGER.info("Initialized '{}' and '{}'", path.toAbsolutePath(), path1.toAbsolutePath());
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -107,24 +116,42 @@
|
||||
@@ -113,14 +122,15 @@
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -61,15 +58,19 @@
|
||||
YggdrasilAuthenticationService yggdrasilauthenticationservice = new YggdrasilAuthenticationService(Proxy.NO_PROXY);
|
||||
MinecraftSessionService minecraftsessionservice = yggdrasilauthenticationservice.createMinecraftSessionService();
|
||||
GameProfileRepository gameprofilerepository = yggdrasilauthenticationservice.createProfileRepository();
|
||||
UserCache usercache = new UserCache(gameprofilerepository, new File(file, MinecraftServer.b.getName()));
|
||||
- String s = (String) Optional.ofNullable(optionset.valueOf(optionspec10)).orElse(dedicatedserversettings.getProperties().levelName);
|
||||
UserCache usercache = new UserCache(gameprofilerepository, new File(file, MinecraftServer.USERID_CACHE_FILE.getName()));
|
||||
- String s = (String) Optional.ofNullable((String) optionset.valueOf(optionspec10)).orElse(dedicatedserversettings.getProperties().levelName);
|
||||
+ // CraftBukkit start
|
||||
+ String s = (String) Optional.ofNullable(optionset.valueOf("world")).orElse(dedicatedserversettings.getProperties().levelName);
|
||||
+ String s = (String) Optional.ofNullable((String) optionset.valueOf("world")).orElse(dedicatedserversettings.getProperties().levelName);
|
||||
Convertable convertable = Convertable.a(file.toPath());
|
||||
- Convertable.ConversionSession convertable_conversionsession = convertable.c(s);
|
||||
+ Convertable.ConversionSession convertable_conversionsession = convertable.c(s, WorldDimension.OVERWORLD);
|
||||
|
||||
MinecraftServer.convertWorld(convertable_conversionsession);
|
||||
WorldInfo worldinfo = convertable_conversionsession.d();
|
||||
@@ -131,13 +141,30 @@
|
||||
}
|
||||
|
||||
DataPackConfiguration datapackconfiguration = convertable_conversionsession.e();
|
||||
- boolean flag = optionset.has(optionspec6);
|
||||
+ boolean flag = optionset.has("safeMode");
|
||||
@@ -78,9 +79,9 @@
|
||||
Main.LOGGER.warn("Safe mode active, only vanilla datapack will be loaded");
|
||||
}
|
||||
|
||||
ResourcePackRepository resourcepackrepository = new ResourcePackRepository(new ResourcePackSource[]{new ResourcePackSourceVanilla(), new ResourcePackSourceFolder(convertable_conversionsession.getWorldFolder(SavedFile.DATAPACKS).toFile(), PackSource.c)});
|
||||
ResourcePackRepository resourcepackrepository = new ResourcePackRepository(EnumResourcePackType.SERVER_DATA, new ResourcePackSource[]{new ResourcePackSourceVanilla(), new ResourcePackSourceFolder(convertable_conversionsession.getWorldFolder(SavedFile.DATAPACK_DIR).toFile(), PackSource.WORLD)});
|
||||
+ // CraftBukkit start
|
||||
+ File bukkitDataPackFolder = new File(convertable_conversionsession.getWorldFolder(SavedFile.DATAPACKS).toFile(), "bukkit");
|
||||
+ File bukkitDataPackFolder = new File(convertable_conversionsession.getWorldFolder(SavedFile.DATAPACK_DIR).toFile(), "bukkit");
|
||||
+ if (!bukkitDataPackFolder.exists()) {
|
||||
+ bukkitDataPackFolder.mkdirs();
|
||||
+ }
|
||||
@@ -96,18 +97,18 @@
|
||||
+ throw new RuntimeException("Could not initialize Bukkit datapack", ex);
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
DataPackConfiguration datapackconfiguration1 = MinecraftServer.a(resourcepackrepository, datapackconfiguration == null ? DataPackConfiguration.a : datapackconfiguration, flag);
|
||||
CompletableFuture completablefuture = DataPackResources.a(resourcepackrepository.f(), CommandDispatcher.ServerType.DEDICATED, dedicatedserversettings.getProperties().functionPermissionLevel, SystemUtils.f(), Runnable::run);
|
||||
DataPackConfiguration datapackconfiguration1 = MinecraftServer.a(resourcepackrepository, datapackconfiguration == null ? DataPackConfiguration.DEFAULT : datapackconfiguration, flag);
|
||||
CompletableFuture completablefuture = DataPackResources.a(resourcepackrepository.f(), iregistrycustom_dimension, CommandDispatcher.ServerType.DEDICATED, dedicatedserversettings.getProperties().functionPermissionLevel, SystemUtils.f(), Runnable::run);
|
||||
|
||||
@@ -139,6 +166,7 @@
|
||||
@@ -152,6 +179,7 @@
|
||||
}
|
||||
|
||||
datapackresources.i();
|
||||
datapackresources.j();
|
||||
+ /*
|
||||
RegistryReadOps<NBTBase> registryreadops = RegistryReadOps.a((DynamicOps) DynamicOpsNBT.a, datapackresources.h(), iregistrycustom_dimension);
|
||||
Object object = convertable_conversionsession.a((DynamicOps) registryreadops, datapackconfiguration1);
|
||||
RegistryReadOps<NBTBase> registryreadops = RegistryReadOps.a((DynamicOps) DynamicOpsNBT.INSTANCE, datapackresources.i(), (IRegistryCustom) iregistrycustom_dimension);
|
||||
|
||||
@@ -166,21 +194,32 @@
|
||||
dedicatedserversettings.getProperties().a((IRegistryCustom) iregistrycustom_dimension);
|
||||
@@ -181,21 +209,32 @@
|
||||
}
|
||||
|
||||
convertable_conversionsession.a((IRegistryCustom) iregistrycustom_dimension, (SaveData) object);
|
||||
@@ -126,7 +127,7 @@
|
||||
+ boolean flag1 = !optionset.has("nogui") && !optionset.nonOptionArguments().contains("nogui");
|
||||
|
||||
if (flag1 && !GraphicsEnvironment.isHeadless()) {
|
||||
dedicatedserver1.bd();
|
||||
dedicatedserver1.bi();
|
||||
}
|
||||
|
||||
+ if (optionset.has("port")) {
|
||||
@@ -142,7 +143,7 @@
|
||||
Thread thread = new Thread("Server Shutdown Thread") {
|
||||
public void run() {
|
||||
dedicatedserver.safeShutdown(true);
|
||||
@@ -189,14 +228,15 @@
|
||||
@@ -204,14 +243,15 @@
|
||||
|
||||
thread.setUncaughtExceptionHandler(new DefaultUncaughtExceptionHandler(Main.LOGGER));
|
||||
Runtime.getRuntime().addShutdownHook(thread);
|
||||
|
||||
Reference in New Issue
Block a user