diff --git a/divinemc-server/paper-patches/features/0001-Rebrand.patch b/divinemc-server/paper-patches/features/0001-Rebrand.patch index 7fdb2fa..e23e19b 100644 --- a/divinemc-server/paper-patches/features/0001-Rebrand.patch +++ b/divinemc-server/paper-patches/features/0001-Rebrand.patch @@ -134,6 +134,19 @@ index b36e30fd4057a938e4d90cb42a2dca661f16478e..4e29f5f55b9a894099bef6f7c7f11e2a } @Override +diff --git a/src/main/java/org/bukkit/craftbukkit/Main.java b/src/main/java/org/bukkit/craftbukkit/Main.java +index 2e1b7f613de8876095ef39bb0341a3f9520c8d5d..bab0d25e82f85c7b9524ae42e0bb41e6233d71cf 100644 +--- a/src/main/java/org/bukkit/craftbukkit/Main.java ++++ b/src/main/java/org/bukkit/craftbukkit/Main.java +@@ -285,7 +285,7 @@ public class Main { + System.setProperty("jdk.console", "java.base"); // Paper - revert default console provider back to java.base so we can have our own jline + //System.out.println("Loading libraries, please wait..."); + //net.minecraft.server.Main.main(options); +- io.papermc.paper.PaperBootstrap.boot(options); ++ org.bxteam.divinemc.DivineBootstrap.boot(options); // DivineMC - Replace with DivineBootstrap + } catch (Throwable t) { + t.printStackTrace(); + } diff --git a/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java b/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java index 2e7c3d4befeb6256ce81ecaa9ed4e8fbcb21651e..a839dbbb72f48b8f8736d9f4693c528686570732 100644 --- a/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java diff --git a/divinemc-server/paper-patches/features/0005-Parallel-world-ticking.patch b/divinemc-server/paper-patches/features/0005-Parallel-world-ticking.patch index a2bdc34..20a8e2e 100644 --- a/divinemc-server/paper-patches/features/0005-Parallel-world-ticking.patch +++ b/divinemc-server/paper-patches/features/0005-Parallel-world-ticking.patch @@ -5,14 +5,14 @@ Subject: [PATCH] Parallel world ticking diff --git a/src/main/java/ca/spottedleaf/moonrise/common/util/TickThread.java b/src/main/java/ca/spottedleaf/moonrise/common/util/TickThread.java -index 69cdd304d255d52c9b7dc9b6a33ffdb630b79abe..09357f2ef583af04f6b8dc5ba67ef7e1d83e3462 100644 +index 69cdd304d255d52c9b7dc9b6a33ffdb630b79abe..e40e1a21c720ddecf84abf5f399b48b92a8a80c5 100644 --- a/src/main/java/ca/spottedleaf/moonrise/common/util/TickThread.java +++ b/src/main/java/ca/spottedleaf/moonrise/common/util/TickThread.java @@ -14,6 +14,7 @@ import java.util.concurrent.atomic.AtomicInteger; public class TickThread extends Thread { private static final Logger LOGGER = LoggerFactory.getLogger(TickThread.class); -+ public static final boolean HARD_THROW = !Boolean.getBoolean("divinemc.disableHardThrow"); // DivineMC - parallel world ticking - THIS SHOULD NOT BE DISABLED SINCE IT CAN CAUSE DATA CORRUPTION! ++ public static final boolean HARD_THROW = !org.bxteam.divinemc.DivineBootstrap.disableTickThreadHardThrow; // DivineMC - parallel world ticking - THIS SHOULD NOT BE DISABLED SINCE IT CAN CAUSE DATA CORRUPTION! private static String getThreadContext() { return "thread=" + Thread.currentThread().getName(); diff --git a/divinemc-server/paper-patches/features/0009-Add-chunk-worker-algorithm.patch b/divinemc-server/paper-patches/features/0008-Add-chunk-worker-algorithm.patch similarity index 100% rename from divinemc-server/paper-patches/features/0009-Add-chunk-worker-algorithm.patch rename to divinemc-server/paper-patches/features/0008-Add-chunk-worker-algorithm.patch diff --git a/divinemc-server/paper-patches/features/0008-Verify-Minecraft-EULA-earlier.patch b/divinemc-server/paper-patches/features/0008-Verify-Minecraft-EULA-earlier.patch deleted file mode 100644 index f0f4e07..0000000 --- a/divinemc-server/paper-patches/features/0008-Verify-Minecraft-EULA-earlier.patch +++ /dev/null @@ -1,45 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: NONPLAYT <76615486+NONPLAYT@users.noreply.github.com> -Date: Wed, 5 Feb 2025 17:48:56 +0300 -Subject: [PATCH] Verify Minecraft EULA earlier - - -diff --git a/src/main/java/io/papermc/paper/PaperBootstrap.java b/src/main/java/io/papermc/paper/PaperBootstrap.java -index d543b1b107ab8d3eeb1fc3c1cadf489928d2786e..b25afd2a33a61cfbe3dabe65a26aca0669329e32 100644 ---- a/src/main/java/io/papermc/paper/PaperBootstrap.java -+++ b/src/main/java/io/papermc/paper/PaperBootstrap.java -@@ -1,8 +1,11 @@ - package io.papermc.paper; - -+import java.nio.file.Path; -+import java.nio.file.Paths; - import java.util.List; - import joptsimple.OptionSet; - import net.minecraft.SharedConstants; -+import net.minecraft.server.Eula; - import net.minecraft.server.Main; - import org.slf4j.Logger; - import org.slf4j.LoggerFactory; -@@ -16,6 +19,22 @@ public final class PaperBootstrap { - public static void boot(final OptionSet options) { - SharedConstants.tryDetectVersion(); - -+ // DivineMC start - Verify Minecraft EULA earlier -+ Path path2 = Paths.get("eula.txt"); -+ Eula eula = new Eula(path2); -+ boolean eulaAgreed = Boolean.getBoolean("com.mojang.eula.agree"); -+ if (eulaAgreed) { -+ LOGGER.error("You have used the Spigot command line EULA agreement flag."); -+ LOGGER.error("By using this setting you are indicating your agreement to Mojang's EULA (https://aka.ms/MinecraftEULA)."); -+ LOGGER.error("If you do not agree to the above EULA please stop your server and remove this flag immediately."); -+ } -+ if (!eula.hasAgreedToEULA() && !eulaAgreed) { -+ LOGGER.info("You need to agree to the EULA in order to run the server. Go to eula.txt for more info."); -+ return; -+ } -+ System.out.println("Loading libraries, please wait..."); // Restore CraftBukkit log -+ // DivineMC end - Verify Minecraft EULA earlier -+ - getStartupVersionMessages().forEach(LOGGER::info); - - Main.main(options); diff --git a/divinemc-server/paper-patches/features/0010-Configurable-thread-pool-priority.patch b/divinemc-server/paper-patches/features/0009-Configurable-thread-pool-priority.patch similarity index 100% rename from divinemc-server/paper-patches/features/0010-Configurable-thread-pool-priority.patch rename to divinemc-server/paper-patches/features/0009-Configurable-thread-pool-priority.patch diff --git a/divinemc-server/src/main/java/org/bxteam/divinemc/DivineBootstrap.java b/divinemc-server/src/main/java/org/bxteam/divinemc/DivineBootstrap.java new file mode 100644 index 0000000..4538e4e --- /dev/null +++ b/divinemc-server/src/main/java/org/bxteam/divinemc/DivineBootstrap.java @@ -0,0 +1,40 @@ +package org.bxteam.divinemc; + +import io.papermc.paper.PaperBootstrap; +import joptsimple.OptionSet; +import net.minecraft.server.Eula; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import java.nio.file.Path; +import java.nio.file.Paths; + +public class DivineBootstrap { + private static final Logger LOGGER = LoggerFactory.getLogger("bootstrap"); + public static final boolean disableTickThreadHardThrow = Boolean.parseBoolean(System.getProperty("DivineMC.disableTickThreadHardThrow", "false")); + + public static void boot(final OptionSet options) { + runPreBootTasks(); + + // DivineMC start - Verify Minecraft EULA earlier + Path path2 = Paths.get("eula.txt"); + Eula eula = new Eula(path2); + boolean eulaAgreed = Boolean.getBoolean("com.mojang.eula.agree"); + if (eulaAgreed) { + LOGGER.error("You have used the Spigot command line EULA agreement flag."); + LOGGER.error("By using this setting you are indicating your agreement to Mojang's EULA (https://aka.ms/MinecraftEULA)."); + LOGGER.error("If you do not agree to the above EULA please stop your server and remove this flag immediately."); + } + if (!eula.hasAgreedToEULA() && !eulaAgreed) { + LOGGER.info("You need to agree to the EULA in order to run the server. Go to eula.txt for more info."); + return; + } + System.out.println("Loading libraries, please wait..."); // Restore CraftBukkit log + // DivineMC end - Verify Minecraft EULA earlier + + PaperBootstrap.boot(options); + } + + private static void runPreBootTasks() { + // not required rn + } +}