From 6e642cf7638656ea33e6dd7b4096ff381372b558 Mon Sep 17 00:00:00 2001 From: NONPLAYT <76615486+NONPLAYT@users.noreply.github.com> Date: Wed, 5 Mar 2025 21:22:34 +0300 Subject: [PATCH] update main build file and some patches --- build.gradle.kts | 27 +++++- .../features/0036-Virtual-Threads.patch | 37 +++++++- .../0037-Regionized-Chunk-Ticking.patch | 87 +++++++++++------ ...-Leaf-Optimize-Connection.flushQueue.patch | 95 ++++++++++++++----- .../features/0041-Configurable-MC-59471.patch | 42 ++++++++ .../org/bxteam/divinemc/DivineConfig.java | 21 +++- .../bxteam/divinemc/DivineWorldConfig.java | 6 +- 7 files changed, 250 insertions(+), 65 deletions(-) create mode 100644 divinemc-server/minecraft-patches/features/0041-Configurable-MC-59471.patch diff --git a/build.gradle.kts b/build.gradle.kts index fb5fe28..92d2a2a 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -3,7 +3,7 @@ import org.gradle.api.tasks.testing.logging.TestLogEvent plugins { java - id("io.papermc.paperweight.patcher") version "2.0.0-beta.14" + id("io.papermc.paperweight.patcher") version "2.0.0-SNAPSHOT" } val paperMavenPublicUrl = "https://repo.papermc.io/repository/maven-public/" @@ -37,6 +37,27 @@ paperweight { } } +allprojects { + apply(plugin = "java") + apply(plugin = "maven-publish") + + java { + toolchain { + languageVersion = JavaLanguageVersion.of(22) + } + } + + tasks.compileJava { + options.compilerArgs.add("-Xlint:-deprecation") + options.isWarnings = false + } + + tasks.withType(JavaCompile::class.java).configureEach { + options.isFork = true + options.forkOptions.memoryMaximumSize = "4G" + } +} + subprojects { apply(plugin = "java-library") apply(plugin = "maven-publish") @@ -65,10 +86,6 @@ subprojects { events(TestLogEvent.STANDARD_OUT) } } - tasks.withType().configureEach { - isPreserveFileTimestamps = false - isReproducibleFileOrder = true - } repositories { mavenCentral() diff --git a/divinemc-server/minecraft-patches/features/0036-Virtual-Threads.patch b/divinemc-server/minecraft-patches/features/0036-Virtual-Threads.patch index 50d26e0..4bfb50c 100644 --- a/divinemc-server/minecraft-patches/features/0036-Virtual-Threads.patch +++ b/divinemc-server/minecraft-patches/features/0036-Virtual-Threads.patch @@ -4,6 +4,24 @@ Date: Mon, 24 Feb 2025 19:29:58 +0300 Subject: [PATCH] Virtual Threads +diff --git a/net/minecraft/Util.java b/net/minecraft/Util.java +index 80a7a85e1a03a1ca406259207e1ae3b909b3284f..aa2d99de3d23d262542bfb1592fe084f94230f85 100644 +--- a/net/minecraft/Util.java ++++ b/net/minecraft/Util.java +@@ -97,7 +97,12 @@ public class Util { + public static final TracingExecutor DIMENSION_DATA_IO_POOL = makeExtraIoExecutor("Dimension-Data-IO-Worker-"); // Paper - Separate dimension data IO pool + private static final TracingExecutor DOWNLOAD_POOL = makeIoExecutor("Download-", true); + // Paper start - don't submit BLOCKING PROFILE LOOKUPS to the world gen thread +- public static final ExecutorService PROFILE_EXECUTOR = Executors.newFixedThreadPool(2, new java.util.concurrent.ThreadFactory() { ++ // DivineMC start - Virtual Threads ++ public static final ExecutorService PROFILE_EXECUTOR = org.bxteam.divinemc.DivineConfig.virtualThreadsEnabled && org.bxteam.divinemc.DivineConfig.virtualProfileLookupPool ++ ? Executors.newVirtualThreadPerTaskExecutor() ++ : Executors.newFixedThreadPool(2, new java.util.concurrent.ThreadFactory() ++ { ++ // DivineMC end - Virtual Threads + + private final AtomicInteger count = new AtomicInteger(); + diff --git a/net/minecraft/commands/Commands.java b/net/minecraft/commands/Commands.java index d7922847bd398d809e8b8a31bf136c804305a32b..559fd3d12dc5bc84bd976e684153295d8fb7cf64 100644 --- a/net/minecraft/commands/Commands.java @@ -36,7 +54,7 @@ index 85f81c83aff81133289a03f12a059729b7d2e00e..3f286034d50b53fbd71b4f64d83dc78b public ChatDecorator getChatDecorator() { diff --git a/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index 9e4ea539afcd07294bdc5018f479e496ee011451..afda1b0a1fd3ca278c75a822471a964ccbd09fc4 100644 +index 4b5e31ba7b36be0e9dc75f0337c2282fa190fc85..d4e15d9295236fef5cbac3569cd37c1bd3c96d96 100644 --- a/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/net/minecraft/server/network/ServerGamePacketListenerImpl.java @@ -800,8 +800,11 @@ public class ServerGamePacketListenerImpl @@ -70,3 +88,20 @@ index 45ea5fa0ef57724acce46008c53f7fa216cf78ee..f4a9d49247d2124b03273c38b14ddf96 private static final int MAX_TICKS_BEFORE_LOGIN = 600; private final byte[] challenge; final MinecraftServer server; +diff --git a/net/minecraft/server/network/ServerTextFilter.java b/net/minecraft/server/network/ServerTextFilter.java +index 5d18f6c3173ed257bef15637a53adbff26ee9062..c843e073db2a0046bbd5b64e1a4f4e956ce88a70 100644 +--- a/net/minecraft/server/network/ServerTextFilter.java ++++ b/net/minecraft/server/network/ServerTextFilter.java +@@ -48,7 +48,11 @@ public abstract class ServerTextFilter implements AutoCloseable { + final ExecutorService workerPool; + + protected static ExecutorService createWorkerPool(int size) { +- return Executors.newFixedThreadPool(size, THREAD_FACTORY); ++ // DivineMC start - Virtual Threads ++ return org.bxteam.divinemc.DivineConfig.virtualThreadsEnabled && org.bxteam.divinemc.DivineConfig.virtualServerTextFilterPool ++ ? Executors.newVirtualThreadPerTaskExecutor() ++ : Executors.newFixedThreadPool(size, THREAD_FACTORY); ++ // DivineMC end - Virtual Threads + } + + protected ServerTextFilter( diff --git a/divinemc-server/minecraft-patches/features/0037-Regionized-Chunk-Ticking.patch b/divinemc-server/minecraft-patches/features/0037-Regionized-Chunk-Ticking.patch index 1af92b9..c0e4666 100644 --- a/divinemc-server/minecraft-patches/features/0037-Regionized-Chunk-Ticking.patch +++ b/divinemc-server/minecraft-patches/features/0037-Regionized-Chunk-Ticking.patch @@ -5,18 +5,21 @@ Subject: [PATCH] Regionized Chunk Ticking diff --git a/net/minecraft/server/level/ServerChunkCache.java b/net/minecraft/server/level/ServerChunkCache.java -index 2678bf59d557f085c7265e2f3eb038647723d35e..ee4e5462c784ea8588c12eb2b248c708c4d84bee 100644 +index 2678bf59d557f085c7265e2f3eb038647723d35e..f13ddc9a11ad0bc6396e31d7629f8ab9425cd4d7 100644 --- a/net/minecraft/server/level/ServerChunkCache.java +++ b/net/minecraft/server/level/ServerChunkCache.java -@@ -56,6 +56,7 @@ public class ServerChunkCache extends ChunkSource implements ca.spottedleaf.moon +@@ -56,6 +56,10 @@ public class ServerChunkCache extends ChunkSource implements ca.spottedleaf.moon private static final Logger LOGGER = LogUtils.getLogger(); private final DistanceManager distanceManager; private final ServerLevel level; -+ public static final Executor REGION_EXECUTOR = java.util.concurrent.Executors.newFixedThreadPool(org.bxteam.divinemc.DivineConfig.regionizedChunkTickingExecutorThreadCount, new org.bxteam.divinemc.util.NamedAgnosticThreadFactory<>("region_ticking", ca.spottedleaf.moonrise.common.util.TickThread::new, org.bxteam.divinemc.DivineConfig.regionizedChunkTickingExecutorThreadPriority)); // DivineMC - Regionized Chunk Ticking ++ // DivineMC - Regionized Chunk Ticking ++ public static final Executor REGION_EXECUTOR = java.util.concurrent.Executors.newFixedThreadPool(org.bxteam.divinemc.DivineConfig.regionizedChunkTickingExecutorThreadCount, new org.bxteam.divinemc.util.NamedAgnosticThreadFactory<>("region_ticking", ca.spottedleaf.moonrise.common.util.TickThread::new, org.bxteam.divinemc.DivineConfig.regionizedChunkTickingExecutorThreadPriority)); ++ public volatile int tickingRegionsCount = 0; ++ // DivineMC end - Regionized Chunk Ticking public final Thread mainThread; final ThreadedLevelLightEngine lightEngine; public final ServerChunkCache.MainThreadExecutor mainThreadProcessor; -@@ -479,6 +480,41 @@ public class ServerChunkCache extends ChunkSource implements ca.spottedleaf.moon +@@ -479,6 +483,46 @@ public class ServerChunkCache extends ChunkSource implements ca.spottedleaf.moon } // CraftBukkit end @@ -24,62 +27,84 @@ index 2678bf59d557f085c7265e2f3eb038647723d35e..ee4e5462c784ea8588c12eb2b248c708 + private static final int[] DX = {1, -1, 0, 0, 1, -1, -1, 1}; + private static final int[] DZ = {0, 0, 1, -1, 1, 1, -1, -1}; + -+ private List> splitChunksIntoRegions(List chunks) { -+ Set chunkSet = new java.util.HashSet<>(chunks); -+ Set visited = new java.util.HashSet<>(chunks.size()); -+ List> groups = new ArrayList<>(); ++ private List[] splitChunksIntoRegions(List chunks) { ++ int size = chunks.size(); ++ java.util.IdentityHashMap chunkSet = new java.util.IdentityHashMap<>(size); + + for (LevelChunk chunk : chunks) { -+ if (visited.contains(chunk)) continue; ++ chunkSet.put(chunk, Boolean.TRUE); ++ } + -+ List group = new ArrayList<>(64); -+ java.util.ArrayDeque stack = new java.util.ArrayDeque<>(); -+ stack.push(chunk); -+ visited.add(chunk); ++ List> groups = new it.unimi.dsi.fastutil.objects.ObjectArrayList<>(size >> 3); ++ LevelChunk[] stack = new LevelChunk[size]; ++ int stackPointer = 0; + -+ while (!stack.isEmpty()) { -+ LevelChunk current = stack.pop(); ++ for (LevelChunk chunk : chunks) { ++ if (chunkSet.remove(chunk) == null) continue; ++ ++ List group = new it.unimi.dsi.fastutil.objects.ObjectArrayList<>(64); ++ stack[stackPointer++] = chunk; ++ ++ while (stackPointer > 0) { ++ LevelChunk current = stack[--stackPointer]; + group.add(current); + + for (int i = 0; i < 8; i++) { + LevelChunk neighbor = getChunk(current.locX + DX[i], current.locZ + DZ[i], false); -+ if (neighbor == null || !chunkSet.contains(neighbor) || !visited.add(neighbor)) continue; -+ stack.push(neighbor); ++ if (neighbor == null || chunkSet.remove(neighbor) == null) continue; ++ stack[stackPointer++] = neighbor; + } + } + + groups.add(group); + } + -+ return groups; ++ return groups.toArray(new List[0]); + } + // DivineMC end - Regionized Chunk Ticking + @Override public void tick(BooleanSupplier hasTimeLeft, boolean tickChunks) { ProfilerFiller profilerFiller = Profiler.get(); -@@ -519,7 +555,27 @@ public class ServerChunkCache extends ChunkSource implements ca.spottedleaf.moon +@@ -519,7 +563,44 @@ public class ServerChunkCache extends ChunkSource implements ca.spottedleaf.moon this.shuffleRandom.setSeed(this.level.random.nextLong()); if (!this.level.paperConfig().entities.spawning.perPlayerMobSpawns) Util.shuffle(list, this.shuffleRandom); // Paper - Optional per player mob spawns; do not need this when per-player is enabled // Paper end - chunk tick iteration optimisation - this.tickChunks(profilerFiller, l, list); + // DivineMC start - Regionized Chunk Ticking + if (org.bxteam.divinemc.DivineConfig.enableRegionizedChunkTicking) { -+ List> regions = splitChunksIntoRegions(list); -+ List> futures = new ArrayList<>(); -+ for (List region : regions) { -+ CompletableFuture future = new CompletableFuture<>(); -+ futures.add(future); -+ REGION_EXECUTOR.execute(() -> { -+ try { -+ tickChunks(profilerFiller, l, region); -+ } finally { -+ future.complete(null); ++ List[] regions = splitChunksIntoRegions(list); ++ int regionCount = regions.length; ++ this.tickingRegionsCount = regionCount; ++ java.util.concurrent.CountDownLatch latch = new java.util.concurrent.CountDownLatch(regionCount); ++ ++ try { ++ java.util.concurrent.ForkJoinPool.managedBlock(new java.util.concurrent.ForkJoinPool.ManagedBlocker() { ++ @Override ++ public boolean block() throws InterruptedException { ++ for (List region : regions) { ++ if (region == null) continue; ++ REGION_EXECUTOR.execute(() -> { ++ try { ++ tickChunks(profilerFiller, l, region); ++ } finally { ++ latch.countDown(); ++ } ++ }); ++ } ++ ++ latch.await(); ++ return true; ++ } ++ ++ @Override ++ public boolean isReleasable() { ++ return latch.getCount() == 0; + } + }); ++ } catch (InterruptedException ex) { ++ throw new RuntimeException("Interrupted managed block during region ticking", ex); + } -+ CompletableFuture finalFuture = CompletableFuture.allOf(futures.toArray(new CompletableFuture[0])); -+ finalFuture.join(); + } else { + this.tickChunks(profilerFiller, l, list); + } diff --git a/divinemc-server/minecraft-patches/features/0039-Leaf-Optimize-Connection.flushQueue.patch b/divinemc-server/minecraft-patches/features/0039-Leaf-Optimize-Connection.flushQueue.patch index 34cdb98..6efd0b1 100644 --- a/divinemc-server/minecraft-patches/features/0039-Leaf-Optimize-Connection.flushQueue.patch +++ b/divinemc-server/minecraft-patches/features/0039-Leaf-Optimize-Connection.flushQueue.patch @@ -7,34 +7,43 @@ Original author - Taiyou06 Original patch - https://github.com/Winds-Studio/Leaf/pull/235 diff --git a/net/minecraft/network/Connection.java b/net/minecraft/network/Connection.java -index 7b78c0af4a83bd39a5bc2d6554cc677bd4c0c822..515e90aca8ab1c3a9dce67784a360630ae7dd247 100644 +index 7b78c0af4a83bd39a5bc2d6554cc677bd4c0c822..f3a2cc99799b41d663940847f7099df0ba40c3b7 100644 --- a/net/minecraft/network/Connection.java +++ b/net/minecraft/network/Connection.java -@@ -85,7 +85,7 @@ public class Connection extends SimpleChannelInboundHandler> { +@@ -85,7 +85,11 @@ public class Connection extends SimpleChannelInboundHandler> { private static final ProtocolInfo INITIAL_PROTOCOL = HandshakeProtocols.SERVERBOUND; private final PacketFlow receiving; private volatile boolean sendLoginDisconnect = true; - private final Queue pendingActions = Queues.newConcurrentLinkedQueue(); // Paper - Optimize network -+ private final Queue pendingActions = new java.util.ArrayDeque<>(); // Paper - Optimize network // DivineMC - Optimize Connection.flushQueue ++ // DivineMC start - Optimize Connection.flushQueue ++ private final Queue pendingActions = org.bxteam.divinemc.DivineConfig.connectionFlushQueueRewrite ++ ? new java.util.ArrayDeque<>() ++ : Queues.newConcurrentLinkedQueue(); // Paper - Optimize network ++ // DivineMC end - Optimize Connection.flushQueue public Channel channel; public SocketAddress address; // Spigot start -@@ -541,10 +541,10 @@ public class Connection extends SimpleChannelInboundHandler> { +@@ -541,10 +545,16 @@ public class Connection extends SimpleChannelInboundHandler> { if (io.papermc.paper.util.MCUtil.isMainThread()) { return this.processQueue(); } else if (this.isPending) { - // Should only happen during login/status stages - synchronized (this.pendingActions) { - return this.processQueue(); -- } + // DivineMC start - Optimize Connection.flushQueue -+ this.channel.eventLoop().execute(this::processQueue); -+ return false; ++ if (org.bxteam.divinemc.DivineConfig.connectionFlushQueueRewrite) { ++ this.channel.eventLoop().execute(this::processQueue); ++ return false; ++ } else { ++ synchronized (this.pendingActions) { ++ return this.processQueue(); ++ } + } + // DivineMC end - Optimize Connection.flushQueue } return false; } -@@ -554,29 +554,18 @@ public class Connection extends SimpleChannelInboundHandler> { +@@ -554,33 +564,53 @@ public class Connection extends SimpleChannelInboundHandler> { return true; } @@ -43,29 +52,67 @@ index 7b78c0af4a83bd39a5bc2d6554cc677bd4c0c822..515e90aca8ab1c3a9dce67784a360630 - final java.util.Iterator iterator = this.pendingActions.iterator(); - while (iterator.hasNext()) { - final WrappedConsumer queued = iterator.next(); // poll -> peek -- ++ // DivineMC start - Optimize Connection.flushQueue ++ if (org.bxteam.divinemc.DivineConfig.connectionFlushQueueRewrite) { ++ WrappedConsumer queued; ++ while ((queued = this.pendingActions.poll()) != null) { ++ if (queued instanceof PacketSendAction packetSendAction) { ++ final Packet packet = packetSendAction.packet; ++ if (!packet.isReady()) { ++ // Re-add to the front and exit ++ this.pendingActions.add(queued); ++ return false; ++ } ++ } + - // Fix NPE (Spigot bug caused by handleDisconnection()) - if (queued == null) { - return true; -- } -- ++ if (queued.tryMarkConsumed()) { ++ queued.accept(this); ++ } + } ++ } else { ++ // If we are on main, we are safe here in that nothing else should be processing queue off main anymore ++ // But if we are not on main due to login/status, the parent is synchronized on packetQueue ++ final java.util.Iterator iterator = this.pendingActions.iterator(); ++ while (iterator.hasNext()) { ++ final WrappedConsumer queued = iterator.next(); // poll -> peek ++ ++ // Fix NPE (Spigot bug caused by handleDisconnection()) ++ if (queued == null) { ++ return true; ++ } + - if (queued.isConsumed()) { - continue; - } -- -+ // DivineMC start - Optimize Connection.flushQueue -+ WrappedConsumer queued; -+ while ((queued = this.pendingActions.poll()) != null) { - if (queued instanceof PacketSendAction packetSendAction) { - final Packet packet = packetSendAction.packet; - if (!packet.isReady()) { -+ this.pendingActions.add(queued); - return false; ++ if (queued.isConsumed()) { ++ continue; ++ } + +- if (queued instanceof PacketSendAction packetSendAction) { +- final Packet packet = packetSendAction.packet; +- if (!packet.isReady()) { +- return false; ++ if (queued instanceof PacketSendAction packetSendAction) { ++ final Packet packet = packetSendAction.packet; ++ if (!packet.isReady()) { ++ return false; ++ } } - } +- } - iterator.remove(); -+ // DivineMC end - Optimize Connection.flushQueue - if (queued.tryMarkConsumed()) { - queued.accept(this); +- if (queued.tryMarkConsumed()) { +- queued.accept(this); ++ iterator.remove(); ++ if (queued.tryMarkConsumed()) { ++ queued.accept(this); ++ } } + } ++ // DivineMC end - Optimize Connection.flushQueue + return true; + } + // Paper end - Optimize network diff --git a/divinemc-server/minecraft-patches/features/0041-Configurable-MC-59471.patch b/divinemc-server/minecraft-patches/features/0041-Configurable-MC-59471.patch new file mode 100644 index 0000000..fb7d98f --- /dev/null +++ b/divinemc-server/minecraft-patches/features/0041-Configurable-MC-59471.patch @@ -0,0 +1,42 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: NONPLAYT <76615486+NONPLAYT@users.noreply.github.com> +Date: Wed, 5 Mar 2025 18:08:25 +0300 +Subject: [PATCH] Configurable MC-59471 + +Bring back MC-59471, MC-129055 on 1.21.2+, which fixed in 1.21.2 snapshots 24w33a and 24w36a + +P.S: This setting is different from skip-tripwire-hook-placement-validation in Paper + +diff --git a/net/minecraft/world/level/block/TripWireHookBlock.java b/net/minecraft/world/level/block/TripWireHookBlock.java +index 9aace993c6c18f1a50610e4766225485984b8167..0849e0b116845a16792855afdd16de7ec6838542 100644 +--- a/net/minecraft/world/level/block/TripWireHookBlock.java ++++ b/net/minecraft/world/level/block/TripWireHookBlock.java +@@ -201,7 +201,6 @@ public class TripWireHookBlock extends Block { + if (!cancelledEmitterHook) { // Paper - Call BlockRedstoneEvent + emitState(level, pos, flag2, flag3, flag, flag1); + if (!attaching) { +- if (io.papermc.paper.configuration.GlobalConfiguration.get().unsupportedSettings.skipTripwireHookPlacementValidation || level.getBlockState(pos).is(Blocks.TRIPWIRE_HOOK)) // Paper - Validate tripwire hook placement before update + level.setBlock(pos, blockState1.setValue(FACING, direction), 3); + if (shouldNotifyNeighbours) { + notifyNeighbors(block, level, pos, direction); +@@ -214,10 +213,17 @@ public class TripWireHookBlock extends Block { + BlockPos blockPos1 = pos.relative(direction, i2); + BlockState blockState2 = blockStates[i2]; + if (blockState2 != null) { +- BlockState blockState3 = level.getBlockState(blockPos1); +- if (blockState3.is(Blocks.TRIPWIRE) || blockState3.is(Blocks.TRIPWIRE_HOOK)) { +- if (!io.papermc.paper.configuration.GlobalConfiguration.get().blockUpdates.disableTripwireUpdates || !blockState3.is(Blocks.TRIPWIRE)) level.setBlock(blockPos1, blockState2.trySetValue(ATTACHED, Boolean.valueOf(flag2)), 3); // Paper - prevent tripwire from updating ++ // DivineMC start - Configurable MC-59471 ++ if (level.divineConfig.allowTripwireDupe) { ++ level.setBlock(blockPos1, blockState2.trySetValue(ATTACHED, flag2), 3); ++ level.getBlockState(blockPos1); ++ } else { ++ BlockState blockState3 = level.getBlockState(blockPos1); ++ if (blockState3.is(Blocks.TRIPWIRE) || blockState3.is(Blocks.TRIPWIRE_HOOK)) { ++ if (!io.papermc.paper.configuration.GlobalConfiguration.get().blockUpdates.disableTripwireUpdates || !blockState3.is(Blocks.TRIPWIRE)) level.setBlock(blockPos1, blockState2.trySetValue(ATTACHED, Boolean.valueOf(flag2)), 3); // Paper - prevent tripwire from updating ++ } + } ++ // DivineMC end - Configurable MC-59471 + } + } + } diff --git a/divinemc-server/src/main/java/org/bxteam/divinemc/DivineConfig.java b/divinemc-server/src/main/java/org/bxteam/divinemc/DivineConfig.java index 9b9dbef..92a99c0 100644 --- a/divinemc-server/src/main/java/org/bxteam/divinemc/DivineConfig.java +++ b/divinemc-server/src/main/java/org/bxteam/divinemc/DivineConfig.java @@ -170,7 +170,7 @@ public class DivineConfig { public static long chunkDataCacheSoftLimit = 8192L; public static long chunkDataCacheLimit = 32678L; public static int maxViewDistance = 32; - public static ChunkSystemAlgorithms chunkWorkerAlgorithm = ChunkSystemAlgorithms.MOONRISE; + public static ChunkSystemAlgorithms chunkWorkerAlgorithm = ChunkSystemAlgorithms.C2ME; public static int threadPoolPriority = Thread.NORM_PRIORITY + 1; public static boolean enableSecureSeed = false; public static boolean smoothBedrockLayer = false; @@ -286,7 +286,6 @@ public class DivineConfig { public static boolean ignoreMovedTooQuicklyWhenLagging = true; public static boolean alwaysAllowWeirdMovement = true; public static boolean updateSuppressionCrashFix = true; - public static boolean disableDisconnectSpam = false; private static void miscSettings() { skipUselessSecondaryPoiSensor = getBoolean("settings.misc.skip-useless-secondary-poi-sensor", skipUselessSecondaryPoiSensor); clumpOrbs = getBoolean("settings.misc.clump-orbs", clumpOrbs, @@ -296,8 +295,18 @@ public class DivineConfig { alwaysAllowWeirdMovement = getBoolean("settings.misc.always-allow-weird-movement", alwaysAllowWeirdMovement, "Means ignoring messages like 'moved too quickly' and 'moved wrongly'"); updateSuppressionCrashFix = getBoolean("settings.misc.update-suppression-crash-fix", updateSuppressionCrashFix); - disableDisconnectSpam = getBoolean("settings.misc.disable-disconnect-spam", disableDisconnectSpam, + } + + public static boolean disableDisconnectSpam = false; + public static boolean connectionFlushQueueRewrite = true; + private static void networkSettings() { + disableDisconnectSpam = getBoolean("settings.network.disable-disconnect-spam", disableDisconnectSpam, "Prevents players being disconnected by 'disconnect.spam' when sending too many chat packets"); + connectionFlushQueueRewrite = getBoolean("settings.network.connection-flush-queue-rewrite", connectionFlushQueueRewrite, + "Replaces ConcurrentLinkedQueue with ArrayDeque in Connection for better performance", + "and also uses the Netty event loop to ensure thread safety.", + "", + "Note: May increase the Netty thread usage"); } public static boolean enableFasterTntOptimization = true; @@ -359,6 +368,8 @@ public class DivineConfig { public static boolean virtualTabCompleteScheduler = false; public static boolean virtualAsyncExecutor = false; public static boolean virtualCommandBuilderScheduler = false; + public static boolean virtualProfileLookupPool = false; + public static boolean virtualServerTextFilterPool = false; private static void virtualThreads() { virtualThreadsEnabled = getBoolean("settings.virtual-threads.enabled", virtualThreadsEnabled, "Enables use of virtual threads that was added in Java 21"); @@ -375,6 +386,10 @@ public class DivineConfig { "Uses virtual threads for the MCUtil async executor."); virtualCommandBuilderScheduler = getBoolean("settings.virtual-threads.command-builder-scheduler", virtualCommandBuilderScheduler, "Uses virtual threads for the Async Command Builder Thread Pool."); + virtualProfileLookupPool = getBoolean("settings.virtual-threads.profile-lookup-pool", virtualProfileLookupPool, + "Uses virtual threads for the Profile Lookup Pool, that is used for fetching player profiles."); + virtualServerTextFilterPool = getBoolean("settings.virtual-threads.server-text-filter-pool", virtualServerTextFilterPool, + "Uses virtual threads for the server text filter pool."); } public static boolean asyncPathfinding = true; diff --git a/divinemc-server/src/main/java/org/bxteam/divinemc/DivineWorldConfig.java b/divinemc-server/src/main/java/org/bxteam/divinemc/DivineWorldConfig.java index e258bbc..ecdc912 100644 --- a/divinemc-server/src/main/java/org/bxteam/divinemc/DivineWorldConfig.java +++ b/divinemc-server/src/main/java/org/bxteam/divinemc/DivineWorldConfig.java @@ -59,7 +59,11 @@ public class DivineWorldConfig { } public boolean allowEntityPortalWithPassenger = true; + public boolean allowTripwireDupe = false; private void unsupportedFeatures() { - allowEntityPortalWithPassenger = getBoolean("unsupported-features.allow-entity-portal-with-passenger", allowEntityPortalWithPassenger); + allowEntityPortalWithPassenger = getBoolean("unsupported-features.allow-entity-portal-with-passenger", allowEntityPortalWithPassenger, + "Enables or disables the fix of MC-67 bug: https://bugs-legacy.mojang.com/browse/MC-67"); + allowTripwireDupe = getBoolean("unsupported-features.allow-tripwire-dupe", allowTripwireDupe, + "Bring back MC-59471, MC-129055 on 1.21.2+, which fixed in 1.21.2 snapshots 24w33a and 24w36a"); } }