From 45c933a5b2ea28d7f4a86fd38dc711627a740d72 Mon Sep 17 00:00:00 2001 From: violetc <58360096+s-yh-china@users.noreply.github.com> Date: Wed, 10 Jan 2024 13:32:42 +0800 Subject: [PATCH] Leaves config hot modify (#126) --- ...005-Leaves-Server-Config-And-Command.patch | 1645 +++++++++-------- .../server/0006-Leaves-Protocol-Core.patch | 6 +- patches/server/0010-Fakeplayer-support.patch | 40 +- patches/server/0018-No-chat-sign.patch | 4 +- ...19-Dont-send-useless-entity-packets.patch} | 0 .../server/0019-Optimize-mob-spawning.patch | 20 - ...45-block-goal-shouldn-t-load-chunks.patch} | 0 .../server/0021-Multithreaded-Tracker.patch | 20 - ...0021-Optimize-entity-coordinate-key.patch} | 2 +- ....patch => 0022-Optimize-suffocation.patch} | 0 ...heck-for-spooky-season-once-an-hour.patch} | 0 ...e-ThreadUnsafeRandom-Initialization.patch} | 8 +- ...imize-random-calls-in-chunk-ticking.patch} | 2 +- ...urn-optimization-for-target-finding.patch} | 0 ...read-unsafe-random-for-mob-spawning.patch} | 0 ...8-Config-to-disable-method-profiler.patch} | 4 +- ...al-selector-during-inactive-ticking.patch} | 2 +- ...h => 0030-Reduce-entity-allocations.patch} | 2 +- ...31-Remove-lambda-from-ticking-guard.patch} | 2 +- ...e-iterators-from-inventory-contains.patch} | 0 ...eams-and-iterators-from-range-check.patch} | 0 ...Cache-climbing-check-for-activation.patch} | 0 ...-aging-cache-for-biome-temperatures.patch} | 0 patches/server/0036-Async-Pathfinding.patch | 21 - ...e-entity-fluid-lookups-if-no-fluids.patch} | 0 ...> 0037-Reduce-chunk-loading-lookups.patch} | 0 ...col.patch => 0038-PCA-sync-protocol.patch} | 0 ...rotocol.patch => 0039-BBOR-Protocol.patch} | 0 ...40-InstantBlockUpdater-Reintroduced.patch} | 4 +- ...dom-flatten-triangular-distribution.patch} | 0 ...rotocol.patch => 0042-Jade-Protocol.patch} | 0 ...lternative-block-placement-Protocol.patch} | 0 ...ch => 0044-Player-operation-limiter.patch} | 2 +- ...ytra.patch => 0045-Renewable-Elytra.patch} | 0 ...atch => 0046-Stackable-ShulkerBoxes.patch} | 0 ...047-Improve-fluid-direction-caching.patch} | 0 ... => 0048-MC-Technical-Survival-Mode.patch} | 61 +- ...ch => 0049-Return-nether-portal-fix.patch} | 0 ...ol.patch => 0050-Appleskin-Protocol.patch} | 0 ...ol.patch => 0051-Xaero-Map-Protocol.patch} | 0 ...0052-Leaves-Extra-Yggdrasil-Service.patch} | 22 - ...h => 0053-Use-vanilla-random-config.patch} | 2 +- ...> 0054-Fix-update-suppression-crash.patch} | 0 ...st.patch => 0055-Bedrock-break-list.patch} | 0 ....patch => 0056-Fix-trapdoor-feature.patch} | 0 ...l.patch => 0057-Syncmatica-Protocol.patch} | 22 +- ...-distance-check-for-UseItemOnPacket.patch} | 2 +- ... => 0059-No-feather-falling-trample.patch} | 0 ...h => 0060-Shared-villager-discounts.patch} | 0 ...ne-wire-dont-connect-if-on-trapdoor.patch} | 0 ...-Disable-check-out-of-order-command.patch} | 0 ...=> 0063-Despawn-enderman-with-block.patch} | 0 ...patch => 0064-Leaves-carpet-support.patch} | 22 - ....patch => 0065-Creative-fly-no-clip.patch} | 0 ...ch => 0066-Optimized-dragon-respawn.patch} | 0 ...ment-mending-compatibility-infinity.patch} | 0 ...ers.patch => 0068-Shave-snow-layers.patch} | 0 ...re-lc.patch => 0069-Spawn-ignore-lc.patch} | 0 ...70-Elytra-aeronautics-no-chunk-load.patch} | 0 ...r-9372.patch => 0071-Fix-Paper-9372.patch} | 0 ...dds.patch => 0072-Cache-ignite-odds.patch} | 0 ...-riptide.patch => 0073-Lava-riptide.patch} | 0 ...tch => 0074-No-block-update-command.patch} | 23 - ...075-Raider-die-skip-self-raid-check.patch} | 0 ... => 0076-Container-open-passthrough.patch} | 0 ...col.patch => 0077-Bladeren-Protocol.patch} | 32 - ...=> 0078-Bladeren-mspt-sync-protocol.patch} | 0 ...-support.patch => 0079-SIMD-support.patch} | 0 ...ont-respond-ping-before-start-fully.patch} | 0 ... => 0081-Faster-chunk-serialization.patch} | 0 ...d-generation-chunk-and-block-access.patch} | 0 ...083-Cache-world-generator-sea-level.patch} | 0 ...Skip-secondary-POI-sensor-if-absent.patch} | 0 ...85-Cache-CubeVoxelShape-shape-array.patch} | 0 ...> 0086-Store-mob-counts-in-an-array.patch} | 0 ...> 0087-Cache-BlockStatePairKey-hash.patch} | 0 ...h => 0088-Optimize-noise-generation.patch} | 0 ....patch => 0089-Disable-packet-limit.patch} | 0 ...ch => 0090-Reduce-array-allocations.patch} | 4 +- ...atch => 0091-Optimize-sun-burn-tick.patch} | 0 ...-Optional-allocation-in-EntityBased.patch} | 0 ...ch => 0093-Use-optimized-collection.patch} | 4 +- ...ignableFrom-call-in-ClassInstanceMu.patch} | 0 ...ch => 0095-Optimized-CubePointRange.patch} | 0 ...k-frozen-ticks-before-landing-block.patch} | 0 ...h => 0097-Cache-ominous-banner-item.patch} | 0 ...kip-entity-move-if-movement-is-zero.patch} | 0 ...9-Skip-cloning-advancement-criteria.patch} | 0 ...ible-planar-movement-multiplication.patch} | 0 ...1-Fix-villagers-dont-release-memory.patch} | 0 ...h => 0102-Avoid-anvil-too-expensive.patch} | 0 ...-fix.patch => 0103-Bow-infinity-fix.patch} | 0 ...ants.patch => 0104-Zero-tick-plants.patch} | 0 ...patch => 0105-Leaves-update-command.patch} | 10 +- ... => 0106-Force-peaceful-mode-switch.patch} | 10 +- ...atch => 0107-Add-Leaves-Auto-Update.patch} | 22 +- ...od-API.patch => 0108-Replay-Mod-API.patch} | 4 +- ...Fix-vehicle-teleport-by-end-gateway.patch} | 0 ...aves-I18n.patch => 0110-Leaves-I18n.patch} | 6 +- ...raft-hopper-not-work-without-player.patch} | 0 ...r.patch => 0112-Wool-Hopper-Counter.patch} | 10 +- ...dom.patch => 0113-Loot-world-random.patch} | 0 ...patch => 0114-Leaves-Reload-Command.patch} | 8 +- ...=> 0115-Spider-jockeys-drop-gapples.patch} | 0 ...rade.patch => 0116-Force-Void-Trade.patch} | 0 ...tocol.patch => 0117-Servux-Protocol.patch} | 0 ...=> 0118-Villager-infinite-discounts.patch} | 44 +- ...atch => 0119-CCE-update-suppression.patch} | 0 ...0-Disable-offline-warn-if-use-proxy.patch} | 4 +- ...121-Disable-moved-wrongly-threshold.patch} | 2 +- ...r-stand-cant-kill-by-mob-projectile.patch} | 0 ...atch => 0123-Make-Item-tick-vanilla.patch} | 0 ...atch => 0124-Copper-Bulb-1-gt-delay.patch} | 0 ...ay.patch => 0125-Crafter-1-gt-delay.patch} | 0 114 files changed, 962 insertions(+), 1136 deletions(-) rename patches/server/{0020-Dont-send-useless-entity-packets.patch => 0019-Dont-send-useless-entity-packets.patch} (100%) delete mode 100644 patches/server/0019-Optimize-mob-spawning.patch rename patches/server/{0022-Fix-Paper-6045-block-goal-shouldn-t-load-chunks.patch => 0020-Fix-Paper-6045-block-goal-shouldn-t-load-chunks.patch} (100%) delete mode 100644 patches/server/0021-Multithreaded-Tracker.patch rename patches/server/{0023-Optimize-entity-coordinate-key.patch => 0021-Optimize-entity-coordinate-key.patch} (95%) rename patches/server/{0024-Optimize-suffocation.patch => 0022-Optimize-suffocation.patch} (100%) rename patches/server/{0025-Only-check-for-spooky-season-once-an-hour.patch => 0023-Only-check-for-spooky-season-once-an-hour.patch} (100%) rename patches/server/{0026-Move-ThreadUnsafeRandom-Initialization.patch => 0024-Move-ThreadUnsafeRandom-Initialization.patch} (90%) rename patches/server/{0027-Optimize-random-calls-in-chunk-ticking.patch => 0025-Optimize-random-calls-in-chunk-ticking.patch} (98%) rename patches/server/{0028-Early-return-optimization-for-target-finding.patch => 0026-Early-return-optimization-for-target-finding.patch} (100%) rename patches/server/{0029-Use-thread-unsafe-random-for-mob-spawning.patch => 0027-Use-thread-unsafe-random-for-mob-spawning.patch} (100%) rename patches/server/{0030-Config-to-disable-method-profiler.patch => 0028-Config-to-disable-method-profiler.patch} (91%) rename patches/server/{0031-Throttle-goal-selector-during-inactive-ticking.patch => 0029-Throttle-goal-selector-during-inactive-ticking.patch} (93%) rename patches/server/{0032-Reduce-entity-allocations.patch => 0030-Reduce-entity-allocations.patch} (96%) rename patches/server/{0033-Remove-lambda-from-ticking-guard.patch => 0031-Remove-lambda-from-ticking-guard.patch} (96%) rename patches/server/{0034-Remove-iterators-from-inventory-contains.patch => 0032-Remove-iterators-from-inventory-contains.patch} (100%) rename patches/server/{0035-Remove-streams-and-iterators-from-range-check.patch => 0033-Remove-streams-and-iterators-from-range-check.patch} (100%) rename patches/server/{0037-Cache-climbing-check-for-activation.patch => 0034-Cache-climbing-check-for-activation.patch} (100%) rename patches/server/{0038-Use-aging-cache-for-biome-temperatures.patch => 0035-Use-aging-cache-for-biome-temperatures.patch} (100%) delete mode 100644 patches/server/0036-Async-Pathfinding.patch rename patches/server/{0039-Reduce-entity-fluid-lookups-if-no-fluids.patch => 0036-Reduce-entity-fluid-lookups-if-no-fluids.patch} (100%) rename patches/server/{0040-Reduce-chunk-loading-lookups.patch => 0037-Reduce-chunk-loading-lookups.patch} (100%) rename patches/server/{0041-PCA-sync-protocol.patch => 0038-PCA-sync-protocol.patch} (100%) rename patches/server/{0042-BBOR-Protocol.patch => 0039-BBOR-Protocol.patch} (100%) rename patches/server/{0043-InstantBlockUpdater-Reintroduced.patch => 0040-InstantBlockUpdater-Reintroduced.patch} (91%) rename patches/server/{0044-Random-flatten-triangular-distribution.patch => 0041-Random-flatten-triangular-distribution.patch} (100%) rename patches/server/{0045-Jade-Protocol.patch => 0042-Jade-Protocol.patch} (100%) rename patches/server/{0046-Alternative-block-placement-Protocol.patch => 0043-Alternative-block-placement-Protocol.patch} (100%) rename patches/server/{0047-Player-operation-limiter.patch => 0044-Player-operation-limiter.patch} (98%) rename patches/server/{0048-Renewable-Elytra.patch => 0045-Renewable-Elytra.patch} (100%) rename patches/server/{0049-Stackable-ShulkerBoxes.patch => 0046-Stackable-ShulkerBoxes.patch} (100%) rename patches/server/{0050-Improve-fluid-direction-caching.patch => 0047-Improve-fluid-direction-caching.patch} (100%) rename patches/server/{0051-MC-Technical-Survival-Mode.patch => 0048-MC-Technical-Survival-Mode.patch} (82%) rename patches/server/{0052-Return-nether-portal-fix.patch => 0049-Return-nether-portal-fix.patch} (100%) rename patches/server/{0053-Appleskin-Protocol.patch => 0050-Appleskin-Protocol.patch} (100%) rename patches/server/{0054-Xaero-Map-Protocol.patch => 0051-Xaero-Map-Protocol.patch} (100%) rename patches/server/{0055-Leaves-Extra-Yggdrasil-Service.patch => 0052-Leaves-Extra-Yggdrasil-Service.patch} (87%) rename patches/server/{0056-Use-vanilla-random-config.patch => 0053-Use-vanilla-random-config.patch} (98%) rename patches/server/{0057-Fix-update-suppression-crash.patch => 0054-Fix-update-suppression-crash.patch} (100%) rename patches/server/{0058-Bedrock-break-list.patch => 0055-Bedrock-break-list.patch} (100%) rename patches/server/{0059-Fix-trapdoor-feature.patch => 0056-Fix-trapdoor-feature.patch} (100%) rename patches/server/{0060-Syncmatica-Protocol.patch => 0057-Syncmatica-Protocol.patch} (98%) rename patches/server/{0061-Disable-distance-check-for-UseItemOnPacket.patch => 0058-Disable-distance-check-for-UseItemOnPacket.patch} (92%) rename patches/server/{0062-No-feather-falling-trample.patch => 0059-No-feather-falling-trample.patch} (100%) rename patches/server/{0063-Shared-villager-discounts.patch => 0060-Shared-villager-discounts.patch} (100%) rename patches/server/{0064-Redstone-wire-dont-connect-if-on-trapdoor.patch => 0061-Redstone-wire-dont-connect-if-on-trapdoor.patch} (100%) rename patches/server/{0065-Disable-check-out-of-order-command.patch => 0062-Disable-check-out-of-order-command.patch} (100%) rename patches/server/{0066-Despawn-enderman-with-block.patch => 0063-Despawn-enderman-with-block.patch} (100%) rename patches/server/{0067-Leaves-carpet-support.patch => 0064-Leaves-carpet-support.patch} (79%) rename patches/server/{0068-Creative-fly-no-clip.patch => 0065-Creative-fly-no-clip.patch} (100%) rename patches/server/{0069-Optimized-dragon-respawn.patch => 0066-Optimized-dragon-respawn.patch} (100%) rename patches/server/{0070-Enchantment-mending-compatibility-infinity.patch => 0067-Enchantment-mending-compatibility-infinity.patch} (100%) rename patches/server/{0071-Shave-snow-layers.patch => 0068-Shave-snow-layers.patch} (100%) rename patches/server/{0072-Spawn-ignore-lc.patch => 0069-Spawn-ignore-lc.patch} (100%) rename patches/server/{0073-Elytra-aeronautics-no-chunk-load.patch => 0070-Elytra-aeronautics-no-chunk-load.patch} (100%) rename patches/server/{0074-Fix-Paper-9372.patch => 0071-Fix-Paper-9372.patch} (100%) rename patches/server/{0075-Cache-ignite-odds.patch => 0072-Cache-ignite-odds.patch} (100%) rename patches/server/{0076-Lava-riptide.patch => 0073-Lava-riptide.patch} (100%) rename patches/server/{0077-No-block-update-command.patch => 0074-No-block-update-command.patch} (88%) rename patches/server/{0078-Raider-die-skip-self-raid-check.patch => 0075-Raider-die-skip-self-raid-check.patch} (100%) rename patches/server/{0079-Container-open-passthrough.patch => 0076-Container-open-passthrough.patch} (100%) rename patches/server/{0080-Bladeren-Protocol.patch => 0077-Bladeren-Protocol.patch} (78%) rename patches/server/{0081-Bladeren-mspt-sync-protocol.patch => 0078-Bladeren-mspt-sync-protocol.patch} (100%) rename patches/server/{0082-SIMD-support.patch => 0079-SIMD-support.patch} (100%) rename patches/server/{0083-Dont-respond-ping-before-start-fully.patch => 0080-Dont-respond-ping-before-start-fully.patch} (100%) rename patches/server/{0084-Faster-chunk-serialization.patch => 0081-Faster-chunk-serialization.patch} (100%) rename patches/server/{0085-Optimize-world-generation-chunk-and-block-access.patch => 0082-Optimize-world-generation-chunk-and-block-access.patch} (100%) rename patches/server/{0086-Cache-world-generator-sea-level.patch => 0083-Cache-world-generator-sea-level.patch} (100%) rename patches/server/{0087-Skip-secondary-POI-sensor-if-absent.patch => 0084-Skip-secondary-POI-sensor-if-absent.patch} (100%) rename patches/server/{0088-Cache-CubeVoxelShape-shape-array.patch => 0085-Cache-CubeVoxelShape-shape-array.patch} (100%) rename patches/server/{0089-Store-mob-counts-in-an-array.patch => 0086-Store-mob-counts-in-an-array.patch} (100%) rename patches/server/{0090-Cache-BlockStatePairKey-hash.patch => 0087-Cache-BlockStatePairKey-hash.patch} (100%) rename patches/server/{0091-Optimize-noise-generation.patch => 0088-Optimize-noise-generation.patch} (100%) rename patches/server/{0092-Disable-packet-limit.patch => 0089-Disable-packet-limit.patch} (100%) rename patches/server/{0093-Reduce-array-allocations.patch => 0090-Reduce-array-allocations.patch} (99%) rename patches/server/{0094-Optimize-sun-burn-tick.patch => 0091-Optimize-sun-burn-tick.patch} (100%) rename patches/server/{0095-Reduce-lambda-and-Optional-allocation-in-EntityBased.patch => 0092-Reduce-lambda-and-Optional-allocation-in-EntityBased.patch} (100%) rename patches/server/{0096-Use-optimized-collection.patch => 0093-Use-optimized-collection.patch} (98%) rename patches/server/{0097-Avoid-Class-isAssignableFrom-call-in-ClassInstanceMu.patch => 0094-Avoid-Class-isAssignableFrom-call-in-ClassInstanceMu.patch} (100%) rename patches/server/{0098-Optimized-CubePointRange.patch => 0095-Optimized-CubePointRange.patch} (100%) rename patches/server/{0099-Check-frozen-ticks-before-landing-block.patch => 0096-Check-frozen-ticks-before-landing-block.patch} (100%) rename patches/server/{0100-Cache-ominous-banner-item.patch => 0097-Cache-ominous-banner-item.patch} (100%) rename patches/server/{0101-Skip-entity-move-if-movement-is-zero.patch => 0098-Skip-entity-move-if-movement-is-zero.patch} (100%) rename patches/server/{0102-Skip-cloning-advancement-criteria.patch => 0099-Skip-cloning-advancement-criteria.patch} (100%) rename patches/server/{0103-Skip-negligible-planar-movement-multiplication.patch => 0100-Skip-negligible-planar-movement-multiplication.patch} (100%) rename patches/server/{0104-Fix-villagers-dont-release-memory.patch => 0101-Fix-villagers-dont-release-memory.patch} (100%) rename patches/server/{0105-Avoid-anvil-too-expensive.patch => 0102-Avoid-anvil-too-expensive.patch} (100%) rename patches/server/{0106-Bow-infinity-fix.patch => 0103-Bow-infinity-fix.patch} (100%) rename patches/server/{0107-Zero-tick-plants.patch => 0104-Zero-tick-plants.patch} (100%) rename patches/server/{0108-Leaves-update-command.patch => 0105-Leaves-update-command.patch} (97%) rename patches/server/{0109-Force-peaceful-mode-switch.patch => 0106-Force-peaceful-mode-switch.patch} (97%) rename patches/server/{0110-Add-Leaves-Auto-Update.patch => 0107-Add-Leaves-Auto-Update.patch} (73%) rename patches/server/{0111-Replay-Mod-API.patch => 0108-Replay-Mod-API.patch} (99%) rename patches/server/{0112-Fix-vehicle-teleport-by-end-gateway.patch => 0109-Fix-vehicle-teleport-by-end-gateway.patch} (100%) rename patches/server/{0113-Leaves-I18n.patch => 0110-Leaves-I18n.patch} (99%) rename patches/server/{0114-Fix-minecraft-hopper-not-work-without-player.patch => 0111-Fix-minecraft-hopper-not-work-without-player.patch} (100%) rename patches/server/{0115-Wool-Hopper-Counter.patch => 0112-Wool-Hopper-Counter.patch} (98%) rename patches/server/{0116-Loot-world-random.patch => 0113-Loot-world-random.patch} (100%) rename patches/server/{0117-Leaves-Reload-Command.patch => 0114-Leaves-Reload-Command.patch} (89%) rename patches/server/{0118-Spider-jockeys-drop-gapples.patch => 0115-Spider-jockeys-drop-gapples.patch} (100%) rename patches/server/{0119-Force-Void-Trade.patch => 0116-Force-Void-Trade.patch} (100%) rename patches/server/{0120-Servux-Protocol.patch => 0117-Servux-Protocol.patch} (100%) rename patches/server/{0121-Villager-infinite-discounts.patch => 0118-Villager-infinite-discounts.patch} (53%) rename patches/server/{0122-CCE-update-suppression.patch => 0119-CCE-update-suppression.patch} (100%) rename patches/server/{0123-Disable-offline-warn-if-use-proxy.patch => 0120-Disable-offline-warn-if-use-proxy.patch} (89%) rename patches/server/{0124-Disable-moved-wrongly-threshold.patch => 0121-Disable-moved-wrongly-threshold.patch} (97%) rename patches/server/{0125-Armor-stand-cant-kill-by-mob-projectile.patch => 0122-Armor-stand-cant-kill-by-mob-projectile.patch} (100%) rename patches/server/{0126-Make-Item-tick-vanilla.patch => 0123-Make-Item-tick-vanilla.patch} (100%) rename patches/server/{0127-Copper-Bulb-1-gt-delay.patch => 0124-Copper-Bulb-1-gt-delay.patch} (100%) rename patches/server/{0128-Crafter-1-gt-delay.patch => 0125-Crafter-1-gt-delay.patch} (100%) diff --git a/patches/server/0005-Leaves-Server-Config-And-Command.patch b/patches/server/0005-Leaves-Server-Config-And-Command.patch index 23f846d2..679397d7 100644 --- a/patches/server/0005-Leaves-Server-Config-And-Command.patch +++ b/patches/server/0005-Leaves-Server-Config-And-Command.patch @@ -17,58 +17,21 @@ index a67ddd1ca3f18e6754dd52d9f34e5d2e850760e0..fe547d04abece42bdc0d0897e2d3f2e6 org.spigotmc.WatchdogThread.hasStarted = true; // Paper Arrays.fill( this.recentTps, 20 ); diff --git a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java -index 11d26f4a84792019ce9ad6886bd96214cd73a320..fd89dfb3f2ceab015b74d7e3a061973e590cedd5 100644 +index 11d26f4a84792019ce9ad6886bd96214cd73a320..570310512c9ce5cf87f3fffe20d6d88c651aa83a 100644 --- a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java +++ b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java -@@ -219,6 +219,10 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface +@@ -219,6 +219,9 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface com.destroystokyo.paper.VersionHistoryManager.INSTANCE.getClass(); // load version history now io.papermc.paper.brigadier.PaperBrigadierProviderImpl.INSTANCE.getClass(); // init PaperBrigadierProvider // Paper end + + top.leavesmc.leaves.LeavesConfig.init((java.io.File) options.valueOf("leaves-settings")); // Leaves - Server Config -+ top.leavesmc.leaves.LeavesConfig.registerCommands(); // Leaves - Server Command + System.setProperty("spark.serverconfigs.extra", "leaves.yml"); // Leaves - spark config com.destroystokyo.paper.Metrics.PaperMetrics.startMetrics(); // Leaves - down -diff --git a/src/main/java/net/minecraft/world/entity/ai/gossip/GossipType.java b/src/main/java/net/minecraft/world/entity/ai/gossip/GossipType.java -index 8c942c21dc3aebcd2fc89b5bde92c73a95bdc3e3..c3d1d7b525a6f2b708144ebe9bc28dfadcfe11fa 100644 ---- a/src/main/java/net/minecraft/world/entity/ai/gossip/GossipType.java -+++ b/src/main/java/net/minecraft/world/entity/ai/gossip/GossipType.java -@@ -15,9 +15,9 @@ public enum GossipType implements StringRepresentable { - public static final int REPUTATION_CHANGE_PER_TRADE = 2; - public final String id; - public final int weight; -- public final int max; -+ public int max; - public final int decayPerDay; -- public final int decayPerTransfer; -+ public int decayPerTransfer; - public static final Codec CODEC = StringRepresentable.fromEnum(GossipType::values); - - private GossipType(String key, int multiplier, int maxReputation, int decay, int shareDecrement) { -diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java -index c495dc410c17593bf8785c69eb23a41fc9d3084a..c51d22285a253d4220ee967504ab9eef1403edbe 100644 ---- a/src/main/java/net/minecraft/world/level/Level.java -+++ b/src/main/java/net/minecraft/world/level/Level.java -@@ -169,6 +169,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable { - // Paper end - - public final com.destroystokyo.paper.antixray.ChunkPacketBlockController chunkPacketBlockController; // Paper - Anti-Xray -+ public final top.leavesmc.leaves.LeavesConfig.WorldConfig leavesConfig; // Leaves - World Config - public static BlockPos lastPhysicsProblem; // Spigot - private org.spigotmc.TickLimiter entityLimiter; - private org.spigotmc.TickLimiter tileLimiter; -@@ -205,6 +206,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable { - protected Level(WritableLevelData worlddatamutable, ResourceKey resourcekey, RegistryAccess iregistrycustom, Holder holder, Supplier supplier, boolean flag, boolean flag1, long i, int j, org.bukkit.generator.ChunkGenerator gen, org.bukkit.generator.BiomeProvider biomeProvider, org.bukkit.World.Environment env, java.util.function.Function paperWorldConfigCreator, java.util.concurrent.Executor executor) { // Paper - Async-Anti-Xray - Pass executor - this.spigotConfig = new org.spigotmc.SpigotWorldConfig(((net.minecraft.world.level.storage.PrimaryLevelData) worlddatamutable).getLevelName()); // Spigot - this.paperConfig = paperWorldConfigCreator.apply(this.spigotConfig); // Paper -+ this.leavesConfig = new top.leavesmc.leaves.LeavesConfig.WorldConfig(((net.minecraft.world.level.storage.PrimaryLevelData)worlddatamutable).getLevelName()); // Leaves - World Config - this.generator = gen; - this.world = new CraftWorld((ServerLevel) this, gen, biomeProvider, env); - diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -index 9e4002e82dba3a09a3a8346aebba34f30f902dff..f18225bff50f87e4dab89951a9f09947639b6a27 100644 +index 9e4002e82dba3a09a3a8346aebba34f30f902dff..417a808d2b99a0a3f499a457c93afb9494d22fff 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java @@ -1037,6 +1037,7 @@ public final class CraftServer implements Server { @@ -79,23 +42,7 @@ index 9e4002e82dba3a09a3a8346aebba34f30f902dff..f18225bff50f87e4dab89951a9f09947 for (ServerLevel world : this.console.getAllLevels()) { // world.serverLevelData.setDifficulty(config.difficulty); // Paper - per level difficulty world.setSpawnSettings(world.serverLevelData.getDifficulty() != Difficulty.PEACEFUL && config.spawnMonsters, config.spawnAnimals); // Paper - per level difficulty (from MinecraftServer#setDifficulty(ServerLevel, Difficulty, boolean)) -@@ -1052,6 +1053,7 @@ public final class CraftServer implements Server { - } - } - world.spigotConfig.init(); // Spigot -+ world.leavesConfig.init(); // Leaves - World Config - } - - Plugin[] pluginClone = pluginManager.getPlugins().clone(); // Paper -@@ -1067,6 +1069,7 @@ public final class CraftServer implements Server { - this.reloadData(); - org.spigotmc.SpigotConfig.registerCommands(); // Spigot - io.papermc.paper.command.PaperCommands.registerCommands(this.console); // Paper -+ top.leavesmc.leaves.LeavesConfig.registerCommands(); // Leaves - Server Command - this.overrideAllCommandBlockCommands = this.commandsConfiguration.getStringList("command-block-overrides").contains("*"); - this.ignoreVanillaPermissions = this.commandsConfiguration.getBoolean("ignore-vanilla-permissions"); - -@@ -3010,6 +3013,14 @@ public final class CraftServer implements Server { +@@ -3010,6 +3011,14 @@ public final class CraftServer implements Server { { return CraftServer.this.console.paperConfigurations.createLegacyObject(CraftServer.this.console); } @@ -131,56 +78,60 @@ index 01d907e3266095bb33d3a73dc56004fd79043943..06c00aa070334deeae96524b35ff1295 .withRequiredArg() diff --git a/src/main/java/top/leavesmc/leaves/LeavesConfig.java b/src/main/java/top/leavesmc/leaves/LeavesConfig.java new file mode 100644 -index 0000000000000000000000000000000000000000..a1ca90ea40b4ccd8df290f8cc34d63d390acc87c +index 0000000000000000000000000000000000000000..f6821b1f760dcf2a504c8bdf845e469f7041537a --- /dev/null +++ b/src/main/java/top/leavesmc/leaves/LeavesConfig.java -@@ -0,0 +1,1059 @@ +@@ -0,0 +1,815 @@ +package top.leavesmc.leaves; + +import com.destroystokyo.paper.util.SneakyThrow; -+import com.google.common.base.Throwables; ++import io.papermc.paper.configuration.GlobalConfiguration; +import net.minecraft.server.MinecraftServer; +import org.bukkit.Bukkit; +import org.bukkit.command.Command; -+import org.bukkit.configuration.ConfigurationSection; +import org.bukkit.configuration.file.YamlConfiguration; +import top.leavesmc.leaves.command.LeavesCommand; ++import top.leavesmc.leaves.config.ConfigVerify; ++import top.leavesmc.leaves.config.GlobalConfig; ++import top.leavesmc.leaves.config.GlobalConfigManager; ++import top.leavesmc.leaves.config.RemovedConfig; ++import top.leavesmc.leaves.util.MathUtils; + +import java.io.File; -+import java.lang.reflect.InvocationTargetException; -+import java.lang.reflect.Method; -+import java.lang.reflect.Modifier; -+import java.util.HashMap; ++import java.io.IOException; ++import java.util.Collections; +import java.util.List; -+import java.util.Map; +import java.util.logging.Level; +import java.util.Random; + -+// Powered by Tuinity(https://github.com/Tuinity/Tuinity) ++import top.leavesmc.leaves.protocol.CarpetServerProtocol.CarpetRule; ++import top.leavesmc.leaves.protocol.CarpetServerProtocol.CarpetRules; ++ ++import top.leavesmc.leaves.protocol.bladeren.BladerenProtocol.LeavesFeatureSet; ++import top.leavesmc.leaves.protocol.bladeren.BladerenProtocol.LeavesFeature; + -+@SuppressWarnings("unused") +public final class LeavesConfig { + + public static final String CONFIG_HEADER = "Configuration file for Leaves."; + public static final int CURRENT_CONFIG_VERSION = 5; + -+ private static final Object[] EMPTY = new Object[0]; -+ + private static File configFile; + public static YamlConfiguration config; + private static int configVersion; + public static boolean createWorldSections = true; -+ static Map commands; + + public static void init(final File file) { + LeavesConfig.configFile = file; + config = new YamlConfiguration(); -+ config.options().header(CONFIG_HEADER); ++ config.options().setHeader(Collections.singletonList(CONFIG_HEADER)); + config.options().copyDefaults(true); + + if (!file.exists()) { + try { -+ file.createNewFile(); ++ boolean is = file.createNewFile(); ++ if (!is) { ++ throw new IOException("Can't create file"); ++ } + } catch (final Exception ex) { + Bukkit.getLogger().log(Level.SEVERE, "Failure to create leaves config", ex); + } @@ -194,38 +145,17 @@ index 0000000000000000000000000000000000000000..a1ca90ea40b4ccd8df290f8cc34d63d3 + } + } + -+ if (config.contains("config-version-please-do-not-modify-me")) { -+ LeavesConfig.set("config-version-please-do-not-modify-me", null); -+ } -+ LeavesConfig.configVersion = LeavesConfig.getInt("config-version", CURRENT_CONFIG_VERSION); -+ LeavesConfig.set("config-version", CURRENT_CONFIG_VERSION); ++ LeavesConfig.configVersion = LeavesConfig.config.getInt("config-version", CURRENT_CONFIG_VERSION); ++ LeavesConfig.config.set("config-version", CURRENT_CONFIG_VERSION); + + updateConfigVersion(config); + -+ LeavesConfig.load(config); -+ registerCarpetRules(); ++ GlobalConfigManager.init(); + -+ commands = new HashMap<>(); -+ commands.put("leaves", new LeavesCommand("leaves")); ++ registerCommand("leaves", new LeavesCommand("leaves")); + } + -+ public static void load(final YamlConfiguration config) { -+ for (Method method : LeavesConfig.class.getDeclaredMethods()) { -+ if (Modifier.isPrivate(method.getModifiers())) { -+ if (method.getParameterTypes().length == 0 && method.getReturnType() == Void.TYPE) { -+ try { -+ method.setAccessible(true); -+ method.invoke(null); -+ } catch (InvocationTargetException ex) { -+ throw Throwables.propagate(ex.getCause()); -+ } catch (Exception ex) { -+ Bukkit.getLogger().log(Level.SEVERE, "Error invoking " + method, ex); -+ } -+ } -+ } -+ } -+ -+ /* We re-save to add new options */ ++ public static void save() { + try { + config.save(LeavesConfig.configFile); + } catch (final Exception ex) { @@ -233,6 +163,7 @@ index 0000000000000000000000000000000000000000..a1ca90ea40b4ccd8df290f8cc34d63d3 + } + } + ++ @Deprecated(forRemoval = true) + private static void updateConfigVersion(final YamlConfiguration config) { + if (configVersion < CURRENT_CONFIG_VERSION) { + switch (configVersion) { @@ -286,913 +217,685 @@ index 0000000000000000000000000000000000000000..a1ca90ea40b4ccd8df290f8cc34d63d3 + } + } + -+ static void set(final String path, final Object value) { -+ LeavesConfig.config.set(path, value); ++ public static void registerCommand(String name, Command command) { ++ MinecraftServer.getServer().server.getCommandMap().register(name, "Leaves", command); + } + -+ public static void registerCommands() { -+ for (Map.Entry entry : commands.entrySet()) { -+ MinecraftServer.getServer().server.getCommandMap().register(entry.getKey(), "Leaves", entry.getValue()); -+ } ++ public static void unregisterCommand(String name) { ++ name = name.toLowerCase(java.util.Locale.ENGLISH).trim(); ++ MinecraftServer.getServer().server.getCommandMap().getKnownCommands().remove(name); + } + -+ static boolean getBoolean(final String path, final boolean dfl) { -+ LeavesConfig.config.addDefault(path, Boolean.valueOf(dfl)); -+ return LeavesConfig.config.getBoolean(path, dfl); -+ } ++ // Leaves - modify start + -+ static int getInt(final String path, final int dfl) { -+ LeavesConfig.config.addDefault(path, Integer.valueOf(dfl)); -+ return LeavesConfig.config.getInt(path, dfl); -+ } ++ // Leaves - modify - fakeplayer start + -+ static long getLong(final String path, final long dfl) { -+ LeavesConfig.config.addDefault(path, Long.valueOf(dfl)); -+ return LeavesConfig.config.getLong(path, dfl); -+ } -+ -+ static double getDouble(final String path, final double dfl) { -+ LeavesConfig.config.addDefault(path, Double.valueOf(dfl)); -+ return LeavesConfig.config.getDouble(path, dfl); -+ } -+ -+ static String getString(final String path, final String dfl) { -+ LeavesConfig.config.addDefault(path, dfl); -+ return LeavesConfig.config.getString(path, dfl); -+ } -+ -+ static List getList(final String path, final List def) { -+ LeavesConfig.config.addDefault(path, def); -+ return (List) LeavesConfig.config.getList(path, config.getList(path)); -+ } ++ @GlobalConfig(name = "enable", category = {"modify", "fakeplayer"}, verify = FakeplayerVerify.class) ++ public static boolean fakeplayerSupport = true; + -+ public static boolean snowballAndEggCanKnockback = true; -+ private static void snowballAndEggCanKnockback() { -+ snowballAndEggCanKnockback = getBoolean("settings.modify.snowball-and-egg-can-knockback-player", snowballAndEggCanKnockback); ++ private static class FakeplayerVerify extends ConfigVerify.BooleanConfigVerify { ++ @Override ++ public String check(Boolean old, Boolean value) { ++ if (value) { ++ registerCommand("bot", new top.leavesmc.leaves.bot.BotCommand("bot")); ++ top.leavesmc.leaves.bot.agent.Actions.registerAll(); ++ } else { ++ unregisterCommand("bot"); ++ } ++ return null; ++ } + } + -+ public static boolean fakeplayerSupport = true; ++ @GlobalConfig(name = "unable-fakeplayer-names", category = {"modify", "fakeplayer"}, verify = ConfigVerify.ListConfigVerify.class) + public static List unableFakeplayerNames = List.of("player-name"); ++ ++ @GlobalConfig(name = "limit", category = {"modify", "fakeplayer"}, verify = ConfigVerify.IntConfigVerify.class) + public static int fakeplayerLimit = 10; ++ ++ @GlobalConfig(name = "prefix", category = {"modify", "fakeplayer"}, verify = ConfigVerify.StringConfigVerify.class) + public static String fakeplayerPrefix = ""; ++ ++ @GlobalConfig(name = "suffix", category = {"modify", "fakeplayer"}, verify = ConfigVerify.StringConfigVerify.class) + public static String fakeplayerSuffix = ""; ++ ++ @GlobalConfig(name = "always-send-data", category = {"modify", "fakeplayer"}) + public static boolean alwaysSendFakeplayerData = true; ++ ++ @GlobalConfig(name = "resident-fakeplayer", category = {"modify", "fakeplayer"}) + public static boolean fakeplayerResident = false; ++ ++ @GlobalConfig(name = "open-fakeplayer-inventory", category = {"modify", "fakeplayer"}) + public static boolean openFakeplayerInventory = false; ++ ++ @GlobalConfig(name = "skip-sleep-check", category = {"modify", "fakeplayer"}) + public static boolean fakeplayerSkipSleep = false; ++ ++ @GlobalConfig(name = "spawn-phantom", category = {"modify", "fakeplayer"}) + public static boolean fakeplayerSpawnPhantom = false; -+ public static float fakeplayerRegenAmount = 0.010f; -+ private static void fakeplayer() { -+ fakeplayerSupport = getBoolean("settings.modify.fakeplayer.enable", fakeplayerSupport); -+ unableFakeplayerNames = getList("settings.modify.fakeplayer.unable-fakeplayer-names", unableFakeplayerNames); -+ fakeplayerLimit = getInt("settings.modify.fakeplayer.limit", fakeplayerLimit); -+ fakeplayerPrefix = getString("settings.modify.fakeplayer.prefix", fakeplayerPrefix); -+ fakeplayerSuffix = getString("settings.modify.fakeplayer.suffix", fakeplayerSuffix); -+ alwaysSendFakeplayerData = getBoolean("settings.modify.fakeplayer.always-send-data", alwaysSendFakeplayerData); -+ fakeplayerResident = getBoolean("settings.modify.fakeplayer.resident-fakeplayer", fakeplayerResident); -+ openFakeplayerInventory = getBoolean("settings.modify.fakeplayer.open-fakeplayer-inventory", openFakeplayerInventory); -+ fakeplayerSkipSleep = getBoolean("settings.modify.fakeplayer.skip-sleep-check", fakeplayerSkipSleep); -+ fakeplayerSpawnPhantom = getBoolean("settings.modify.fakeplayer.spawn-phantom", fakeplayerSpawnPhantom); -+ fakeplayerRegenAmount = (float) getDouble("settings.modify.fakeplayer.regen-amount", fakeplayerRegenAmount); -+ } + -+ public static boolean shearsInDispenserCanZeroAmount = false; -+ private static void shearsInDispenserCanZeroAmount() { -+ shearsInDispenserCanZeroAmount = getBoolean("settings.modify.minecraft-old.shears-in-dispenser-can-zero-amount", shearsInDispenserCanZeroAmount); -+ } ++ @GlobalConfig(name = "regen-amount", category = {"modify", "fakeplayer"}, verify = RegenAmountVerify.class) ++ public static double fakeplayerRegenAmount = 0.010; + -+ public static boolean redstoneShearsWrench = true; -+ private static void redstoneShearsWrench() { -+ redstoneShearsWrench = getBoolean("settings.modify.redstone-shears-wrench", redstoneShearsWrench); ++ private static class RegenAmountVerify extends ConfigVerify.DoubleConfigVerify { ++ @Override ++ public String check(Double old, Double value) { ++ return value > 0.0 ? null : "regen-amount need > 0.0f"; ++ } + } + -+ public static boolean buddingAmethystCanPushByPiston = false; -+ private static void buddingAmethystCanPushByPiston() { -+ buddingAmethystCanPushByPiston = getBoolean("settings.modify.budding-amethyst-can-push-by-piston", buddingAmethystCanPushByPiston); -+ } ++ // Leaves - modify - fakeplayer end + -+ public static boolean spectatorDontGetAdvancement = false; -+ private static void spectatorDontGetAdvancement() { -+ spectatorDontGetAdvancement = getBoolean("settings.modify.spectator-dont-get-advancement", spectatorDontGetAdvancement); -+ } ++ // Leaves - modify - minecraft-old start + -+ public static boolean stickChangeArmorStandArmStatus = true; -+ private static void stickChangeArmorStandHasArm() { -+ stickChangeArmorStandArmStatus = getBoolean("settings.modify.stick-change-armorstand-arm-status", stickChangeArmorStandArmStatus); -+ } ++ @GlobalConfig(name = "shears-in-dispenser-can-zero-amount", category = {"modify", "minecraft-old"}) ++ public static boolean shearsInDispenserCanZeroAmount = false; + -+ public static boolean noChatSign = true; -+ private static void noChatSign() { -+ noChatSign = getBoolean("settings.misc.no-chat-sign", noChatSign); -+ } ++ @GlobalConfig(name = "instant-block-updater-reintroduced", category = {"modify", "minecraft-old"}, lock = true) ++ public static boolean instantBlockUpdaterReintroduced = false; + -+ public static boolean asyncMobSpawning = false; -+ private static boolean asyncMobSpawningLock = false; -+ private static void asyncMobSpawning() { -+ if (!asyncMobSpawningLock) { -+ asyncMobSpawning = getBoolean("settings.performance.async-mob-spawning", asyncMobSpawning); -+ asyncMobSpawningLock = true; -+ } -+ } ++ @GlobalConfig(name = "armor-stand-cant-kill-by-mob-projectile", category = {"modify", "minecraft-old"}) ++ public static boolean armorStandCantKillByMobProjectile = false; + -+ public static boolean dontSendUselessEntityPackets = true; -+ private static void dontSendUselessEntityPackets() { -+ dontSendUselessEntityPackets = getBoolean("settings.performance.dont-send-useless-entity-packets", dontSendUselessEntityPackets); -+ } ++ @GlobalConfig(name = "cce-update-suppression", category = {"modify", "minecraft-old"}) ++ public static boolean cceUpdateSuppression = false; + -+ public static boolean asyncEntityTracker = false; -+ private static boolean asyncEntityTrackerLock = false; -+ private static void asyncEntityTracker() { -+ if (!asyncEntityTrackerLock) { -+ asyncEntityTracker = getBoolean("settings.performance.async-entity-tracker", asyncEntityTracker); -+ asyncEntityTrackerLock = true; -+ } ++ @GlobalConfig(name = "villager-infinite-discounts", category = {"modify", "minecraft-old"}, verify = VillagerInfiniteDiscountsVerify.class) ++ public static boolean villagerInfiniteDiscounts = false; + -+ if (asyncEntityTracker) { -+ asyncEntityTracker = false; -+ LeavesLogger.LOGGER.severe("Async EntityTracker is updating, it can't work"); ++ private static class VillagerInfiniteDiscountsVerify extends ConfigVerify.BooleanConfigVerify { ++ @Override ++ public String check(Boolean old, Boolean value) { ++ top.leavesmc.leaves.util.VillagerInfiniteDiscountHelper.doVillagerInfiniteDiscount(value); ++ return null; + } + } + -+ public static boolean fixPaper6045 = true; -+ private static void fixPaper6045() { -+ fixPaper6045 = getBoolean("settings.performance.fix.fix-paper-6045", fixPaper6045); -+ } ++ @GlobalConfig(name = "copper-bulb-1gt-delay", category = {"modify", "minecraft-old"}) ++ public static boolean copperBulb1gt = false; + -+ public static boolean optimizeEntityCoordinateKey = true; -+ private static void optimizeEntityCoordinateKey() { -+ optimizeEntityCoordinateKey = getBoolean("settings.performance.optimize-entity-coordinate-key", optimizeEntityCoordinateKey); -+ } ++ @GlobalConfig(name = "crafter-1gt-delay", category = {"modify", "minecraft-old"}) ++ public static boolean crafter1gt = false; + -+ public static boolean enableSuffocationOptimization = true; -+ private static void enableSuffocationOptimization() { -+ enableSuffocationOptimization = getBoolean("settings.performance.enable-suffocation-optimization", enableSuffocationOptimization); -+ } ++ @GlobalConfig(name = "redstone-wire-dont-connect-if-on-trapdoor", category = {"modify", "minecraft-old"}) ++ public static boolean redstoneDontCantOnTrapDoor = false; + -+ public static boolean entityStripRaytracing = true; -+ private static void entityStripRaytracing() { -+ entityStripRaytracing = getBoolean("settings.performance.strip-raytracing-for-entity", entityStripRaytracing); -+ } ++ @GlobalConfig(name = "mending-compatibility-infinity", category = {"modify", "minecraft-old"}) ++ public static boolean mendingCompatibilityInfinity = false; + -+ public static boolean checkSpookySeasonOnceAnHour = true; -+ private static void checkSpookySeasonOnceAnHour() { -+ checkSpookySeasonOnceAnHour = getBoolean("settings.performance.check-spooky-season-once-an-hour", checkSpookySeasonOnceAnHour); -+ } ++ @GlobalConfig(name = "zero-tick-plants", category = {"modify", "minecraft-old"}) ++ public static boolean zeroTickPlants = false; + -+ public static boolean optimizeChunkTicking = true; -+ private static boolean optimizeChunkTickingLock = false; -+ private static void optimizeChunkTicking() { -+ if (!optimizeChunkTickingLock) { -+ optimizeChunkTicking = getBoolean("settings.performance.optimize-chunk-ticking", optimizeChunkTicking); -+ optimizeChunkTickingLock = true; ++ @GlobalConfig(name = "loot-world-random", category = {"modify", "minecraft-old"}, verify = LootWorldRandomVerify.class) ++ public static boolean lootWorldRandom = false; ++ ++ private static class LootWorldRandomVerify extends ConfigVerify.BooleanConfigVerify { ++ @Override ++ public String check(Boolean old, Boolean value) { ++ LeavesFeatureSet.register(LeavesFeature.of("loot_world_random", value)); ++ return null; + } + } + -+ public static boolean skipPOIFindingInVehicle = true; -+ private static void skipPOIFindingInVehicle() { -+ skipPOIFindingInVehicle = getBoolean("settings.performance.skip-poi-find-in-vehicle", skipPOIFindingInVehicle); -+ } ++ // Leaves - modify - minecraft-old end + -+ public static boolean entityTargetFindingOptimization = true; -+ private static void entityTargetFindingOptimization() { -+ entityTargetFindingOptimization = getBoolean("settings.performance.entity-target-find-optimization", entityTargetFindingOptimization); -+ } ++ // Leaves - modify - elytra-aeronautics start + -+ public static boolean useMoreThreadUnsafeRandom = true; -+ private static void useMoreThreadUnsafeRandom() { -+ useMoreThreadUnsafeRandom = getBoolean("settings.performance.use-more-thread-unsafe-random", useMoreThreadUnsafeRandom); -+ } ++ @GlobalConfig(name = "no-chunk-load", category = {"modify", "elytra-aeronautics"}) ++ public static boolean elytraAeronauticsNoChunk = false; + -+ public static boolean disableMethodProfiler = true; -+ private static void disableMethodProfiler() { -+ disableMethodProfiler = getBoolean("settings.misc.disable-method-profiler", disableMethodProfiler); -+ } ++ @GlobalConfig(name = "no-chunk-height", category = {"modify", "elytra-aeronautics"}, verify = ConfigVerify.DoubleConfigVerify.class) ++ public static double elytraAeronauticsNoChunkHeight = 500.0D; + -+ public static boolean throttleInactiveGoalSelectorTick = false; -+ private static void throttleInactiveGoalSelectorTick() { -+ throttleInactiveGoalSelectorTick = getBoolean("settings.performance.inactive-goal-selector-disable", throttleInactiveGoalSelectorTick); -+ } ++ @GlobalConfig(name = "no-chunk-speed", category = {"modify", "elytra-aeronautics"}, verify = ConfigVerify.DoubleConfigVerify.class) ++ public static double elytraAeronauticsNoChunkSpeed = -1.0D; + -+ public static boolean reduceEntityAllocations = true; -+ private static void reduceEntityAllocations() { -+ reduceEntityAllocations = getBoolean("settings.performance.reduce-entity-allocations", reduceEntityAllocations); -+ } ++ @GlobalConfig(name = "message", category = {"modify", "elytra-aeronautics"}) ++ public static boolean elytraAeronauticsNoChunkMes = true; + -+ public static boolean removeTickGuardLambda = true; -+ private static void removeTickGuardLambda() { -+ removeTickGuardLambda = getBoolean("settings.performance.remove.tick-guard-lambda", removeTickGuardLambda); -+ } ++ @GlobalConfig(name = "message-start", category = {"modify", "elytra-aeronautics"}, verify = ConfigVerify.StringConfigVerify.class) ++ public static String elytraAeronauticsNoChunkStartMes = "Flight enter cruise mode"; + -+ public static boolean removeInventoryContainsIterators = true; -+ private static void removeInventoryContainsIterators() { -+ removeInventoryContainsIterators = getBoolean("settings.performance.remove.inventory-contains-iterators", removeInventoryContainsIterators); -+ } ++ @GlobalConfig(name = "message-end", category = {"modify", "elytra-aeronautics"}, verify = ConfigVerify.StringConfigVerify.class) ++ public static String elytraAeronauticsNoChunkEndMes = "Flight exit cruise mode"; + -+ public static boolean removeGetNearPlayerStreams = true; -+ private static void removeGetNearPlayerStreams() { -+ removeGetNearPlayerStreams = getBoolean("settings.performance.remove.get-nearby-players-streams", removeGetNearPlayerStreams); -+ } ++ // Leaves - modify - elytra-aeronautics end + -+ public static boolean removeRangeCheckStreams = true; -+ private static void removeRangeCheckStreams() { -+ removeRangeCheckStreams = getBoolean("settings.performance.remove.range-check-streams-and-iterators", removeRangeCheckStreams); -+ } ++ @GlobalConfig(name = "redstone-shears-wrench", category = "modify") ++ public static boolean redstoneShearsWrench = true; + -+ // only config now -+ public static boolean asyncPathfinding = false; -+ private static boolean asyncPathfindingLock = false; -+ private static void asyncPathfinding() { -+ if (!asyncPathfindingLock) { -+ asyncPathfinding = getBoolean("settings.performance.async-pathfinding", asyncPathfinding); -+ asyncPathfindingLock = true; -+ } ++ @GlobalConfig(name = "budding-amethyst-can-push-by-piston", category = "modify") ++ public static boolean buddingAmethystCanPushByPiston = false; ++ ++ @GlobalConfig(name = "spectator-dont-get-advancement", category = "modify") ++ public static boolean spectatorDontGetAdvancement = false; ++ ++ @GlobalConfig(name = "stick-change-armorstand-arm-status", category = "modify") ++ public static boolean stickChangeArmorStandArmStatus = true; + -+ if (asyncPathfinding) { -+ asyncPathfinding = false; -+ LeavesLogger.LOGGER.severe("Async Pathfinding is updating, it can't work"); ++ @GlobalConfig(name = "snowball-and-egg-can-knockback-player", category = "modify") ++ public static boolean snowballAndEggCanKnockback = true; ++ ++ @GlobalConfig(name = "flatten-triangular-distribution", category = "modify") ++ public static boolean flattenTriangularDistribution = false; ++ ++ @GlobalConfig(name = "player-operation-limiter", category = "modify") ++ public static boolean playerOperationLimiter = false; ++ ++ @GlobalConfig(name = "renewable-elytra", category = "modify", verify = RenewableElytraVerify.class) ++ public static double renewableElytra = -1.0F; ++ ++ private static class RenewableElytraVerify extends ConfigVerify.DoubleConfigVerify { ++ @Override ++ public String check(Double old, Double value) { ++ return value <= 1.0 ? null : "renewable-elytra need <= 1.0f"; + } + } + -+ public static boolean cacheClimbCheck = true; -+ private static void cacheClimbCheck() { -+ cacheClimbCheck = getBoolean("settings.performance.cache-climb-check", cacheClimbCheck); -+ } ++ public static int shulkerBoxStackSize = 1; ++ @GlobalConfig(name = "stackable-shulker-boxes", category = "modify", verify = StackableShulkerVerify.class) ++ private static String stackableShulkerBoxes = "false"; + -+ public static boolean biomeTemperaturesUseAgingCache = true; -+ private static boolean biomeTemperaturesUseAgingCacheLock = false; -+ private static void biomeTemperaturesUseAgingCache() { -+ if (!biomeTemperaturesUseAgingCacheLock) { -+ biomeTemperaturesUseAgingCache = getBoolean("settings.performance.biome-temperatures-use-aging-cache", biomeTemperaturesUseAgingCache); -+ biomeTemperaturesUseAgingCacheLock = true; ++ private static class StackableShulkerVerify extends ConfigVerify.StringConfigVerify { ++ @Override ++ public String check(String old, String value) { ++ String realValue = MathUtils.isNumeric(value) ? value : value.equals("true") ? "2" : "1"; ++ shulkerBoxStackSize = Integer.parseInt(realValue); ++ return null; + } + } + -+ public static boolean reduceEntityFluidLookup = true; -+ private static void reduceEntityFluidLookup() { -+ reduceEntityFluidLookup = getBoolean("settings.performance.reduce-entity-fluid-lookup", reduceEntityFluidLookup); -+ } ++ @GlobalConfig(name = "force-void-trade", category = "modify") ++ public static boolean forceVoidTrade = false; + -+ public static boolean reduceChuckLoadAndLookup = true; -+ private static void reduceChuckLoadAndLookup() { -+ reduceChuckLoadAndLookup = getBoolean("settings.performance.reduce-chuck-load-and-lookup", reduceChuckLoadAndLookup); -+ } ++ @GlobalConfig(name = "disable-moved-wrongly-threshold", category = "modify") ++ public static boolean disableMovedWronglyThreshold = false; + -+ public static boolean pcaSyncProtocol = false; -+ private static void pcaSyncProtocol() { -+ pcaSyncProtocol = getBoolean("settings.protocol.pca-sync-protocol", pcaSyncProtocol); -+ } ++ @GlobalConfig(name = "mc-technical-survival-mode", category = "modify", verify = McTechnicalModeVerify.class, lock = true) ++ public static boolean mcTechnicalMode = true; + -+ public static String pcaSyncPlayerEntity = "OPS"; -+ private static final List pcaSyncPlayerEntityList = List.of("NOBODY", "BOT", "OPS", "OPS_AND_SELF", "EVERYONE"); -+ private static void pcaSyncPlayerEntity() { -+ pcaSyncPlayerEntity = getString("settings.protocol.pca-sync-player-entity", pcaSyncPlayerEntity); -+ if (!pcaSyncPlayerEntityList.contains(pcaSyncPlayerEntity)) { -+ pcaSyncPlayerEntity = "OPS"; -+ LeavesLogger.LOGGER.severe("pca-sync-player-entity value error, reset to OPS"); ++ private static class McTechnicalModeVerify extends ConfigVerify.BooleanConfigVerify { ++ @Override ++ public String check(Boolean old, Boolean value) { ++ if (value) { ++ top.leavesmc.leaves.util.McTechnicalModeHelper.doMcTechnicalMode(); ++ } ++ return null; + } + } + -+ public static boolean bborProtocol = false; -+ private static void bborProtocol() { -+ bborProtocol = getBoolean("settings.protocol.bbor-protocol", bborProtocol); -+ } ++ @GlobalConfig(name = "return-nether-portal-fix", category = "modify") ++ public static boolean netherPortalFix = false; + -+ public static boolean instantBlockUpdaterReintroduced = false; -+ private static boolean instantBlockUpdaterReintroducedLock = false; -+ private static void instantBlockUpdaterReintroduced() { -+ if (!instantBlockUpdaterReintroducedLock) { -+ instantBlockUpdaterReintroduced = getBoolean("settings.modify.minecraft-old.instant-block-updater-reintroduced", instantBlockUpdaterReintroduced); -+ instantBlockUpdaterReintroducedLock = true; ++ @GlobalConfig(name = "use-vanilla-random", category = "modify", lock = true, verify = UseVanillaRandomVerify.class) ++ public static boolean useVanillaRandom = false; ++ ++ private static class UseVanillaRandomVerify extends ConfigVerify.BooleanConfigVerify { ++ @Override ++ public String check(Boolean old, Boolean value) { ++ LeavesFeatureSet.register(LeavesFeature.of("use_vanilla_random", value)); ++ return null; + } + } + -+ public static boolean flattenTriangularDistribution = false; -+ private static void flattenTriangularDistribution() { -+ flattenTriangularDistribution = getBoolean("settings.modify.flatten-triangular-distribution", flattenTriangularDistribution); -+ } ++ @GlobalConfig(name = "fix-update-suppression-crash", category = "modify") ++ public static boolean updateSuppressionCrashFix = true; + -+ public static boolean jadeProtocol = false; -+ private static void jadeProtocol() { -+ jadeProtocol = getBoolean("settings.protocol.jade-protocol", jadeProtocol); -+ } ++ @GlobalConfig(name = "bedrock-break-list", category = "modify", lock = true) ++ public static boolean bedrockBreakList = false; + -+ public static String alternativeBlockPlacement = "NONE"; -+ private static final List alternativeBlockPlacementType = List.of("NONE", "CARPET", "CARPET_FIX", "LITEMATICA"); -+ private static void alternativeBlockPlacement() { -+ alternativeBlockPlacement = getString("settings.protocol.alternative-block-placement", alternativeBlockPlacement); -+ if (!alternativeBlockPlacementType.contains(alternativeBlockPlacement)) { -+ alternativeBlockPlacement = "NONE"; -+ LeavesLogger.LOGGER.severe("alternative-block-placement value error, reset to NONE"); -+ } -+ } ++ @GlobalConfig(name = "disable-distance-check-for-use-item", category = "modify") ++ public static boolean disableDistanceCheckForUseItem = false; + -+ public static boolean playerOperationLimiter = false; -+ private static void playerOperationLimiter() { -+ playerOperationLimiter = getBoolean("settings.modify.player-operation-limiter", playerOperationLimiter); -+ } ++ @GlobalConfig(name = "no-feather-falling-trample", category = "modify") ++ public static boolean noFeatherFallingTrample = false; + -+ public static double renewableElytra = -1.0; -+ private static void renewableElytra() { -+ renewableElytra = getDouble("settings.modify.renewable-elytra", renewableElytra); -+ } ++ @GlobalConfig(name = "shared-villager-discounts", category = "modify") ++ public static boolean sharedVillagerDiscounts = false; + -+ public static int shulkerBoxStackSize = 1; -+ private static String stackableShulkerBoxes = "false"; -+ private static void stackableShulkerBoxes() { -+ stackableShulkerBoxes = getString("settings.modify.stackable-shulker-boxes", stackableShulkerBoxes); -+ stackableShulkerBoxes = MathUtils.isNumeric(stackableShulkerBoxes) ? stackableShulkerBoxes : stackableShulkerBoxes.equals("true") ? "2" : "1"; -+ shulkerBoxStackSize = Integer.parseInt(stackableShulkerBoxes); -+ } ++ @GlobalConfig(name = "disable-check-out-of-order-command", category = "modify") ++ public static boolean disableCheckOutOfOrderCommand = false; + -+ public static boolean improveFluidDirectionCaching = true; -+ private static boolean improveFluidDirectionCachingLock = false; -+ private static void improveFluidDirectionCaching() { -+ if (!improveFluidDirectionCachingLock) { -+ improveFluidDirectionCaching = getBoolean("settings.performance.improve-fluid-direction-caching", improveFluidDirectionCaching); -+ improveFluidDirectionCachingLock = true; -+ } -+ } ++ @GlobalConfig(name = "despawn-enderman-with-block", category = "modify") ++ public static boolean despawnEndermanWithBlock = false; + -+ public static boolean mcTechnicalMode = true; -+ private static void mcTechnicalMode() { -+ mcTechnicalMode = getBoolean("settings.modify.mc-technical-survival-mode", mcTechnicalMode); -+ doMcTechnicalMode(); -+ } ++ @GlobalConfig(name = "creative-no-clip", category = "modify", verify = CreativeNoClipVerify.class) ++ public static boolean creativeNoClip = false; + -+ public static void doMcTechnicalMode() { -+ if (mcTechnicalMode) { ++ private static class CreativeNoClipVerify extends ConfigVerify.BooleanConfigVerify { ++ @Override ++ public String check(Boolean old, Boolean value) { ++ CarpetRules.register(CarpetRule.of("carpet", "creativeNoClip", value)); ++ return null; + } + } + -+ public static boolean netherPortalFix = false; -+ private static void netherPortalFix() { -+ netherPortalFix = getBoolean("settings.modify.return-nether-portal-fix", netherPortalFix); -+ } ++ @GlobalConfig(name = "shave-snow-layers", category = "modify") ++ public static boolean shaveSnowLayers = true; + -+ public static boolean appleskinProtocol = false; -+ private static void appleskinProtocol() { -+ appleskinProtocol = getBoolean("settings.protocol.appleskin-protocol", appleskinProtocol); -+ } ++ @GlobalConfig(name = "ignore-lc", category = "modify") ++ public static boolean ignoreLC = false; + -+ public static boolean xaeroMapProtocol = false; -+ public static int xaeroMapServerID = new Random().nextInt(); -+ private static void xaeroMapProtocol() { -+ xaeroMapProtocol = getBoolean("settings.protocol.xaero-map-protocol", xaeroMapProtocol); -+ xaeroMapServerID = getInt("settings.protocol.xaero-map-server-id", xaeroMapServerID); -+ } ++ @GlobalConfig(name = "disable-packet-limit", category = "modify") ++ public static boolean disablePacketLimit = false; + -+ public static boolean extraYggdrasilService = false; -+ public static boolean extraYggdrasilLoginProtect = false; -+ public static List extraYggdrasilServiceList = List.of("https://url.with.authlib-injector-yggdrasil"); -+ private static void extraYggdrasilService() { -+ extraYggdrasilService = getBoolean("settings.misc.extra-yggdrasil-service.enable", extraYggdrasilService); -+ extraYggdrasilLoginProtect = getBoolean("settings.misc.extra-yggdrasil-service.login-protect", extraYggdrasilLoginProtect); -+ extraYggdrasilServiceList = getList("settings.misc.extra-yggdrasil-service.urls", extraYggdrasilServiceList); -+ if (extraYggdrasilService) { -+ } -+ } ++ @GlobalConfig(name = "lava-riptide", category = "modify", verify = LavaRiptideVerify.class) ++ public static boolean lavaRiptide = false; + -+ public static boolean useVanillaRandom = false; -+ private static boolean useVanillaRandomLock = false; -+ private static void useVanillaRandom() { -+ if (!useVanillaRandomLock) { -+ useVanillaRandom = getBoolean("settings.modify.use-vanilla-random", useVanillaRandom); -+ useVanillaRandomLock = true; ++ private static class LavaRiptideVerify extends ConfigVerify.BooleanConfigVerify { ++ @Override ++ public String check(Boolean old, Boolean value) { ++ LeavesFeatureSet.register(LeavesFeature.of("lava_riptide", value)); ++ return null; + } + } + -+ public static boolean updateSuppressionCrashFix = true; -+ private static void updateSuppressionCrashFix() { -+ updateSuppressionCrashFix = getBoolean("settings.modify.fix-update-suppression-crash", updateSuppressionCrashFix); -+ } ++ @GlobalConfig(name = "no-block-update-command", category = "modify", verify = NoBlockUpdateVerify.class) ++ public static boolean noBlockUpdateCommand = false; + -+ public static boolean bedrockBreakList = false; -+ private static boolean bedrockBreakListLock = false; -+ private static void bedrockBreakList() { -+ if (!bedrockBreakListLock) { -+ bedrockBreakList = getBoolean("settings.modify.bedrock-break-list", bedrockBreakList); -+ bedrockBreakListLock = true; ++ private static class NoBlockUpdateVerify extends ConfigVerify.BooleanConfigVerify { ++ @Override ++ public String check(Boolean old, Boolean value) { ++ if (value) { ++ registerCommand("blockupdate", new top.leavesmc.leaves.command.NoBlockUpdateCommand("blockupdate")); ++ } else { ++ unregisterCommand("blockupdate"); ++ } ++ return null; + } + } + -+ public static boolean syncmaticaProtocol = false; -+ public static boolean syncmaticaQuota = false; -+ public static int syncmaticaQuotaLimit = 40000000; -+ private static void syncmaticaProtocol() { -+ syncmaticaProtocol = getBoolean("settings.protocol.syncmatica.enable", syncmaticaProtocol); -+ syncmaticaQuota = getBoolean("settings.protocol.syncmatica.quota", syncmaticaQuota); -+ syncmaticaQuotaLimit = getInt("settings.protocol.syncmatica.quota-limit", syncmaticaQuotaLimit); -+ if (syncmaticaProtocol) { ++ @GlobalConfig(name = "raider-die-skip-self-raid-check", category = "modify") ++ public static boolean skipSelfRaidCheck = false; ++ ++ @GlobalConfig(name = "container-passthrough", category = "modify") ++ public static boolean containerPassthrough = false; ++ ++ @GlobalConfig(name = "avoid-anvil-too-expensive", category = "modify", verify = AnvilNotExpensiveVerify.class) ++ public static boolean avoidAnvilTooExpensive = false; ++ ++ private static class AnvilNotExpensiveVerify extends ConfigVerify.BooleanConfigVerify { ++ @Override ++ public String check(Boolean old, Boolean value) { ++ CarpetRules.register(CarpetRule.of("pca", "avoidAnvilTooExpensive", value)); ++ return null; + } + } + -+ public static boolean disableDistanceCheckForUseItem = false; -+ private static void disableDistanceCheckForUseItem() { -+ disableDistanceCheckForUseItem = getBoolean("settings.modify.disable-distance-check-for-use-item", disableDistanceCheckForUseItem); -+ if (!alternativeBlockPlacement.equals("NONE")) { -+ disableDistanceCheckForUseItem = true; ++ @GlobalConfig(name = "bow-infinity-fix", category = "modify") ++ public static boolean bowInfinityFix = false; ++ ++ @GlobalConfig(name = "hopper-counter", category = "modify") ++ public static boolean hopperCounter = false; ++ ++ @GlobalConfig(name = "spider-jockeys-drop-gapples", category = "modify", verify = JockeysDropGAppleVerify.class) ++ public static double spiderJockeysDropGapples = -1.0; ++ ++ private static class JockeysDropGAppleVerify extends ConfigVerify.DoubleConfigVerify { ++ @Override ++ public String check(Double old, Double value) { ++ return value <= 1.0 ? null : "spider-jockeys-drop-gapples need <= 1.0f"; + } + } + -+ public static boolean noFeatherFallingTrample = false; -+ private static void noFeatherFallingTrample() { -+ noFeatherFallingTrample = getBoolean("settings.modify.no-feather-falling-trample", noFeatherFallingTrample); -+ } ++ // Leaves - modify removed start + -+ public static boolean sharedVillagerDiscounts = false; -+ private static void sharedVillagerDiscounts() { -+ sharedVillagerDiscounts = getBoolean("settings.modify.shared-villager-discounts", sharedVillagerDiscounts); -+ } ++ @RemovedConfig ++ @GlobalConfig(name = "tick-command", category = "modify") ++ public static boolean tickCommand = false; + -+ public static boolean redstoneDontCantOnTrapDoor = false; -+ private static void redstoneDontCantOnTrapDoor() { -+ redstoneDontCantOnTrapDoor = getBoolean("settings.modify.minecraft-old.redstone-wire-dont-connect-if-on-trapdoor", redstoneDontCantOnTrapDoor); -+ } ++ // Leaves - modify removed end + -+ public static boolean disableCheckOutOfOrderCommand = false; -+ private static void disableCheckOutOfOrderCommand() { -+ disableCheckOutOfOrderCommand = getBoolean("settings.modify.disable-check-out-of-order-command", disableCheckOutOfOrderCommand); -+ } ++ // Leaves - modify end + -+ public static boolean despawnEndermanWithBlock = false; -+ private static void despawnEndermanWithBlock() { -+ despawnEndermanWithBlock = getBoolean("settings.modify.despawn-enderman-with-block", despawnEndermanWithBlock); -+ } ++ // Leaves - performance start + -+ public static boolean leavesCarpetSupport = false; -+ private static void leavesCarpetSupport() { -+ leavesCarpetSupport = getBoolean("settings.protocol.leaves-carpet-support", leavesCarpetSupport); -+ } ++ // Leaves - performance fix start + -+ public static void registerCarpetRules() { -+ } ++ @GlobalConfig(name = "fix-paper-6045", category = {"performance", "fix"}) ++ public static boolean fixPaper6045 = true; + -+ public static boolean creativeNoClip = false; -+ private static void creativeNoClip() { -+ creativeNoClip = getBoolean("settings.modify.creative-no-clip", creativeNoClip); -+ } ++ @GlobalConfig(name = "fix-paper-9372", category = {"performance", "fix"}) ++ public static boolean fixPaper9372 = true; ++ ++ // Leaves - performance fix end ++ ++ // Leaves - performance remove start + ++ @GlobalConfig(name = "tick-guard-lambda", category = {"performance", "remove"}) ++ public static boolean removeTickGuardLambda = true; ++ ++ @GlobalConfig(name = "inventory-contains-iterators", category = {"performance", "remove"}) ++ public static boolean removeInventoryContainsIterators = true; ++ ++ @GlobalConfig(name = "get-nearby-players-streams", category = {"performance", "remove"}) ++ public static boolean removeGetNearPlayerStreams = true; ++ ++ @GlobalConfig(name = "range-check-streams-and-iterators", category = {"performance", "remove"}) ++ public static boolean removeRangeCheckStreams = true; ++ ++ @GlobalConfig(name = "damage-lambda", category = {"performance", "remove"}) ++ public static boolean removeDamageLambda = true; ++ ++ // Leaves - performance remove end ++ ++ @GlobalConfig(name = "optimized-dragon-respawn", category = "performance") + public static boolean optimizedDragonRespawn = false; -+ private static void optimizedDragonRespawn() { -+ optimizedDragonRespawn = getBoolean("settings.performance.optimized-dragon-respawn", optimizedDragonRespawn); -+ } + -+ public static boolean mendingCompatibilityInfinity = false; -+ private static void mendingCompatibilityInfinity() { -+ mendingCompatibilityInfinity = getBoolean("settings.modify.minecraft-old.mending-compatibility-infinity", mendingCompatibilityInfinity); -+ } ++ @GlobalConfig(name = "dont-send-useless-entity-packets", category = "performance") ++ public static boolean dontSendUselessEntityPackets = true; + -+ public static boolean shaveSnowLayers = true; -+ private static void shaveSnowLayers() { -+ shaveSnowLayers = getBoolean("settings.modify.shave-snow-layers", shaveSnowLayers); -+ } ++ @GlobalConfig(name = "optimize-entity-coordinate-key", category = "performance") ++ public static boolean optimizeEntityCoordinateKey = true; + -+ public static boolean ignoreLC = false; -+ private static void ignoreLC() { -+ ignoreLC = getBoolean("settings.modify.ignore-lc", ignoreLC); -+ } ++ @GlobalConfig(name = "enable-suffocation-optimization", category = "performance") ++ public static boolean enableSuffocationOptimization = true; + -+ public static boolean elytraAeronauticsNoChunk = false; -+ public static double elytraAeronauticsNoChunkHeight = 500.0D; -+ public static double elytraAeronauticsNoChunkSpeed = -1.0D; -+ public static boolean elytraAeronauticsNoChunkMes = true; -+ public static String elytraAeronauticsNoChunkStartMes = "Flight enter cruise mode"; -+ public static String elytraAeronauticsNoChunkEndMes = "Flight exit cruise mode"; -+ private static void elytraAeronautics() { -+ elytraAeronauticsNoChunk = getBoolean("settings.modify.elytra-aeronautics.no-chunk-load", elytraAeronauticsNoChunk); -+ elytraAeronauticsNoChunkHeight = getDouble("settings.modify.elytra-aeronautics.no-chunk-height", elytraAeronauticsNoChunkHeight); -+ elytraAeronauticsNoChunkSpeed = getDouble("settings.modify.elytra-aeronautics.no-chunk-speed", elytraAeronauticsNoChunkSpeed); -+ elytraAeronauticsNoChunkMes = getBoolean("settings.modify.elytra-aeronautics.message", elytraAeronauticsNoChunkMes); -+ elytraAeronauticsNoChunkStartMes = getString("settings.modify.elytra-aeronautics.message-start", elytraAeronauticsNoChunkStartMes); -+ elytraAeronauticsNoChunkEndMes = getString("settings.modify.elytra-aeronautics.message-end", elytraAeronauticsNoChunkEndMes); -+ } ++ @GlobalConfig(name = "strip-raytracing-for-entity", category = "performance") ++ public static boolean entityStripRaytracing = true; + -+ public static boolean msptSyncProtocol = false; -+ public static int msptSyncTickInterval = 20; -+ private static void msptSyncProtocol() { -+ msptSyncTickInterval = getInt("settings.protocol.bladeren.mspt-sync-tick-interval", msptSyncTickInterval); -+ msptSyncProtocol = getBoolean("settings.protocol.bladeren.mspt-sync-protocol", msptSyncProtocol); -+ } ++ @GlobalConfig(name = "check-spooky-season-once-an-hour", category = "performance") ++ public static boolean checkSpookySeasonOnceAnHour = true; + -+ public static boolean fixPaper9372 = true; -+ private static void fixPaper9372() { -+ fixPaper9372 = getBoolean("settings.performance.fix.fix-paper-9372", fixPaper9372); -+ } ++ @GlobalConfig(name = "optimize-chunk-ticking", category = "performance", lock = true) ++ public static boolean optimizeChunkTicking = true; + -+ public static boolean cacheIgniteOdds = true; -+ private static void cacheIgniteOdds() { -+ cacheIgniteOdds = getBoolean("settings.performance.cache-ignite-odds", cacheIgniteOdds); -+ } ++ @GlobalConfig(name = "skip-poi-find-in-vehicle", category = "performance") ++ public static boolean skipPOIFindingInVehicle = true; + -+ public static boolean lavaRiptide = false; -+ private static void lavaRiptide() { -+ lavaRiptide = getBoolean("settings.modify.lava-riptide", lavaRiptide); -+ } ++ @GlobalConfig(name = "entity-target-find-optimization", category = "performance") ++ public static boolean entityTargetFindingOptimization = true; + -+ public static boolean noBlockUpdateCommand = false; -+ private static void noBlockUpdateCommand() { -+ noBlockUpdateCommand = getBoolean("settings.modify.no-block-update-command", noBlockUpdateCommand); -+ } ++ @GlobalConfig(name = "use-more-thread-unsafe-random", category = "performance") ++ public static boolean useMoreThreadUnsafeRandom = true; + -+ public static boolean skipSelfRaidCheck = false; -+ private static void skipSelfRaidCheck() { -+ skipSelfRaidCheck = getBoolean("settings.modify.raider-die-skip-self-raid-check", skipSelfRaidCheck); -+ } ++ @GlobalConfig(name = "inactive-goal-selector-disable", category = "performance") ++ public static boolean throttleInactiveGoalSelectorTick = false; + -+ public static boolean containerPassthrough = false; -+ private static void containerPassthrough() { -+ containerPassthrough = getBoolean("settings.modify.container-passthrough", containerPassthrough); -+ } ++ @GlobalConfig(name = "reduce-entity-allocations", category = "performance") ++ public static boolean reduceEntityAllocations = true; + -+ public static boolean dontRespondPingBeforeStart = true; -+ private static void dontRespondPingBeforeStart() { -+ dontRespondPingBeforeStart = getBoolean("settings.misc.dont-respond-ping-before-start-fully", dontRespondPingBeforeStart); -+ } ++ @GlobalConfig(name = "cache-climb-check", category = "performance") ++ public static boolean cacheClimbCheck = true; ++ ++ @GlobalConfig(name = "biome-temperatures-use-aging-cache", category = "performance", lock = true) ++ public static boolean biomeTemperaturesUseAgingCache = true; ++ ++ @GlobalConfig(name = "reduce-entity-fluid-lookup", category = "performance") ++ public static boolean reduceEntityFluidLookup = true; ++ ++ @GlobalConfig(name = "reduce-chuck-load-and-lookup", category = "performance") ++ public static boolean reduceChuckLoadAndLookup = true; ++ ++ @GlobalConfig(name = "improve-fluid-direction-caching", category = "performance", lock = true) ++ public static boolean improveFluidDirectionCaching = true; + ++ @GlobalConfig(name = "cache-ignite-odds", category = "performance") ++ public static boolean cacheIgniteOdds = true; ++ ++ @GlobalConfig(name = "faster-chunk-serialization", category = "performance") + public static boolean fasterChunkSerialization = true; -+ private static void fasterChunkSerialization() { -+ fasterChunkSerialization = getBoolean("settings.performance.faster-chunk-serialization", fasterChunkSerialization); -+ } + ++ @GlobalConfig(name = "optimize-world-generation-and-block-access", category = "performance") + public static boolean optimizeWorldGenerationAccess = true; -+ private static void optimizeWorldGenerationAccess() { -+ optimizeWorldGenerationAccess = getBoolean("settings.performance.optimize-world-generation-and-block-access", optimizeWorldGenerationAccess); -+ } + ++ @GlobalConfig(name = "cache-world-generator-sea-level", category = "performance") + public static boolean cacheWorldGeneratorSeaLevel = true; -+ private static void cacheWorldGeneratorSeaLevel() { -+ cacheWorldGeneratorSeaLevel = getBoolean("settings.performance.cache-world-generator-sea-level", cacheWorldGeneratorSeaLevel); -+ } + ++ @GlobalConfig(name = "skip-secondary-POI-sensor-if-absent", category = "performance") + public static boolean skipSecondaryPOISensorIfAbsent = true; -+ private static void skipSecondaryPOISensorIfAbsent() { -+ skipSecondaryPOISensorIfAbsent = getBoolean("settings.performance.skip-secondary-POI-sensor-if-absent", skipSecondaryPOISensorIfAbsent); -+ } + ++ @GlobalConfig(name = "cache-CubeVoxelShape-shape-array", category = "performance") + public static boolean cacheCubeVoxelShapeShapeArray = true; -+ private static void cacheCubeVoxelShapeShapeArray() { -+ cacheCubeVoxelShapeShapeArray = getBoolean("settings.performance.cache-CubeVoxelShape-shape-array", cacheCubeVoxelShapeShapeArray); -+ } + ++ @GlobalConfig(name = "store-mob-counts-in-array", category = "performance") + public static boolean storeMobCountsInArray = true; -+ private static void storeMobCountsInArray() { -+ storeMobCountsInArray = getBoolean("settings.performance.store-mob-counts-in-array", storeMobCountsInArray); -+ } + ++ @GlobalConfig(name = "cache-BlockStatePairKey-hash", category = "performance") + public static boolean cacheBlockStatePairKeyHash = true; -+ private static void cacheBlockStatePairKeyHash() { -+ cacheBlockStatePairKeyHash = getBoolean("settings.performance.cache-BlockStatePairKey-hash", cacheBlockStatePairKeyHash); -+ } + ++ @GlobalConfig(name = "optimize-noise-generation", category = "performance") + public static boolean optimizeNoiseGeneration = false; -+ private static void optimizeNoiseGeneration() { -+ optimizeNoiseGeneration = getBoolean("settings.performance.optimize-noise-generation", optimizeNoiseGeneration); -+ } -+ -+ public static boolean disablePacketLimit = false; -+ private static void disablePacketLimit() { -+ disablePacketLimit = getBoolean("settings.modify.disable-packet-limit", disablePacketLimit); -+ } + ++ @GlobalConfig(name = "optimize-sun-burn-tick", category = "performance") + public static boolean optimizeSunBurnTick = true; -+ private static void optimizeSunBurnTick() { -+ optimizeSunBurnTick = getBoolean("settings.performance.optimize-sun-burn-tick", optimizeSunBurnTick); -+ } -+ -+ public static boolean removeDamageLambda = true; -+ private static void removeDamageLambda() { -+ removeDamageLambda = getBoolean("settings.performance.remove.damage-lambda", removeDamageLambda); -+ } + ++ @GlobalConfig(name = "use-optimized-collection", category = "performance") + public static boolean useOptimizedCollection = true; -+ private static void useOptimizedCollection() { -+ useOptimizedCollection = getBoolean("settings.performance.use-optimized-collection", useOptimizedCollection); -+ } + ++ @GlobalConfig(name = "optimized-CubePointRange", category = "performance") + public static boolean optimizedCubePointRange = true; -+ private static void optimizedCubePointRange() { -+ optimizedCubePointRange = getBoolean("settings.performance.optimized-CubePointRange", optimizedCubePointRange); -+ } + ++ @GlobalConfig(name = "check-frozen-ticks-before-landing-block", category = "performance") + public static boolean checkFrozenTicksBeforeLandingBlock = true; -+ private static void checkFrozenTicksBeforeLandingBlock() { -+ checkFrozenTicksBeforeLandingBlock = getBoolean("settings.performance.check-frozen-ticks-before-landing-block", checkFrozenTicksBeforeLandingBlock); -+ } + ++ @GlobalConfig(name = "cache-ominous-banner-item", category = "performance") + public static boolean cacheOminousBannerItem = true; -+ private static void cacheOminousBannerItem() { -+ cacheOminousBannerItem = getBoolean("settings.performance.cache-ominous-banner-item", cacheOminousBannerItem); -+ } + ++ @GlobalConfig(name = "skip-entity-move-if-movement-is-zero", category = "performance") + public static boolean skipEntityMoveIfMovementIsZero = true; -+ private static void skipEntityMoveIfMovementIsZero() { -+ skipEntityMoveIfMovementIsZero = getBoolean("settings.performance.skip-entity-move-if-movement-is-zero", skipEntityMoveIfMovementIsZero); -+ } + ++ @GlobalConfig(name = "skip-cloning-advancement-criteria", category = "performance") + public static boolean skipCloningAdvancementCriteria = false; -+ private static void skipCloningAdvancementCriteria() { -+ skipCloningAdvancementCriteria = getBoolean("settings.performance.skip-cloning-advancement-criteria", skipCloningAdvancementCriteria); -+ } + ++ @GlobalConfig(name = "skip-negligible-planar-movement-multiplication", category = "performance") + public static boolean skipNegligiblePlanarMovementMultiplication = true; -+ private static void skipNegligiblePlanarMovementMultiplication() { -+ skipNegligiblePlanarMovementMultiplication = getBoolean("settings.performance.skip-negligible-planar-movement-multiplication", skipNegligiblePlanarMovementMultiplication); -+ } + ++ @GlobalConfig(name = "fix-villagers-dont-release-memory", category = "performance") + public static boolean villagersDontReleaseMemoryFix = false; -+ private static void villagersDontReleaseMemoryFix() { -+ villagersDontReleaseMemoryFix = getBoolean("settings.performance.fix-villagers-dont-release-memory", villagersDontReleaseMemoryFix); -+ } + -+ public static boolean avoidAnvilTooExpensive = false; -+ private static void avoidAnvilTooExpensive() { -+ avoidAnvilTooExpensive = getBoolean("settings.modify.avoid-anvil-too-expensive", avoidAnvilTooExpensive); -+ } ++ // Leaves - performance removed start + -+ public static boolean bowInfinityFix = false; -+ private static void bowInfinityFix() { -+ bowInfinityFix = getBoolean("settings.modify.bow-infinity-fix", bowInfinityFix); -+ } ++ @RemovedConfig ++ @GlobalConfig(name = "async-pathfinding", category = "performance") ++ public static boolean asyncPathfinding = false; + -+ public static boolean zeroTickPlants = false; -+ private static void zeroTickPlants() { -+ zeroTickPlants = getBoolean("settings.modify.minecraft-old.zero-tick-plants", zeroTickPlants); -+ } ++ @RemovedConfig ++ @GlobalConfig(name = "async-mob-spawning", category = "performance") ++ public static boolean asyncMobSpawning = false; + -+ public static boolean bstatsPrivacyMode = false; -+ private static void bstatsPrivacyMode() { -+ bstatsPrivacyMode = getBoolean("settings.misc.bstats-privacy-mode", bstatsPrivacyMode); ++ @RemovedConfig ++ @GlobalConfig(name = "async-entity-tracker", category = "performance") ++ public static boolean asyncEntityTracker = false; ++ ++ // Leaves - performance removed end ++ ++ // Leaves - performance end ++ ++ // Leaves - protocol start ++ ++ // Leaves - protocol bladeren start ++ ++ @GlobalConfig(name = "protocol", category = {"protocol", "bladeren"}) ++ public static boolean bladerenLeavesProtocol = true; ++ ++ @GlobalConfig(name = "mspt-sync-protocol", category = {"protocol", "bladeren"}, verify = MSPTSyncVerify.class) ++ public static boolean msptSyncProtocol = false; ++ ++ private static class MSPTSyncVerify extends ConfigVerify.BooleanConfigVerify { ++ @Override ++ public String check(Boolean old, Boolean value) { ++ LeavesFeatureSet.register(LeavesFeature.of("mspt_sync", value)); ++ return null; ++ } + } + -+ public static boolean autoUpdate = false; -+ public static List autoUpdateTime = List.of("14:00","2:00"); -+ private static void autoUpdate() { -+ autoUpdate = getBoolean("settings.misc.auto-update.enable", autoUpdate); -+ autoUpdateTime = getList("settings.misc.auto-update.time", autoUpdateTime); -+ if (autoUpdate) { -+ LeavesLogger.LOGGER.warning("Auto-Update is not completely safe. Enabling it may cause data security problems!"); ++ @GlobalConfig(name = "mspt-sync-tick-interval", category = {"protocol", "bladeren"}, verify = MSPTSyncIntervalVerify.class) ++ public static int msptSyncTickInterval = 20; ++ ++ private static class MSPTSyncIntervalVerify extends ConfigVerify.IntConfigVerify { ++ @Override ++ public String check(Integer old, Integer value) { ++ return value > 0 ? null : "mspt-sync-tick-interval need > 0"; + } + } + -+ public static String serverLang = "en_us"; -+ private static final List supportLang = List.of("en_us", "zh_cn"); -+ private static void serverLang() { -+ serverLang = getString("settings.misc.server-lang", serverLang); -+ if (!supportLang.contains(serverLang)) { -+ serverLang = "en_us"; -+ LeavesLogger.LOGGER.severe("server-lang value error, reset to en_us"); ++ // Leaves - protocol bladeren end ++ ++ // Leaves - protocol syncmatica start ++ ++ @GlobalConfig(name = "enable", category = {"protocol", "syncmatica"}, verify = SyncmaticaVerify.class) ++ public static boolean syncmaticaProtocol = false; ++ ++ @GlobalConfig(name = "quota", category = {"protocol", "syncmatica"}) ++ public static boolean syncmaticaQuota = false; ++ ++ @GlobalConfig(name = "quota-limit", category = {"protocol", "syncmatica"}, verify = ConfigVerify.IntConfigVerify.class) ++ public static int syncmaticaQuotaLimit = 40000000; ++ ++ public static class SyncmaticaVerify extends ConfigVerify.BooleanConfigVerify { ++ @Override ++ public String check(Boolean old, Boolean value) { ++ if (value) { ++ top.leavesmc.leaves.protocol.syncmatica.SyncmaticaProtocol.init(); ++ } ++ return null; + } + } + -+ public static String serverModName = "Leaves"; -+ private static void serverModName(){ -+ serverModName = getString("settings.misc.server-mod-name", serverModName); -+ } ++ // Leaves - protocol syncmatica end + -+ public static boolean tickCommand = false; -+ private static void tickCommand() { -+ tickCommand = getBoolean("settings.modify.tick-command", tickCommand); -+ } ++ @GlobalConfig(name = "pca-sync-protocol", category = "protocol") ++ public static boolean pcaSyncProtocol = false; + -+ public static boolean bladerenLeavesProtocol = true; -+ private static void bladerenLeavesProtocol() { -+ bladerenLeavesProtocol = getBoolean("settings.protocol.bladeren.protocol", bladerenLeavesProtocol); -+ } ++ @GlobalConfig(name = "pca-sync-player-entity", category = "protocol", verify = PcaPlayerEntityVerify.class) ++ public static String pcaSyncPlayerEntity = "OPS"; + -+ public static void registerLeavesFeatures() { -+ } ++ private static class PcaPlayerEntityVerify extends ConfigVerify.StringConfigVerify { ++ private static final List pcaSyncPlayerEntityList = List.of("NOBODY", "BOT", "OPS", "OPS_AND_SELF", "EVERYONE"); + -+ public static boolean hopperCounter = false; -+ private static void hopperCounter() { -+ hopperCounter = getBoolean("settings.modify.hopper-counter", hopperCounter); ++ @Override ++ public String check(String old, String value) { ++ if (!pcaSyncPlayerEntityList.contains(value)) { ++ return "pca-sync-player-entity value error"; ++ } ++ return null; ++ } + } + -+ public static boolean lootWorldRandom = false; -+ private static void lootWorldRandom() { -+ lootWorldRandom = getBoolean("settings.modify.minecraft-old.loot-world-random", lootWorldRandom); -+ } ++ @GlobalConfig(name = "bbor-protocol", category = "protocol") ++ public static boolean bborProtocol = false; + -+ public static double spiderJockeysDropGapples = -1.0; -+ private static void spiderJockeysDropGapples() { -+ spiderJockeysDropGapples = getDouble("settings.modify.spider-jockeys-drop-gapples", spiderJockeysDropGapples); -+ } ++ @GlobalConfig(name = "jade-protocol", category = "protocol") ++ public static boolean jadeProtocol = false; + -+ public static boolean servuxProtocol = false; -+ private static void servuxProtocol() { -+ servuxProtocol = getBoolean("settings.protocol.servux-protocol", servuxProtocol); -+ } ++ @GlobalConfig(name = "alternative-block-placement", category = "protocol", verify = AlternativePlaceVerify.class) ++ public static String alternativeBlockPlacement = "NONE"; + -+ public static boolean forceVoidTrade = false; -+ private static void forceVoidTrade() { -+ forceVoidTrade = getBoolean("settings.modify.force-void-trade", forceVoidTrade); -+ } + -+ public static boolean cceUpdateSuppression = false; -+ private static void cceUpdateSuppression() { -+ cceUpdateSuppression = getBoolean("settings.modify.minecraft-old.cce-update-suppression", cceUpdateSuppression); -+ } ++ private static class AlternativePlaceVerify extends ConfigVerify.StringConfigVerify { ++ private static final List alternativeBlockPlacementType = List.of("NONE", "CARPET", "CARPET_FIX", "LITEMATICA"); + -+ public static boolean villagerInfiniteDiscounts = false; -+ private static void villagerInfiniteDiscounts() { -+ villagerInfiniteDiscounts = getBoolean("settings.modify.minecraft-old.villager-infinite-discounts", villagerInfiniteDiscounts); -+ if (villagerInfiniteDiscounts) { ++ @Override ++ public String check(String old, String value) { ++ if (!alternativeBlockPlacementType.contains(value)) { ++ return "alternative-block-placement value error"; ++ } ++ return null; + } + } + -+ public static boolean disableMovedWronglyThreshold = false; -+ private static void disableMovedWronglyThreshold() { -+ disableMovedWronglyThreshold = getBoolean("settings.modify.disable-moved-wrongly-threshold", disableMovedWronglyThreshold); -+ } ++ @GlobalConfig(name = "appleskin-protocol", category = "protocol") ++ public static boolean appleskinProtocol = false; + -+ public static boolean armorStandCantKillByMobProjectile = false; -+ private static void armorStandCantKillByMobProjectile() { -+ armorStandCantKillByMobProjectile = getBoolean("settings.modify.minecraft-old.armor-stand-cant-kill-by-mob-projectile", armorStandCantKillByMobProjectile); -+ } ++ @GlobalConfig(name = "xaero-map-protocol", category = "protocol") ++ public static boolean xaeroMapProtocol = false; + -+ public static boolean copperBulb1gt = false; -+ private static void copperBulb1gt() { -+ copperBulb1gt = getBoolean("settings.modify.minecraft-old.copper-bulb-1gt-delay", copperBulb1gt); -+ } ++ @GlobalConfig(name = "xaero-map-server-id", category = "protocol", verify = ConfigVerify.IntConfigVerify.class) ++ public static int xaeroMapServerID = new Random().nextInt(); + -+ public static boolean crafter1gt = false; -+ private static void crafter1gt() { -+ crafter1gt = getBoolean("settings.modify.minecraft-old.crafter-1gt-delay", crafter1gt); -+ } ++ @GlobalConfig(name = "servux-protocol", category = "protocol") ++ public static boolean servuxProtocol = false; + -+ public static final class WorldConfig { ++ @GlobalConfig(name = "leaves-carpet-support", category = "protocol") ++ public static boolean leavesCarpetSupport = false; + -+ public final String worldName; -+ public String configPath; -+ ConfigurationSection worldDefaults; ++ // Leaves - protocol end + -+ public WorldConfig(final String worldName) { -+ this.worldName = worldName; -+ this.init(); -+ } ++ // Leaves - misc start + -+ public void init() { -+ this.worldDefaults = LeavesConfig.config.getConfigurationSection("world-settings.default"); -+ if (this.worldDefaults == null) { -+ this.worldDefaults = LeavesConfig.config.createSection("world-settings.default"); -+ } ++ // Leaves - misc auto-update start + -+ String worldSectionPath = LeavesConfig.configVersion < CURRENT_CONFIG_VERSION ? this.worldName : "world-settings.".concat(this.worldName); -+ ConfigurationSection section = LeavesConfig.config.getConfigurationSection(worldSectionPath); -+ this.configPath = worldSectionPath; -+ if (LeavesConfig.createWorldSections) { -+ if (section == null) { -+ section = LeavesConfig.config.createSection(worldSectionPath); -+ } -+ LeavesConfig.config.set(worldSectionPath, section); -+ } ++ @GlobalConfig(name = "enable", category = {"misc", "auto-update"}, lock = true, verify = AutoUpdateVerify.class) ++ public static boolean autoUpdate = false; + -+ this.load(); ++ private static class AutoUpdateVerify extends ConfigVerify.BooleanConfigVerify { ++ @Override ++ public void runAfterLoader(Boolean value) { ++ top.leavesmc.leaves.util.LeavesUpdateHelper.init(); ++ if (value) { ++ LeavesLogger.LOGGER.warning("Auto-Update is not completely safe. Enabling it may cause data security problems!"); ++ } + } ++ } + -+ public void load() { -+ for (final Method method : LeavesConfig.WorldConfig.class.getDeclaredMethods()) { -+ if (method.getReturnType() != void.class || method.getParameterCount() != 0 || -+ !Modifier.isPrivate(method.getModifiers()) || Modifier.isStatic(method.getModifiers())) { -+ continue; -+ } ++ @GlobalConfig(name = "time", category = {"misc", "auto-update"}, lock = true, verify = ConfigVerify.ListConfigVerify.class) ++ public static List autoUpdateTime = List.of("14:00", "2:00"); + -+ try { -+ method.setAccessible(true); -+ method.invoke(this, EMPTY); -+ } catch (final Exception ex) { -+ SneakyThrow.sneaky(ex); /* Rethrow, this is critical */ -+ throw new RuntimeException(ex); // unreachable -+ } -+ } ++ // Leaves - misc auto-update end + -+ if (LeavesConfig.configVersion < CURRENT_CONFIG_VERSION) { -+ ConfigurationSection oldSection = LeavesConfig.config.getConfigurationSection(this.worldName); -+ LeavesConfig.config.set("world-settings.".concat(this.worldName), oldSection); -+ LeavesConfig.config.set(this.worldName, null); -+ } ++ // Leaves - misc extra-yggdrasil-service start + -+ /* We re-save to add new options */ -+ try { -+ LeavesConfig.config.save(LeavesConfig.configFile); -+ } catch (final Exception ex) { -+ Bukkit.getLogger().log(Level.SEVERE, "Unable to save leaves config", ex); -+ } -+ } ++ @GlobalConfig(name = "enable", category = {"misc", "extra-yggdrasil-service"}, verify = ExtraYggdrasilVerify.class) ++ public static boolean extraYggdrasilService = false; + -+ void set(final String path, final Object val) { -+ final ConfigurationSection config = LeavesConfig.config.getConfigurationSection(this.configPath); -+ this.worldDefaults.set(path, val); -+ if (config != null && config.get(path) != null) { -+ config.set(path, val); ++ public static class ExtraYggdrasilVerify extends ConfigVerify.BooleanConfigVerify { ++ @Override ++ public String check(Boolean old, Boolean value) { ++ if (value) { ++ LeavesLogger.LOGGER.warning("extra-yggdrasil-service is an unofficial support. Enabling it may cause data security problems!"); ++ GlobalConfiguration.get().unsupportedSettings.performUsernameValidation = true; // always check username + } ++ return null; + } ++ } + -+ boolean getBoolean(final String path, final boolean dfl) { -+ final ConfigurationSection config = LeavesConfig.config.getConfigurationSection(this.configPath); -+ this.worldDefaults.addDefault(path, Boolean.valueOf(dfl)); -+ if (LeavesConfig.configVersion < CURRENT_CONFIG_VERSION) { -+ if (config != null && config.getBoolean(path) == dfl) { -+ config.set(path, null); -+ } -+ } -+ return config == null ? this.worldDefaults.getBoolean(path) : config.getBoolean(path, this.worldDefaults.getBoolean(path)); -+ } ++ @GlobalConfig(name = "login-protect", category = {"misc", "extra-yggdrasil-service"}) ++ public static boolean extraYggdrasilLoginProtect = false; + -+ boolean getBooleanRaw(final String path, final boolean dfl) { -+ final ConfigurationSection config = LeavesConfig.config.getConfigurationSection(this.configPath); -+ if (LeavesConfig.configVersion < CURRENT_CONFIG_VERSION) { -+ if (config != null && config.getBoolean(path) == dfl) { -+ config.set(path, null); -+ } -+ } -+ return config == null ? this.worldDefaults.getBoolean(path, dfl) : config.getBoolean(path, this.worldDefaults.getBoolean(path, dfl)); -+ } ++ @GlobalConfig(name = "urls", category = {"misc", "extra-yggdrasil-service"}, verify = ExtraYggdrasilUrlsVerify.class) ++ public static List extraYggdrasilServiceList = List.of("https://url.with.authlib-injector-yggdrasil"); + -+ int getInt(final String path, final int dfl) { -+ final ConfigurationSection config = LeavesConfig.config.getConfigurationSection(this.configPath); -+ this.worldDefaults.addDefault(path, Integer.valueOf(dfl)); -+ if (LeavesConfig.configVersion < CURRENT_CONFIG_VERSION) { -+ if (config != null && config.getInt(path) == dfl) { -+ config.set(path, null); -+ } -+ } -+ return config == null ? this.worldDefaults.getInt(path) : config.getInt(path, this.worldDefaults.getInt(path)); ++ public static class ExtraYggdrasilUrlsVerify extends ConfigVerify.ListConfigVerify { ++ @Override ++ public String check(List old, List value) { ++ top.leavesmc.leaves.profile.LeavesMinecraftSessionService.initExtraYggdrasilList(); ++ return null; + } ++ } + -+ int getIntRaw(final String path, final int dfl) { -+ final ConfigurationSection config = LeavesConfig.config.getConfigurationSection(this.configPath); -+ if (LeavesConfig.configVersion < CURRENT_CONFIG_VERSION) { -+ if (config != null && config.getInt(path) == dfl) { -+ config.set(path, null); -+ } -+ } -+ return config == null ? this.worldDefaults.getInt(path, dfl) : config.getInt(path, this.worldDefaults.getInt(path, dfl)); -+ } ++ // Leaves - misc extra-yggdrasil-service end + -+ long getLong(final String path, final long dfl) { -+ final ConfigurationSection config = LeavesConfig.config.getConfigurationSection(this.configPath); -+ this.worldDefaults.addDefault(path, Long.valueOf(dfl)); -+ if (LeavesConfig.configVersion < CURRENT_CONFIG_VERSION) { -+ if (config != null && config.getLong(path) == dfl) { -+ config.set(path, null); -+ } -+ } -+ return config == null ? this.worldDefaults.getLong(path) : config.getLong(path, this.worldDefaults.getLong(path)); -+ } ++ @GlobalConfig(name = "disable-method-profiler", category = "misc") ++ public static boolean disableMethodProfiler = true; + -+ long getLongRaw(final String path, final long dfl) { -+ final ConfigurationSection config = LeavesConfig.config.getConfigurationSection(this.configPath); -+ if (LeavesConfig.configVersion < CURRENT_CONFIG_VERSION) { -+ if (config != null && config.getLong(path) == dfl) { -+ config.set(path, null); -+ } -+ } -+ return config == null ? this.worldDefaults.getLong(path, dfl) : config.getLong(path, this.worldDefaults.getLong(path, dfl)); -+ } ++ @GlobalConfig(name = "no-chat-sign", category = "misc") ++ public static boolean noChatSign = true; + -+ double getDouble(final String path, final double dfl) { -+ final ConfigurationSection config = LeavesConfig.config.getConfigurationSection(this.configPath); -+ this.worldDefaults.addDefault(path, Double.valueOf(dfl)); -+ if (LeavesConfig.configVersion < CURRENT_CONFIG_VERSION) { -+ if (config != null && config.getDouble(path) == dfl) { -+ config.set(path, null); -+ } -+ } -+ return config == null ? this.worldDefaults.getDouble(path) : config.getDouble(path, this.worldDefaults.getDouble(path)); -+ } ++ @GlobalConfig(name = "dont-respond-ping-before-start-fully", category = "misc") ++ public static boolean dontRespondPingBeforeStart = true; + -+ double getDoubleRaw(final String path, final double dfl) { -+ final ConfigurationSection config = LeavesConfig.config.getConfigurationSection(this.configPath); -+ if (LeavesConfig.configVersion < CURRENT_CONFIG_VERSION) { -+ if (config != null && config.getDouble(path) == dfl) { -+ config.set(path, null); -+ } -+ } -+ return config == null ? this.worldDefaults.getDouble(path, dfl) : config.getDouble(path, this.worldDefaults.getDouble(path, dfl)); -+ } ++ @GlobalConfig(name = "server-lang", category = "misc", lock = true, verify = ServerLangVerify.class) ++ public static String serverLang = "en_us"; + -+ String getString(final String path, final String dfl) { -+ final ConfigurationSection config = LeavesConfig.config.getConfigurationSection(this.configPath); -+ this.worldDefaults.addDefault(path, dfl); -+ return config == null ? this.worldDefaults.getString(path) : config.getString(path, this.worldDefaults.getString(path)); -+ } ++ private static class ServerLangVerify extends ConfigVerify.StringConfigVerify { ++ private static final List supportLang = List.of("en_us", "zh_cn"); + -+ String getStringRaw(final String path, final String dfl) { -+ final ConfigurationSection config = LeavesConfig.config.getConfigurationSection(this.configPath); -+ return config == null ? this.worldDefaults.getString(path, dfl) : config.getString(path, this.worldDefaults.getString(path, dfl)); ++ @Override ++ public String check(String old, String value) { ++ if (!supportLang.contains(value)) { ++ return "server-lang value error"; ++ } ++ return null; + } ++ } + -+ List getList(final String path, final List dfl) { -+ final ConfigurationSection config = LeavesConfig.config.getConfigurationSection(this.configPath); -+ this.worldDefaults.addDefault(path, dfl); -+ return config == null ? this.worldDefaults.getList(path) : config.getList(path, this.worldDefaults.getList(path)); -+ } ++ @GlobalConfig(name = "server-mod-name", category = "misc", verify = ConfigVerify.StringConfigVerify.class) ++ public static String serverModName = "Leaves"; + -+ List getListRaw(final String path, final List dfl) { -+ final ConfigurationSection config = LeavesConfig.config.getConfigurationSection(this.configPath); -+ return config == null ? this.worldDefaults.getList(path, dfl) : config.getList(path, this.worldDefaults.getList(path, dfl)); -+ } -+ } ++ @GlobalConfig(name = "bstats-privacy-mode", category = "misc") ++ public static boolean bstatsPrivacyMode = false; ++ ++ // Leaves - misc end +} diff --git a/src/main/java/top/leavesmc/leaves/command/CommandArgument.java b/src/main/java/top/leavesmc/leaves/command/CommandArgument.java new file mode 100644 @@ -1356,10 +1059,10 @@ index 0000000000000000000000000000000000000000..edf12195c7224ca2fb5d3c2ac3fcf485 +} diff --git a/src/main/java/top/leavesmc/leaves/command/LeavesCommand.java b/src/main/java/top/leavesmc/leaves/command/LeavesCommand.java new file mode 100644 -index 0000000000000000000000000000000000000000..e89bf96486c87cdff6c1a425afd10d744376c77f +index 0000000000000000000000000000000000000000..9b6fb546a672fa5b27047fec638e42b2b5dbf533 --- /dev/null +++ b/src/main/java/top/leavesmc/leaves/command/LeavesCommand.java -@@ -0,0 +1,116 @@ +@@ -0,0 +1,118 @@ +package top.leavesmc.leaves.command; + +import io.papermc.paper.command.CommandUtil; @@ -1374,6 +1077,7 @@ index 0000000000000000000000000000000000000000..e89bf96486c87cdff6c1a425afd10d74 +import org.bukkit.plugin.PluginManager; +import org.checkerframework.checker.nullness.qual.Nullable; +import org.jetbrains.annotations.NotNull; ++import top.leavesmc.leaves.command.subcommands.ConfigCommand; + +import java.util.ArrayList; +import java.util.Arrays; @@ -1393,6 +1097,7 @@ index 0000000000000000000000000000000000000000..e89bf96486c87cdff6c1a425afd10d74 + // subcommand label -> subcommand + private static final Map SUBCOMMANDS = Util.make(() -> { + final Map, LeavesSubcommand> commands = new HashMap<>(); ++ commands.put(Set.of("config"), new ConfigCommand()); + + return commands.entrySet().stream() + .flatMap(entry -> entry.getKey().stream().map(s -> Map.entry(s, entry.getValue()))) @@ -1500,3 +1205,343 @@ index 0000000000000000000000000000000000000000..7ba1b573c8e49cc0838c25bc26687d14 + return true; + } +} +diff --git a/src/main/java/top/leavesmc/leaves/command/subcommands/ConfigCommand.java b/src/main/java/top/leavesmc/leaves/command/subcommands/ConfigCommand.java +new file mode 100644 +index 0000000000000000000000000000000000000000..205e563ed4b3f59e294c2866952c73d22bd367b0 +--- /dev/null ++++ b/src/main/java/top/leavesmc/leaves/command/subcommands/ConfigCommand.java +@@ -0,0 +1,86 @@ ++package top.leavesmc.leaves.command.subcommands; ++ ++import io.papermc.paper.command.CommandUtil; ++import net.kyori.adventure.text.Component; ++import net.kyori.adventure.text.JoinConfiguration; ++import net.kyori.adventure.text.format.NamedTextColor; ++import org.bukkit.command.CommandSender; ++import top.leavesmc.leaves.command.LeavesSubcommand; ++import top.leavesmc.leaves.config.GlobalConfigManager; ++ ++import java.util.ArrayList; ++import java.util.Collections; ++import java.util.List; ++ ++public class ConfigCommand implements LeavesSubcommand { ++ ++ @Override ++ public boolean execute(CommandSender sender, String subCommand, String[] args) { ++ if (args.length < 1) { ++ sender.sendMessage(Component.text("Leaves Config", NamedTextColor.GRAY)); ++ return true; ++ } ++ ++ GlobalConfigManager.VerifiedConfig verifiedConfig = GlobalConfigManager.getVerifiedConfig(args[0]); ++ if (verifiedConfig == null) { ++ sender.sendMessage(Component.join(JoinConfiguration.noSeparators(), ++ Component.text("Config ", NamedTextColor.GRAY), ++ Component.text(args[0], NamedTextColor.RED), ++ Component.text(" is Not Found.", NamedTextColor.GRAY) ++ )); ++ return true; ++ } ++ ++ if (args.length > 1) { ++ try { ++ verifiedConfig.set(args[1]); ++ sender.sendMessage(Component.join(JoinConfiguration.noSeparators(), ++ Component.text("Config ", NamedTextColor.GRAY), ++ Component.text(args[0], NamedTextColor.AQUA), ++ Component.text(" changed to ", NamedTextColor.GRAY), ++ Component.text(verifiedConfig.getString(), NamedTextColor.AQUA) ++ )); ++ } catch (IllegalArgumentException exception) { ++ sender.sendMessage(Component.join(JoinConfiguration.noSeparators(), ++ Component.text("Config ", NamedTextColor.GRAY), ++ Component.text(args[0], NamedTextColor.RED), ++ Component.text(" modify error by ", NamedTextColor.GRAY), ++ Component.text(exception.getMessage(), NamedTextColor.RED) ++ )); ++ } ++ } else { ++ sender.sendMessage(Component.join(JoinConfiguration.noSeparators(), ++ Component.text("Config ", NamedTextColor.GRAY), ++ Component.text(args[0], NamedTextColor.AQUA), ++ Component.text(" value is ", NamedTextColor.GRAY), ++ Component.text(verifiedConfig.getString(), NamedTextColor.AQUA) ++ )); ++ } ++ ++ return true; ++ } ++ ++ @Override ++ public List tabComplete(CommandSender sender, String subCommand, String[] args) { ++ switch (args.length) { ++ case 1 -> { ++ List list = new ArrayList<>(GlobalConfigManager.getVerifiedConfigPaths()); ++ return CommandUtil.getListMatchingLast(sender, args, list); ++ } ++ ++ case 2 -> { ++ GlobalConfigManager.VerifiedConfig verifiedConfig = GlobalConfigManager.getVerifiedConfig(args[0]); ++ if (verifiedConfig != null) { ++ if (verifiedConfig.config().lock()) { ++ return Collections.singletonList(""); ++ } ++ return CommandUtil.getListMatchingLast(sender, args, verifiedConfig.verify().valueSuggest()); ++ } else { ++ return Collections.singletonList(""); ++ } ++ } ++ } ++ ++ return Collections.emptyList(); ++ } ++} +diff --git a/src/main/java/top/leavesmc/leaves/config/ConfigVerify.java b/src/main/java/top/leavesmc/leaves/config/ConfigVerify.java +new file mode 100644 +index 0000000000000000000000000000000000000000..6cd0d02ed56140752d40642d8fcf7dc51423210a +--- /dev/null ++++ b/src/main/java/top/leavesmc/leaves/config/ConfigVerify.java +@@ -0,0 +1,60 @@ ++package top.leavesmc.leaves.config; ++ ++import java.util.List; ++ ++public interface ConfigVerify { ++ ++ default String check(E old, E value) { ++ return null; ++ } ++ ++ E convert(String value); ++ ++ default List valueSuggest() { ++ return List.of(""); ++ } ++ ++ default void runAfterLoader(E value) { ++ } ++ ++ class BooleanConfigVerify implements ConfigVerify { ++ ++ @Override ++ public Boolean convert(String value) { ++ return Boolean.parseBoolean(value); ++ } ++ ++ @Override ++ public List valueSuggest() { ++ return List.of("false", "true"); ++ } ++ } ++ ++ class IntConfigVerify implements ConfigVerify { ++ @Override ++ public Integer convert(String value) { ++ return Integer.parseInt(value); ++ } ++ } ++ ++ class StringConfigVerify implements ConfigVerify { ++ @Override ++ public String convert(String value) { ++ return value; ++ } ++ } ++ ++ class DoubleConfigVerify implements ConfigVerify { ++ @Override ++ public Double convert(String value) { ++ return Double.parseDouble(value); ++ } ++ } ++ ++ class ListConfigVerify implements ConfigVerify> { ++ @Override ++ public List convert(String value) { ++ throw new IllegalArgumentException("not support"); // TODO ++ } ++ } ++} +diff --git a/src/main/java/top/leavesmc/leaves/config/GlobalConfig.java b/src/main/java/top/leavesmc/leaves/config/GlobalConfig.java +new file mode 100644 +index 0000000000000000000000000000000000000000..f6b946e5dfb5e3a2c169f88e8fb54718b0ca84ea +--- /dev/null ++++ b/src/main/java/top/leavesmc/leaves/config/GlobalConfig.java +@@ -0,0 +1,19 @@ ++package top.leavesmc.leaves.config; ++ ++import java.lang.annotation.ElementType; ++import java.lang.annotation.Retention; ++import java.lang.annotation.RetentionPolicy; ++import java.lang.annotation.Target; ++ ++@Target(ElementType.FIELD) ++@Retention(RetentionPolicy.RUNTIME) ++public @interface GlobalConfig { ++ ++ String name(); ++ ++ String[] category(); ++ ++ boolean lock() default false; ++ ++ Class> verify() default ConfigVerify.BooleanConfigVerify.class; ++} +diff --git a/src/main/java/top/leavesmc/leaves/config/GlobalConfigManager.java b/src/main/java/top/leavesmc/leaves/config/GlobalConfigManager.java +new file mode 100644 +index 0000000000000000000000000000000000000000..55899c275c496fc6441fbb15b22bb89406e587ae +--- /dev/null ++++ b/src/main/java/top/leavesmc/leaves/config/GlobalConfigManager.java +@@ -0,0 +1,133 @@ ++package top.leavesmc.leaves.config; ++ ++import org.bukkit.Bukkit; ++import top.leavesmc.leaves.LeavesConfig; ++import top.leavesmc.leaves.LeavesLogger; ++ ++import java.lang.reflect.Constructor; ++import java.lang.reflect.Field; ++import java.lang.reflect.Modifier; ++import java.util.HashMap; ++import java.util.Map; ++import java.util.Set; ++import java.util.logging.Level; ++ ++public class GlobalConfigManager { ++ ++ private static boolean firstLoad = true; ++ private static final Map verifiedConfigs = new HashMap<>(); ++ ++ public static void init() { ++ verifiedConfigs.clear(); ++ ++ Class clazz = LeavesConfig.class; ++ for (Field field : clazz.getDeclaredFields()) { ++ if (Modifier.isStatic(field.getModifiers())) { ++ GlobalConfig globalConfig = field.getAnnotation(GlobalConfig.class); ++ if (globalConfig != null) { ++ try { ++ VerifiedConfig verifiedConfig = VerifiedConfig.build(globalConfig, field); ++ if (field.getAnnotation(RemovedConfig.class) != null) { ++ LeavesConfig.config.set(verifiedConfig.path, null); ++ } else { ++ field.setAccessible(true); ++ if (globalConfig.lock() && !firstLoad) { ++ continue; ++ } ++ Object defValue = field.get(null); ++ LeavesConfig.config.addDefault(verifiedConfig.path, defValue); ++ ++ Object savedValue = LeavesConfig.config.get(verifiedConfig.path); ++ String checkInfo = verifiedConfig.verify.check(null, savedValue); ++ if (checkInfo == null) { ++ field.set(null, savedValue); ++ } else { ++ LeavesConfig.config.set(verifiedConfig.path, defValue); ++ LeavesLogger.LOGGER.warning(checkInfo + ", reset to " + defValue); ++ } ++ ++ verifiedConfigs.put(verifiedConfig.path.substring("settings.".length()), verifiedConfig); ++ } ++ } catch (Exception e) { ++ Bukkit.getLogger().log(Level.SEVERE, "Failure to load leaves config", e); ++ } ++ } ++ } ++ } ++ ++ verifiedConfigs.forEach((path, config) -> config.verify.runAfterLoader(config.get())); ++ ++ firstLoad = false; ++ LeavesConfig.save(); ++ } ++ ++ public static VerifiedConfig getVerifiedConfig(String path) { ++ return verifiedConfigs.get(path); ++ } ++ ++ public static Set getVerifiedConfigPaths() { ++ return verifiedConfigs.keySet(); ++ } ++ ++ public record VerifiedConfig(GlobalConfig config, ConfigVerify verify, Field field, String path) { ++ ++ public void set(String realValue) throws IllegalArgumentException { ++ if (config.lock()) { ++ throw new IllegalArgumentException("locked"); ++ } ++ ++ Object value; ++ try { ++ value = verify.convert(realValue); ++ } catch (Exception e) { ++ throw new IllegalArgumentException("value parse error: " + e.getMessage()); ++ } ++ ++ String checkInfo = verify.check(this.get(), value); ++ if (checkInfo != null) { ++ throw new IllegalArgumentException(checkInfo); ++ } ++ ++ try { ++ field.set(null, value); ++ LeavesConfig.config.set(path, value); ++ LeavesConfig.save(); ++ } catch (IllegalAccessException e) { ++ throw new IllegalArgumentException("?"); ++ } ++ } ++ ++ public String getString() { ++ return this.get().toString(); ++ } ++ ++ public Object get() { ++ try { ++ return field.get(null); ++ } catch (IllegalAccessException e) { ++ LeavesLogger.LOGGER.log(Level.SEVERE, "Failure to get " + path + " value", e); ++ return ""; ++ } ++ } ++ ++ public static VerifiedConfig build(GlobalConfig config, Field field) { ++ StringBuilder path = new StringBuilder("settings."); ++ for (int i = 0; i < config.category().length; i++) { ++ path.append(config.category()[i]).append("."); ++ } ++ path.append(config.name()); ++ ++ ConfigVerify configVerify = null; ++ try { ++ Constructor> constructor = config.verify().getDeclaredConstructor(); ++ constructor.setAccessible(true); ++ configVerify = constructor.newInstance(); ++ } catch (Exception e) { ++ e.printStackTrace(); ++ } ++ ++ ++ return new VerifiedConfig(config, configVerify, field, path.toString()); ++ } ++ } ++} +diff --git a/src/main/java/top/leavesmc/leaves/config/RemovedConfig.java b/src/main/java/top/leavesmc/leaves/config/RemovedConfig.java +new file mode 100644 +index 0000000000000000000000000000000000000000..942992b3aba4492be7b24854129a570377fa17bc +--- /dev/null ++++ b/src/main/java/top/leavesmc/leaves/config/RemovedConfig.java +@@ -0,0 +1,12 @@ ++package top.leavesmc.leaves.config; ++ ++import java.lang.annotation.ElementType; ++import java.lang.annotation.Retention; ++import java.lang.annotation.RetentionPolicy; ++import java.lang.annotation.Target; ++ ++@Target(ElementType.FIELD) ++@Retention(RetentionPolicy.RUNTIME) ++public @interface RemovedConfig { ++ ++} diff --git a/patches/server/0006-Leaves-Protocol-Core.patch b/patches/server/0006-Leaves-Protocol-Core.patch index 2a03a569..68fe6f56 100644 --- a/patches/server/0006-Leaves-Protocol-Core.patch +++ b/patches/server/0006-Leaves-Protocol-Core.patch @@ -77,7 +77,7 @@ index 192eeaffd6d51baca149c7b9eaccf53246cb3af5..00f4ee320f8a8d019cb311cee78bb384 ServerLevel worldserver = entityplayer.serverLevel(); diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -index f18225bff50f87e4dab89951a9f09947639b6a27..dc4ce7bbde058560c077fe2004da64e3113ccace 100644 +index 417a808d2b99a0a3f499a457c93afb9494d22fff..1e904d37a4646ebd2c3913fb6157342678c06ba9 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java @@ -463,6 +463,7 @@ public final class CraftServer implements Server { @@ -88,8 +88,8 @@ index f18225bff50f87e4dab89951a9f09947639b6a27..dc4ce7bbde058560c077fe2004da64e3 } public boolean getCommandBlockOverride(String command) { -@@ -1072,6 +1073,7 @@ public final class CraftServer implements Server { - top.leavesmc.leaves.LeavesConfig.registerCommands(); // Leaves - Server Command +@@ -1070,6 +1071,7 @@ public final class CraftServer implements Server { + io.papermc.paper.command.PaperCommands.registerCommands(this.console); // Paper this.overrideAllCommandBlockCommands = this.commandsConfiguration.getStringList("command-block-overrides").contains("*"); this.ignoreVanillaPermissions = this.commandsConfiguration.getBoolean("ignore-vanilla-permissions"); + top.leavesmc.leaves.protocol.core.LeavesProtocolManager.handleServerReload(); // Leaves - protocol diff --git a/patches/server/0010-Fakeplayer-support.patch b/patches/server/0010-Fakeplayer-support.patch index 65798544..eb693e70 100644 --- a/patches/server/0010-Fakeplayer-support.patch +++ b/patches/server/0010-Fakeplayer-support.patch @@ -353,7 +353,7 @@ index dfeb3e336e06ef01f5401a362755030db942bb07..c51413bf02b3572a05f09d2f0d02493d if (randomsource.nextInt(j) >= world.paperConfig().entities.behavior.playerInsomniaStartTicks) { // Paper BlockPos blockposition1 = blockposition.above(20 + randomsource.nextInt(15)).east(-10 + randomsource.nextInt(21)).south(-10 + randomsource.nextInt(21)); diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -index dc4ce7bbde058560c077fe2004da64e3113ccace..602d913b144c6d565e09c5623859c40775a4fcca 100644 +index 1e904d37a4646ebd2c3913fb6157342678c06ba9..1dc51050065af9bfc760f0a2cd7a479817888280 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java @@ -259,6 +259,7 @@ import org.yaml.snakeyaml.constructor.SafeConstructor; @@ -372,7 +372,7 @@ index dc4ce7bbde058560c077fe2004da64e3113ccace..602d913b144c6d565e09c5623859c407 // Paper start - Folia region threading API private final io.papermc.paper.threadedregions.scheduler.FallbackRegionScheduler regionizedScheduler = new io.papermc.paper.threadedregions.scheduler.FallbackRegionScheduler(); -@@ -3246,4 +3248,11 @@ public final class CraftServer implements Server { +@@ -3244,4 +3246,11 @@ public final class CraftServer implements Server { } // Paper end @@ -419,35 +419,9 @@ index 74ff54724626908a083063c54983e0adfbbf7749..7afc1618f2014df67ca42f00c09e863c /** * The start ID for the counter. */ -diff --git a/src/main/java/top/leavesmc/leaves/LeavesConfig.java b/src/main/java/top/leavesmc/leaves/LeavesConfig.java -index a1ca90ea40b4ccd8df290f8cc34d63d390acc87c..ae21d3e873b22849cc2f02444624d150e9e3868d 100644 ---- a/src/main/java/top/leavesmc/leaves/LeavesConfig.java -+++ b/src/main/java/top/leavesmc/leaves/LeavesConfig.java -@@ -8,6 +8,9 @@ import org.bukkit.command.Command; - import org.bukkit.configuration.ConfigurationSection; - import org.bukkit.configuration.file.YamlConfiguration; - import top.leavesmc.leaves.command.LeavesCommand; -+import top.leavesmc.leaves.bot.BotCommand; -+import top.leavesmc.leaves.bot.agent.Actions; -+import top.leavesmc.leaves.util.MathUtils; - - import java.io.File; - import java.lang.reflect.InvocationTargetException; -@@ -70,6 +73,11 @@ public final class LeavesConfig { - - commands = new HashMap<>(); - commands.put("leaves", new LeavesCommand("leaves")); -+ -+ if (top.leavesmc.leaves.LeavesConfig.fakeplayerSupport) { -+ commands.put("bot", new BotCommand("bot")); -+ Actions.registerAll(); -+ } - } - - public static void load(final YamlConfiguration config) { diff --git a/src/main/java/top/leavesmc/leaves/bot/BotCommand.java b/src/main/java/top/leavesmc/leaves/bot/BotCommand.java new file mode 100644 -index 0000000000000000000000000000000000000000..6abc37cff54d876b598051bb23aa3a2c2e1a7baa +index 0000000000000000000000000000000000000000..6a67f2e548d5f0a5936cc7520eb8369788e9bea8 --- /dev/null +++ b/src/main/java/top/leavesmc/leaves/bot/BotCommand.java @@ -0,0 +1,275 @@ @@ -467,7 +441,7 @@ index 0000000000000000000000000000000000000000..6abc37cff54d876b598051bb23aa3a2c +import org.bukkit.permissions.PermissionDefault; +import org.bukkit.plugin.PluginManager; +import org.jetbrains.annotations.NotNull; -+import top.leavesmc.leaves.LeavesLogger; ++import top.leavesmc.leaves.LeavesConfig; +import top.leavesmc.leaves.bot.agent.Actions; +import top.leavesmc.leaves.bot.agent.BotAction; +import top.leavesmc.leaves.bot.agent.actions.CraftCustomBotAction; @@ -532,7 +506,7 @@ index 0000000000000000000000000000000000000000..6abc37cff54d876b598051bb23aa3a2c + + @Override + public boolean execute(@NotNull CommandSender sender, @NotNull String commandLabel, String[] args) { -+ if (!testPermission(sender)) return true; ++ if (!testPermission(sender) || !LeavesConfig.fakeplayerSupport) return true; + + if (args.length == 0) { + sender.sendMessage(ChatColor.RED + "Usage: " + usageMessage); @@ -1194,7 +1168,7 @@ index 0000000000000000000000000000000000000000..daaece30b2a3983f1cc9ee9a851e8f37 +} diff --git a/src/main/java/top/leavesmc/leaves/bot/ServerBot.java b/src/main/java/top/leavesmc/leaves/bot/ServerBot.java new file mode 100644 -index 0000000000000000000000000000000000000000..02ef39695d921f804c2a89ae5cf7959c0c0e2903 +index 0000000000000000000000000000000000000000..7a8eb0a472933239145e79930de28deb4cb7b0d6 --- /dev/null +++ b/src/main/java/top/leavesmc/leaves/bot/ServerBot.java @@ -0,0 +1,722 @@ @@ -1518,7 +1492,7 @@ index 0000000000000000000000000000000000000000..02ef39695d921f804c2a89ae5cf7959c + if (server.getTickCount() % 20 == 0) { + float health = getHealth(); + float maxHealth = getMaxHealth(); -+ float regenAmount = LeavesConfig.fakeplayerRegenAmount * 20; ++ float regenAmount = (float) (LeavesConfig.fakeplayerRegenAmount * 20); + float amount; + + if (health < maxHealth - regenAmount) { diff --git a/patches/server/0018-No-chat-sign.patch b/patches/server/0018-No-chat-sign.patch index 7eec36de..64490ddb 100644 --- a/patches/server/0018-No-chat-sign.patch +++ b/patches/server/0018-No-chat-sign.patch @@ -102,10 +102,10 @@ index 9d6db4a378036559efab91c8b7dcf2a6b0c2cce6..2c349dc502ce275a8215766933f4855f } } diff --git a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java -index fd89dfb3f2ceab015b74d7e3a061973e590cedd5..4b13af14fcbe1925f9d3104d95ebbfbc596cfb3c 100644 +index 570310512c9ce5cf87f3fffe20d6d88c651aa83a..d4932ba7042b897a8561103367d0b7cf9a08234c 100644 --- a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java +++ b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java -@@ -643,7 +643,7 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface +@@ -642,7 +642,7 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface // Paper start - fix secure profile with proxy online mode return dedicatedserverproperties.enforceSecureProfile && io.papermc.paper.configuration.GlobalConfiguration.get().proxies.isProxyOnlineMode() diff --git a/patches/server/0020-Dont-send-useless-entity-packets.patch b/patches/server/0019-Dont-send-useless-entity-packets.patch similarity index 100% rename from patches/server/0020-Dont-send-useless-entity-packets.patch rename to patches/server/0019-Dont-send-useless-entity-packets.patch diff --git a/patches/server/0019-Optimize-mob-spawning.patch b/patches/server/0019-Optimize-mob-spawning.patch deleted file mode 100644 index 026d36fe..00000000 --- a/patches/server/0019-Optimize-mob-spawning.patch +++ /dev/null @@ -1,20 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: violetc <58360096+s-yh-china@users.noreply.github.com> -Date: Sat, 13 Aug 2022 17:27:18 +0800 -Subject: [PATCH] Optimize mob spawning - -This patch is Powered by Pufferfish(https://github.com/pufferfish-gg/Pufferfish) - -diff --git a/src/main/java/top/leavesmc/leaves/LeavesConfig.java b/src/main/java/top/leavesmc/leaves/LeavesConfig.java -index ae21d3e873b22849cc2f02444624d150e9e3868d..d5b4e98214f722e2709f542a1f5c3e19a8b1fabe 100644 ---- a/src/main/java/top/leavesmc/leaves/LeavesConfig.java -+++ b/src/main/java/top/leavesmc/leaves/LeavesConfig.java -@@ -257,7 +257,7 @@ public final class LeavesConfig { - noChatSign = getBoolean("settings.misc.no-chat-sign", noChatSign); - } - -- public static boolean asyncMobSpawning = false; -+ public static boolean asyncMobSpawning = false; // void - private static boolean asyncMobSpawningLock = false; - private static void asyncMobSpawning() { - if (!asyncMobSpawningLock) { diff --git a/patches/server/0022-Fix-Paper-6045-block-goal-shouldn-t-load-chunks.patch b/patches/server/0020-Fix-Paper-6045-block-goal-shouldn-t-load-chunks.patch similarity index 100% rename from patches/server/0022-Fix-Paper-6045-block-goal-shouldn-t-load-chunks.patch rename to patches/server/0020-Fix-Paper-6045-block-goal-shouldn-t-load-chunks.patch diff --git a/patches/server/0021-Multithreaded-Tracker.patch b/patches/server/0021-Multithreaded-Tracker.patch deleted file mode 100644 index d0d8aadc..00000000 --- a/patches/server/0021-Multithreaded-Tracker.patch +++ /dev/null @@ -1,20 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: violetc <58360096+s-yh-china@users.noreply.github.com> -Date: Sun, 14 Aug 2022 00:39:45 +0800 -Subject: [PATCH] Multithreaded Tracker - -This patch is Powered by Pufferfish(https://github.com/pufferfish-gg/Pufferfish) - -diff --git a/src/main/java/top/leavesmc/leaves/LeavesConfig.java b/src/main/java/top/leavesmc/leaves/LeavesConfig.java -index d5b4e98214f722e2709f542a1f5c3e19a8b1fabe..51295f0c5ee66a59a9847c4a4d4a7070fc17f62e 100644 ---- a/src/main/java/top/leavesmc/leaves/LeavesConfig.java -+++ b/src/main/java/top/leavesmc/leaves/LeavesConfig.java -@@ -271,7 +271,7 @@ public final class LeavesConfig { - dontSendUselessEntityPackets = getBoolean("settings.performance.dont-send-useless-entity-packets", dontSendUselessEntityPackets); - } - -- public static boolean asyncEntityTracker = false; -+ public static boolean asyncEntityTracker = false; // void - private static boolean asyncEntityTrackerLock = false; - private static void asyncEntityTracker() { - if (!asyncEntityTrackerLock) { diff --git a/patches/server/0023-Optimize-entity-coordinate-key.patch b/patches/server/0021-Optimize-entity-coordinate-key.patch similarity index 95% rename from patches/server/0023-Optimize-entity-coordinate-key.patch rename to patches/server/0021-Optimize-entity-coordinate-key.patch index 915ed983..dc81b671 100644 --- a/patches/server/0023-Optimize-entity-coordinate-key.patch +++ b/patches/server/0021-Optimize-entity-coordinate-key.patch @@ -25,7 +25,7 @@ index 200ed770b57e1a9240abf0473968d4b85cbefe3c..bf16715db2424f0b05854ae7665b4448 public static long getCoordinateKey(final ChunkPos pair) { diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java -index 2bd6e02291b6ac6ff31e85f6721bb89b2efc704b..0cdfb9470c29132f75a5b3df05178626a56e4e6e 100644 +index f9e9b708eecae0dfdb283899ac293ddbfb986ade..b989029d7425cf410698ff477a3622b4c629ada3 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java @@ -307,7 +307,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S diff --git a/patches/server/0024-Optimize-suffocation.patch b/patches/server/0022-Optimize-suffocation.patch similarity index 100% rename from patches/server/0024-Optimize-suffocation.patch rename to patches/server/0022-Optimize-suffocation.patch diff --git a/patches/server/0025-Only-check-for-spooky-season-once-an-hour.patch b/patches/server/0023-Only-check-for-spooky-season-once-an-hour.patch similarity index 100% rename from patches/server/0025-Only-check-for-spooky-season-once-an-hour.patch rename to patches/server/0023-Only-check-for-spooky-season-once-an-hour.patch diff --git a/patches/server/0026-Move-ThreadUnsafeRandom-Initialization.patch b/patches/server/0024-Move-ThreadUnsafeRandom-Initialization.patch similarity index 90% rename from patches/server/0026-Move-ThreadUnsafeRandom-Initialization.patch rename to patches/server/0024-Move-ThreadUnsafeRandom-Initialization.patch index 1bb56418..74bc617b 100644 --- a/patches/server/0026-Move-ThreadUnsafeRandom-Initialization.patch +++ b/patches/server/0024-Move-ThreadUnsafeRandom-Initialization.patch @@ -6,7 +6,7 @@ Subject: [PATCH] Move ThreadUnsafeRandom Initialization This patch is Powered by Pufferfish(https://github.com/pufferfish-gg/Pufferfish) diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java -index 62867bc387f49398ebb5d608c4f1e4e562079bd7..ddbe5ece289235cf5b9a0e9d532ab9b8f1ff200c 100644 +index 90626c175b8bb496e2e1c18cc8a501d8eff44a87..eaad1404e690f1fe47a49df1447e31f068fcb0a2 100644 --- a/src/main/java/net/minecraft/server/level/ServerLevel.java +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java @@ -971,7 +971,7 @@ public class ServerLevel extends Level implements WorldGenLevel { @@ -19,10 +19,10 @@ index 62867bc387f49398ebb5d608c4f1e4e562079bd7..ddbe5ece289235cf5b9a0e9d532ab9b8 public void tickChunk(LevelChunk chunk, int randomTickSpeed) { diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java -index c51d22285a253d4220ee967504ab9eef1403edbe..f434b1dc911ce45a4d309b892079a266f2485c90 100644 +index 2f1e70a695b222dfa832b5d2c81544bc314b1aec..987c5d9c54d4fe101659c42a1113ecd5ab164a6c 100644 --- a/src/main/java/net/minecraft/world/level/Level.java +++ b/src/main/java/net/minecraft/world/level/Level.java -@@ -203,6 +203,8 @@ public abstract class Level implements LevelAccessor, AutoCloseable { +@@ -202,6 +202,8 @@ public abstract class Level implements LevelAccessor, AutoCloseable { public abstract ResourceKey getTypeKey(); @@ -31,7 +31,7 @@ index c51d22285a253d4220ee967504ab9eef1403edbe..f434b1dc911ce45a4d309b892079a266 protected Level(WritableLevelData worlddatamutable, ResourceKey resourcekey, RegistryAccess iregistrycustom, Holder holder, Supplier supplier, boolean flag, boolean flag1, long i, int j, org.bukkit.generator.ChunkGenerator gen, org.bukkit.generator.BiomeProvider biomeProvider, org.bukkit.World.Environment env, java.util.function.Function paperWorldConfigCreator, java.util.concurrent.Executor executor) { // Paper - Async-Anti-Xray - Pass executor this.spigotConfig = new org.spigotmc.SpigotWorldConfig(((net.minecraft.world.level.storage.PrimaryLevelData) worlddatamutable).getLevelName()); // Spigot this.paperConfig = paperWorldConfigCreator.apply(this.spigotConfig); // Paper -@@ -296,6 +298,12 @@ public abstract class Level implements LevelAccessor, AutoCloseable { +@@ -294,6 +296,12 @@ public abstract class Level implements LevelAccessor, AutoCloseable { // Paper end - optimise collisions } diff --git a/patches/server/0027-Optimize-random-calls-in-chunk-ticking.patch b/patches/server/0025-Optimize-random-calls-in-chunk-ticking.patch similarity index 98% rename from patches/server/0027-Optimize-random-calls-in-chunk-ticking.patch rename to patches/server/0025-Optimize-random-calls-in-chunk-ticking.patch index ea8f8c35..3c3f3dd2 100644 --- a/patches/server/0027-Optimize-random-calls-in-chunk-ticking.patch +++ b/patches/server/0025-Optimize-random-calls-in-chunk-ticking.patch @@ -22,7 +22,7 @@ index d6089c0d0b076d232834619bc93bc64f0be57340..c4577d7dc27bb48c95794212de4abf2e // Paper - optimise chunk tick iteration diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java -index ddbe5ece289235cf5b9a0e9d532ab9b8f1ff200c..1ed4e8b5feb4cad478ac6472b386ccb9b610a7de 100644 +index eaad1404e690f1fe47a49df1447e31f068fcb0a2..e25361263cb354293d584b8f400c02065654b4b8 100644 --- a/src/main/java/net/minecraft/server/level/ServerLevel.java +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java @@ -974,6 +974,13 @@ public class ServerLevel extends Level implements WorldGenLevel { diff --git a/patches/server/0028-Early-return-optimization-for-target-finding.patch b/patches/server/0026-Early-return-optimization-for-target-finding.patch similarity index 100% rename from patches/server/0028-Early-return-optimization-for-target-finding.patch rename to patches/server/0026-Early-return-optimization-for-target-finding.patch diff --git a/patches/server/0029-Use-thread-unsafe-random-for-mob-spawning.patch b/patches/server/0027-Use-thread-unsafe-random-for-mob-spawning.patch similarity index 100% rename from patches/server/0029-Use-thread-unsafe-random-for-mob-spawning.patch rename to patches/server/0027-Use-thread-unsafe-random-for-mob-spawning.patch diff --git a/patches/server/0030-Config-to-disable-method-profiler.patch b/patches/server/0028-Config-to-disable-method-profiler.patch similarity index 91% rename from patches/server/0030-Config-to-disable-method-profiler.patch rename to patches/server/0028-Config-to-disable-method-profiler.patch index ad455bb6..b6996b97 100644 --- a/patches/server/0030-Config-to-disable-method-profiler.patch +++ b/patches/server/0028-Config-to-disable-method-profiler.patch @@ -22,10 +22,10 @@ index 37af0a508cfe56f23be806d2d4100d890ad5e7ec..89a50e07bc79cb0d5353f5a06fa037f3 } diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java -index 0934de77256734d3dd50ea7e16662d49c3d58242..12f5a090affed70ba041f77fd0eacbeb4a700cb9 100644 +index 987c5d9c54d4fe101659c42a1113ecd5ab164a6c..33dcb0c113614c7605ba750afb80459b68d78f99 100644 --- a/src/main/java/net/minecraft/world/level/Level.java +++ b/src/main/java/net/minecraft/world/level/Level.java -@@ -1791,6 +1791,11 @@ public abstract class Level implements LevelAccessor, AutoCloseable { +@@ -1789,6 +1789,11 @@ public abstract class Level implements LevelAccessor, AutoCloseable { } public ProfilerFiller getProfiler() { diff --git a/patches/server/0031-Throttle-goal-selector-during-inactive-ticking.patch b/patches/server/0029-Throttle-goal-selector-during-inactive-ticking.patch similarity index 93% rename from patches/server/0031-Throttle-goal-selector-during-inactive-ticking.patch rename to patches/server/0029-Throttle-goal-selector-during-inactive-ticking.patch index bae967b2..6771a8a6 100644 --- a/patches/server/0031-Throttle-goal-selector-during-inactive-ticking.patch +++ b/patches/server/0029-Throttle-goal-selector-during-inactive-ticking.patch @@ -6,7 +6,7 @@ Subject: [PATCH] Throttle goal selector during inactive ticking This patch is Powered by Pufferfish(https://github.com/pufferfish-gg/Pufferfish) diff --git a/src/main/java/net/minecraft/world/entity/Mob.java b/src/main/java/net/minecraft/world/entity/Mob.java -index e0cf7771488ab0065708d68b4e8550b865af0ed4..dc196d04afa8e74be1a43994212d17b430aad2ee 100644 +index a7fbd329ea6d36a46c00b4476c74e426dbbfe238..f0e1318a0a7d7a409df8fc5567040de9da25b75d 100644 --- a/src/main/java/net/minecraft/world/entity/Mob.java +++ b/src/main/java/net/minecraft/world/entity/Mob.java @@ -221,11 +221,13 @@ public abstract class Mob extends LivingEntity implements Targeting { diff --git a/patches/server/0032-Reduce-entity-allocations.patch b/patches/server/0030-Reduce-entity-allocations.patch similarity index 96% rename from patches/server/0032-Reduce-entity-allocations.patch rename to patches/server/0030-Reduce-entity-allocations.patch index ad97bbd3..e7e6df0c 100644 --- a/patches/server/0032-Reduce-entity-allocations.patch +++ b/patches/server/0030-Reduce-entity-allocations.patch @@ -6,7 +6,7 @@ Subject: [PATCH] Reduce entity allocations This patch is Powered by Pufferfish(https://github.com/pufferfish-gg/Pufferfish) diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java -index 0cdfb9470c29132f75a5b3df05178626a56e4e6e..c4fb0f8e4aa77f8c6d77ad0ca9f8d985ea6cec3e 100644 +index b989029d7425cf410698ff477a3622b4c629ada3..79b2831322b8312448c89b5276af40d1efa880d2 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java @@ -439,6 +439,8 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S diff --git a/patches/server/0033-Remove-lambda-from-ticking-guard.patch b/patches/server/0031-Remove-lambda-from-ticking-guard.patch similarity index 96% rename from patches/server/0033-Remove-lambda-from-ticking-guard.patch rename to patches/server/0031-Remove-lambda-from-ticking-guard.patch index 368ffd7f..3d4a27f5 100644 --- a/patches/server/0033-Remove-lambda-from-ticking-guard.patch +++ b/patches/server/0031-Remove-lambda-from-ticking-guard.patch @@ -6,7 +6,7 @@ Subject: [PATCH] Remove lambda from ticking guard This patch is Powered by Pufferfish(https://github.com/pufferfish-gg/Pufferfish) diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java -index 1ed4e8b5feb4cad478ac6472b386ccb9b610a7de..fc2f0e767e079b9c7aba131e71f11eb8a8920be2 100644 +index e25361263cb354293d584b8f400c02065654b4b8..3397a9f45a82e00b71578d82b6f5505288a79820 100644 --- a/src/main/java/net/minecraft/server/level/ServerLevel.java +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java @@ -908,7 +908,24 @@ public class ServerLevel extends Level implements WorldGenLevel { diff --git a/patches/server/0034-Remove-iterators-from-inventory-contains.patch b/patches/server/0032-Remove-iterators-from-inventory-contains.patch similarity index 100% rename from patches/server/0034-Remove-iterators-from-inventory-contains.patch rename to patches/server/0032-Remove-iterators-from-inventory-contains.patch diff --git a/patches/server/0035-Remove-streams-and-iterators-from-range-check.patch b/patches/server/0033-Remove-streams-and-iterators-from-range-check.patch similarity index 100% rename from patches/server/0035-Remove-streams-and-iterators-from-range-check.patch rename to patches/server/0033-Remove-streams-and-iterators-from-range-check.patch diff --git a/patches/server/0037-Cache-climbing-check-for-activation.patch b/patches/server/0034-Cache-climbing-check-for-activation.patch similarity index 100% rename from patches/server/0037-Cache-climbing-check-for-activation.patch rename to patches/server/0034-Cache-climbing-check-for-activation.patch diff --git a/patches/server/0038-Use-aging-cache-for-biome-temperatures.patch b/patches/server/0035-Use-aging-cache-for-biome-temperatures.patch similarity index 100% rename from patches/server/0038-Use-aging-cache-for-biome-temperatures.patch rename to patches/server/0035-Use-aging-cache-for-biome-temperatures.patch diff --git a/patches/server/0036-Async-Pathfinding.patch b/patches/server/0036-Async-Pathfinding.patch deleted file mode 100644 index 7c89ada5..00000000 --- a/patches/server/0036-Async-Pathfinding.patch +++ /dev/null @@ -1,21 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: violetc <58360096+s-yh-china@users.noreply.github.com> -Date: Wed, 17 Aug 2022 16:54:54 +0800 -Subject: [PATCH] Async Pathfinding - -This patch is Powered by Pufferfish(https://github.com/pufferfish-gg/Pufferfish) -But Pufferfish patch was ported downstream from the Petal fork - -diff --git a/src/main/java/top/leavesmc/leaves/LeavesConfig.java b/src/main/java/top/leavesmc/leaves/LeavesConfig.java -index 51295f0c5ee66a59a9847c4a4d4a7070fc17f62e..3c66bd015c493ab971c12be8e134fdaa13daa935 100644 ---- a/src/main/java/top/leavesmc/leaves/LeavesConfig.java -+++ b/src/main/java/top/leavesmc/leaves/LeavesConfig.java -@@ -372,7 +372,7 @@ public final class LeavesConfig { - // only config now - public static boolean asyncPathfinding = false; - private static boolean asyncPathfindingLock = false; -- private static void asyncPathfinding() { -+ private static void asyncPathfinding() { // void - if (!asyncPathfindingLock) { - asyncPathfinding = getBoolean("settings.performance.async-pathfinding", asyncPathfinding); - asyncPathfindingLock = true; diff --git a/patches/server/0039-Reduce-entity-fluid-lookups-if-no-fluids.patch b/patches/server/0036-Reduce-entity-fluid-lookups-if-no-fluids.patch similarity index 100% rename from patches/server/0039-Reduce-entity-fluid-lookups-if-no-fluids.patch rename to patches/server/0036-Reduce-entity-fluid-lookups-if-no-fluids.patch diff --git a/patches/server/0040-Reduce-chunk-loading-lookups.patch b/patches/server/0037-Reduce-chunk-loading-lookups.patch similarity index 100% rename from patches/server/0040-Reduce-chunk-loading-lookups.patch rename to patches/server/0037-Reduce-chunk-loading-lookups.patch diff --git a/patches/server/0041-PCA-sync-protocol.patch b/patches/server/0038-PCA-sync-protocol.patch similarity index 100% rename from patches/server/0041-PCA-sync-protocol.patch rename to patches/server/0038-PCA-sync-protocol.patch diff --git a/patches/server/0042-BBOR-Protocol.patch b/patches/server/0039-BBOR-Protocol.patch similarity index 100% rename from patches/server/0042-BBOR-Protocol.patch rename to patches/server/0039-BBOR-Protocol.patch diff --git a/patches/server/0043-InstantBlockUpdater-Reintroduced.patch b/patches/server/0040-InstantBlockUpdater-Reintroduced.patch similarity index 91% rename from patches/server/0043-InstantBlockUpdater-Reintroduced.patch rename to patches/server/0040-InstantBlockUpdater-Reintroduced.patch index 5a94b0df..6d168860 100644 --- a/patches/server/0043-InstantBlockUpdater-Reintroduced.patch +++ b/patches/server/0040-InstantBlockUpdater-Reintroduced.patch @@ -6,7 +6,7 @@ Subject: [PATCH] InstantBlockUpdater Reintroduced This patch is Powered by Carpet-TIS-Addition(https://github.com/plusls/Carpet-TIS-Addition) diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java -index 831a5795b08e9bb74649404d8ef767dc3f18f173..fa93fd1fbcc3b508e46a2d1df38bb2c7ca1903c2 100644 +index 33dcb0c113614c7605ba750afb80459b68d78f99..e304b4977dd77bd770335accae697e7c7bc90ecc 100644 --- a/src/main/java/net/minecraft/world/level/Level.java +++ b/src/main/java/net/minecraft/world/level/Level.java @@ -70,6 +70,7 @@ import net.minecraft.world.level.lighting.LevelLightEngine; @@ -17,7 +17,7 @@ index 831a5795b08e9bb74649404d8ef767dc3f18f173..fa93fd1fbcc3b508e46a2d1df38bb2c7 import net.minecraft.world.level.redstone.NeighborUpdater; import net.minecraft.world.level.saveddata.maps.MapItemSavedData; import net.minecraft.world.level.storage.LevelData; -@@ -249,7 +250,13 @@ public abstract class Level implements LevelAccessor, AutoCloseable { +@@ -247,7 +248,13 @@ public abstract class Level implements LevelAccessor, AutoCloseable { this.thread = Thread.currentThread(); this.biomeManager = new BiomeManager(this, i); this.isDebug = flag1; diff --git a/patches/server/0044-Random-flatten-triangular-distribution.patch b/patches/server/0041-Random-flatten-triangular-distribution.patch similarity index 100% rename from patches/server/0044-Random-flatten-triangular-distribution.patch rename to patches/server/0041-Random-flatten-triangular-distribution.patch diff --git a/patches/server/0045-Jade-Protocol.patch b/patches/server/0042-Jade-Protocol.patch similarity index 100% rename from patches/server/0045-Jade-Protocol.patch rename to patches/server/0042-Jade-Protocol.patch diff --git a/patches/server/0046-Alternative-block-placement-Protocol.patch b/patches/server/0043-Alternative-block-placement-Protocol.patch similarity index 100% rename from patches/server/0046-Alternative-block-placement-Protocol.patch rename to patches/server/0043-Alternative-block-placement-Protocol.patch diff --git a/patches/server/0047-Player-operation-limiter.patch b/patches/server/0044-Player-operation-limiter.patch similarity index 98% rename from patches/server/0047-Player-operation-limiter.patch rename to patches/server/0044-Player-operation-limiter.patch index acbe38ec..b5a76996 100644 --- a/patches/server/0047-Player-operation-limiter.patch +++ b/patches/server/0044-Player-operation-limiter.patch @@ -62,7 +62,7 @@ index d9038d85f8a04381a92567acf1c8922d666aa3e8..b22dd3700c913d0391c8641fca46e89e // CraftBukkit end } diff --git a/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java b/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java -index 58f972832c39a27a8ccd606f9144e1c54adbf6f3..b2aae4463f2d0fc6ae03bbb9a63c5b8f08d67d43 100644 +index a0d69082f5fdeee15bba0d76b940aa48cff36fa9..a8583c8a368466e9c9148b5620ec51cc1816711d 100644 --- a/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java @@ -44,6 +44,7 @@ import org.bukkit.event.Event; diff --git a/patches/server/0048-Renewable-Elytra.patch b/patches/server/0045-Renewable-Elytra.patch similarity index 100% rename from patches/server/0048-Renewable-Elytra.patch rename to patches/server/0045-Renewable-Elytra.patch diff --git a/patches/server/0049-Stackable-ShulkerBoxes.patch b/patches/server/0046-Stackable-ShulkerBoxes.patch similarity index 100% rename from patches/server/0049-Stackable-ShulkerBoxes.patch rename to patches/server/0046-Stackable-ShulkerBoxes.patch diff --git a/patches/server/0050-Improve-fluid-direction-caching.patch b/patches/server/0047-Improve-fluid-direction-caching.patch similarity index 100% rename from patches/server/0050-Improve-fluid-direction-caching.patch rename to patches/server/0047-Improve-fluid-direction-caching.patch diff --git a/patches/server/0051-MC-Technical-Survival-Mode.patch b/patches/server/0048-MC-Technical-Survival-Mode.patch similarity index 82% rename from patches/server/0051-MC-Technical-Survival-Mode.patch rename to patches/server/0048-MC-Technical-Survival-Mode.patch index 765ceb6b..26276ad9 100644 --- a/patches/server/0051-MC-Technical-Survival-Mode.patch +++ b/patches/server/0048-MC-Technical-Survival-Mode.patch @@ -19,14 +19,14 @@ index 5b446e6ac151f99f64f0c442d0b40b5e251bc4c4..c2eb3e8b019dbc0543a2308d7e88e324 final long timeout; if (type == RegionizedPlayerChunkLoader.REGION_PLAYER_TICKET && delayTimeout > 0) { diff --git a/src/main/java/io/papermc/paper/configuration/PaperConfigurations.java b/src/main/java/io/papermc/paper/configuration/PaperConfigurations.java -index fa1c0aee8c3a4d0868482cf5c703bbfd08e09874..8b0feb7f0d008e5b8a5294a014a0cd9b684707f2 100644 +index fa1c0aee8c3a4d0868482cf5c703bbfd08e09874..c24148d8486420434922864df6f1ffa0b9929612 100644 --- a/src/main/java/io/papermc/paper/configuration/PaperConfigurations.java +++ b/src/main/java/io/papermc/paper/configuration/PaperConfigurations.java @@ -317,6 +317,7 @@ public class PaperConfigurations extends Configurations -1) { -diff --git a/src/main/java/top/leavesmc/leaves/LeavesConfig.java b/src/main/java/top/leavesmc/leaves/LeavesConfig.java -index 6f08cdecbc1175ca2808a4d798252b91341c88eb..9214b89a27b2f922971c58f3e49058ea9887959c 100644 ---- a/src/main/java/top/leavesmc/leaves/LeavesConfig.java -+++ b/src/main/java/top/leavesmc/leaves/LeavesConfig.java -@@ -12,6 +12,7 @@ import top.leavesmc.leaves.command.LeavesCommand; - import top.leavesmc.leaves.bot.BotCommand; - import top.leavesmc.leaves.bot.agent.Actions; - import top.leavesmc.leaves.profile.LeavesMinecraftSessionService; -+import top.leavesmc.leaves.protocol.syncmatica.SyncmaticaProtocol; - import top.leavesmc.leaves.util.MathUtils; - - import java.io.File; -@@ -567,6 +568,7 @@ public final class LeavesConfig { - syncmaticaQuota = getBoolean("settings.protocol.syncmatica.quota", syncmaticaQuota); - syncmaticaQuotaLimit = getInt("settings.protocol.syncmatica.quota-limit", syncmaticaQuotaLimit); - if (syncmaticaProtocol) { -+ SyncmaticaProtocol.init(); - } - } - diff --git a/src/main/java/top/leavesmc/leaves/protocol/syncmatica/CommunicationManager.java b/src/main/java/top/leavesmc/leaves/protocol/syncmatica/CommunicationManager.java new file mode 100644 index 0000000000000000000000000000000000000000..fc229f23076147304754a267bcc345cc836b648b diff --git a/patches/server/0061-Disable-distance-check-for-UseItemOnPacket.patch b/patches/server/0058-Disable-distance-check-for-UseItemOnPacket.patch similarity index 92% rename from patches/server/0061-Disable-distance-check-for-UseItemOnPacket.patch rename to patches/server/0058-Disable-distance-check-for-UseItemOnPacket.patch index 8723608b..8ad4a4ce 100644 --- a/patches/server/0061-Disable-distance-check-for-UseItemOnPacket.patch +++ b/patches/server/0058-Disable-distance-check-for-UseItemOnPacket.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Disable distance check for UseItemOnPacket diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index eacc68696f8d78114c7129b390e1a1e915f29223..6e70d8832ca06367573b0c8066a5d9fe41c0d9cf 100644 +index 8cae2004b3ffec981be1fe277a97321843f4a2cf..bcd90c6a9173d2b089995cd1049e0db1d7316719 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java @@ -1936,7 +1936,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl diff --git a/patches/server/0062-No-feather-falling-trample.patch b/patches/server/0059-No-feather-falling-trample.patch similarity index 100% rename from patches/server/0062-No-feather-falling-trample.patch rename to patches/server/0059-No-feather-falling-trample.patch diff --git a/patches/server/0063-Shared-villager-discounts.patch b/patches/server/0060-Shared-villager-discounts.patch similarity index 100% rename from patches/server/0063-Shared-villager-discounts.patch rename to patches/server/0060-Shared-villager-discounts.patch diff --git a/patches/server/0064-Redstone-wire-dont-connect-if-on-trapdoor.patch b/patches/server/0061-Redstone-wire-dont-connect-if-on-trapdoor.patch similarity index 100% rename from patches/server/0064-Redstone-wire-dont-connect-if-on-trapdoor.patch rename to patches/server/0061-Redstone-wire-dont-connect-if-on-trapdoor.patch diff --git a/patches/server/0065-Disable-check-out-of-order-command.patch b/patches/server/0062-Disable-check-out-of-order-command.patch similarity index 100% rename from patches/server/0065-Disable-check-out-of-order-command.patch rename to patches/server/0062-Disable-check-out-of-order-command.patch diff --git a/patches/server/0066-Despawn-enderman-with-block.patch b/patches/server/0063-Despawn-enderman-with-block.patch similarity index 100% rename from patches/server/0066-Despawn-enderman-with-block.patch rename to patches/server/0063-Despawn-enderman-with-block.patch diff --git a/patches/server/0067-Leaves-carpet-support.patch b/patches/server/0064-Leaves-carpet-support.patch similarity index 79% rename from patches/server/0067-Leaves-carpet-support.patch rename to patches/server/0064-Leaves-carpet-support.patch index 0ab83146..b621ed52 100644 --- a/patches/server/0067-Leaves-carpet-support.patch +++ b/patches/server/0064-Leaves-carpet-support.patch @@ -4,28 +4,6 @@ Date: Tue, 27 Jun 2023 01:54:43 +0800 Subject: [PATCH] Leaves carpet support -diff --git a/src/main/java/top/leavesmc/leaves/LeavesConfig.java b/src/main/java/top/leavesmc/leaves/LeavesConfig.java -index 9214b89a27b2f922971c58f3e49058ea9887959c..d9a11d6228f3ea86705503d394e6632deda8e1ef 100644 ---- a/src/main/java/top/leavesmc/leaves/LeavesConfig.java -+++ b/src/main/java/top/leavesmc/leaves/LeavesConfig.java -@@ -14,6 +14,8 @@ import top.leavesmc.leaves.bot.agent.Actions; - import top.leavesmc.leaves.profile.LeavesMinecraftSessionService; - import top.leavesmc.leaves.protocol.syncmatica.SyncmaticaProtocol; - import top.leavesmc.leaves.util.MathUtils; -+import top.leavesmc.leaves.protocol.CarpetServerProtocol.CarpetRule; -+import top.leavesmc.leaves.protocol.CarpetServerProtocol.CarpetRules; - - import java.io.File; - import java.lang.reflect.InvocationTargetException; -@@ -611,6 +613,8 @@ public final class LeavesConfig { - } - - public static void registerCarpetRules() { -+ CarpetRules.register(CarpetRule.of("carpet", "creativeNoClip", creativeNoClip)); -+ CarpetRules.register(CarpetRule.of("pca", "avoidAnvilTooExpensive", avoidAnvilTooExpensive)); - } - - public static boolean creativeNoClip = false; diff --git a/src/main/java/top/leavesmc/leaves/protocol/CarpetServerProtocol.java b/src/main/java/top/leavesmc/leaves/protocol/CarpetServerProtocol.java new file mode 100644 index 0000000000000000000000000000000000000000..207bbbdf462d12f39273eee1b1552477be35346f diff --git a/patches/server/0068-Creative-fly-no-clip.patch b/patches/server/0065-Creative-fly-no-clip.patch similarity index 100% rename from patches/server/0068-Creative-fly-no-clip.patch rename to patches/server/0065-Creative-fly-no-clip.patch diff --git a/patches/server/0069-Optimized-dragon-respawn.patch b/patches/server/0066-Optimized-dragon-respawn.patch similarity index 100% rename from patches/server/0069-Optimized-dragon-respawn.patch rename to patches/server/0066-Optimized-dragon-respawn.patch diff --git a/patches/server/0070-Enchantment-mending-compatibility-infinity.patch b/patches/server/0067-Enchantment-mending-compatibility-infinity.patch similarity index 100% rename from patches/server/0070-Enchantment-mending-compatibility-infinity.patch rename to patches/server/0067-Enchantment-mending-compatibility-infinity.patch diff --git a/patches/server/0071-Shave-snow-layers.patch b/patches/server/0068-Shave-snow-layers.patch similarity index 100% rename from patches/server/0071-Shave-snow-layers.patch rename to patches/server/0068-Shave-snow-layers.patch diff --git a/patches/server/0072-Spawn-ignore-lc.patch b/patches/server/0069-Spawn-ignore-lc.patch similarity index 100% rename from patches/server/0072-Spawn-ignore-lc.patch rename to patches/server/0069-Spawn-ignore-lc.patch diff --git a/patches/server/0073-Elytra-aeronautics-no-chunk-load.patch b/patches/server/0070-Elytra-aeronautics-no-chunk-load.patch similarity index 100% rename from patches/server/0073-Elytra-aeronautics-no-chunk-load.patch rename to patches/server/0070-Elytra-aeronautics-no-chunk-load.patch diff --git a/patches/server/0074-Fix-Paper-9372.patch b/patches/server/0071-Fix-Paper-9372.patch similarity index 100% rename from patches/server/0074-Fix-Paper-9372.patch rename to patches/server/0071-Fix-Paper-9372.patch diff --git a/patches/server/0075-Cache-ignite-odds.patch b/patches/server/0072-Cache-ignite-odds.patch similarity index 100% rename from patches/server/0075-Cache-ignite-odds.patch rename to patches/server/0072-Cache-ignite-odds.patch diff --git a/patches/server/0076-Lava-riptide.patch b/patches/server/0073-Lava-riptide.patch similarity index 100% rename from patches/server/0076-Lava-riptide.patch rename to patches/server/0073-Lava-riptide.patch diff --git a/patches/server/0077-No-block-update-command.patch b/patches/server/0074-No-block-update-command.patch similarity index 88% rename from patches/server/0077-No-block-update-command.patch rename to patches/server/0074-No-block-update-command.patch index d2053989..eb8e4467 100644 --- a/patches/server/0077-No-block-update-command.patch +++ b/patches/server/0074-No-block-update-command.patch @@ -91,29 +91,6 @@ index 2708251ebc1995e71fb0e5dca9e158a3005f8a8a..e28351b379677fec356b6efec2d882ee NeighborUpdater.executeUpdate(this.level, state, pos, sourceBlock, sourcePos, notify); } } -diff --git a/src/main/java/top/leavesmc/leaves/LeavesConfig.java b/src/main/java/top/leavesmc/leaves/LeavesConfig.java -index d9a11d6228f3ea86705503d394e6632deda8e1ef..d90a36e1a512842dc322787cc767239a34e895af 100644 ---- a/src/main/java/top/leavesmc/leaves/LeavesConfig.java -+++ b/src/main/java/top/leavesmc/leaves/LeavesConfig.java -@@ -11,6 +11,7 @@ import org.bukkit.configuration.file.YamlConfiguration; - import top.leavesmc.leaves.command.LeavesCommand; - import top.leavesmc.leaves.bot.BotCommand; - import top.leavesmc.leaves.bot.agent.Actions; -+import top.leavesmc.leaves.command.NoBlockUpdateCommand; - import top.leavesmc.leaves.profile.LeavesMinecraftSessionService; - import top.leavesmc.leaves.protocol.syncmatica.SyncmaticaProtocol; - import top.leavesmc.leaves.util.MathUtils; -@@ -83,6 +84,10 @@ public final class LeavesConfig { - commands.put("bot", new BotCommand("bot")); - Actions.registerAll(); - } -+ -+ if (LeavesConfig.noBlockUpdateCommand) { -+ commands.put("blockupdate", new NoBlockUpdateCommand("blockupdate")); -+ } - } - - public static void load(final YamlConfiguration config) { diff --git a/src/main/java/top/leavesmc/leaves/command/NoBlockUpdateCommand.java b/src/main/java/top/leavesmc/leaves/command/NoBlockUpdateCommand.java new file mode 100644 index 0000000000000000000000000000000000000000..819d5a5383dc6978f53645b727722fa924b7a505 diff --git a/patches/server/0078-Raider-die-skip-self-raid-check.patch b/patches/server/0075-Raider-die-skip-self-raid-check.patch similarity index 100% rename from patches/server/0078-Raider-die-skip-self-raid-check.patch rename to patches/server/0075-Raider-die-skip-self-raid-check.patch diff --git a/patches/server/0079-Container-open-passthrough.patch b/patches/server/0076-Container-open-passthrough.patch similarity index 100% rename from patches/server/0079-Container-open-passthrough.patch rename to patches/server/0076-Container-open-passthrough.patch diff --git a/patches/server/0080-Bladeren-Protocol.patch b/patches/server/0077-Bladeren-Protocol.patch similarity index 78% rename from patches/server/0080-Bladeren-Protocol.patch rename to patches/server/0077-Bladeren-Protocol.patch index f2ab8010..3247c115 100644 --- a/patches/server/0080-Bladeren-Protocol.patch +++ b/patches/server/0077-Bladeren-Protocol.patch @@ -4,38 +4,6 @@ Date: Fri, 7 Jul 2023 16:50:06 +0800 Subject: [PATCH] Bladeren Protocol -diff --git a/src/main/java/top/leavesmc/leaves/LeavesConfig.java b/src/main/java/top/leavesmc/leaves/LeavesConfig.java -index d90a36e1a512842dc322787cc767239a34e895af..73a951413c1518895bf8a0efb6267ba4c57d71e9 100644 ---- a/src/main/java/top/leavesmc/leaves/LeavesConfig.java -+++ b/src/main/java/top/leavesmc/leaves/LeavesConfig.java -@@ -17,6 +17,8 @@ import top.leavesmc.leaves.protocol.syncmatica.SyncmaticaProtocol; - import top.leavesmc.leaves.util.MathUtils; - import top.leavesmc.leaves.protocol.CarpetServerProtocol.CarpetRule; - import top.leavesmc.leaves.protocol.CarpetServerProtocol.CarpetRules; -+import top.leavesmc.leaves.protocol.bladeren.BladerenProtocol.LeavesFeatureSet; -+import top.leavesmc.leaves.protocol.bladeren.BladerenProtocol.LeavesFeature; - - import java.io.File; - import java.lang.reflect.InvocationTargetException; -@@ -76,6 +78,7 @@ public final class LeavesConfig { - - LeavesConfig.load(config); - registerCarpetRules(); -+ registerLeavesFeatures(); - - commands = new HashMap<>(); - commands.put("leaves", new LeavesCommand("leaves")); -@@ -855,6 +858,10 @@ public final class LeavesConfig { - } - - public static void registerLeavesFeatures() { -+ LeavesFeatureSet.register(LeavesFeature.of("lava_riptide", lavaRiptide)); -+ LeavesFeatureSet.register(LeavesFeature.of("mspt_sync", msptSyncProtocol)); -+ LeavesFeatureSet.register(LeavesFeature.of("loot_world_random", lootWorldRandom)); -+ LeavesFeatureSet.register(LeavesFeature.of("use_vanilla_random", useVanillaRandom)); - } - - public static boolean hopperCounter = false; diff --git a/src/main/java/top/leavesmc/leaves/protocol/bladeren/BladerenProtocol.java b/src/main/java/top/leavesmc/leaves/protocol/bladeren/BladerenProtocol.java new file mode 100644 index 0000000000000000000000000000000000000000..a91011c7a2c56646053bb9d158ff0c265c658c00 diff --git a/patches/server/0081-Bladeren-mspt-sync-protocol.patch b/patches/server/0078-Bladeren-mspt-sync-protocol.patch similarity index 100% rename from patches/server/0081-Bladeren-mspt-sync-protocol.patch rename to patches/server/0078-Bladeren-mspt-sync-protocol.patch diff --git a/patches/server/0082-SIMD-support.patch b/patches/server/0079-SIMD-support.patch similarity index 100% rename from patches/server/0082-SIMD-support.patch rename to patches/server/0079-SIMD-support.patch diff --git a/patches/server/0083-Dont-respond-ping-before-start-fully.patch b/patches/server/0080-Dont-respond-ping-before-start-fully.patch similarity index 100% rename from patches/server/0083-Dont-respond-ping-before-start-fully.patch rename to patches/server/0080-Dont-respond-ping-before-start-fully.patch diff --git a/patches/server/0084-Faster-chunk-serialization.patch b/patches/server/0081-Faster-chunk-serialization.patch similarity index 100% rename from patches/server/0084-Faster-chunk-serialization.patch rename to patches/server/0081-Faster-chunk-serialization.patch diff --git a/patches/server/0085-Optimize-world-generation-chunk-and-block-access.patch b/patches/server/0082-Optimize-world-generation-chunk-and-block-access.patch similarity index 100% rename from patches/server/0085-Optimize-world-generation-chunk-and-block-access.patch rename to patches/server/0082-Optimize-world-generation-chunk-and-block-access.patch diff --git a/patches/server/0086-Cache-world-generator-sea-level.patch b/patches/server/0083-Cache-world-generator-sea-level.patch similarity index 100% rename from patches/server/0086-Cache-world-generator-sea-level.patch rename to patches/server/0083-Cache-world-generator-sea-level.patch diff --git a/patches/server/0087-Skip-secondary-POI-sensor-if-absent.patch b/patches/server/0084-Skip-secondary-POI-sensor-if-absent.patch similarity index 100% rename from patches/server/0087-Skip-secondary-POI-sensor-if-absent.patch rename to patches/server/0084-Skip-secondary-POI-sensor-if-absent.patch diff --git a/patches/server/0088-Cache-CubeVoxelShape-shape-array.patch b/patches/server/0085-Cache-CubeVoxelShape-shape-array.patch similarity index 100% rename from patches/server/0088-Cache-CubeVoxelShape-shape-array.patch rename to patches/server/0085-Cache-CubeVoxelShape-shape-array.patch diff --git a/patches/server/0089-Store-mob-counts-in-an-array.patch b/patches/server/0086-Store-mob-counts-in-an-array.patch similarity index 100% rename from patches/server/0089-Store-mob-counts-in-an-array.patch rename to patches/server/0086-Store-mob-counts-in-an-array.patch diff --git a/patches/server/0090-Cache-BlockStatePairKey-hash.patch b/patches/server/0087-Cache-BlockStatePairKey-hash.patch similarity index 100% rename from patches/server/0090-Cache-BlockStatePairKey-hash.patch rename to patches/server/0087-Cache-BlockStatePairKey-hash.patch diff --git a/patches/server/0091-Optimize-noise-generation.patch b/patches/server/0088-Optimize-noise-generation.patch similarity index 100% rename from patches/server/0091-Optimize-noise-generation.patch rename to patches/server/0088-Optimize-noise-generation.patch diff --git a/patches/server/0092-Disable-packet-limit.patch b/patches/server/0089-Disable-packet-limit.patch similarity index 100% rename from patches/server/0092-Disable-packet-limit.patch rename to patches/server/0089-Disable-packet-limit.patch diff --git a/patches/server/0093-Reduce-array-allocations.patch b/patches/server/0090-Reduce-array-allocations.patch similarity index 99% rename from patches/server/0093-Reduce-array-allocations.patch rename to patches/server/0090-Reduce-array-allocations.patch index 158ab275..d6bc8388 100644 --- a/patches/server/0093-Reduce-array-allocations.patch +++ b/patches/server/0090-Reduce-array-allocations.patch @@ -504,7 +504,7 @@ index 6c2e8049c2197ddc912c1a0fc99c87beae81e25b..be13baa7b51c4ad377b50d8ca8f7cfad private static Enchantment register(String name, Enchantment enchantment) { return Registry.register(BuiltInRegistries.ENCHANTMENT, name, enchantment); diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java -index bae8f999f4d9e798d87018cca3ff9c98c9337aab..ea3db1021a076d7b0560676ef2b916f7b0e514db 100644 +index e304b4977dd77bd770335accae697e7c7bc90ecc..6517b7f2c21c971b6af3324c5a91bc17a052f349 100644 --- a/src/main/java/net/minecraft/world/level/Level.java +++ b/src/main/java/net/minecraft/world/level/Level.java @@ -97,6 +97,7 @@ import org.bukkit.craftbukkit.util.CraftSpawnCategory; @@ -515,7 +515,7 @@ index bae8f999f4d9e798d87018cca3ff9c98c9337aab..ea3db1021a076d7b0560676ef2b916f7 public abstract class Level implements LevelAccessor, AutoCloseable { -@@ -1847,7 +1848,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable { +@@ -1845,7 +1846,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable { public org.bukkit.entity.Entity[] getChunkEntities(int chunkX, int chunkZ) { io.papermc.paper.world.ChunkEntitySlices slices = ((ServerLevel)this).getEntityLookup().getChunk(chunkX, chunkZ); if (slices == null) { diff --git a/patches/server/0094-Optimize-sun-burn-tick.patch b/patches/server/0091-Optimize-sun-burn-tick.patch similarity index 100% rename from patches/server/0094-Optimize-sun-burn-tick.patch rename to patches/server/0091-Optimize-sun-burn-tick.patch diff --git a/patches/server/0095-Reduce-lambda-and-Optional-allocation-in-EntityBased.patch b/patches/server/0092-Reduce-lambda-and-Optional-allocation-in-EntityBased.patch similarity index 100% rename from patches/server/0095-Reduce-lambda-and-Optional-allocation-in-EntityBased.patch rename to patches/server/0092-Reduce-lambda-and-Optional-allocation-in-EntityBased.patch diff --git a/patches/server/0096-Use-optimized-collection.patch b/patches/server/0093-Use-optimized-collection.patch similarity index 98% rename from patches/server/0096-Use-optimized-collection.patch rename to patches/server/0093-Use-optimized-collection.patch index 00824fd1..fc490c39 100644 --- a/patches/server/0096-Use-optimized-collection.patch +++ b/patches/server/0093-Use-optimized-collection.patch @@ -6,7 +6,7 @@ Subject: [PATCH] Use optimized collection This patch is Powered by Gale(https://github.com/GaleMC/Gale) diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java -index 2e3061b3874764fa2bde068486fa0c03a6b6a6f4..a6eef599ce6023925328d68454a6570d56f07cda 100644 +index 6edd6ae82a049d988331a22af8440ffacf0a6bbe..61a84fd1aeaa4ddd506a1879183c532540a055a6 100644 --- a/src/main/java/net/minecraft/server/level/ChunkMap.java +++ b/src/main/java/net/minecraft/server/level/ChunkMap.java @@ -237,7 +237,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider @@ -84,7 +84,7 @@ index 4f2fa47d094348bb8f86a86e808019ddba56e187..e6938589bf12ccd401cc6700cfa5f28c // Paper start int arraySize = rules.keySet().stream().mapToInt(key -> key.gameRuleIndex).max().orElse(-1) + 1; diff --git a/src/main/java/net/minecraft/world/level/block/Block.java b/src/main/java/net/minecraft/world/level/block/Block.java -index 478dcee61e4cb5e0691ce52a3be2e307f6d4af64..38f3644ffe7fd13f13b928ee8568860a23d7c69d 100644 +index c498d397938c973608634867366aea8bfad7b3c9..96bf3845f5c76363726ebb934ab008c4c1807f26 100644 --- a/src/main/java/net/minecraft/world/level/block/Block.java +++ b/src/main/java/net/minecraft/world/level/block/Block.java @@ -62,6 +62,7 @@ import net.minecraft.world.phys.shapes.BooleanOp; diff --git a/patches/server/0097-Avoid-Class-isAssignableFrom-call-in-ClassInstanceMu.patch b/patches/server/0094-Avoid-Class-isAssignableFrom-call-in-ClassInstanceMu.patch similarity index 100% rename from patches/server/0097-Avoid-Class-isAssignableFrom-call-in-ClassInstanceMu.patch rename to patches/server/0094-Avoid-Class-isAssignableFrom-call-in-ClassInstanceMu.patch diff --git a/patches/server/0098-Optimized-CubePointRange.patch b/patches/server/0095-Optimized-CubePointRange.patch similarity index 100% rename from patches/server/0098-Optimized-CubePointRange.patch rename to patches/server/0095-Optimized-CubePointRange.patch diff --git a/patches/server/0099-Check-frozen-ticks-before-landing-block.patch b/patches/server/0096-Check-frozen-ticks-before-landing-block.patch similarity index 100% rename from patches/server/0099-Check-frozen-ticks-before-landing-block.patch rename to patches/server/0096-Check-frozen-ticks-before-landing-block.patch diff --git a/patches/server/0100-Cache-ominous-banner-item.patch b/patches/server/0097-Cache-ominous-banner-item.patch similarity index 100% rename from patches/server/0100-Cache-ominous-banner-item.patch rename to patches/server/0097-Cache-ominous-banner-item.patch diff --git a/patches/server/0101-Skip-entity-move-if-movement-is-zero.patch b/patches/server/0098-Skip-entity-move-if-movement-is-zero.patch similarity index 100% rename from patches/server/0101-Skip-entity-move-if-movement-is-zero.patch rename to patches/server/0098-Skip-entity-move-if-movement-is-zero.patch diff --git a/patches/server/0102-Skip-cloning-advancement-criteria.patch b/patches/server/0099-Skip-cloning-advancement-criteria.patch similarity index 100% rename from patches/server/0102-Skip-cloning-advancement-criteria.patch rename to patches/server/0099-Skip-cloning-advancement-criteria.patch diff --git a/patches/server/0103-Skip-negligible-planar-movement-multiplication.patch b/patches/server/0100-Skip-negligible-planar-movement-multiplication.patch similarity index 100% rename from patches/server/0103-Skip-negligible-planar-movement-multiplication.patch rename to patches/server/0100-Skip-negligible-planar-movement-multiplication.patch diff --git a/patches/server/0104-Fix-villagers-dont-release-memory.patch b/patches/server/0101-Fix-villagers-dont-release-memory.patch similarity index 100% rename from patches/server/0104-Fix-villagers-dont-release-memory.patch rename to patches/server/0101-Fix-villagers-dont-release-memory.patch diff --git a/patches/server/0105-Avoid-anvil-too-expensive.patch b/patches/server/0102-Avoid-anvil-too-expensive.patch similarity index 100% rename from patches/server/0105-Avoid-anvil-too-expensive.patch rename to patches/server/0102-Avoid-anvil-too-expensive.patch diff --git a/patches/server/0106-Bow-infinity-fix.patch b/patches/server/0103-Bow-infinity-fix.patch similarity index 100% rename from patches/server/0106-Bow-infinity-fix.patch rename to patches/server/0103-Bow-infinity-fix.patch diff --git a/patches/server/0107-Zero-tick-plants.patch b/patches/server/0104-Zero-tick-plants.patch similarity index 100% rename from patches/server/0107-Zero-tick-plants.patch rename to patches/server/0104-Zero-tick-plants.patch diff --git a/patches/server/0108-Leaves-update-command.patch b/patches/server/0105-Leaves-update-command.patch similarity index 97% rename from patches/server/0108-Leaves-update-command.patch rename to patches/server/0105-Leaves-update-command.patch index c96a952b..f881162a 100644 --- a/patches/server/0108-Leaves-update-command.patch +++ b/patches/server/0105-Leaves-update-command.patch @@ -5,21 +5,21 @@ Subject: [PATCH] Leaves update command diff --git a/src/main/java/top/leavesmc/leaves/command/LeavesCommand.java b/src/main/java/top/leavesmc/leaves/command/LeavesCommand.java -index e89bf96486c87cdff6c1a425afd10d744376c77f..8027a27b253db02570c2f28ebb200001b76a1fc3 100644 +index 9b6fb546a672fa5b27047fec638e42b2b5dbf533..abf5c05cd5b54b53a192cc452f0e12c43f1fa2fa 100644 --- a/src/main/java/top/leavesmc/leaves/command/LeavesCommand.java +++ b/src/main/java/top/leavesmc/leaves/command/LeavesCommand.java -@@ -12,6 +12,7 @@ import org.bukkit.permissions.PermissionDefault; - import org.bukkit.plugin.PluginManager; +@@ -13,6 +13,7 @@ import org.bukkit.plugin.PluginManager; import org.checkerframework.checker.nullness.qual.Nullable; import org.jetbrains.annotations.NotNull; + import top.leavesmc.leaves.command.subcommands.ConfigCommand; +import top.leavesmc.leaves.command.subcommands.UpdateCommand; import java.util.ArrayList; import java.util.Arrays; -@@ -31,6 +32,7 @@ public final class LeavesCommand extends Command { - // subcommand label -> subcommand +@@ -33,6 +34,7 @@ public final class LeavesCommand extends Command { private static final Map SUBCOMMANDS = Util.make(() -> { final Map, LeavesSubcommand> commands = new HashMap<>(); + commands.put(Set.of("config"), new ConfigCommand()); + commands.put(Set.of("update"), new UpdateCommand()); return commands.entrySet().stream() diff --git a/patches/server/0109-Force-peaceful-mode-switch.patch b/patches/server/0106-Force-peaceful-mode-switch.patch similarity index 97% rename from patches/server/0109-Force-peaceful-mode-switch.patch rename to patches/server/0106-Force-peaceful-mode-switch.patch index e454d267..7d6e32e5 100644 --- a/patches/server/0109-Force-peaceful-mode-switch.patch +++ b/patches/server/0106-Force-peaceful-mode-switch.patch @@ -130,20 +130,20 @@ index 38d842bc0fb7d9c39a3673983a643248e9563fe2..8f57c3805547354af3f5167acc7efca9 if (!this.persistentDataContainer.isEmpty()) { c.put("BukkitValues", this.persistentDataContainer.toTagCompound()); diff --git a/src/main/java/top/leavesmc/leaves/command/LeavesCommand.java b/src/main/java/top/leavesmc/leaves/command/LeavesCommand.java -index 8027a27b253db02570c2f28ebb200001b76a1fc3..da1f7ce2db23c509c70f673c8bb1c46af2ed7279 100644 +index abf5c05cd5b54b53a192cc452f0e12c43f1fa2fa..5efdb9b5138738da7cfc075ce0be531d2608577e 100644 --- a/src/main/java/top/leavesmc/leaves/command/LeavesCommand.java +++ b/src/main/java/top/leavesmc/leaves/command/LeavesCommand.java -@@ -12,6 +12,7 @@ import org.bukkit.permissions.PermissionDefault; - import org.bukkit.plugin.PluginManager; +@@ -13,6 +13,7 @@ import org.bukkit.plugin.PluginManager; import org.checkerframework.checker.nullness.qual.Nullable; import org.jetbrains.annotations.NotNull; + import top.leavesmc.leaves.command.subcommands.ConfigCommand; +import top.leavesmc.leaves.command.subcommands.PeacefulModeSwitchCommand; import top.leavesmc.leaves.command.subcommands.UpdateCommand; import java.util.ArrayList; -@@ -33,6 +34,7 @@ public final class LeavesCommand extends Command { - private static final Map SUBCOMMANDS = Util.make(() -> { +@@ -35,6 +36,7 @@ public final class LeavesCommand extends Command { final Map, LeavesSubcommand> commands = new HashMap<>(); + commands.put(Set.of("config"), new ConfigCommand()); commands.put(Set.of("update"), new UpdateCommand()); + commands.put(Set.of("peaceful"), new PeacefulModeSwitchCommand()); diff --git a/patches/server/0110-Add-Leaves-Auto-Update.patch b/patches/server/0107-Add-Leaves-Auto-Update.patch similarity index 73% rename from patches/server/0110-Add-Leaves-Auto-Update.patch rename to patches/server/0107-Add-Leaves-Auto-Update.patch index 72717cb1..d8000b85 100644 --- a/patches/server/0110-Add-Leaves-Auto-Update.patch +++ b/patches/server/0107-Add-Leaves-Auto-Update.patch @@ -4,28 +4,8 @@ Date: Sun, 6 Aug 2023 09:57:53 +0800 Subject: [PATCH] Add Leaves Auto Update -diff --git a/src/main/java/top/leavesmc/leaves/LeavesConfig.java b/src/main/java/top/leavesmc/leaves/LeavesConfig.java -index 73a951413c1518895bf8a0efb6267ba4c57d71e9..f0caa9a182b1fe2a1b1e0a02c878afc0e61771a1 100644 ---- a/src/main/java/top/leavesmc/leaves/LeavesConfig.java -+++ b/src/main/java/top/leavesmc/leaves/LeavesConfig.java -@@ -17,6 +17,7 @@ import top.leavesmc.leaves.protocol.syncmatica.SyncmaticaProtocol; - import top.leavesmc.leaves.util.MathUtils; - import top.leavesmc.leaves.protocol.CarpetServerProtocol.CarpetRule; - import top.leavesmc.leaves.protocol.CarpetServerProtocol.CarpetRules; -+import top.leavesmc.leaves.util.LeavesUpdateHelper; - import top.leavesmc.leaves.protocol.bladeren.BladerenProtocol.LeavesFeatureSet; - import top.leavesmc.leaves.protocol.bladeren.BladerenProtocol.LeavesFeature; - -@@ -827,6 +828,7 @@ public final class LeavesConfig { - private static void autoUpdate() { - autoUpdate = getBoolean("settings.misc.auto-update.enable", autoUpdate); - autoUpdateTime = getList("settings.misc.auto-update.time", autoUpdateTime); -+ LeavesUpdateHelper.init(); - if (autoUpdate) { - LeavesLogger.LOGGER.warning("Auto-Update is not completely safe. Enabling it may cause data security problems!"); - } diff --git a/src/main/java/top/leavesmc/leaves/util/LeavesUpdateHelper.java b/src/main/java/top/leavesmc/leaves/util/LeavesUpdateHelper.java -index 9b18d711191aa26c9afea85fc901e422e8f8496c..35a9ea436b86137d0329b16489e3fb3bbdedee48 100644 +index e7060b91a27b1d0cddb14c155caaa0e78a043e20..68400212f121f57d3dfa0c3e5ccb2346ae95eb02 100644 --- a/src/main/java/top/leavesmc/leaves/util/LeavesUpdateHelper.java +++ b/src/main/java/top/leavesmc/leaves/util/LeavesUpdateHelper.java @@ -7,8 +7,11 @@ import com.google.gson.JsonElement; diff --git a/patches/server/0111-Replay-Mod-API.patch b/patches/server/0108-Replay-Mod-API.patch similarity index 99% rename from patches/server/0111-Replay-Mod-API.patch rename to patches/server/0108-Replay-Mod-API.patch index f1d176e1..60769d25 100644 --- a/patches/server/0111-Replay-Mod-API.patch +++ b/patches/server/0108-Replay-Mod-API.patch @@ -334,7 +334,7 @@ index 5e156b229f132626ed1e15a92302f8c4e06b47db..a7eb6319f274c3fc7071251fe3a6aedb this.server.getCustomBossEvents().onPlayerDisconnect(entityplayer); UUID uuid = entityplayer.getUUID(); diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -index 602d913b144c6d565e09c5623859c40775a4fcca..48d105c48c51b006493de29baef4fe7236886eef 100644 +index 1dc51050065af9bfc760f0a2cd7a479817888280..3997e5b56d99cb7374a0983ddb12caac12776b07 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java @@ -260,6 +260,7 @@ import org.yaml.snakeyaml.error.MarkedYAMLException; @@ -362,7 +362,7 @@ index 602d913b144c6d565e09c5623859c40775a4fcca..48d105c48c51b006493de29baef4fe72 @Override public CraftPlayer apply(ServerPlayer player) { return player.getBukkitEntity(); -@@ -3255,4 +3257,11 @@ public final class CraftServer implements Server { +@@ -3253,4 +3255,11 @@ public final class CraftServer implements Server { return botManager; } // Leaves end - Bot API diff --git a/patches/server/0112-Fix-vehicle-teleport-by-end-gateway.patch b/patches/server/0109-Fix-vehicle-teleport-by-end-gateway.patch similarity index 100% rename from patches/server/0112-Fix-vehicle-teleport-by-end-gateway.patch rename to patches/server/0109-Fix-vehicle-teleport-by-end-gateway.patch diff --git a/patches/server/0113-Leaves-I18n.patch b/patches/server/0110-Leaves-I18n.patch similarity index 99% rename from patches/server/0113-Leaves-I18n.patch rename to patches/server/0110-Leaves-I18n.patch index 3abffc75..2285cc4f 100644 --- a/patches/server/0113-Leaves-I18n.patch +++ b/patches/server/0110-Leaves-I18n.patch @@ -51,12 +51,12 @@ index 571fdf253ebc5cf2a3ec120c53293b37b770836d..800cadbb379cb90d5351c6d73f994713 ImmutableMap.Builder builder = ImmutableMap.builder(); BiConsumer biConsumer = builder::put; diff --git a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java -index 4b13af14fcbe1925f9d3104d95ebbfbc596cfb3c..2225401b9b864d58803cfd76357c4e9f7d97e5ec 100644 +index d4932ba7042b897a8561103367d0b7cf9a08234c..e23d90e2952efbab58e43b795550ae0db7b3c883 100644 --- a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java +++ b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java -@@ -223,6 +223,7 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface +@@ -222,6 +222,7 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface + top.leavesmc.leaves.LeavesConfig.init((java.io.File) options.valueOf("leaves-settings")); // Leaves - Server Config - top.leavesmc.leaves.LeavesConfig.registerCommands(); // Leaves - Server Command System.setProperty("spark.serverconfigs.extra", "leaves.yml"); // Leaves - spark config + net.minecraft.locale.Language.loadI18N(top.leavesmc.leaves.LeavesConfig.serverLang); // Leaves - i18n diff --git a/patches/server/0114-Fix-minecraft-hopper-not-work-without-player.patch b/patches/server/0111-Fix-minecraft-hopper-not-work-without-player.patch similarity index 100% rename from patches/server/0114-Fix-minecraft-hopper-not-work-without-player.patch rename to patches/server/0111-Fix-minecraft-hopper-not-work-without-player.patch diff --git a/patches/server/0115-Wool-Hopper-Counter.patch b/patches/server/0112-Wool-Hopper-Counter.patch similarity index 98% rename from patches/server/0115-Wool-Hopper-Counter.patch rename to patches/server/0112-Wool-Hopper-Counter.patch index fabda121..c205e84c 100644 --- a/patches/server/0115-Wool-Hopper-Counter.patch +++ b/patches/server/0112-Wool-Hopper-Counter.patch @@ -61,19 +61,19 @@ index 5fabdda079ebcb0e5d119f3e60f7447d88dd2707..659d4e62bb57946e595174d758c351e4 return inventory instanceof WorldlyContainer ? IntStream.of(((WorldlyContainer) inventory).getSlotsForFace(side)) : IntStream.range(0, inventory.getContainerSize()); } diff --git a/src/main/java/top/leavesmc/leaves/command/LeavesCommand.java b/src/main/java/top/leavesmc/leaves/command/LeavesCommand.java -index da1f7ce2db23c509c70f673c8bb1c46af2ed7279..5e413b0216289922a49a3de7ff5cd9aef4c3c16e 100644 +index 5efdb9b5138738da7cfc075ce0be531d2608577e..9fc807312bd61158f996abb8424ec0c0005d2d42 100644 --- a/src/main/java/top/leavesmc/leaves/command/LeavesCommand.java +++ b/src/main/java/top/leavesmc/leaves/command/LeavesCommand.java -@@ -12,6 +12,7 @@ import org.bukkit.permissions.PermissionDefault; - import org.bukkit.plugin.PluginManager; +@@ -13,6 +13,7 @@ import org.bukkit.plugin.PluginManager; import org.checkerframework.checker.nullness.qual.Nullable; import org.jetbrains.annotations.NotNull; + import top.leavesmc.leaves.command.subcommands.ConfigCommand; +import top.leavesmc.leaves.command.subcommands.CounterCommand; import top.leavesmc.leaves.command.subcommands.PeacefulModeSwitchCommand; import top.leavesmc.leaves.command.subcommands.UpdateCommand; -@@ -35,6 +36,7 @@ public final class LeavesCommand extends Command { - final Map, LeavesSubcommand> commands = new HashMap<>(); +@@ -37,6 +38,7 @@ public final class LeavesCommand extends Command { + commands.put(Set.of("config"), new ConfigCommand()); commands.put(Set.of("update"), new UpdateCommand()); commands.put(Set.of("peaceful"), new PeacefulModeSwitchCommand()); + commands.put(Set.of("counter"), new CounterCommand()); diff --git a/patches/server/0116-Loot-world-random.patch b/patches/server/0113-Loot-world-random.patch similarity index 100% rename from patches/server/0116-Loot-world-random.patch rename to patches/server/0113-Loot-world-random.patch diff --git a/patches/server/0117-Leaves-Reload-Command.patch b/patches/server/0114-Leaves-Reload-Command.patch similarity index 89% rename from patches/server/0117-Leaves-Reload-Command.patch rename to patches/server/0114-Leaves-Reload-Command.patch index c2a2062c..42e41fea 100644 --- a/patches/server/0117-Leaves-Reload-Command.patch +++ b/patches/server/0114-Leaves-Reload-Command.patch @@ -5,18 +5,18 @@ Subject: [PATCH] Leaves Reload Command diff --git a/src/main/java/top/leavesmc/leaves/command/LeavesCommand.java b/src/main/java/top/leavesmc/leaves/command/LeavesCommand.java -index 5e413b0216289922a49a3de7ff5cd9aef4c3c16e..5109d08998707f7443880b2daff719483dff7a5e 100644 +index 9fc807312bd61158f996abb8424ec0c0005d2d42..3d7b012d51fc2774cde688fcde01800a511c6bf2 100644 --- a/src/main/java/top/leavesmc/leaves/command/LeavesCommand.java +++ b/src/main/java/top/leavesmc/leaves/command/LeavesCommand.java -@@ -14,6 +14,7 @@ import org.checkerframework.checker.nullness.qual.Nullable; - import org.jetbrains.annotations.NotNull; +@@ -15,6 +15,7 @@ import org.jetbrains.annotations.NotNull; + import top.leavesmc.leaves.command.subcommands.ConfigCommand; import top.leavesmc.leaves.command.subcommands.CounterCommand; import top.leavesmc.leaves.command.subcommands.PeacefulModeSwitchCommand; +import top.leavesmc.leaves.command.subcommands.ReloadCommand; import top.leavesmc.leaves.command.subcommands.UpdateCommand; import java.util.ArrayList; -@@ -37,6 +38,7 @@ public final class LeavesCommand extends Command { +@@ -39,6 +40,7 @@ public final class LeavesCommand extends Command { commands.put(Set.of("update"), new UpdateCommand()); commands.put(Set.of("peaceful"), new PeacefulModeSwitchCommand()); commands.put(Set.of("counter"), new CounterCommand()); diff --git a/patches/server/0118-Spider-jockeys-drop-gapples.patch b/patches/server/0115-Spider-jockeys-drop-gapples.patch similarity index 100% rename from patches/server/0118-Spider-jockeys-drop-gapples.patch rename to patches/server/0115-Spider-jockeys-drop-gapples.patch diff --git a/patches/server/0119-Force-Void-Trade.patch b/patches/server/0116-Force-Void-Trade.patch similarity index 100% rename from patches/server/0119-Force-Void-Trade.patch rename to patches/server/0116-Force-Void-Trade.patch diff --git a/patches/server/0120-Servux-Protocol.patch b/patches/server/0117-Servux-Protocol.patch similarity index 100% rename from patches/server/0120-Servux-Protocol.patch rename to patches/server/0117-Servux-Protocol.patch diff --git a/patches/server/0121-Villager-infinite-discounts.patch b/patches/server/0118-Villager-infinite-discounts.patch similarity index 53% rename from patches/server/0121-Villager-infinite-discounts.patch rename to patches/server/0118-Villager-infinite-discounts.patch index 6162f971..b325ac65 100644 --- a/patches/server/0121-Villager-infinite-discounts.patch +++ b/patches/server/0118-Villager-infinite-discounts.patch @@ -5,40 +5,42 @@ Subject: [PATCH] Villager infinite discounts diff --git a/src/main/java/net/minecraft/world/entity/ai/gossip/GossipType.java b/src/main/java/net/minecraft/world/entity/ai/gossip/GossipType.java -index c3d1d7b525a6f2b708144ebe9bc28dfadcfe11fa..55b4386fc57286548161f9ee91e19e22e35ba3c9 100644 +index 8c942c21dc3aebcd2fc89b5bde92c73a95bdc3e3..55b4386fc57286548161f9ee91e19e22e35ba3c9 100644 --- a/src/main/java/net/minecraft/world/entity/ai/gossip/GossipType.java +++ b/src/main/java/net/minecraft/world/entity/ai/gossip/GossipType.java @@ -15,9 +15,9 @@ public enum GossipType implements StringRepresentable { public static final int REPUTATION_CHANGE_PER_TRADE = 2; public final String id; public final int weight; -- public int max; +- public final int max; + public int max; // Leaves - not final public final int decayPerDay; -- public int decayPerTransfer; +- public final int decayPerTransfer; + public int decayPerTransfer; // Leaves - not final public static final Codec CODEC = StringRepresentable.fromEnum(GossipType::values); private GossipType(String key, int multiplier, int maxReputation, int decay, int shareDecrement) { -diff --git a/src/main/java/top/leavesmc/leaves/LeavesConfig.java b/src/main/java/top/leavesmc/leaves/LeavesConfig.java -index f0caa9a182b1fe2a1b1e0a02c878afc0e61771a1..13a723e03fad5d9c65c49beec879ba06bdc598e4 100644 ---- a/src/main/java/top/leavesmc/leaves/LeavesConfig.java -+++ b/src/main/java/top/leavesmc/leaves/LeavesConfig.java -@@ -20,6 +20,7 @@ import top.leavesmc.leaves.protocol.CarpetServerProtocol.CarpetRules; - import top.leavesmc.leaves.util.LeavesUpdateHelper; - import top.leavesmc.leaves.protocol.bladeren.BladerenProtocol.LeavesFeatureSet; - import top.leavesmc.leaves.protocol.bladeren.BladerenProtocol.LeavesFeature; +diff --git a/src/main/java/top/leavesmc/leaves/util/VillagerInfiniteDiscountHelper.java b/src/main/java/top/leavesmc/leaves/util/VillagerInfiniteDiscountHelper.java +new file mode 100644 +index 0000000000000000000000000000000000000000..a5063fdcc8b5bf009994bf4134a56390141e69c2 +--- /dev/null ++++ b/src/main/java/top/leavesmc/leaves/util/VillagerInfiniteDiscountHelper.java +@@ -0,0 +1,18 @@ ++package top.leavesmc.leaves.util; ++ +import net.minecraft.world.entity.ai.gossip.GossipType; - - import java.io.File; - import java.lang.reflect.InvocationTargetException; -@@ -900,6 +901,9 @@ public final class LeavesConfig { - private static void villagerInfiniteDiscounts() { - villagerInfiniteDiscounts = getBoolean("settings.modify.minecraft-old.villager-infinite-discounts", villagerInfiniteDiscounts); - if (villagerInfiniteDiscounts) { ++ ++public class VillagerInfiniteDiscountHelper { ++ ++ public static void doVillagerInfiniteDiscount(boolean value) { ++ if (value) { + GossipType.MAJOR_POSITIVE.max = 100; + GossipType.MAJOR_POSITIVE.decayPerTransfer = 100; + GossipType.MINOR_POSITIVE.max = 200; - } - } - ++ } else { ++ GossipType.MAJOR_POSITIVE.max = 20; ++ GossipType.MAJOR_POSITIVE.decayPerTransfer = 20; ++ GossipType.MINOR_POSITIVE.max = 25; ++ } ++ } ++} diff --git a/patches/server/0122-CCE-update-suppression.patch b/patches/server/0119-CCE-update-suppression.patch similarity index 100% rename from patches/server/0122-CCE-update-suppression.patch rename to patches/server/0119-CCE-update-suppression.patch diff --git a/patches/server/0123-Disable-offline-warn-if-use-proxy.patch b/patches/server/0120-Disable-offline-warn-if-use-proxy.patch similarity index 89% rename from patches/server/0123-Disable-offline-warn-if-use-proxy.patch rename to patches/server/0120-Disable-offline-warn-if-use-proxy.patch index 8a002696..dbd9c579 100644 --- a/patches/server/0123-Disable-offline-warn-if-use-proxy.patch +++ b/patches/server/0120-Disable-offline-warn-if-use-proxy.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Disable offline warn if use proxy diff --git a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java -index 2225401b9b864d58803cfd76357c4e9f7d97e5ec..c2d98ccd9f2a71007dc39c1a67eb2b20b403e833 100644 +index e23d90e2952efbab58e43b795550ae0db7b3c883..f855d6a7dfe563476c35219a6195916fbbcb53aa 100644 --- a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java +++ b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java -@@ -284,7 +284,7 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface +@@ -283,7 +283,7 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface String proxyFlavor = (io.papermc.paper.configuration.GlobalConfiguration.get().proxies.velocity.enabled) ? "Velocity" : "BungeeCord"; String proxyLink = (io.papermc.paper.configuration.GlobalConfiguration.get().proxies.velocity.enabled) ? "https://docs.papermc.io/velocity/security" : "http://www.spigotmc.org/wiki/firewall-guide/"; // Paper end diff --git a/patches/server/0124-Disable-moved-wrongly-threshold.patch b/patches/server/0121-Disable-moved-wrongly-threshold.patch similarity index 97% rename from patches/server/0124-Disable-moved-wrongly-threshold.patch rename to patches/server/0121-Disable-moved-wrongly-threshold.patch index 46cf2ed4..5a41e1b2 100644 --- a/patches/server/0124-Disable-moved-wrongly-threshold.patch +++ b/patches/server/0121-Disable-moved-wrongly-threshold.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Disable moved wrongly threshold diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index 9776c4e3ff6327592322ca441ef8fc2e9022db8d..05cf9062de1398c2285dd041a5076d397430c368 100644 +index aa5fc061e905bc901ae6672cd54c3c9bca4cee76..d4bb01f41dc46bb4ea01472e04238c39ef865788 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java @@ -559,7 +559,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl diff --git a/patches/server/0125-Armor-stand-cant-kill-by-mob-projectile.patch b/patches/server/0122-Armor-stand-cant-kill-by-mob-projectile.patch similarity index 100% rename from patches/server/0125-Armor-stand-cant-kill-by-mob-projectile.patch rename to patches/server/0122-Armor-stand-cant-kill-by-mob-projectile.patch diff --git a/patches/server/0126-Make-Item-tick-vanilla.patch b/patches/server/0123-Make-Item-tick-vanilla.patch similarity index 100% rename from patches/server/0126-Make-Item-tick-vanilla.patch rename to patches/server/0123-Make-Item-tick-vanilla.patch diff --git a/patches/server/0127-Copper-Bulb-1-gt-delay.patch b/patches/server/0124-Copper-Bulb-1-gt-delay.patch similarity index 100% rename from patches/server/0127-Copper-Bulb-1-gt-delay.patch rename to patches/server/0124-Copper-Bulb-1-gt-delay.patch diff --git a/patches/server/0128-Crafter-1-gt-delay.patch b/patches/server/0125-Crafter-1-gt-delay.patch similarity index 100% rename from patches/server/0128-Crafter-1-gt-delay.patch rename to patches/server/0125-Crafter-1-gt-delay.patch