Skip to content

Commit

Permalink
Move config (2)
Browse files Browse the repository at this point in the history
  • Loading branch information
s-yh-china committed Nov 30, 2024
1 parent 0560d56 commit 46898af
Show file tree
Hide file tree
Showing 78 changed files with 291 additions and 289 deletions.
48 changes: 23 additions & 25 deletions patches/server/0006-Leaves-Server-Config-And-Command.patch
Original file line number Diff line number Diff line change
Expand Up @@ -85,10 +85,10 @@ index 44bbfc4eba78dfa268696c79b1d15c8f1271bbb1..a88ff89928c322fa1c42987a06991a56
.withRequiredArg()
diff --git a/src/main/java/org/leavesmc/leaves/LeavesConfig.java b/src/main/java/org/leavesmc/leaves/LeavesConfig.java
new file mode 100644
index 0000000000000000000000000000000000000000..2c01d721b9a1b41ca4b82dc87aaf894a94ba1062
index 0000000000000000000000000000000000000000..248536658e094ce5b035c16da54658b80e967829
--- /dev/null
+++ b/src/main/java/org/leavesmc/leaves/LeavesConfig.java
@@ -0,0 +1,963 @@
@@ -0,0 +1,961 @@
+package org.leavesmc.leaves;
+
+import com.destroystokyo.paper.util.SneakyThrow;
Expand Down Expand Up @@ -186,12 +186,12 @@ index 0000000000000000000000000000000000000000..2c01d721b9a1b41ca4b82dc87aaf894a
+ MinecraftServer.getServer().server.syncCommands();
+ }
+
+ public static ModifyConfig modify;
+ public static ModifyConfig modify = new ModifyConfig();
+
+ @GlobalConfigCategory("modify")
+ public static class ModifyConfig {
+
+ public FakeplayerConfig fakeplayer;
+ public FakeplayerConfig fakeplayer = new FakeplayerConfig();
+
+ @GlobalConfigCategory("fakeplayer")
+ public static class FakeplayerConfig {
Expand Down Expand Up @@ -265,12 +265,12 @@ index 0000000000000000000000000000000000000000..2c01d721b9a1b41ca4b82dc87aaf894a
+ public boolean useSkinCache = false;
+ }
+
+ public MinecraftOLDConfig oldMC;
+ public MinecraftOLDConfig oldMC = new MinecraftOLDConfig();
+
+ @GlobalConfigCategory("minecraft-old")
+ public static class MinecraftOLDConfig {
+
+ public BlockUpdaterConfig updater;
+ public BlockUpdaterConfig updater = new BlockUpdaterConfig();
+
+ @GlobalConfigCategory("block-updater")
+ public static class BlockUpdaterConfig {
Expand Down Expand Up @@ -346,7 +346,7 @@ index 0000000000000000000000000000000000000000..2c01d721b9a1b41ca4b82dc87aaf894a
+ @GlobalConfig("old-block-entity-behaviour")
+ public boolean oldBlockEntityBehaviour = false;
+
+ public RaidConfig raid;
+ public RaidConfig raid = new RaidConfig();
+
+ @GlobalConfigCategory("revert-raid-changes")
+ public static class RaidConfig {
Expand All @@ -364,7 +364,7 @@ index 0000000000000000000000000000000000000000..2c01d721b9a1b41ca4b82dc87aaf894a
+ public boolean stringTripwireHookDuplicate = false;
+ }
+
+ public ElytraAeronauticsConfig elytraAeronautics;
+ public ElytraAeronauticsConfig elytraAeronautics = new ElytraAeronauticsConfig();
+
+ @GlobalConfigCategory("elytra-aeronautics")
+ public static class ElytraAeronauticsConfig {
Expand Down Expand Up @@ -440,9 +440,6 @@ index 0000000000000000000000000000000000000000..2c01d721b9a1b41ca4b82dc87aaf894a
+ @GlobalConfig("force-void-trade")
+ public boolean forceVoidTrade = false;
+
+ @GlobalConfig("disable-moved-wrongly-threshold")
+ public boolean disableMovedWronglyThreshold = false;
+
+ @GlobalConfig(value = "mc-technical-survival-mode", validator = McTechnicalModeValidator.class, lock = true)
+ public boolean mcTechnicalMode = true;
+
Expand Down Expand Up @@ -620,15 +617,16 @@ index 0000000000000000000000000000000000000000..2c01d721b9a1b41ca4b82dc87aaf894a
+ @RemovedConfig(name = "player-can-edit-sign", category = "modify")
+ @RemovedConfig(name = "mending-compatibility-infinity", category = {"modify", "minecraft-old"})
+ @RemovedConfig(name = "protection-stacking", category = {"modify", "minecraft-old"})
+ @RemovedConfig(name = "disable-moved-wrongly-threshold", category = {"modify"})
+ private final boolean removed = false;
+ }
+
+ public static PerformanceConfig performance;
+ public static PerformanceConfig performance = new PerformanceConfig();
+
+ @GlobalConfigCategory("performance")
+ public static class PerformanceConfig {
+
+ public PerformanceRemoveConfig remove;
+ public PerformanceRemoveConfig remove = new PerformanceRemoveConfig();
+
+ @GlobalConfigCategory("remove")
+ public static class PerformanceRemoveConfig {
Expand Down Expand Up @@ -732,12 +730,12 @@ index 0000000000000000000000000000000000000000..2c01d721b9a1b41ca4b82dc87aaf894a
+ private final boolean removedPerformance = true;
+ }
+
+ public static ProtocolConfig protocol;
+ public static ProtocolConfig protocol = new ProtocolConfig();
+
+ @GlobalConfigCategory("protocol")
+ public static class ProtocolConfig {
+
+ public BladerenConfig bladeren;
+ public BladerenConfig bladeren = new BladerenConfig();
+
+ @GlobalConfigCategory("bladeren")
+ public static class BladerenConfig {
Expand Down Expand Up @@ -767,7 +765,7 @@ index 0000000000000000000000000000000000000000..2c01d721b9a1b41ca4b82dc87aaf894a
+ }
+ }
+
+ public SyncmaticaConfig syncmatica;
+ public SyncmaticaConfig syncmatica = new SyncmaticaConfig();
+
+ @GlobalConfigCategory("syncmatica")
+ public static class SyncmaticaConfig {
Expand All @@ -790,7 +788,7 @@ index 0000000000000000000000000000000000000000..2c01d721b9a1b41ca4b82dc87aaf894a
+ public int quotaLimit = 40000000;
+ }
+
+ public PCAConfig pca;
+ public PCAConfig pca = new PCAConfig();
+
+ @GlobalConfigCategory("pca")
+ public static class PCAConfig {
Expand Down Expand Up @@ -819,7 +817,7 @@ index 0000000000000000000000000000000000000000..2c01d721b9a1b41ca4b82dc87aaf894a
+ }
+ }
+
+ public AppleSkinConfig appleskin;
+ public AppleSkinConfig appleskin = new AppleSkinConfig();
+
+ @GlobalConfigCategory("appleskin")
+ public static class AppleSkinConfig {
Expand All @@ -831,7 +829,7 @@ index 0000000000000000000000000000000000000000..2c01d721b9a1b41ca4b82dc87aaf894a
+ public int syncTickInterval = 20;
+ }
+
+ public ServuxConfig servux;
+ public ServuxConfig servux = new ServuxConfig();
+
+ @GlobalConfigCategory("servux")
+ public static class ServuxConfig {
Expand Down Expand Up @@ -875,12 +873,12 @@ index 0000000000000000000000000000000000000000..2c01d721b9a1b41ca4b82dc87aaf894a
+ public boolean leavesCarpetSupport = false;
+ }
+
+ public static MiscConfig mics;
+ public static MiscConfig mics = new MiscConfig();
+
+ @GlobalConfigCategory("misc")
+ public static class MiscConfig {
+
+ public AutoUpdateConfig autoUpdate;
+ public AutoUpdateConfig autoUpdate = new AutoUpdateConfig();
+
+ @GlobalConfigCategory("auto-update")
+ public static class AutoUpdateConfig {
Expand Down Expand Up @@ -918,7 +916,7 @@ index 0000000000000000000000000000000000000000..2c01d721b9a1b41ca4b82dc87aaf894a
+ public List<String> updateTime = List.of("14:00", "2:00");
+ }
+
+ public ExtraYggdrasilConfig yggdrasil;
+ public ExtraYggdrasilConfig yggdrasil = new ExtraYggdrasilConfig();
+
+ @GlobalConfigCategory("extra-yggdrasil-service")
+ public static class ExtraYggdrasilConfig {
Expand Down Expand Up @@ -991,7 +989,7 @@ index 0000000000000000000000000000000000000000..2c01d721b9a1b41ca4b82dc87aaf894a
+ public boolean leavesPacketEvent = true;
+ }
+
+ public static RegionConfig region;
+ public static RegionConfig region = new RegionConfig();
+
+ @GlobalConfigCategory("region")
+ public static class RegionConfig {
Expand All @@ -1002,7 +1000,7 @@ index 0000000000000000000000000000000000000000..2c01d721b9a1b41ca4b82dc87aaf894a
+ private static class RegionFormatValidator extends EnumConfigValidator<RegionFileFormat> {
+ }
+
+ public LinearConfig linear;
+ public LinearConfig linear = new LinearConfig();
+
+ @GlobalConfigCategory("linear")
+ public static class LinearConfig {
Expand Down Expand Up @@ -1041,7 +1039,7 @@ index 0000000000000000000000000000000000000000..2c01d721b9a1b41ca4b82dc87aaf894a
+ }
+ }
+
+ public static FixConfig fix;
+ public static FixConfig fix = new FixConfig();
+
+ @GlobalConfigCategory("fix")
+ public static class FixConfig {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Subject: [PATCH] Remove iterators from inventory contains
This patch is Powered by Pufferfish(https://github.com/pufferfish-gg/Pufferfish)

diff --git a/src/main/java/net/minecraft/world/entity/player/Inventory.java b/src/main/java/net/minecraft/world/entity/player/Inventory.java
index 0e214d502998e9eb959952b257844529992df0df..d2bd4c5b2a7a9689680f4b021368f25356c58ac7 100644
index 0e214d502998e9eb959952b257844529992df0df..9506c4cf1c757219f9f01c06cf61ad3e40ee0979 100644
--- a/src/main/java/net/minecraft/world/entity/player/Inventory.java
+++ b/src/main/java/net/minecraft/world/entity/player/Inventory.java
@@ -649,17 +649,31 @@ public class Inventory implements Container, Nameable {
Expand Down Expand Up @@ -54,7 +54,7 @@ index 0e214d502998e9eb959952b257844529992df0df..d2bd4c5b2a7a9689680f4b021368f253

public boolean contains(TagKey<Item> tag) {
- Iterator iterator = this.compartments.iterator();
+ if (org.leavesmc.leaves.LeavesConfig.removeInventoryContainsIterators) {
+ if (org.leavesmc.leaves.LeavesConfig.performance.remove.inventoryContainsIterators) {
+ for (int i = 0; i < this.compartments.size(); i++) {
+ List<ItemStack> list = this.compartments.get(i);
+ for (int j = 0; j < list.size(); j++) {
Expand Down Expand Up @@ -93,7 +93,7 @@ index 0e214d502998e9eb959952b257844529992df0df..d2bd4c5b2a7a9689680f4b021368f253

public boolean contains(Predicate<ItemStack> predicate) {
- Iterator iterator = this.compartments.iterator();
+ if (org.leavesmc.leaves.LeavesConfig.removeInventoryContainsIterators) {
+ if (org.leavesmc.leaves.LeavesConfig.performance.remove.inventoryContainsIterators) {
+ for (int i = 0; i < this.compartments.size(); i++) {
+ List<ItemStack> list = this.compartments.get(i);
+ for (int j = 0; j < list.size(); j++) {
Expand Down
12 changes: 6 additions & 6 deletions patches/server/0045-Bedrock-break-list.patch
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Subject: [PATCH] Bedrock break list


diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index 3c2db9fa853ade7e429738f9896ad31e0550df65..ffc6eac2d8d78f4d1493405bbdff2550a075b434 100644
index 875bbe2e5d247d3483a65d172a5f7a16f53c21d6..5e62bd7c887944faf76834ce8394697ce78ef967 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -1904,6 +1904,8 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
Expand Down Expand Up @@ -81,7 +81,7 @@ index 4b51472502d08ea357da437afeb4b581979e9cff..79bb7ff91f67fa49f34f2714b3ee2bc2
((ServerLevel) world).getChunkSource().blockChanged(headPos); // ... fix client desync
diff --git a/src/main/java/org/leavesmc/leaves/util/BreakBedrockList.java b/src/main/java/org/leavesmc/leaves/util/BreakBedrockList.java
new file mode 100644
index 0000000000000000000000000000000000000000..1c5992f1480a25dbd5967218be2a3a2185d0279e
index 0000000000000000000000000000000000000000..fb10e783e5971f3e1e222e1e3423883f3dd3d3af
--- /dev/null
+++ b/src/main/java/org/leavesmc/leaves/util/BreakBedrockList.java
@@ -0,0 +1,114 @@
Expand Down Expand Up @@ -120,7 +120,7 @@ index 0000000000000000000000000000000000000000..1c5992f1480a25dbd5967218be2a3a21
+ }
+
+ public static void onPlayerPlacePiston(Level level, Player player, BlockPos pos) {
+ if (LeavesConfig.bedrockBreakList) {
+ if (LeavesConfig.modify.bedrockBreakList) {
+ Direction pistonFacing = level.getBlockState(pos).getValue(DirectionalBlock.FACING);
+ BlockPos bedrockPos = pos.relative(pistonFacing);
+ if (level.getBlockState(bedrockPos).getBlock() == Blocks.BEDROCK) {
Expand All @@ -130,7 +130,7 @@ index 0000000000000000000000000000000000000000..1c5992f1480a25dbd5967218be2a3a21
+ }
+
+ public static void onPistonBreakBedrock(Level level, BlockPos bedrock) {
+ if (LeavesConfig.bedrockBreakList) {
+ if (LeavesConfig.modify.bedrockBreakList) {
+ Map<BlockPos, Player> map = pistonCache.get(level);
+
+ boolean flag = map != null && map.get(bedrock) != null;
Expand Down Expand Up @@ -164,7 +164,7 @@ index 0000000000000000000000000000000000000000..1c5992f1480a25dbd5967218be2a3a21
+ }
+
+ public static void onScoreboardAdd(@NotNull Objective objective) {
+ if (LeavesConfig.bedrockBreakList) {
+ if (LeavesConfig.modify.bedrockBreakList) {
+ if (objective.getCriteria() == ObjectiveCriteria.DUMMY) {
+ String name = objective.getName();
+
Expand All @@ -182,7 +182,7 @@ index 0000000000000000000000000000000000000000..1c5992f1480a25dbd5967218be2a3a21
+ }
+
+ public static void onScoreboardRemove(@NotNull Objective objective) {
+ if (LeavesConfig.bedrockBreakList) {
+ if (LeavesConfig.modify.bedrockBreakList) {
+ if (objective.getCriteria() == ObjectiveCriteria.DUMMY) {
+ String name = objective.getName();
+
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@ 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 43cfe5e00285bf88d0724d27e55d28c2f825f741..c32e2996aeff5d54abaffcc788155f6a2326422d 100644
index 43cfe5e00285bf88d0724d27e55d28c2f825f741..c88cb9c1c7f588b2617a71ecd6acbcf98ade5687 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -1945,7 +1945,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
Vec3 vec3d1 = vec3d.subtract(Vec3.atCenterOf(blockposition));
double d0 = 1.0000001D;

- if (Math.abs(vec3d1.x()) < 1.0000001D && Math.abs(vec3d1.y()) < 1.0000001D && Math.abs(vec3d1.z()) < 1.0000001D) {
+ if (org.leavesmc.leaves.LeavesConfig.disableDistanceCheckForUseItem || (Math.abs(vec3d1.x()) < 1.0000001D && Math.abs(vec3d1.y()) < 1.0000001D && Math.abs(vec3d1.z()) < 1.0000001D)) {
+ if (org.leavesmc.leaves.LeavesConfig.modify.disableDistanceCheckForUseItem || (Math.abs(vec3d1.x()) < 1.0000001D && Math.abs(vec3d1.y()) < 1.0000001D && Math.abs(vec3d1.z()) < 1.0000001D)) {
Direction enumdirection = movingobjectpositionblock.getDirection();

this.player.resetLastActionTime();
4 changes: 2 additions & 2 deletions patches/server/0048-No-feather-falling-trample.patch
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@ Subject: [PATCH] No feather falling trample


diff --git a/src/main/java/net/minecraft/world/level/block/FarmBlock.java b/src/main/java/net/minecraft/world/level/block/FarmBlock.java
index c3dba0c2c94f3804338f86621dc42405e380a6b3..b511cca8750ab05ca9724c5cf944ad1d9d3be3b6 100644
index c3dba0c2c94f3804338f86621dc42405e380a6b3..b3de7e10a5514100712998519a7e9303b347d6a8 100644
--- a/src/main/java/net/minecraft/world/level/block/FarmBlock.java
+++ b/src/main/java/net/minecraft/world/level/block/FarmBlock.java
@@ -113,6 +113,13 @@ public class FarmBlock extends Block {
super.fallOn(world, state, pos, entity, fallDistance); // CraftBukkit - moved here as game rules / events shouldn't affect fall damage.
if (world instanceof ServerLevel worldserver) {
if (world.random.nextFloat() < fallDistance - 0.5F && entity instanceof LivingEntity && (entity instanceof Player || worldserver.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING)) && entity.getBbWidth() * entity.getBbWidth() * entity.getBbHeight() > 0.512F) {
+ // Leaves start - noFeatherFallingTrample
+ if (org.leavesmc.leaves.LeavesConfig.noFeatherFallingTrample) {
+ if (org.leavesmc.leaves.LeavesConfig.modify.noFeatherFallingTrample) {
+ if (net.minecraft.world.item.enchantment.EnchantmentHelper.getEnchantmentLevel(world.registryAccess().lookupOrThrow(net.minecraft.core.registries.Registries.ENCHANTMENT).getOrThrow(net.minecraft.world.item.enchantment.Enchantments.FEATHER_FALLING), (LivingEntity) entity) > 0) {
+ return;
+ }
Expand Down
14 changes: 7 additions & 7 deletions patches/server/0049-Syncmatica-Protocol.patch
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Subject: [PATCH] Syncmatica Protocol
This patch is Powered by Syncmatica(https://github.com/End-Tech/syncmatica)

diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index c32e2996aeff5d54abaffcc788155f6a2326422d..3fe4221ad7b8c5cd7797db4519e1235afcd7da64 100644
index c88cb9c1c7f588b2617a71ecd6acbcf98ade5687..58b260c37393eebc9fe838ab801287573c04cfde 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -324,6 +324,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
Expand All @@ -28,7 +28,7 @@ index c32e2996aeff5d54abaffcc788155f6a2326422d..3fe4221ad7b8c5cd7797db4519e1235a
if (this.ackBlockChangesUpTo > -1) {
diff --git a/src/main/java/org/leavesmc/leaves/protocol/syncmatica/CommunicationManager.java b/src/main/java/org/leavesmc/leaves/protocol/syncmatica/CommunicationManager.java
new file mode 100644
index 0000000000000000000000000000000000000000..c452bb80f8a51a11b9d4eca53fc6d977b35ae2ef
index 0000000000000000000000000000000000000000..365b07d8d9741d07bf4505d121394dd053825c76
--- /dev/null
+++ b/src/main/java/org/leavesmc/leaves/protocol/syncmatica/CommunicationManager.java
@@ -0,0 +1,396 @@
Expand Down Expand Up @@ -100,7 +100,7 @@ index 0000000000000000000000000000000000000000..c452bb80f8a51a11b9d4eca53fc6d977
+
+ @ProtocolHandler.PlayerJoin
+ public static void onPlayerJoin(ServerPlayer player) {
+ if (!LeavesConfig.syncmaticaProtocol) {
+ if (!LeavesConfig.protocol.syncmatica.enable) {
+ return;
+ }
+ final ExchangeTarget newPlayer = player.connection.exchangeTarget;
Expand All @@ -113,7 +113,7 @@ index 0000000000000000000000000000000000000000..c452bb80f8a51a11b9d4eca53fc6d977
+
+ @ProtocolHandler.PlayerLeave
+ public static void onPlayerLeave(ServerPlayer player) {
+ if (!LeavesConfig.syncmaticaProtocol) {
+ if (!LeavesConfig.protocol.syncmatica.enable) {
+ return;
+ }
+ final ExchangeTarget oldPlayer = player.connection.exchangeTarget;
Expand All @@ -130,7 +130,7 @@ index 0000000000000000000000000000000000000000..c452bb80f8a51a11b9d4eca53fc6d977
+
+ @ProtocolHandler.PayloadReceiver(payload = SyncmaticaPayload.class, payloadId = "main")
+ public static void onPacketGet(ServerPlayer player, SyncmaticaPayload payload) {
+ if (!LeavesConfig.syncmaticaProtocol) {
+ if (!LeavesConfig.protocol.syncmatica.enable) {
+ return;
+ }
+ onPacket(player.connection.exchangeTarget, payload.packetType(), payload.data());
Expand Down Expand Up @@ -1335,7 +1335,7 @@ index 0000000000000000000000000000000000000000..d7a3c85df0f5950f3f0c69c33fa5d809
+}
diff --git a/src/main/java/org/leavesmc/leaves/protocol/syncmatica/SyncmaticaProtocol.java b/src/main/java/org/leavesmc/leaves/protocol/syncmatica/SyncmaticaProtocol.java
new file mode 100644
index 0000000000000000000000000000000000000000..0d93792de3a12a450f5da1705cff95274360a9c4
index 0000000000000000000000000000000000000000..055da1928daddedaa72e8d805193f81e4aaafdea
--- /dev/null
+++ b/src/main/java/org/leavesmc/leaves/protocol/syncmatica/SyncmaticaProtocol.java
@@ -0,0 +1,127 @@
Expand Down Expand Up @@ -1438,7 +1438,7 @@ index 0000000000000000000000000000000000000000..0d93792de3a12a450f5da1705cff9527
+ }
+
+ public static boolean isOverQuota(int sent) {
+ return LeavesConfig.syncmaticaQuota && sent > LeavesConfig.syncmaticaQuotaLimit;
+ return LeavesConfig.protocol.syncmatica.useQuota && sent > LeavesConfig.protocol.syncmatica.quotaLimit;
+ }
+
+ public static void backupAndReplace(final Path backup, final Path current, final Path incoming) {
Expand Down
Loading

0 comments on commit 46898af

Please sign in to comment.