diff --git a/build.gradle.kts b/build.gradle.kts index 8281a6a..eb0ade6 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -85,6 +85,9 @@ subprojects { mavenCentral() maven("https://jitpack.io") maven("https://papermc.io/repo/repository/maven-public/") + maven(url = "https://s01.oss.sonatype.org/content/repositories/snapshots/") { + name = "sonatype-oss-snapshots" + } } } diff --git a/libs/common.versions.toml b/libs/common.versions.toml index fcea90c..9144180 100644 --- a/libs/common.versions.toml +++ b/libs/common.versions.toml @@ -5,7 +5,7 @@ mockito = "5.5.0" jupiter = "5.10.0" hamcrest = "2.2" snakeyaml = "2.2" -adventure = "4.16.0" +adventure = "4.17.0-SNAPSHOT" commons-lang2 = "2.6" commons-lang3 = "3.12.0" maven-provider = "3.9.6" diff --git a/libs/server.versions.toml b/libs/server.versions.toml index 7218785..50dbc38 100644 --- a/libs/server.versions.toml +++ b/libs/server.versions.toml @@ -1,4 +1,6 @@ [versions] +art = "2.0.3" +tca = "1.3.0" upnp = "1.0" ansi = "1.0.3" jansi = "3.21.0" @@ -7,15 +9,18 @@ mysql = "8.2.0" sqlite = "3.42.0.1" pioneer = "2.2.0" haproxy = "4.1.97.Final" +rewriter = "0.0.1" +srgutils = "1.0.9" velocity = "3.1.2-SNAPSHOT" disruptor = "3.4.4" simpleyaml = "1.8.4" classgraph = "4.8.47" mapping-io = "0.5.0" configurate = "4.2.0-SNAPSHOT" -terminal-appender = "1.3.0" [libraries] +art = { group = "net.neoforged", name = "AutoRenamingTool", version.ref = "art" } +tca = { group = "net.minecrell", name = "terminalconsoleappender", version.ref="tca" } ansi = { group = "net.kyori", name = "ansi", version.ref = "ansi" } upnp = { group = "dev.omega24", name = "upnp4j", version.ref = "upnp" } mysql = { group = "com.mysql", name = "mysql-connector-j", version.ref = "mysql" } @@ -23,6 +28,7 @@ jansi = { group = "org.jline", name = "jline-terminal-jansi", version.ref = "jan sqlite = { group = "org.xerial", name = "sqlite-jdbc", version.ref = "sqlite" } pioneer = { group = "org.junit-pioneer", name = "junit-pioneer", version.ref = "pioneer" } haproxy = { group = "io.netty", name = "netty-codec-haproxy", version.ref = "haproxy" } +srgutils = { group = "net.neoforged", name = "srgutils", version.ref = "srgutils" } velocity = { group = "com.velocitypowered", name = "velocity-native", version.ref = "velocity" } disruptor = { group = "com.lmax", name = "disruptor", version.ref = "disruptor" } mappingio = { group = "net.fabricmc", name = "mapping-io", version.ref = "mapping-io" } @@ -32,9 +38,12 @@ configurate = { group = "org.spongepowered", name = "configurate-yaml", version. rhino-engine = { group = "org.mozilla", name = "rhino-engine", version.ref = "rhino" } rhino-runtime = { group = "org.mozilla", name = "rhino-runtime", version.ref = "rhino" } -terminal-appender = { group = "net.minecrell", name = "terminalconsoleappender", version.ref="terminal-appender" } + +rewriter = { group = "io.papermc", name = "reflection-rewriter", version.ref = "rewriter" } +rewriter-runtime = { group = "io.papermc", name = "reflection-rewriter-runtime", version.ref = "rewriter" } +rewriter-generator = { group = "io.papermc", name = "reflection-rewriter-proxy-generator", version.ref = "rewriter" } [bundles] runtime = [ "sqlite", "mysql", "disruptor" ] -implementation = [ "jansi", "terminal-appender", "ansi", "upnp", "haproxy", "configurate", "mappingio", "rhino-engine", "rhino-runtime" ] +implementation = [ "jansi", "tca", "ansi", "upnp", "haproxy", "configurate", "mappingio", "rhino-engine", "rhino-runtime", "srgutils", "art", "rewriter", "rewriter-runtime", "rewriter-generator" ] test = [ "classgraph", "pioneer" ] diff --git a/patches/unapplied/server/0007-Plazma-Configurations.patch b/patches/server/0006-Plazma-Configurations.patch similarity index 88% rename from patches/unapplied/server/0007-Plazma-Configurations.patch rename to patches/server/0006-Plazma-Configurations.patch index ee59dd7..0c7d4a3 100644 --- a/patches/unapplied/server/0007-Plazma-Configurations.patch +++ b/patches/server/0006-Plazma-Configurations.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Plazma Configurations diff --git a/src/main/java/io/papermc/paper/configuration/Configurations.java b/src/main/java/io/papermc/paper/configuration/Configurations.java -index 218bf89fd7583d6db9f64754c4db8fcce5415bdb..bd2234f883faa50015289315fa745e6556d3f094 100644 +index 96142deb42700f888ea08689ab62c27ef2b881fd..3ac80b85ba7c4a4e0b0b4aa06fa92f6e4e376c28 100644 --- a/src/main/java/io/papermc/paper/configuration/Configurations.java +++ b/src/main/java/io/papermc/paper/configuration/Configurations.java -@@ -36,28 +36,93 @@ public abstract class Configurations { +@@ -39,28 +39,94 @@ public abstract class Configurations { public static final String WORLD_DEFAULTS = "__world_defaults__"; public static final ResourceLocation WORLD_DEFAULTS_KEY = new ResourceLocation("configurations", WORLD_DEFAULTS); protected final Path globalFolder; @@ -26,6 +26,7 @@ index 218bf89fd7583d6db9f64754c4db8fcce5415bdb..bd2234f883faa50015289315fa745e65 - final String defaultWorldConfigFileName, - final String worldConfigFileName - ) { ++ + // Plazma start - Configurable Plazma + @org.jetbrains.annotations.VisibleForTesting + public static final java.util.function.Supplier SPIGOT_WORLD_DEFAULTS = com.google.common.base.Suppliers.memoize(() -> new org.spigotmc.SpigotWorldConfig(org.apache.commons.lang.RandomStringUtils.randomAlphabetic(255)) { @@ -121,7 +122,7 @@ index 218bf89fd7583d6db9f64754c4db8fcce5415bdb..bd2234f883faa50015289315fa745e65 protected ObjectMapper.Factory.Builder createObjectMapper() { return ObjectMapper.factoryBuilder() .addConstraint(Constraint.class, new Constraint.Factory()) -@@ -65,17 +130,21 @@ public abstract class Configurations { +@@ -68,17 +134,21 @@ public abstract class Configurations { } protected YamlConfigurationLoader.Builder createLoaderBuilder() { @@ -146,16 +147,16 @@ index 218bf89fd7583d6db9f64754c4db8fcce5415bdb..bd2234f883faa50015289315fa745e65 } @MustBeInvokedByOverriders -@@ -93,7 +162,7 @@ public abstract class Configurations { +@@ -96,7 +166,7 @@ public abstract class Configurations { }; } - static CheckedFunction reloader(Class type, T instance) { -+ protected static CheckedFunction reloader(Class type, T instance) { // Plazma - package -> protected ++ protected static CheckedFunction reloader(Class type, T instance) { // Plazma - AT (package -> protected) return node -> { ObjectMapper.Factory factory = (ObjectMapper.Factory) Objects.requireNonNull(node.options().serializers().get(type)); ObjectMapper.Mutable mutable = (ObjectMapper.Mutable) factory.get(type); -@@ -103,7 +172,7 @@ public abstract class Configurations { +@@ -106,7 +176,7 @@ public abstract class Configurations { } public G initializeGlobalConfiguration(final RegistryAccess registryAccess) throws ConfigurateException { @@ -164,7 +165,7 @@ index 218bf89fd7583d6db9f64754c4db8fcce5415bdb..bd2234f883faa50015289315fa745e65 } private void trySaveFileNode(YamlConfigurationLoader loader, ConfigurationNode node, String filename) throws ConfigurateException { -@@ -117,7 +186,7 @@ public abstract class Configurations { +@@ -120,7 +190,7 @@ public abstract class Configurations { } protected G initializeGlobalConfiguration(final CheckedFunction creator) throws ConfigurateException { @@ -173,7 +174,7 @@ index 218bf89fd7583d6db9f64754c4db8fcce5415bdb..bd2234f883faa50015289315fa745e65 final YamlConfigurationLoader loader = this.createGlobalLoaderBuilder() .defaultOptions(this.applyObjectMapperFactory(this.createGlobalObjectMapperFactoryBuilder().build())) .path(configFile) -@@ -148,6 +217,13 @@ public abstract class Configurations { +@@ -151,6 +221,13 @@ public abstract class Configurations { } protected void applyGlobalConfigTransformations(final ConfigurationNode node) throws ConfigurateException { @@ -187,7 +188,7 @@ index 218bf89fd7583d6db9f64754c4db8fcce5415bdb..bd2234f883faa50015289315fa745e65 } @MustBeInvokedByOverriders -@@ -155,6 +231,7 @@ public abstract class Configurations { +@@ -158,6 +235,7 @@ public abstract class Configurations { return ContextMap.builder() .put(WORLD_NAME, WORLD_DEFAULTS) .put(WORLD_KEY, WORLD_DEFAULTS_KEY) @@ -195,7 +196,7 @@ index 218bf89fd7583d6db9f64754c4db8fcce5415bdb..bd2234f883faa50015289315fa745e65 .put(REGISTRY_ACCESS, registryAccess); } -@@ -162,7 +239,7 @@ public abstract class Configurations { +@@ -165,7 +243,7 @@ public abstract class Configurations { final ContextMap contextMap = this.createDefaultContextMap(registryAccess) .put(FIRST_DEFAULT) .build(); @@ -204,18 +205,18 @@ index 218bf89fd7583d6db9f64754c4db8fcce5415bdb..bd2234f883faa50015289315fa745e65 final DefaultWorldLoader result = this.createDefaultWorldLoader(false, contextMap, configFile); final YamlConfigurationLoader loader = result.loader(); final ConfigurationNode node = loader.load(); -@@ -172,8 +249,8 @@ public abstract class Configurations { +@@ -175,8 +253,8 @@ public abstract class Configurations { this.verifyWorldConfigVersion(contextMap, node); } - this.applyWorldConfigTransformations(contextMap, node); + this.applyWorldConfigTransformations(contextMap, node, null); - final W instance = node.require(this.worldConfigClass); - node.set(this.worldConfigClass, instance); + final W instance = node.require(this.worldConfigClass()); // Plazma - Configurable Plazma + node.set(this.worldConfigClass(), instance); // Plazma - Configurable Plazma - trySaveFileNode(loader, node, configFile.toString()); + this.trySaveFileNode(loader, node, configFile.toString()); } -@@ -194,30 +271,41 @@ public abstract class Configurations { +@@ -197,31 +275,42 @@ public abstract class Configurations { private record DefaultWorldLoader(YamlConfigurationLoader loader, boolean isNewFile) { } @@ -236,9 +237,8 @@ index 218bf89fd7583d6db9f64754c4db8fcce5415bdb..bd2234f883faa50015289315fa745e65 } // Make sure to run version transforms on the default world config first via #setupWorldDefaultsConfig -- public W createWorldConfig(final ContextMap contextMap) throws IOException { + public W createWorldConfig(final ContextMap contextMap) throws IOException { - return this.createWorldConfig(contextMap, creator(this.worldConfigClass, false)); -+ public W createWorldConfig(final ContextMap contextMap) { + final String levelName = contextMap.require(WORLD_NAME); + try { + return this.createWorldConfig(contextMap, creator(this.worldConfigClass(), false)); @@ -249,6 +249,7 @@ index 218bf89fd7583d6db9f64754c4db8fcce5415bdb..bd2234f883faa50015289315fa745e65 + // Plazma end - Configurable Plazma protected W createWorldConfig(final ContextMap contextMap, final CheckedFunction creator) throws IOException { + Preconditions.checkArgument(!contextMap.isDefaultWorldContext(), "cannot create world map with default world context"); - final Path defaultsConfigFile = this.globalFolder.resolve(this.defaultWorldConfigFileName); + final Path defaultsConfigFile = this.globalFolder.resolve(this.defaultWorldConfigFileName()); // Plazma - Configurable Plazma final YamlConfigurationLoader defaultsLoader = this.createDefaultWorldLoader(true, this.createDefaultContextMap(contextMap.require(REGISTRY_ACCESS)).build(), defaultsConfigFile).loader(); @@ -264,19 +265,19 @@ index 218bf89fd7583d6db9f64754c4db8fcce5415bdb..bd2234f883faa50015289315fa745e65 Files.createFile(worldConfigFile); // create empty file as template newFile = true; } -@@ -246,7 +334,7 @@ public abstract class Configurations { +@@ -250,7 +339,7 @@ public abstract class Configurations { if (worldName.equals(WORLD_DEFAULTS)) { LOGGER.warn("The world defaults config file didn't have a version set, assuming latest"); } else { - LOGGER.warn("The world config file for " + worldName + " didn't have a version set, assuming latest"); -+ LOGGER.warn("The world config file for {} didn't have a version set, assuming latest", worldName); // Plazma ++ LOGGER.warn("The world config file for {} didn't have a version set, assuming latest", worldName); // Plazma - nah } version.raw(this.worldConfigVersion()); } else if (version.getInt() > this.worldConfigVersion()) { -@@ -261,6 +349,13 @@ public abstract class Configurations { +@@ -265,6 +354,13 @@ public abstract class Configurations { } - protected void applyWorldConfigTransformations(final ContextMap contextMap, final ConfigurationNode node) throws ConfigurateException { + protected void applyWorldConfigTransformations(final ContextMap contextMap, final ConfigurationNode node, final @Nullable ConfigurationNode defaultsNode) throws ConfigurateException { + // Plazma start - Configurable Plazma + org.spongepowered.configurate.transformation.ConfigurationTransformation.Builder builder = org.spongepowered.configurate.transformation.ConfigurationTransformation.builder(); + for (org.spongepowered.configurate.NodePath path : removedWorldPaths()) { @@ -287,7 +288,7 @@ index 218bf89fd7583d6db9f64754c4db8fcce5415bdb..bd2234f883faa50015289315fa745e65 } protected void applyDefaultsAwareWorldConfigTransformations(final ContextMap contextMap, final ConfigurationNode worldNode, final ConfigurationNode defaultsNode) throws ConfigurateException { -@@ -273,7 +368,7 @@ public abstract class Configurations { +@@ -277,7 +373,7 @@ public abstract class Configurations { } public Path getWorldConfigFile(ServerLevel level) { @@ -297,30 +298,30 @@ index 218bf89fd7583d6db9f64754c4db8fcce5415bdb..bd2234f883faa50015289315fa745e65 public static class ContextMap { diff --git a/src/main/java/io/papermc/paper/configuration/PaperConfigurations.java b/src/main/java/io/papermc/paper/configuration/PaperConfigurations.java -index fa1c0aee8c3a4d0868482cf5c703bbfd08e09874..4a444ac90d357e1b5cc432bccad958054b8a8665 100644 +index 83a726bcf8b7dce73a361b0d79dbd63a0afc7a12..27a2914fabdc2c5ac70e402a41f5c9bb7bfe3c51 100644 --- a/src/main/java/io/papermc/paper/configuration/PaperConfigurations.java +++ b/src/main/java/io/papermc/paper/configuration/PaperConfigurations.java -@@ -131,6 +131,7 @@ public class PaperConfigurations extends Configurations SPIGOT_WORLD_DEFAULTS = Suppliers.memoize(() -> new SpigotWorldConfig(RandomStringUtils.randomAlphabetic(255)) { @Override // override to ensure "verbose" is false -@@ -139,12 +140,69 @@ public class PaperConfigurations extends Configurations> SPIGOT_WORLD_CONFIG_CONTEXT_KEY = new ContextKey<>(new TypeToken>() {}, "spigot world config"); -- -+ // Plazma start - Configurable Plazma + */ + public PaperConfigurations(final Path globalFolder) { - super(globalFolder, GlobalConfiguration.class, WorldConfiguration.class, GLOBAL_CONFIG_FILE_NAME, WORLD_DEFAULTS_CONFIG_FILE_NAME, WORLD_CONFIG_FILE_NAME); + super(globalFolder); -+ } -+ + } + + @Override + protected Class globalConfigClass() { + return GlobalConfiguration.class; @@ -334,8 +335,8 @@ index fa1c0aee8c3a4d0868482cf5c703bbfd08e09874..4a444ac90d357e1b5cc432bccad95805 + @Override + protected NodePath[] removedGlobalPaths() { + return RemovedConfigurations.REMOVED_GLOBAL_PATHS; - } - ++ } ++ + @Override + protected GlobalConfiguration getGlobalConfiguration() { + return GlobalConfiguration.get(); @@ -380,7 +381,7 @@ index fa1c0aee8c3a4d0868482cf5c703bbfd08e09874..4a444ac90d357e1b5cc432bccad95805 @Override protected int globalConfigVersion() { return GlobalConfiguration.CURRENT_VERSION; -@@ -155,6 +213,7 @@ public class PaperConfigurations extends Configurations builder +@@ -203,6 +264,7 @@ public class PaperConfigurations extends Configurations protected) return new WorldConfiguration( contextMap.require(PaperConfigurations.SPIGOT_WORLD_CONFIG_CONTEXT_KEY).get(), contextMap.require(Configurations.WORLD_KEY) -@@ -226,7 +291,6 @@ public class PaperConfigurations extends Configurations options - .header(contextMap.require(WORLD_NAME).equals(WORLD_DEFAULTS) ? WORLD_DEFAULTS_HEADER : WORLD_HEADER.apply(contextMap)) ++ // .header(contextMap.require(WORLD_NAME).equals(WORLD_DEFAULTS) ? WORLD_DEFAULTS_HEADER : WORLD_HEADER.apply(contextMap)) // Plazma - Configurable Plazma .serializers(serializers -> serializers .register(new TypeToken>() {}, new FastutilMapSerializer.SomethingToPrimitive>(Reference2IntOpenHashMap::new, Integer.TYPE)) .register(new TypeToken>() {}, new FastutilMapSerializer.SomethingToPrimitive>(Reference2LongOpenHashMap::new, Long.TYPE)) -@@ -251,11 +315,7 @@ public class PaperConfigurations extends Configurations minecraftserver.paperConfigurations.createWorldConfig(io.papermc.paper.configuration.PaperConfigurations.createWorldContextMap(convertable_conversionsession.levelDirectory.path(), iworlddataserver.getLevelName(), resourcekey.location(), spigotConfig, minecraftserver.registryAccess())), executor); // Paper - create paper world configs; Async-Anti-Xray: Pass executor -+ super(iworlddataserver, resourcekey, minecraftserver.registryAccess(), worlddimension.type(), minecraftserver::getProfiler, false, flag, i, minecraftserver.getMaxChainedNeighborUpdates(), gen, biomeProvider, env, spigotConfig -> minecraftserver.paperConfigurations.createWorldConfig(io.papermc.paper.configuration.PaperConfigurations.createWorldContextMap(convertable_conversionsession.levelDirectory.path(), iworlddataserver.getLevelName(), resourcekey.location(), spigotConfig, minecraftserver.registryAccess())), spigotConfig -> minecraftserver.plazmaConfigurations.createWorldConfig(org.plazmamc.plazma.configurations.PlazmaConfigurations.createWorldContextMap(convertable_conversionsession.levelDirectory.path(), iworlddataserver.getLevelName(), resourcekey.location(), spigotConfig, minecraftserver.registryAccess())), executor); // Paper - create paper world configs; Async-Anti-Xray: Pass executor // Plazma - Configurable Plazma +- super(iworlddataserver, resourcekey, minecraftserver.registryAccess(), worlddimension.type(), minecraftserver::getProfiler, false, flag, i, minecraftserver.getMaxChainedNeighborUpdates(), gen, biomeProvider, env, spigotConfig -> minecraftserver.paperConfigurations.createWorldConfig(io.papermc.paper.configuration.PaperConfigurations.createWorldContextMap(convertable_conversionsession.levelDirectory.path(), iworlddataserver.getLevelName(), resourcekey.location(), spigotConfig, minecraftserver.registryAccess(), iworlddataserver.getGameRules())), executor); // Paper - create paper world configs; Async-Anti-Xray: Pass executor ++ super(iworlddataserver, resourcekey, minecraftserver.registryAccess(), worlddimension.type(), minecraftserver::getProfiler, false, flag, i, minecraftserver.getMaxChainedNeighborUpdates(), gen, biomeProvider, env, spigotConfig -> minecraftserver.paperConfigurations.createWorldConfig(io.papermc.paper.configuration.PaperConfigurations.createWorldContextMap(convertable_conversionsession.levelDirectory.path(), iworlddataserver.getLevelName(), resourcekey.location(), spigotConfig, minecraftserver.registryAccess(), iworlddataserver.getGameRules())), spigotConfig -> minecraftserver.plazmaConfigurations.createWorldConfig(org.plazmamc.plazma.configurations.PlazmaConfigurations.createWorldContextMap(convertable_conversionsession.levelDirectory.path(), iworlddataserver.getLevelName(), resourcekey.location(), spigotConfig, minecraftserver.registryAccess(), iworlddataserver.getGameRules())), executor); // Paper - create paper world configs; Async-Anti-Xray: Pass executor // Plazma - Configurable Plazma this.pvpMode = minecraftserver.isPvpAllowed(); this.convertable = convertable_conversionsession; this.uuid = WorldUUID.getUUID(convertable_conversionsession.levelDirectory.path().toFile()); -diff --git a/src/main/java/net/minecraft/world/item/ItemStack.java b/src/main/java/net/minecraft/world/item/ItemStack.java -index f6664447c45b1d6f3371af7bed8b1175b17f25e2..9161f020d2ecc0cb9191666cfbc6a877d067063e 100644 ---- a/src/main/java/net/minecraft/world/item/ItemStack.java -+++ b/src/main/java/net/minecraft/world/item/ItemStack.java -@@ -271,7 +271,7 @@ public final class ItemStack { - if (0 < version && version < CraftMagicNumbers.INSTANCE.getDataVersion() && MinecraftServer.getServer() != null) { // Paper - skip conversion if the server doesn't exist (for tests) - CompoundTag savedStack = new CompoundTag(); - this.save(savedStack); -- savedStack = (CompoundTag) MinecraftServer.getServer().fixerUpper.update(References.ITEM_STACK, new Dynamic(NbtOps.INSTANCE, savedStack), version, CraftMagicNumbers.INSTANCE.getDataVersion()).getValue(); -+ savedStack = (CompoundTag) MinecraftServer.getServer().getFixerUpper().update(References.ITEM_STACK, new Dynamic(NbtOps.INSTANCE, savedStack), version, CraftMagicNumbers.INSTANCE.getDataVersion()).getValue(); // Plazma - Configurable Plazma - this.load(savedStack); - } - } diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java -index 311c853f2150247350ab6ccb2dd92d58dbfc645c..7578b6d4ee52ebafea16b7eaf88dcedbd1f093d8 100644 +index eda2f8cc034cf46293be1be117a60cf8b663c303..79ebec0543f730af403240e9c1c011777464a698 100644 --- a/src/main/java/net/minecraft/world/level/Level.java +++ b/src/main/java/net/minecraft/world/level/Level.java -@@ -171,7 +171,12 @@ public abstract class Level implements LevelAccessor, AutoCloseable { +@@ -168,6 +168,12 @@ public abstract class Level implements LevelAccessor, AutoCloseable { return this.paperConfig; } // Paper end - add paper world config -- + // Plazma start - Configurable Plazma + private final org.plazmamc.plazma.configurations.WorldConfigurations plazmaConfig; + public org.plazmamc.plazma.configurations.WorldConfigurations plazmaConfig() { + return this.plazmaConfig; + } + // Plazma end - Configurable Plazma + public final com.destroystokyo.paper.antixray.ChunkPacketBlockController chunkPacketBlockController; // Paper - Anti-Xray public final org.purpurmc.purpur.PurpurWorldConfig purpurConfig; // Purpur - public final co.aikar.timings.WorldTimingsHandler timings; // Paper -@@ -262,9 +267,10 @@ public abstract class Level implements LevelAccessor, AutoCloseable { +@@ -257,9 +263,10 @@ public abstract class Level implements LevelAccessor, AutoCloseable { - //protected final io.papermc.paper.util.math.ThreadUnsafeRandom randomTickRandom = new io.papermc.paper.util.math.ThreadUnsafeRandom(java.util.concurrent.ThreadLocalRandom.current().nextLong()); public net.minecraft.util.RandomSource getThreadUnsafeRandom() { return this.randomTickRandom; } // Pufferfish - move thread unsafe random initialization // Pufferfish - getter // Purpur - dont break ABI + public abstract ResourceKey getTypeKey(); - 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 - create paper world config; Async-Anti-Xray: Pass executor + 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.function.Function plazmaWorldConfigurationCreator, java.util.concurrent.Executor executor) { // Paper - create paper world config; Async-Anti-Xray: Pass executor // Plazma - Configurable Plazma @@ -682,7 +651,7 @@ index 311c853f2150247350ab6ccb2dd92d58dbfc645c..7578b6d4ee52ebafea16b7eaf88dcedb this.playerBreedingCooldowns = this.getNewBreedingCooldownCache(); // Purpur this.generator = gen; diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -index b2470f03eecb1b81d3f0acbd9bc3c38f321ef3d9..ceea71c3e6886b03d017c44c287dc20928f63f09 100644 +index dca6cce8768c8c08e4abba249c30731dbdec7763..dffbcd950e081325539289e2b867570be9dd427d 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java @@ -1068,6 +1068,7 @@ public final class CraftServer implements Server { @@ -693,7 +662,7 @@ index b2470f03eecb1b81d3f0acbd9bc3c38f321ef3d9..ceea71c3e6886b03d017c44c287dc209 org.purpurmc.purpur.PurpurConfig.init((File) console.options.valueOf("purpur-settings")); // Purpur for (ServerLevel world : this.console.getAllLevels()) { // world.serverLevelData.setDifficulty(config.difficulty); // Paper - per level difficulty -@@ -3111,6 +3112,13 @@ public final class CraftServer implements Server { +@@ -3126,6 +3127,13 @@ public final class CraftServer implements Server { } // Purpur end @@ -708,11 +677,11 @@ index b2470f03eecb1b81d3f0acbd9bc3c38f321ef3d9..ceea71c3e6886b03d017c44c287dc209 public void restart() { org.spigotmc.RestartCommand.restart(); diff --git a/src/main/java/org/bukkit/craftbukkit/Main.java b/src/main/java/org/bukkit/craftbukkit/Main.java -index d36c880012153058803b595429084adb36458741..e8df8e8520cea5d21197c61a172f7211a3a2c34d 100644 +index 333c8a313208652700c21fc2ac629296b5b02078..9b3371fee86b5e41d5564424c0b3a3805b2059f9 100644 --- a/src/main/java/org/bukkit/craftbukkit/Main.java +++ b/src/main/java/org/bukkit/craftbukkit/Main.java -@@ -195,6 +195,14 @@ public class Main { - .defaultsTo("Plazma Server") // Plazma - Branding +@@ -190,6 +190,14 @@ public class Main { + .defaultsTo("A Plazma Server") // Plazma - Rebrand .describedAs("Name"); // Paper end + @@ -1277,7 +1246,7 @@ index 0000000000000000000000000000000000000000..f2d3d51cb4b8fc7a5fd6db1a63289fff + +} diff --git a/src/test/java/org/bukkit/support/AbstractTestingBase.java b/src/test/java/org/bukkit/support/AbstractTestingBase.java -index b786ed8e620feb51baceae41dd2d1538dc298705..6c2db1219714a524b456428523ed4674f79ffe03 100644 +index 1b1d51a68c0abe7d8f0aa1172064192c71ae645e..74af3501397bfd89d637ad5ce72bb8f2c2bbdc8a 100644 --- a/src/test/java/org/bukkit/support/AbstractTestingBase.java +++ b/src/test/java/org/bukkit/support/AbstractTestingBase.java @@ -64,6 +64,7 @@ public abstract class AbstractTestingBase { @@ -1289,10 +1258,10 @@ index b786ed8e620feb51baceae41dd2d1538dc298705..6c2db1219714a524b456428523ed4674 CraftRegistry.setMinecraftRegistry(REGISTRY_CUSTOM); diff --git a/src/test/java/org/bukkit/support/DummyServer.java b/src/test/java/org/bukkit/support/DummyServer.java -index 3b3e44c5ed24f653f7dc1e5d3d4f0ff76084f277..9391d5447e26a42142c6b44c8e470b35c0f9b0cf 100644 +index 7a4681155f740a98ecafa0b992eae1fb5524551f..37b3c3fe0be6366f0cdb868467d6dcb6f2904c41 100644 --- a/src/test/java/org/bukkit/support/DummyServer.java +++ b/src/test/java/org/bukkit/support/DummyServer.java -@@ -57,6 +57,13 @@ public final class DummyServer { +@@ -59,6 +59,13 @@ public final class DummyServer { when(instance.getTag(anyString(), any(org.bukkit.NamespacedKey.class), any())).thenAnswer(ignored -> new io.papermc.paper.util.EmptyTag()); // paper end - testing additions diff --git a/patches/unapplied/server/0008-Setup-basic-configuration-sections.patch b/patches/server/0007-Setup-basic-configuration-sections.patch similarity index 100% rename from patches/unapplied/server/0008-Setup-basic-configuration-sections.patch rename to patches/server/0007-Setup-basic-configuration-sections.patch diff --git a/patches/unapplied/server/0009-Port-SparklyPaper-patches.patch b/patches/server/0008-Port-SparklyPaper-patches.patch similarity index 90% rename from patches/unapplied/server/0009-Port-SparklyPaper-patches.patch rename to patches/server/0008-Port-SparklyPaper-patches.patch index 8360707..7e6fec7 100644 --- a/patches/unapplied/server/0009-Port-SparklyPaper-patches.patch +++ b/patches/server/0008-Port-SparklyPaper-patches.patch @@ -9,10 +9,10 @@ Copyright (C) 2024 SparklyPower Based on commit: 29212936a832106c4d68e2a2017acbea2fdd3cc4 diff --git a/src/main/java/net/minecraft/server/level/ServerEntity.java b/src/main/java/net/minecraft/server/level/ServerEntity.java -index 04b98e23eed926d8473cc2464e04a5b9f18f1140..cf098d4a3111771c13766285c5ec5f1fc1f539a4 100644 +index 39e7dcf3c92c9203c190782be401c00c010b8aeb..bb03ef9c06bf55be279d5f5ecc95099ad7b1b10e 100644 --- a/src/main/java/net/minecraft/server/level/ServerEntity.java +++ b/src/main/java/net/minecraft/server/level/ServerEntity.java -@@ -74,6 +74,7 @@ public class ServerEntity { +@@ -78,6 +78,7 @@ public class ServerEntity { private List> trackedDataValues; // CraftBukkit start public final Set trackedPlayers; // Purpur - private -> public @@ -20,7 +20,7 @@ index 04b98e23eed926d8473cc2464e04a5b9f18f1140..cf098d4a3111771c13766285c5ec5f1f public ServerEntity(ServerLevel worldserver, Entity entity, int i, boolean flag, Consumer> consumer, Set trackedPlayers) { this.trackedPlayers = trackedPlayers; -@@ -210,12 +211,14 @@ public class ServerEntity { +@@ -208,12 +209,14 @@ public class ServerEntity { if ((this.trackDelta || this.entity.hasImpulse || this.entity instanceof LivingEntity && ((LivingEntity) this.entity).isFallFlying()) && this.tickCount > 0) { Vec3 vec3d1 = this.entity.getDeltaMovement(); @@ -57,10 +57,10 @@ index f890738d3bb9fb5e70a9d323c6cec97f9948f9cf..52e72277c661b67a54bc5ce584efb041 } } diff --git a/src/main/java/net/minecraft/world/item/MapItem.java b/src/main/java/net/minecraft/world/item/MapItem.java -index 8d3c1897044f9a2bbe1911e1a72dc9a00fb246df..a68112a1d1904edfc84acb6c209e13f0836d97e0 100644 +index 608390ed36710a419de1542b80340dd3fcc7299c..b5c584e5cf767ab7ecfd6b2104d1d31ba0f61d60 100644 --- a/src/main/java/net/minecraft/world/item/MapItem.java +++ b/src/main/java/net/minecraft/world/item/MapItem.java -@@ -313,12 +313,14 @@ public class MapItem extends ComplexItem { +@@ -268,11 +268,13 @@ public class MapItem extends ComplexItem { } } @@ -68,13 +68,12 @@ index 8d3c1897044f9a2bbe1911e1a72dc9a00fb246df..a68112a1d1904edfc84acb6c209e13f0 @Override public void inventoryTick(ItemStack stack, Level world, Entity entity, int slot, boolean selected) { if (!world.isClientSide) { - MapItemSavedData worldmap = MapItem.getSavedData(stack, world); - - if (worldmap != null) { + MapItemSavedData mapItemSavedData = getSavedData(stack, world); + if (mapItemSavedData != null) { + if (skipTickWhenCraftNotPresent && worldmap.mapView.getRenderers().stream().noneMatch(mapRenderer -> mapRenderer.getClass() == org.bukkit.craftbukkit.map.CraftMapRenderer.class)) return; // Plazma - SparklyPaper port; Skip map item ticking if the craft map renderer is not present - if (entity instanceof Player) { - Player entityhuman = (Player) entity; - + if (entity instanceof Player player) { + mapItemSavedData.tickCarriedBy(player, stack); + } diff --git a/src/main/java/org/bukkit/craftbukkit/map/CraftMapColorCache.java b/src/main/java/org/bukkit/craftbukkit/map/CraftMapColorCache.java index 8149b9c51b78eb5c689b7218a2ca3aab60e73bcf..b9a303f6280a2f6ad3616da152922a4f4a504281 100644 --- a/src/main/java/org/bukkit/craftbukkit/map/CraftMapColorCache.java diff --git a/patches/server/0009-Always-agree-EULA-on-development-mode.patch b/patches/server/0009-Always-agree-EULA-on-development-mode.patch new file mode 100644 index 0000000..5689168 --- /dev/null +++ b/patches/server/0009-Always-agree-EULA-on-development-mode.patch @@ -0,0 +1,154 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: AlphaKR93 +Date: Sun, 5 Nov 2023 10:13:14 +0900 +Subject: [PATCH] Always agree EULA on development mode + + +diff --git a/build.gradle.kts b/build.gradle.kts +index e2c178e4136fa99427f4e394da363caf7872edcd..4ce3329a2d8a5eb04b3b65a7bbdf0b88e4a4bc2d 100644 +--- a/build.gradle.kts ++++ b/build.gradle.kts +@@ -20,6 +20,7 @@ dependencies { + implementation(common.asm.commons) + implementation(common.log4j.iostreams) + implementation(common.commons.lang2) ++ implementation(common.adventure.serializer.ansi) + implementation(server.velocity) { isTransitive = false } + + runtimeOnly(common.maven.provider) +diff --git a/src/main/java/io/papermc/paper/configuration/Configurations.java b/src/main/java/io/papermc/paper/configuration/Configurations.java +index 3ac80b85ba7c4a4e0b0b4aa06fa92f6e4e376c28..d32a963b0210438ae9f313af47125423a2263bf8 100644 +--- a/src/main/java/io/papermc/paper/configuration/Configurations.java ++++ b/src/main/java/io/papermc/paper/configuration/Configurations.java +@@ -85,16 +85,17 @@ public abstract class Configurations { + } + + protected static ContextMap createWorldContextMap(ServerLevel level) { +- return createWorldContextMap(level.convertable.levelDirectory.path(), level.serverLevelData.getLevelName(), level.dimension().location(), level.spigotConfig, level.registryAccess()); ++ return createWorldContextMap(level.convertable.levelDirectory.path(), level.serverLevelData.getLevelName(), level.dimension().location(), level.spigotConfig, level.registryAccess(), level.getGameRules()); + } + +- public static ContextMap createWorldContextMap(Path dir, String levelName, ResourceLocation worldKey, org.spigotmc.SpigotWorldConfig spigotConfig, RegistryAccess registryAccess) { ++ public static ContextMap createWorldContextMap(Path dir, String levelName, ResourceLocation worldKey, org.spigotmc.SpigotWorldConfig spigotConfig, RegistryAccess registryAccess, final GameRules gameRules) { + return ContextMap.builder() + .put(WORLD_DIRECTORY, dir) + .put(WORLD_NAME, levelName) + .put(WORLD_KEY, worldKey) + .put(SPIGOT_WORLD_CONFIG_CONTEXT_KEY, com.google.common.base.Suppliers.ofInstance(spigotConfig)) + .put(REGISTRY_ACCESS, registryAccess) ++ .put(GAME_RULES, gameRules) + .build(); + } + +@@ -290,7 +291,7 @@ public abstract class Configurations { + } + + // Make sure to run version transforms on the default world config first via #setupWorldDefaultsConfig +- public W createWorldConfig(final ContextMap contextMap) throws IOException { ++ public W createWorldConfig(final ContextMap contextMap) { + final String levelName = contextMap.require(WORLD_NAME); + try { + return this.createWorldConfig(contextMap, creator(this.worldConfigClass(), false)); +diff --git a/src/main/java/io/papermc/paper/configuration/PaperConfigurations.java b/src/main/java/io/papermc/paper/configuration/PaperConfigurations.java +index 27a2914fabdc2c5ac70e402a41f5c9bb7bfe3c51..72c2a84fbf4368d9f80888579878f7247b77f363 100644 +--- a/src/main/java/io/papermc/paper/configuration/PaperConfigurations.java ++++ b/src/main/java/io/papermc/paper/configuration/PaperConfigurations.java +@@ -225,7 +225,7 @@ public class PaperConfigurations extends Configurations builder + .register(MapSerializer.TYPE, new MapSerializer(false)) + .register(new EnumValueSerializer()) +@@ -238,7 +238,7 @@ public class PaperConfigurations extends Configurations { + } + + static MutableComponent translatable(String key) { +- return MutableComponent.create(new TranslatableContents(key, (String) null, TranslatableContents.NO_ARGS)); ++ return MutableComponent.create(new TranslatableContents(key, (String) null, org.plazmamc.plazma.constants.Empty.OBJECT)); // Plazma - Reduce allocations + } + + static MutableComponent translatable(String key, Object... args) { +@@ -209,7 +209,7 @@ public interface Component extends Message, FormattedText, Iterable { + } + + static MutableComponent translatableWithFallback(String key, @Nullable String fallback) { +- return MutableComponent.create(new TranslatableContents(key, fallback, TranslatableContents.NO_ARGS)); ++ return MutableComponent.create(new TranslatableContents(key, fallback, org.plazmamc.plazma.constants.Empty.OBJECT)); // Plazma - Reduce allocations + } + + static MutableComponent translatableWithFallback(String key, @Nullable String fallback, Object... args) { +diff --git a/src/main/java/net/minecraft/server/Main.java b/src/main/java/net/minecraft/server/Main.java +index d06b81b7c72f4cd7f6212c470fa0e7d620054122..69ebe97bcff3e8ea4cd2a3575bedaaa829e826b2 100644 +--- a/src/main/java/net/minecraft/server/Main.java ++++ b/src/main/java/net/minecraft/server/Main.java +@@ -171,6 +171,7 @@ public class Main { + + // Spigot Start + boolean eulaAgreed = Boolean.getBoolean( "com.mojang.eula.agree" ); ++ eulaAgreed = eulaAgreed || Boolean.getBoolean("Paper.isRunDev"); // Plazma - Always agree EULA on development mode + if ( eulaAgreed ) + { + System.err.println( "You have used the Spigot command line EULA agreement flag." ); +diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java +index 5afac92929226388bff73aba6cef253b7624b9ce..7cd380fe9e837bbe8ed50c5444fd714f08d5dadf 100644 +--- a/src/main/java/net/minecraft/server/MinecraftServer.java ++++ b/src/main/java/net/minecraft/server/MinecraftServer.java +@@ -313,6 +313,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop mapRenderer.getClass() == org.bukkit.craftbukkit.map.CraftMapRenderer.class)) return; // Plazma - SparklyPaper port; Skip map item ticking if the craft map renderer is not present ++ if (skipTickWhenCraftNotPresent && mapItemSavedData.mapView.getRenderers().stream().noneMatch(mapRenderer -> mapRenderer.getClass() == org.bukkit.craftbukkit.map.CraftMapRenderer.class)) return; // Plazma - SparklyPaper port; Skip map item ticking if the craft map renderer is not present + if (entity instanceof Player player) { + mapItemSavedData.tickCarriedBy(player, stack); + } +diff --git a/src/test/java/org/bukkit/support/DummyServer.java b/src/test/java/org/bukkit/support/DummyServer.java +index 37b3c3fe0be6366f0cdb868467d6dcb6f2904c41..aae4590428d570244e52cb927a043120aec4d160 100644 +--- a/src/test/java/org/bukkit/support/DummyServer.java ++++ b/src/test/java/org/bukkit/support/DummyServer.java +@@ -61,8 +61,6 @@ public final class DummyServer { + + // Plazma start - Configurable Plazma + net.minecraft.server.MinecraftServer handle = mock(withSettings().stubOnly()); +- when(handle.random()).thenReturn(net.minecraft.util.RandomSource.create()); +- when(handle.getFixerUpper()).thenReturn(net.minecraft.util.datafix.DataFixers.getDataFixer()); + net.minecraft.server.MinecraftServer.setServer(handle); + // Plazma end - Configurable Plazma + diff --git a/patches/unapplied/server/0010-Always-agree-EULA-on-development-mode.patch b/patches/unapplied/server/0010-Always-agree-EULA-on-development-mode.patch deleted file mode 100644 index d838b92..0000000 --- a/patches/unapplied/server/0010-Always-agree-EULA-on-development-mode.patch +++ /dev/null @@ -1,18 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: AlphaKR93 -Date: Sun, 5 Nov 2023 10:13:14 +0900 -Subject: [PATCH] Always agree EULA on development mode - - -diff --git a/src/main/java/net/minecraft/server/Main.java b/src/main/java/net/minecraft/server/Main.java -index b91c3b8ca8f840335ba6470658d82c5d71bb75e1..23f0302f2d90b7229828890eb364bc2c9abc11d2 100644 ---- a/src/main/java/net/minecraft/server/Main.java -+++ b/src/main/java/net/minecraft/server/Main.java -@@ -168,6 +168,7 @@ public class Main { - - // Spigot Start - boolean eulaAgreed = Boolean.getBoolean( "com.mojang.eula.agree" ); -+ eulaAgreed = eulaAgreed || Boolean.getBoolean("Paper.isRunDev"); // Plazma - Always agree EULA on development mode - if ( eulaAgreed ) - { - System.err.println( "You have used the Spigot command line EULA agreement flag." );