diff --git a/README.md b/README.md index 42fa6571c..c04231283 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@
-![image](https://raw.githubusercontent.com/PlazmaMC/Plazma/main/src/resources/title-900.png) +[![image](https://raw.githubusercontent.com/PlazmaMC/Plazma/main/src/resources/title-900.png)](https://github.com/PlazmaMC/Plazma) ### A Server Platform for Minecraft: Java Edition based on [Paper](https://github.com/PaperMC/Paper) @@ -19,8 +19,8 @@ [main]: https://github.com/PlazmaMC/Plazma -### This is the branch for Plazma 1.20.1. If you want to know more about Plazma, please check the [main branch][main]. -이곳은 플라즈마의 1.20.1용 브랜치 입니다. 플라즈마에 대해 자세히 알고 싶다면 [main 브랜치][main]를 확인해주세요. +### This is the branch for Plazma 1.20.2. If you want to know more about Plazma, please check the [main branch][main]. +이곳은 플라즈마의 1.20.2용 브랜치 입니다. 플라즈마에 대해 자세히 알고 싶다면 [main 브랜치][main]를 확인해주세요. ## ⬇️ Downloads ### If you don't know about Mojmap or Bundler, download **Reobf Paperclip** diff --git a/patches/server/0006-Plazma-Configurations.patch b/patches/server/0006-Plazma-Configurations.patch index a56ef8849..108356fa1 100644 --- a/patches/server/0006-Plazma-Configurations.patch +++ b/patches/server/0006-Plazma-Configurations.patch @@ -315,7 +315,7 @@ index 005c854a10f343cd7488b282de002249bf5c4ced..3e8f42811e9254567f2522e68b601870 @Override public YamlConfiguration getPurpurConfig() { diff --git a/src/main/java/org/bukkit/craftbukkit/Main.java b/src/main/java/org/bukkit/craftbukkit/Main.java -index e006351f07356fb42e5858bb3b8a74ffee215b35..8ecf47b458ace51df2bb9f76e1015bcefe882d7c 100644 +index 01f581e6c3dfacb0ec6aff05c08539bbd2e580c7..f1b754fbf72cbf3c10a74192c66a9432d8218d4b 100644 --- a/src/main/java/org/bukkit/craftbukkit/Main.java +++ b/src/main/java/org/bukkit/craftbukkit/Main.java @@ -173,6 +173,14 @@ public class Main { @@ -578,10 +578,10 @@ index 0000000000000000000000000000000000000000..85002144e0b350c4ae044e1a4a4c1734 +} diff --git a/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java b/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java new file mode 100644 -index 0000000000000000000000000000000000000000..b9a6c781684b080bcfb07495e561325d594eeafd +index 0000000000000000000000000000000000000000..d506e0c2b37f91e46e682652bd134ad91db28f84 --- /dev/null +++ b/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java -@@ -0,0 +1,37 @@ +@@ -0,0 +1,43 @@ +package org.plazmamc.plazma.configurations; + +import io.papermc.paper.configuration.Configuration; @@ -610,7 +610,13 @@ index 0000000000000000000000000000000000000000..b9a6c781684b080bcfb07495e561325d + public int version = CURRENT_VERSION; + + public Misc misc; -+ public class Misc extends ConfigurationPart { ++ public class Misc extends ConfigurationPart.Post { ++ ++ @Override ++ public void postProcess() { ++ ++ ++ } + + } + diff --git a/patches/server/0009-Console-logging-tweaks.patch b/patches/server/0009-Console-logging-tweaks.patch index db21a73ed..99edeb6d6 100644 --- a/patches/server/0009-Console-logging-tweaks.patch +++ b/patches/server/0009-Console-logging-tweaks.patch @@ -83,10 +83,10 @@ index 5c38df8170033dbfee267520991a3cc3285d219e..58cc1bed851994fb591e9b832b98d25e this.server.logChatMessage((unsignedFunction == null ? message.decoratedContent() : unsignedFunction.apply(this.server.console)), params, flag ? null : "Not Secure"); // Paper OutgoingChatMessage outgoingchatmessage = OutgoingChatMessage.create(message); diff --git a/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java b/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java -index b9a6c781684b080bcfb07495e561325d594eeafd..81c6b6270fc7b74fdd1261fa1d14ec8221a36182 100644 +index d506e0c2b37f91e46e682652bd134ad91db28f84..44df2c0a1ed3d006b455ba2a47d6bc9059d804e1 100644 --- a/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java +++ b/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java -@@ -34,4 +34,13 @@ public class GlobalConfiguration extends ConfigurationPart { +@@ -40,4 +40,13 @@ public class GlobalConfiguration extends ConfigurationPart { public class Player extends ConfigurationPart { } diff --git a/patches/server/0010-Add-option-to-allow-any-usernames.patch b/patches/server/0010-Add-option-to-allow-any-usernames.patch index 6eb6dc442..a6404e947 100644 --- a/patches/server/0010-Add-option-to-allow-any-usernames.patch +++ b/patches/server/0010-Add-option-to-allow-any-usernames.patch @@ -17,10 +17,10 @@ index b875f4af9dcb45bcad0ee59a958442ba673268fe..d38685f82d2e6c4e71179bf3a85a8b18 // Paper start - validate usernames if (io.papermc.paper.configuration.GlobalConfiguration.get().proxies.isProxyOnlineMode() && io.papermc.paper.configuration.GlobalConfiguration.get().unsupportedSettings.performUsernameValidation) { diff --git a/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java b/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java -index 59c862c0e8a4111d4e9aa14a424b15cd9c37e6d1..8636ec3e130b73af0ec1b069aea6e04bc54cebdf 100644 +index 44df2c0a1ed3d006b455ba2a47d6bc9059d804e1..00c95194788d56f539d1c75e9a1ce48e950c096c 100644 --- a/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java +++ b/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java -@@ -33,6 +33,8 @@ public class GlobalConfiguration extends ConfigurationPart { +@@ -39,6 +39,8 @@ public class GlobalConfiguration extends ConfigurationPart { public Player player; public class Player extends ConfigurationPart { diff --git a/patches/server/0015-Reduce-create-random-instance.patch b/patches/server/0015-Reduce-create-random-instance.patch index 1ac13a8f5..3b06b07a5 100644 --- a/patches/server/0015-Reduce-create-random-instance.patch +++ b/patches/server/0015-Reduce-create-random-instance.patch @@ -357,7 +357,7 @@ index 0000000000000000000000000000000000000000..4421110e20a006c3773e922eb0facc88 + +} diff --git a/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java b/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java -index 8636ec3e130b73af0ec1b069aea6e04bc54cebdf..4ce28f5f7c47c77ca299d1ff9a99d26c4a066215 100644 +index 00c95194788d56f539d1c75e9a1ce48e950c096c..9e26e598d7c381368de422ab0c3cc7936e3bbb6d 100644 --- a/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java +++ b/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java @@ -18,7 +18,7 @@ public class GlobalConfiguration extends ConfigurationPart { @@ -369,9 +369,9 @@ index 8636ec3e130b73af0ec1b069aea6e04bc54cebdf..4ce28f5f7c47c77ca299d1ff9a99d26c } } -@@ -28,6 +28,9 @@ public class GlobalConfiguration extends ConfigurationPart { - public Misc misc; - public class Misc extends ConfigurationPart { +@@ -34,6 +34,9 @@ public class GlobalConfiguration extends ConfigurationPart { + + } + public boolean reduceCreateRandomInstance = DO_OPTIMIZE; + public boolean suppressThreadSafeRandom = DO_OPTIMIZE; diff --git a/patches/server/0018-Don-t-refresh-LootTable-for-non-player-interaction.patch b/patches/server/0018-Don-t-refresh-LootTable-for-non-player-interaction.patch index dd28d4b43..140b9da69 100644 --- a/patches/server/0018-Don-t-refresh-LootTable-for-non-player-interaction.patch +++ b/patches/server/0018-Don-t-refresh-LootTable-for-non-player-interaction.patch @@ -17,10 +17,10 @@ index 081691f9710ff1115e4308f79ed49fbc38941193..79a27755534384ab94e79e422c0a5e9c LootTable lootTable = this.level.getServer().getLootData().getLootTable(this.lootTable); if (player instanceof ServerPlayer) { diff --git a/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java b/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java -index 4ce28f5f7c47c77ca299d1ff9a99d26c4a066215..065a4113f0b1dc1ee122af34609d0de02f62f9de 100644 +index 9e26e598d7c381368de422ab0c3cc7936e3bbb6d..5a62bffe495002b3bbf5fd995df135c5d174458a 100644 --- a/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java +++ b/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java -@@ -30,6 +30,7 @@ public class GlobalConfiguration extends ConfigurationPart { +@@ -36,6 +36,7 @@ public class GlobalConfiguration extends ConfigurationPart { public boolean reduceCreateRandomInstance = DO_OPTIMIZE; public boolean suppressThreadSafeRandom = DO_OPTIMIZE; diff --git a/patches/server/0023-Implement-No-Chat-Reports.patch b/patches/server/0023-Implement-No-Chat-Reports.patch index f77808aa7..68627eb91 100644 --- a/patches/server/0023-Implement-No-Chat-Reports.patch +++ b/patches/server/0023-Implement-No-Chat-Reports.patch @@ -123,10 +123,10 @@ index 58cc1bed851994fb591e9b832b98d25eda153b47..4fbe96813067d3ccf1d8f29151ac3fac } diff --git a/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java b/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java -index 10b42754e872a6c05005c2a129c016e7f53fe516..fa9e3df5be290acfbfecdda93d042b0797e3d0f6 100644 +index 5a62bffe495002b3bbf5fd995df135c5d174458a..989aa0aeb05a878945849adc6fb6663027e15927 100644 --- a/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java +++ b/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java -@@ -49,4 +49,22 @@ public class GlobalConfiguration extends ConfigurationPart { +@@ -55,4 +55,22 @@ public class GlobalConfiguration extends ConfigurationPart { public boolean notSecurePrefix = true; } diff --git a/patches/server/0025-Implement-FixMySpawnR.patch b/patches/server/0025-Implement-FixMySpawnR.patch index 573442cb2..f564e716a 100644 --- a/patches/server/0025-Implement-FixMySpawnR.patch +++ b/patches/server/0025-Implement-FixMySpawnR.patch @@ -61,10 +61,10 @@ index 64d911bee1607880514061c75116d8672df8bb8f..7868590696f620cc5f0785125c9573d7 return nbt; } diff --git a/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java b/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java -index fa9e3df5be290acfbfecdda93d042b0797e3d0f6..5aec79d987c2e9b401c98409460c032f111c37ba 100644 +index 989aa0aeb05a878945849adc6fb6663027e15927..d17df5621717b1c8d1d9a5549feb73c3600ecf3d 100644 --- a/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java +++ b/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java -@@ -34,6 +34,24 @@ public class GlobalConfiguration extends ConfigurationPart { +@@ -40,6 +40,24 @@ public class GlobalConfiguration extends ConfigurationPart { } diff --git a/patches/server/0027-Variable-entity-wakeup-duration.patch b/patches/server/0027-Variable-entity-wakeup-duration.patch new file mode 100644 index 000000000..400184796 --- /dev/null +++ b/patches/server/0027-Variable-entity-wakeup-duration.patch @@ -0,0 +1,76 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: AlphaKR93 +Date: Sat, 30 Sep 2023 21:56:32 +0900 +Subject: [PATCH] Variable entity wakeup duration + + +diff --git a/src/main/java/org/plazmamc/plazma/configurations/LevelConfigurations.java b/src/main/java/org/plazmamc/plazma/configurations/LevelConfigurations.java +index 82975c1c92c84294740a411b4a351efb8a2e6769..cb21da3cff4dbb08c7786c09b39e381abdf45c33 100644 +--- a/src/main/java/org/plazmamc/plazma/configurations/LevelConfigurations.java ++++ b/src/main/java/org/plazmamc/plazma/configurations/LevelConfigurations.java +@@ -51,6 +51,20 @@ public class LevelConfigurations extends ConfigurationPart { + + } + ++ public WakeUpDurationVariance wakeUpDurationVariance; ++ public class WakeUpDurationVariance extends ConfigurationPart { ++ ++ double defaultValue() { ++ return DO_OPTIMIZE ? 0.2 : 0.0; ++ } ++ ++ double animal = defaultValue(); public double animal() { return Math.max(0, this.animal); } ++ double monster = defaultValue(); public double monster() { return Math.max(0, this.monster); } ++ double flyingMonster = defaultValue(); public double flyingMonster() { return Math.max(0, this.flyingMonster); } ++ double villager = defaultValue(); public double villager() { return Math.max(0, this.villager); } ++ ++ } ++ + } + + public Structure structure; +diff --git a/src/main/java/org/spigotmc/ActivationRange.java b/src/main/java/org/spigotmc/ActivationRange.java +index 062a793a134f774ebf918aab10443527c06c4fd1..3a362fef29c6fa29c37eff539e343eb3a56bf122 100644 +--- a/src/main/java/org/spigotmc/ActivationRange.java ++++ b/src/main/java/org/spigotmc/ActivationRange.java +@@ -68,6 +68,13 @@ public class ActivationRange + Activity.PANIC + }; + ++ // Plazma start - Variable entity wakeup duration ++ private static final java.util.Random WAKEUP_DURATION_RANDOM = org.plazmamc.plazma.PlazmaOptions.useJavaRandom() ? new java.util.Random() : new org.plazmamc.plazma.Random(); ++ private static int getWakeupDurationWithVariance(int duration, double deviation) { ++ if (deviation == 0) return duration; ++ return (int) Math.min(Integer.MAX_VALUE, Math.max(1, Math.round(duration * WAKEUP_DURATION_RANDOM.nextGaussian(1, deviation)))); ++ } ++ // Plazma end + private static int checkInactiveWakeup(Entity entity) { + Level world = entity.level(); + SpigotWorldConfig config = world.spigotConfig; +@@ -75,22 +82,22 @@ public class ActivationRange + if (entity.activationType == ActivationType.VILLAGER) { + if (inactiveFor > config.wakeUpInactiveVillagersEvery && world.wakeupInactiveRemainingVillagers > 0) { + world.wakeupInactiveRemainingVillagers--; +- return config.wakeUpInactiveVillagersFor; ++ return getWakeupDurationWithVariance(config.wakeUpInactiveVillagersFor, world.plazmaLevelConfiguration().entity.wakeUpDurationVariance.villager()); // Plazma - Variable entity wakeup duration + } + } else if (entity.activationType == ActivationType.ANIMAL) { + if (inactiveFor > config.wakeUpInactiveAnimalsEvery && world.wakeupInactiveRemainingAnimals > 0) { + world.wakeupInactiveRemainingAnimals--; +- return config.wakeUpInactiveAnimalsFor; ++ return getWakeupDurationWithVariance(config.wakeUpInactiveAnimalsFor, world.plazmaLevelConfiguration().entity.wakeUpDurationVariance.animal()); // Plazma - Variable entity wakeup duration + } + } else if (entity.activationType == ActivationType.FLYING_MONSTER) { + if (inactiveFor > config.wakeUpInactiveFlyingEvery && world.wakeupInactiveRemainingFlying > 0) { + world.wakeupInactiveRemainingFlying--; +- return config.wakeUpInactiveFlyingFor; ++ return getWakeupDurationWithVariance(config.wakeUpInactiveFlyingFor, world.plazmaLevelConfiguration().entity.wakeUpDurationVariance.flyingMonster()); // Plazma - Variable entity wakeup duration + } + } else if (entity.activationType == ActivationType.MONSTER || entity.activationType == ActivationType.RAIDER) { + if (inactiveFor > config.wakeUpInactiveMonstersEvery && world.wakeupInactiveRemainingMonsters > 0) { + world.wakeupInactiveRemainingMonsters--; +- return config.wakeUpInactiveMonstersFor; ++ return getWakeupDurationWithVariance(config.wakeUpInactiveMonstersFor, world.plazmaLevelConfiguration().entity.wakeUpDurationVariance.monster()); // Plazma - Variable entity wakeup duration + } + } + return -1; diff --git a/patches/unapplied/server/0035-More-optimise-state-lookup.patch b/patches/server/0028-Optimise-state-lookup-more.patch similarity index 62% rename from patches/unapplied/server/0035-More-optimise-state-lookup.patch rename to patches/server/0028-Optimise-state-lookup-more.patch index 3e76fbfcc..3a1cdd378 100644 --- a/patches/unapplied/server/0035-More-optimise-state-lookup.patch +++ b/patches/server/0028-Optimise-state-lookup-more.patch @@ -1,27 +1,26 @@ From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: IPECTER -Date: Wed, 10 May 2023 15:30:03 +0900 -Subject: [PATCH] More optimise state lookup +From: AlphaKR93 +Date: Sat, 30 Sep 2023 22:02:58 +0900 +Subject: [PATCH] Optimise state lookup more diff --git a/src/main/java/io/papermc/paper/util/table/ZeroCollidingReferenceStateTable.java b/src/main/java/io/papermc/paper/util/table/ZeroCollidingReferenceStateTable.java -index 57d0cd3ad6f972e986c72a57f1a6e36003f190c2..5c03e26db0f9da992e9b0487a872e0ec8786650a 100644 +index 57d0cd3ad6f972e986c72a57f1a6e36003f190c2..0832e4fa92b6464a6206475fbceb3b36462757b3 100644 --- a/src/main/java/io/papermc/paper/util/table/ZeroCollidingReferenceStateTable.java +++ b/src/main/java/io/papermc/paper/util/table/ZeroCollidingReferenceStateTable.java -@@ -16,7 +16,7 @@ public final class ZeroCollidingReferenceStateTable { - protected final Comparable[] this_table; +@@ -17,6 +17,7 @@ public final class ZeroCollidingReferenceStateTable { protected final StateHolder this_state; -- protected long[] index_table; -+ protected long[] index_table; public long[] index_table() { return index_table; } // Plazma - Paper - optimise state lookup + protected long[] index_table; ++ public long[] index_table() { return this.index_table; } // Plazma - getter protected StateHolder[][] value_table; public ZeroCollidingReferenceStateTable(final StateHolder state, final Map, Comparable> this_map) { diff --git a/src/main/java/net/minecraft/world/level/block/state/StateHolder.java b/src/main/java/net/minecraft/world/level/block/state/StateHolder.java -index 5f285d190186a2ff5a61d05070593e1d633dd79a..62934ef07ef856b917862c6f58ad391984da6327 100644 +index 5f285d190186a2ff5a61d05070593e1d633dd79a..7b61a956892e90c7556db46d9277da8d252547cd 100644 --- a/src/main/java/net/minecraft/world/level/block/state/StateHolder.java +++ b/src/main/java/net/minecraft/world/level/block/state/StateHolder.java -@@ -114,21 +114,17 @@ public abstract class StateHolder { +@@ -114,21 +114,15 @@ public abstract class StateHolder { } public , V extends T> S trySetValue(Property property, V value) { @@ -35,27 +34,26 @@ index 5f285d190186a2ff5a61d05070593e1d633dd79a..62934ef07ef856b917862c6f58ad3919 - } - } else { - return (S)this; -+ // Plazma start - Paper - optimise state lookup -+ final S ret = (S)this.optimisedTable.get(property, value); -+ if (ret == null) { -+ throw new IllegalArgumentException("Cannot set property " + property + " to " + value + " on " + this.owner + ", it is not an allowed value"); - } +- } ++ // Plazma start - optimise state lookup more ++ final S ret = (S) this.optimisedTable.get(property, value); ++ if (ret == null) throw new IllegalArgumentException("Cannot set property " + property + " to " + value + " on " + this.owner + ", it is not an allowed value"); + return ret; -+ // Plazma end - Paper - optimise state lookup ++ // Plazma end } public void populateNeighbours(Map, Comparable>, S> states) { - if (this.neighbours != null) { -+ if (this.optimisedTable.index_table() != null) { ++ if (this.optimisedTable.index_table() != null) { // Plazma - optimise state lookup more throw new IllegalStateException(); } else { Table, Comparable, S> table = HashBasedTable.create(); -@@ -143,7 +139,7 @@ public abstract class StateHolder { +@@ -143,7 +137,7 @@ public abstract class StateHolder { } } - this.neighbours = (Table, Comparable, S>)(table.isEmpty() ? table : ArrayTable.create(table)); this.optimisedTable.loadInTable((Table)this.neighbours, this.values); // Paper - optimise state lookup -+ this.optimisedTable.loadInTable((Table)(table.isEmpty() ? table : ArrayTable.create(table)), this.values); // Paper - optimise state lookup // Plazma ++ this.optimisedTable.loadInTable((Table) (table.isEmpty() ? table : ArrayTable.create(table)), this.values); // Paper - optimise state lookup // Plazma - more } } diff --git a/patches/unapplied/server/0036-Suppress-Error-From-DirtyAttributes.patch b/patches/server/0029-Suppress-error-from-dirty-attributes.patch similarity index 58% rename from patches/unapplied/server/0036-Suppress-Error-From-DirtyAttributes.patch rename to patches/server/0029-Suppress-error-from-dirty-attributes.patch index 328abcba4..91d707f7f 100644 --- a/patches/unapplied/server/0036-Suppress-Error-From-DirtyAttributes.patch +++ b/patches/server/0029-Suppress-error-from-dirty-attributes.patch @@ -1,42 +1,41 @@ From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: IPECTER -Date: Wed, 10 May 2023 15:38:58 +0900 -Subject: [PATCH] Suppress-Error-From-DirtyAttributes +From: AlphaKR93 +Date: Sat, 30 Sep 2023 22:06:00 +0900 +Subject: [PATCH] Suppress error from dirty attributes diff --git a/src/main/java/net/minecraft/server/level/ServerEntity.java b/src/main/java/net/minecraft/server/level/ServerEntity.java -index 80ab684a33876d62186dcf86f555e46db1594b09..21b18d85563ffd5f93234455dca4dc30582b8925 100644 +index b2770e053f6db173dedbf044d67aa315e2fd7302..30b4c6bf1a0c847d00fc466ca9c997f9049bb697 100644 --- a/src/main/java/net/minecraft/server/level/ServerEntity.java +++ b/src/main/java/net/minecraft/server/level/ServerEntity.java -@@ -403,8 +403,8 @@ public class ServerEntity { +@@ -395,7 +395,8 @@ public class ServerEntity { } if (this.entity instanceof LivingEntity) { - Set set = ((LivingEntity) this.entity).getAttributes().getDirtyAttributes(); -- -+ Set attributes = ((LivingEntity) this.entity).getAttributes().getDirtyAttributes(); // Plazma - suppress error from dirty attributes -+ final Set set = this.entity.level().plazmaLevelConfiguration().misc.suppressErrorFromDirtyAttributes ? java.util.Collections.synchronizedSet(attributes) : attributes; // Plazma - suppress error from dirty attributes ++ Set attributes = ((LivingEntity) this.entity).getAttributes().getDirtyAttributes(); // Plazma - Suppress error from dirty attributes ++ final Set set = this.entity.level().plazmaLevelConfiguration().entity.suppressErrorFromDirtyAttributes ? java.util.Collections.synchronizedSet(attributes) : attributes; // Plazma - Suppress error from dirty attributes + if (!set.isEmpty()) { // CraftBukkit start - Send scaled max health - if (this.entity instanceof ServerPlayer) { -@@ -414,7 +414,7 @@ public class ServerEntity { +@@ -406,7 +407,7 @@ public class ServerEntity { this.broadcastAndSend(new ClientboundUpdateAttributesPacket(this.entity.getId(), set)); } - set.clear(); -+ attributes.clear(); ++ attributes.clear(); // Plazma - Suppress error from dirty attributes } } diff --git a/src/main/java/org/plazmamc/plazma/configurations/LevelConfigurations.java b/src/main/java/org/plazmamc/plazma/configurations/LevelConfigurations.java -index 6db3defbf2634ae37af12246c17f852e6786d0ba..7d5bfd3a5aa5135596f3f1ae7c504a51b02798ef 100644 +index cb21da3cff4dbb08c7786c09b39e381abdf45c33..dfd408dc42a6000eb5fa56bbdb64f2329e545078 100644 --- a/src/main/java/org/plazmamc/plazma/configurations/LevelConfigurations.java +++ b/src/main/java/org/plazmamc/plazma/configurations/LevelConfigurations.java -@@ -89,6 +89,7 @@ public class LevelConfigurations extends ConfigurationPart { +@@ -36,6 +36,7 @@ public class LevelConfigurations extends ConfigurationPart { + public int sensorTick = DO_OPTIMIZE ? 10 : 1; - public boolean reduceCreateRandomInstance = DO_OPTIMIZE; - public boolean checkSpectatorMovedToQuickly = DO_OPTIMIZE; + public boolean ignoreUselessPackets = DO_OPTIMIZE; + public boolean suppressErrorFromDirtyAttributes = false; - } - + public Player player; + public class Player extends ConfigurationPart { diff --git a/patches/unapplied/server/0038-Skip-event-if-no-listeners.patch b/patches/server/0030-Skip-event-if-no-listeners.patch similarity index 58% rename from patches/unapplied/server/0038-Skip-event-if-no-listeners.patch rename to patches/server/0030-Skip-event-if-no-listeners.patch index b91c18572..6b854ad15 100644 --- a/patches/unapplied/server/0038-Skip-event-if-no-listeners.patch +++ b/patches/server/0030-Skip-event-if-no-listeners.patch @@ -1,18 +1,27 @@ From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: AlphaKR93 -Date: Thu, 29 Jun 2023 05:49:26 +0000 +Date: Sat, 30 Sep 2023 22:10:59 +0900 Subject: [PATCH] Skip event if no listeners diff --git a/src/main/java/io/papermc/paper/plugin/manager/PaperEventManager.java b/src/main/java/io/papermc/paper/plugin/manager/PaperEventManager.java -index 7ce9ebba8ce304d1f3f21d4f15ee5f3560d7700b..32305a34bcebd53aa523102a6da59bc2eb765055 100644 +index 7ce9ebba8ce304d1f3f21d4f15ee5f3560d7700b..6016c304ddbeb6ffbd591f30914c85fcb6371e80 100644 --- a/src/main/java/io/papermc/paper/plugin/manager/PaperEventManager.java +++ b/src/main/java/io/papermc/paper/plugin/manager/PaperEventManager.java +@@ -26,7 +26,7 @@ import java.util.Map; + import java.util.Set; + import java.util.logging.Level; + +-class PaperEventManager { ++public class PaperEventManager { // Plazma - package -> public + + private final Server server; + @@ -36,15 +36,17 @@ class PaperEventManager { // SimplePluginManager public void callEvent(@NotNull Event event) { -+ // Plazma start ++ // Plazma start - Skip event if no listeners + HandlerList handlers = event.getHandlers(); + RegisteredListener[] listeners = handlers.getRegisteredListeners(); + if (listeners.length == 0) return; @@ -29,3 +38,15 @@ index 7ce9ebba8ce304d1f3f21d4f15ee5f3560d7700b..32305a34bcebd53aa523102a6da59bc2 for (RegisteredListener registration : listeners) { if (!registration.getPlugin().isEnabled()) { continue; +diff --git a/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java b/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java +index d17df5621717b1c8d1d9a5549feb73c3600ecf3d..ddbc37857bd2706844074925bc27b7a84efa5832 100644 +--- a/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java ++++ b/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java +@@ -31,7 +31,6 @@ public class GlobalConfiguration extends ConfigurationPart { + @Override + public void postProcess() { + +- + } + + public boolean reduceCreateRandomInstance = DO_OPTIMIZE; diff --git a/patches/unapplied/server/0039-Optimize-spigot-event-bus.patch b/patches/server/0031-Optimize-Spigot-event-bus.patch similarity index 57% rename from patches/unapplied/server/0039-Optimize-spigot-event-bus.patch rename to patches/server/0031-Optimize-Spigot-event-bus.patch index 31d040e81..6335f3ee0 100644 --- a/patches/unapplied/server/0039-Optimize-spigot-event-bus.patch +++ b/patches/server/0031-Optimize-Spigot-event-bus.patch @@ -1,14 +1,14 @@ From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: IPECTER -Date: Wed, 6 Sep 2023 14:55:37 +0900 -Subject: [PATCH] Optimize-spigot-event-bus +From: AlphaKR93 +Date: Sat, 30 Sep 2023 22:17:02 +0900 +Subject: [PATCH] Optimize Spigot event bus diff --git a/src/main/java/io/papermc/paper/plugin/manager/PaperEventManager.java b/src/main/java/io/papermc/paper/plugin/manager/PaperEventManager.java -index 32305a34bcebd53aa523102a6da59bc2eb765055..6feb88b90831ec7106c9d777bdfa68fa185f1b89 100644 +index 6016c304ddbeb6ffbd591f30914c85fcb6371e80..482e2cdbd4f76f2a56c62bec12bfc39d7193b6ce 100644 --- a/src/main/java/io/papermc/paper/plugin/manager/PaperEventManager.java +++ b/src/main/java/io/papermc/paper/plugin/manager/PaperEventManager.java -@@ -41,12 +41,17 @@ class PaperEventManager { +@@ -41,11 +41,14 @@ public class PaperEventManager { // Plazma - package -> public RegisteredListener[] listeners = handlers.getRegisteredListeners(); if (listeners.length == 0) return; // Plazma end @@ -16,18 +16,14 @@ index 32305a34bcebd53aa523102a6da59bc2eb765055..6feb88b90831ec7106c9d777bdfa68fa - throw new IllegalStateException(event.getEventName() + " may only be triggered asynchronously."); - } else if (!event.isAsynchronous() && !this.server.isPrimaryThread() && !this.server.isStopping()) { - throw new IllegalStateException(event.getEventName() + " may only be triggered synchronously."); -+ // Plazma start - Optimize spigot event bus ++ // Plazma start - Optimize Spigot event bus + if (event.asynchronous() != net.kyori.adventure.util.TriState.NOT_SET) { -+ final boolean isAsync = event.isAsynchronous(); -+ final boolean onPrimaryThread = this.server.isPrimaryThread(); -+ if (isAsync && onPrimaryThread) { -+ throw new IllegalStateException(event.getEventName() + " may only be triggered asynchronously."); -+ } else if (!isAsync && !onPrimaryThread && !this.server.isStopping()) { -+ throw new IllegalStateException(event.getEventName() + " may only be triggered synchronously."); -+ } ++ final boolean async = event.isAsynchronous(); ++ final boolean primary = this.server.isPrimaryThread(); ++ if (async && primary) throw new IllegalStateException(event.getEventName() + " may only be triggered asynchronously."); ++ if (!async && !primary && !this.server.isStopping()) throw new IllegalStateException(event.getEventName() + " may only be triggered synchronously."); } -- + // Plazma end + for (RegisteredListener registration : listeners) { if (!registration.getPlugin().isEnabled()) { - continue; diff --git a/patches/unapplied/server/0034-Variable-entity-wakeup-duration.patch b/patches/unapplied/server/0034-Variable-entity-wakeup-duration.patch deleted file mode 100644 index 0bd7fb413..000000000 --- a/patches/unapplied/server/0034-Variable-entity-wakeup-duration.patch +++ /dev/null @@ -1,78 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: IPECTER -Date: Sat, 6 May 2023 21:09:45 +0900 -Subject: [PATCH] Variable entity wakeup duration - -Original: GaleMC/Gale -Copyright (C) 2023 Martijn Muijsers - -diff --git a/src/main/java/org/plazmamc/plazma/configurations/LevelConfigurations.java b/src/main/java/org/plazmamc/plazma/configurations/LevelConfigurations.java -index 8dadc3fd21d507bf88f7f75935f7477375f21344..6db3defbf2634ae37af12246c17f852e6786d0ba 100644 ---- a/src/main/java/org/plazmamc/plazma/configurations/LevelConfigurations.java -+++ b/src/main/java/org/plazmamc/plazma/configurations/LevelConfigurations.java -@@ -114,5 +114,20 @@ public class LevelConfigurations extends ConfigurationPart { - - } - -+ public WakeUp wakeUp; -+ public class WakeUp extends ConfigurationPart { -+ -+ public DurationVariance durationVariance; -+ public class DurationVariance extends ConfigurationPart { -+ -+ public double animal = DO_OPTIMIZE ? 0.2 : 0.0; -+ public double monster = DO_OPTIMIZE ? 0.2 : 0.0; -+ public double flyingMonster = DO_OPTIMIZE ? 0.2 : 0.0; -+ public double villager = DO_OPTIMIZE ? 0.2 : 0.0; -+ -+ } -+ -+ } -+ - } - } -diff --git a/src/main/java/org/spigotmc/ActivationRange.java b/src/main/java/org/spigotmc/ActivationRange.java -index 43d9e7287cf0e498ccbff9b865bb813e7fb567c0..21f7c0b235936cedcc4e4bde45bebd5fea2e1275 100644 ---- a/src/main/java/org/spigotmc/ActivationRange.java -+++ b/src/main/java/org/spigotmc/ActivationRange.java -@@ -75,28 +75,36 @@ public class ActivationRange - if (entity.activationType == ActivationType.VILLAGER) { - if (inactiveFor > config.wakeUpInactiveVillagersEvery && world.wakeupInactiveRemainingVillagers > 0) { - world.wakeupInactiveRemainingVillagers--; -- return config.wakeUpInactiveVillagersFor; -+ return getWakeUpDurationWithVariance(config.wakeUpInactiveVillagersFor, entity.level().plazmaLevelConfiguration().entity.wakeUp.durationVariance.villager); // Plazma - Variable Entity WakeUp Duration - } - } else if (entity.activationType == ActivationType.ANIMAL) { - if (inactiveFor > config.wakeUpInactiveAnimalsEvery && world.wakeupInactiveRemainingAnimals > 0) { - world.wakeupInactiveRemainingAnimals--; -- return config.wakeUpInactiveAnimalsFor; -+ return getWakeUpDurationWithVariance(config.wakeUpInactiveAnimalsFor, entity.level().plazmaLevelConfiguration().entity.wakeUp.durationVariance.animal); // Plazma - Variable Entity WakeUp Duration - } - } else if (entity.activationType == ActivationType.FLYING_MONSTER) { - if (inactiveFor > config.wakeUpInactiveFlyingEvery && world.wakeupInactiveRemainingFlying > 0) { - world.wakeupInactiveRemainingFlying--; -- return config.wakeUpInactiveFlyingFor; -+ return getWakeUpDurationWithVariance(config.wakeUpInactiveFlyingFor, entity.level().plazmaLevelConfiguration().entity.wakeUp.durationVariance.flyingMonster); // Plazma - Variable Entity WakeUp Duration - } - } else if (entity.activationType == ActivationType.MONSTER || entity.activationType == ActivationType.RAIDER) { - if (inactiveFor > config.wakeUpInactiveMonstersEvery && world.wakeupInactiveRemainingMonsters > 0) { - world.wakeupInactiveRemainingMonsters--; -- return config.wakeUpInactiveMonstersFor; -+ return getWakeUpDurationWithVariance(config.wakeUpInactiveMonstersFor, entity.level().plazmaLevelConfiguration().entity.wakeUp.durationVariance.monster); // Plazma - Variable Entity WakeUp Duration - } - } - return -1; - } - // Paper end - -+ // Plazma start - Variable Entity WakeUp Duration -+ private static final java.util.Random wakeUpDurationRandom = new java.util.Random(); -+ private static int getWakeUpDurationWithVariance(int wakeUpDuration, double deviation) { -+ if (deviation <= 0) return wakeUpDuration; -+ return (int) Math.min(Integer.MAX_VALUE, Math.max(1, Math.round(wakeUpDuration * wakeUpDurationRandom.nextGaussian(1, deviation)))); -+ } -+ // Plazma end -+ - static AABB maxBB = new AABB( 0, 0, 0, 0, 0, 0 ); - - /**