diff --git a/.editorconfig b/.editorconfig index aa4d12f5a8..a8939e783f 100644 --- a/.editorconfig +++ b/.editorconfig @@ -10,3 +10,9 @@ indent_style=tab [*.bat] end_of_line=crlf + +[*.yml] +indent_size=2 + +[*.patch] +trim_trailing_whitespace=false diff --git a/patches/api/0004-Add-FastUtil-to-Bukkit.patch b/patches/api/0004-Add-FastUtil-to-Bukkit.patch index b2d1843a97..8c267a95b7 100644 --- a/patches/api/0004-Add-FastUtil-to-Bukkit.patch +++ b/patches/api/0004-Add-FastUtil-to-Bukkit.patch @@ -6,7 +6,7 @@ Subject: [PATCH] Add FastUtil to Bukkit Doesn't expose to plugins, just allows Paper-API to use it for optimization diff --git a/build.gradle.kts b/build.gradle.kts -index b929458b72f26568b4c87571113eb2f867359312..31cd1ba937c364447e32220ffef1d9ef95b634c6 100644 +index 044b7c49b569e1170108c912e9307f7fec278762..f0423df165bf7d0f3fad21d26b64f31ba3e6aeee 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -18,6 +18,7 @@ dependencies { diff --git a/patches/api/0026-Use-ASM-for-event-executors.patch b/patches/api/0026-Use-ASM-for-event-executors.patch index c05bc2982c..a2afd9ec05 100644 --- a/patches/api/0026-Use-ASM-for-event-executors.patch +++ b/patches/api/0026-Use-ASM-for-event-executors.patch @@ -6,7 +6,7 @@ Subject: [PATCH] Use ASM for event executors. Uses method handles for private or static methods. diff --git a/build.gradle.kts b/build.gradle.kts -index da855f2208b50f024bb7577167a6da53c06a9a4a..ac5cb57d590363ad7b827672f756224d2857fa2c 100644 +index 6f31679c2944fae3b37847c683abb0d2e5791449..733fed7b0a7259a831e976d443b907830703bda6 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -38,6 +38,9 @@ dependencies { diff --git a/patches/api/0069-Allow-plugins-to-use-SLF4J-for-logging.patch b/patches/api/0069-Allow-plugins-to-use-SLF4J-for-logging.patch index 8a241a4898..e51306736c 100644 --- a/patches/api/0069-Allow-plugins-to-use-SLF4J-for-logging.patch +++ b/patches/api/0069-Allow-plugins-to-use-SLF4J-for-logging.patch @@ -14,7 +14,7 @@ it without having to shade it in the plugin and going through several layers of logging abstraction. diff --git a/build.gradle.kts b/build.gradle.kts -index 9ec782b00f9f2ac5a38a75667d36de4582a25a03..ac0a4aea48436201b5712b166413bb7dc0d0b9d8 100644 +index 733fed7b0a7259a831e976d443b907830703bda6..921b301de020ce73126ca518556b3435e776783d 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -38,6 +38,8 @@ dependencies { diff --git a/patches/server/0004-Paper-config-files.patch b/patches/server/0004-Paper-config-files.patch index 1f6e7246ac..00747fba2f 100644 --- a/patches/server/0004-Paper-config-files.patch +++ b/patches/server/0004-Paper-config-files.patch @@ -1,133 +1,3026 @@ From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Zach Brown -Date: Mon, 29 Feb 2016 21:02:09 -0600 +From: Jake Potrebic +Date: Wed, 8 Jun 2022 22:20:16 -0700 Subject: [PATCH] Paper config files -Loads each yml file for early init too so it can be used for early options -diff --git a/src/main/java/com/destroystokyo/paper/PaperConfig.java b/src/main/java/com/destroystokyo/paper/PaperConfig.java +diff --git a/build.gradle.kts b/build.gradle.kts +index 35839e1c2dede1e3a1e54b124667cf2bf63e73f0..a87cf2a4ad955b7429269f2d46adbe59f6e4525e 100644 +--- a/build.gradle.kts ++++ b/build.gradle.kts +@@ -12,6 +12,7 @@ dependencies { + implementation("org.apache.logging.log4j:log4j-iostreams:2.17.1") // Paper + implementation("org.ow2.asm:asm:9.3") + implementation("org.ow2.asm:asm-commons:9.3") // Paper - ASM event executor generation ++ implementation("org.spongepowered:configurate-yaml:4.1.2") // Paper - config files + implementation("commons-lang:commons-lang:2.6") + runtimeOnly("org.xerial:sqlite-jdbc:3.36.0.3") + runtimeOnly("mysql:mysql-connector-java:8.0.29") +diff --git a/src/main/java/io/papermc/paper/configuration/Configuration.java b/src/main/java/io/papermc/paper/configuration/Configuration.java new file mode 100644 -index 0000000000000000000000000000000000000000..80a3d5890aab91e6a48d5734140187851106bde3 +index 0000000000000000000000000000000000000000..817fd26cc3591f9cae0f61f4036dde43c4ed60e8 --- /dev/null -+++ b/src/main/java/com/destroystokyo/paper/PaperConfig.java -@@ -0,0 +1,188 @@ -+package com.destroystokyo.paper; ++++ b/src/main/java/io/papermc/paper/configuration/Configuration.java +@@ -0,0 +1,13 @@ ++package io.papermc.paper.configuration; + -+import com.google.common.base.Throwables; ++public final class Configuration { ++ public static final String VERSION_FIELD = "_version"; ++ @Deprecated ++ public static final String LEGACY_CONFIG_VERSION_FIELD = "config-version"; ++ ++ @Deprecated ++ public static final int FINAL_LEGACY_VERSION = 27; ++ ++ private Configuration() { ++ } ++} +diff --git a/src/main/java/io/papermc/paper/configuration/ConfigurationLoaders.java b/src/main/java/io/papermc/paper/configuration/ConfigurationLoaders.java +new file mode 100644 +index 0000000000000000000000000000000000000000..cb7d11dcf13c6ac464634a7e8115bf3dee0e72a2 +--- /dev/null ++++ b/src/main/java/io/papermc/paper/configuration/ConfigurationLoaders.java +@@ -0,0 +1,26 @@ ++package io.papermc.paper.configuration; ++ ++import java.nio.file.Path; ++import org.spongepowered.configurate.loader.HeaderMode; ++import org.spongepowered.configurate.util.MapFactories; ++import org.spongepowered.configurate.yaml.NodeStyle; ++import org.spongepowered.configurate.yaml.YamlConfigurationLoader; ++ ++public final class ConfigurationLoaders { ++ private ConfigurationLoaders() { ++ } ++ ++ public static YamlConfigurationLoader.Builder naturallySorted() { ++ return YamlConfigurationLoader.builder() ++ .indent(2) ++ .nodeStyle(NodeStyle.BLOCK) ++ .defaultOptions(options -> options.mapFactory(MapFactories.sortedNatural())); ++ } ++ ++ public static YamlConfigurationLoader naturallySortedWithoutHeader(final Path path) { ++ return naturallySorted() ++ .headerMode(HeaderMode.NONE) ++ .path(path) ++ .build(); ++ } ++} +diff --git a/src/main/java/io/papermc/paper/configuration/ConfigurationPart.java b/src/main/java/io/papermc/paper/configuration/ConfigurationPart.java +new file mode 100644 +index 0000000000000000000000000000000000000000..7a4a7a654fe2516ed894a68f2657344df9d70f4c +--- /dev/null ++++ b/src/main/java/io/papermc/paper/configuration/ConfigurationPart.java +@@ -0,0 +1,10 @@ ++package io.papermc.paper.configuration; ++ ++abstract class ConfigurationPart { ++ ++ public static abstract class Post extends ConfigurationPart { ++ ++ public abstract void postProcess(); ++ } ++ ++} +diff --git a/src/main/java/io/papermc/paper/configuration/Configurations.java b/src/main/java/io/papermc/paper/configuration/Configurations.java +new file mode 100644 +index 0000000000000000000000000000000000000000..697a9c495a58de6e6a9a921054b5ae1bba0eb339 +--- /dev/null ++++ b/src/main/java/io/papermc/paper/configuration/Configurations.java +@@ -0,0 +1,198 @@ ++package io.papermc.paper.configuration; ++ ++import com.google.common.base.Suppliers; ++import io.papermc.paper.configuration.constraint.Constraint; ++import io.papermc.paper.configuration.constraint.Constraints; ++import net.minecraft.server.level.ServerLevel; ++import org.apache.commons.lang3.RandomStringUtils; ++import org.jetbrains.annotations.MustBeInvokedByOverriders; ++import org.spigotmc.SpigotConfig; ++import org.spigotmc.SpigotWorldConfig; ++import org.spongepowered.configurate.CommentedConfigurationNode; ++import org.spongepowered.configurate.ConfigurateException; ++import org.spongepowered.configurate.ConfigurationNode; ++import org.spongepowered.configurate.ConfigurationOptions; ++import org.spongepowered.configurate.objectmapping.ObjectMapper; ++import org.spongepowered.configurate.serialize.SerializationException; ++import org.spongepowered.configurate.util.CheckedFunction; ++import org.spongepowered.configurate.yaml.YamlConfigurationLoader; ++ ++import java.io.IOException; ++import java.lang.reflect.Type; ++import java.nio.file.Files; ++import java.nio.file.Path; ++import java.util.Objects; ++import java.util.function.Supplier; ++import java.util.function.UnaryOperator; ++ ++public abstract class Configurations { ++ ++ public static final String WORLD_DEFAULTS = "__world_defaults__"; ++ private static final Supplier SPIGOT_WORLD_DEFAULTS = Suppliers.memoize(() -> new SpigotWorldConfig(RandomStringUtils.randomAlphabetic(255)) { ++ @Override // override to ensure "verbose" is false ++ public void init() { ++ SpigotConfig.readConfig(SpigotWorldConfig.class, this); ++ } ++ }); ++ protected final Path globalFolder; ++ protected final Class globalConfigClass; ++ protected final Class worldConfigClass; ++ protected final String globalConfigFileName; ++ protected final String defaultWorldConfigFileName; ++ protected final String worldConfigFileName; ++ ++ public Configurations( ++ final Path globalFolder, ++ final Class globalConfigType, ++ final Class worldConfigClass, ++ final String globalConfigFileName, ++ final String defaultWorldConfigFileName, ++ final String worldConfigFileName ++ ) { ++ this.globalFolder = globalFolder; ++ this.globalConfigClass = globalConfigType; ++ this.worldConfigClass = worldConfigClass; ++ this.globalConfigFileName = globalConfigFileName; ++ this.defaultWorldConfigFileName = defaultWorldConfigFileName; ++ this.worldConfigFileName = worldConfigFileName; ++ } ++ ++ protected ObjectMapper.Factory.Builder createObjectMapper() { ++ return ObjectMapper.factoryBuilder() ++ .addConstraint(Constraint.class, new Constraint.Factory()) ++ .addConstraint(Constraints.Min.class, Number.class, new Constraints.Min.Factory()); ++ } ++ ++ protected YamlConfigurationLoader.Builder createLoaderBuilder() { ++ return ConfigurationLoaders.naturallySorted(); ++ } ++ ++ protected abstract boolean isConfigType(final Type type); ++ ++ protected ObjectMapper.Factory.Builder createGlobalObjectMapperFactoryBuilder() { ++ return this.createObjectMapper(); ++ } ++ ++ @MustBeInvokedByOverriders ++ protected YamlConfigurationLoader.Builder createGlobalLoaderBuilder() { ++ return this.createLoaderBuilder(); ++ } ++ ++ static CheckedFunction creator(Class type, boolean refreshNode) { ++ return node -> { ++ T instance = node.require(type); ++ if (refreshNode) { ++ node.set(type, instance); ++ } ++ return instance; ++ }; ++ } ++ ++ static CheckedFunction reloader(Class type, T instance) { ++ return node -> { ++ ObjectMapper.Factory factory = (ObjectMapper.Factory) Objects.requireNonNull(node.options().serializers().get(type)); ++ ObjectMapper.Mutable mutable = (ObjectMapper.Mutable) factory.get(type); ++ mutable.load(instance, node); ++ return instance; ++ }; ++ } ++ ++ public G initializeGlobalConfiguration() throws ConfigurateException { ++ return this.initializeGlobalConfiguration(creator(this.globalConfigClass, true)); ++ } ++ ++ protected G initializeGlobalConfiguration(final CheckedFunction creator) throws ConfigurateException { ++ final Path configFile = this.globalFolder.resolve(this.globalConfigFileName); ++ final YamlConfigurationLoader loader = this.createGlobalLoaderBuilder() ++ .defaultOptions(this.applyObjectMapperFactory(this.createGlobalObjectMapperFactoryBuilder().build())) ++ .path(configFile) ++ .build(); ++ final ConfigurationNode node; ++ if (Files.exists(configFile)) { ++ node = loader.load(); ++ } else { ++ node = CommentedConfigurationNode.root(loader.defaultOptions()); ++ } ++ this.applyGlobalConfigTransformations(node); ++ final G instance = creator.apply(node); ++ loader.save(node); ++ return instance; ++ } ++ ++ protected void applyGlobalConfigTransformations(final ConfigurationNode node) throws ConfigurateException { ++ } ++ ++ public void initializeWorldDefaultsConfiguration() throws ConfigurateException { ++ final YamlConfigurationLoader loader = this.createDefaultWorldLoader(false); ++ final ConfigurationNode node = loader.load(); ++ this.applyWorldConfigTransformations(WORLD_DEFAULTS, node); ++ final W instance = node.require(this.worldConfigClass); ++ node.set(this.worldConfigClass, instance); ++ loader.save(node); ++ } ++ ++ private YamlConfigurationLoader createDefaultWorldLoader(final boolean requireFile) { ++ final Path configFile = this.globalFolder.resolve(this.defaultWorldConfigFileName); ++ if (requireFile && !Files.exists(configFile)) { ++ throw new IllegalStateException("World defaults configuration file '" + configFile + "' doesn't exist"); ++ } ++ return this.createWorldConfigLoaderBuilder(WORLD_DEFAULTS, SPIGOT_WORLD_DEFAULTS.get()) ++ .defaultOptions(this.applyObjectMapperFactory(this.createWorldObjectMapperFactoryBuilder(WORLD_DEFAULTS, SPIGOT_WORLD_DEFAULTS.get()).build())) ++ .path(configFile) ++ .build(); ++ } ++ ++ protected ObjectMapper.Factory.Builder createWorldObjectMapperFactoryBuilder(final String levelName, final SpigotWorldConfig spigotConfig) { ++ return this.createObjectMapper(); ++ } ++ ++ @MustBeInvokedByOverriders ++ protected YamlConfigurationLoader.Builder createWorldConfigLoaderBuilder(final String levelName, final SpigotWorldConfig spigotConfig) { ++ return this.createLoaderBuilder(); ++ } ++ ++ // Make sure to run version transforms on the default world config first via #setupWorldDefaultsConfig ++ public W createWorldConfig(final Path dir, final String levelName, final SpigotWorldConfig spigotConfig) throws IOException { ++ return this.createWorldConfig(dir, levelName, spigotConfig, creator(this.worldConfigClass, false)); ++ } ++ ++ protected W createWorldConfig(final Path dir, final String levelName, final SpigotWorldConfig spigotConfig, final CheckedFunction creator) throws IOException { ++ final YamlConfigurationLoader defaultsLoader = this.createDefaultWorldLoader(true); ++ final ConfigurationNode defaultsNode = defaultsLoader.load(); ++ ++ boolean newFile = false; ++ final Path worldConfigFile = dir.resolve(this.worldConfigFileName); ++ if (Files.notExists(worldConfigFile)) { ++ Files.createDirectories(dir); ++ Files.createFile(worldConfigFile); // create empty file as template ++ newFile = true; ++ } ++ ++ final YamlConfigurationLoader worldLoader = this.createWorldConfigLoaderBuilder(levelName, spigotConfig) ++ .defaultOptions(this.applyObjectMapperFactory(this.createWorldObjectMapperFactoryBuilder(levelName, spigotConfig).build())) ++ .path(worldConfigFile) ++ .build(); ++ final ConfigurationNode worldNode = worldLoader.load(); ++ if (newFile) { ++ worldNode.node(Configuration.VERSION_FIELD).set(WorldConfiguration.CURRENT_VERSION); ++ } ++ this.applyWorldConfigTransformations(levelName, worldNode); ++ worldLoader.save(worldNode); // save before loading node NOTE: don't save the backing node after loading it, or you'll fill up the world-specific config ++ worldNode.mergeFrom(defaultsNode); ++ final W worldConfig = creator.apply(worldNode); ++ return worldConfig; ++ } ++ ++ protected void applyWorldConfigTransformations(final String world, final ConfigurationNode node) throws ConfigurateException { ++ } ++ ++ private UnaryOperator applyObjectMapperFactory(final ObjectMapper.Factory factory) { ++ return options -> options.serializers(builder -> builder ++ .register(this::isConfigType, factory.asTypeSerializer()) ++ .registerAnnotatedObjects(factory)); ++ } ++ ++ public Path getWorldConfigFile(ServerLevel level) { ++ return level.convertable.levelDirectory.path().resolve(this.worldConfigFileName); ++ } ++} +diff --git a/src/main/java/io/papermc/paper/configuration/GlobalConfiguration.java b/src/main/java/io/papermc/paper/configuration/GlobalConfiguration.java +new file mode 100644 +index 0000000000000000000000000000000000000000..2d04305279108f2102ebb026998d391f017ba721 +--- /dev/null ++++ b/src/main/java/io/papermc/paper/configuration/GlobalConfiguration.java +@@ -0,0 +1,264 @@ ++package io.papermc.paper.configuration; ++ ++import co.aikar.timings.MinecraftTimings; ++import co.aikar.timings.TimingsManager; ++import com.destroystokyo.paper.io.chunk.ChunkTaskManager; ++import io.papermc.paper.configuration.constraint.Constraint; ++import io.papermc.paper.configuration.constraint.Constraints; ++import net.minecraft.network.protocol.Packet; ++import net.minecraft.network.protocol.game.ServerboundPlaceRecipePacket; ++import org.checkerframework.checker.nullness.qual.Nullable; ++import org.spongepowered.configurate.objectmapping.ConfigSerializable; ++import org.spongepowered.configurate.objectmapping.meta.Comment; ++import org.spongepowered.configurate.objectmapping.meta.Required; ++import org.spongepowered.configurate.objectmapping.meta.Setting; ++ ++import java.util.List; ++import java.util.Map; ++import java.util.Objects; ++ ++@SuppressWarnings({"CanBeFinal", "FieldCanBeLocal", "FieldMayBeFinal", "NotNullFieldNotInitialized", "InnerClassMayBeStatic"}) ++public class GlobalConfiguration extends ConfigurationPart { ++ static final int CURRENT_VERSION = 28; ++ private static GlobalConfiguration instance; ++ public static GlobalConfiguration get() { ++ return instance; ++ } ++ static void set(GlobalConfiguration instance) { ++ GlobalConfiguration.instance = instance; ++ } ++ ++ @Setting(Configuration.VERSION_FIELD) ++ public int version = CURRENT_VERSION; ++ ++ public Messages messages; ++ ++ public class Messages extends ConfigurationPart { ++ public Kick kick; ++ ++ public class Kick extends ConfigurationPart { ++ public String authenticationServersDown = ""; // TODO empty is fallback to translatable msg ++ public String connectionThrottle = "Connection throttled! Please wait before reconnecting."; ++ public String flyingPlayer = "Flying is not enabled on this server"; ++ public String flyingVehicle = "Flying is not enabled on this server"; ++ } ++ ++ public String noPermission = "&cI'm sorry, but you do not have permission to perform this command. Please contact the server administrators if you believe that this is in error."; ++ public boolean useDisplayNameInQuitMessage = false; ++ } ++ ++ public Timings timings; ++ ++ public class Timings extends ConfigurationPart.Post { ++ public boolean enabled = true; ++ public boolean verbose = true; ++ public String url = "https://timings.aikar.co/"; ++ public boolean serverNamePrivacy = false; ++ public List hiddenConfigEntries = List.of( ++ "database", ++ "proxies.velocity.secret" ++ ); ++ public int historyInterval = 300; ++ public int historyLength = 3600; ++ public String serverName = "Unknown Server"; ++ ++ @Override ++ public void postProcess() { ++ MinecraftTimings.processConfig(this); ++ } ++ } ++ ++ public Proxies proxies; ++ ++ public class Proxies extends ConfigurationPart { ++ public BungeeCord bungeeCord; ++ ++ public class BungeeCord extends ConfigurationPart { ++ public boolean onlineMode = true; ++ } ++ ++ @Constraint(Constraints.Velocity.class) ++ public Velocity velocity; ++ ++ public class Velocity extends ConfigurationPart { ++ public boolean enabled = false; ++ public boolean onlineMode = false; ++ public String secret = ""; ++ } ++ public boolean proxyProtocol = false; ++ public boolean isProxyOnlineMode() { ++ return org.bukkit.Bukkit.getOnlineMode() || (org.spigotmc.SpigotConfig.bungee && this.bungeeCord.onlineMode) || (this.velocity.enabled && this.velocity.onlineMode); ++ } ++ } ++ ++ public Console console; ++ ++ public class Console extends ConfigurationPart { ++ public boolean enableBrigadierHighlighting = true; ++ public boolean enableBrigadierCompletions = true; ++ public boolean hasAllPermissions = false; ++ } ++ ++ public Watchdog watchdog; ++ ++ public class Watchdog extends ConfigurationPart { ++ public int earlyWarningEvery = 5000; ++ public int earlyWarningDelay = 10000; ++ } ++ ++ public SpamLimiter spamLimiter; ++ ++ public class SpamLimiter extends ConfigurationPart { ++ public int tabSpamIncrement = 1; ++ public int tabSpamLimit = 500; ++ public int recipeSpamIncrement = 1; ++ public int recipeSpamLimit = 20; ++ public int incomingPacketThreshold = 300; ++ } ++ ++ public ChunkLoading chunkLoading; ++ ++ public class ChunkLoading extends ConfigurationPart { ++ public int minLoadRadius = 2; ++ public int maxConcurrentSends = 2; ++ public boolean autoconfigSendDistance = true; ++ public double targetPlayerChunkSendRate = 100.0; ++ public double globalMaxChunkSendRate = -1.0; ++ public boolean enableFrustumPriority = false; ++ public double globalMaxChunkLoadRate = -1.0; ++ public double playerMaxConcurrentLoads = 20.0; ++ public double globalMaxConcurrentLoads = 500.0; ++ public double playerMaxChunkLoadRate = -1.0; ++ } ++ ++ public UnsupportedSettings unsupportedSettings; ++ ++ public class UnsupportedSettings extends ConfigurationPart { ++ @Comment("This setting controls if players should be able to break bedrock, end portals and other intended to be permanent blocks.") ++ public boolean allowPermanentBlockBreakExploits = false; ++ @Comment("This setting controls if player should be able to use TNT duplication, but this also allows duplicating carpet, rails and potentially other items") ++ public boolean allowPistonDuplication = false; ++ public boolean performUsernameValidation = true; ++ @Comment("This setting controls if players should be able to create headless pistons.") ++ public boolean allowHeadlessPistons = false; ++ } ++ ++ public Commands commands; ++ ++ public class Commands extends ConfigurationPart { ++ public boolean suggestPlayerNamesWhenNullTabCompletions = true; ++ public boolean fixTargetSelectorTagCompletion = true; ++ public boolean timeCommandAffectsAllWorlds = false; ++ } ++ ++ public Logging logging; ++ ++ public class Logging extends ConfigurationPart { ++ public boolean logPlayerIpAddresses = true; ++ public boolean deobfuscateStacktraces = true; ++ public boolean useRgbForNamedTextColors = true; ++ } ++ ++ public Scoreboards scoreboards; ++ ++ public class Scoreboards extends ConfigurationPart { ++ public boolean trackPluginScoreboards = false; ++ public boolean saveEmptyScoreboardTeams = false; ++ } ++ ++ public AsyncChunks asyncChunks; ++ ++ public class AsyncChunks extends ConfigurationPart.Post { ++ public int threads = -1; ++ public transient boolean asyncChunks = false; ++ ++ @Override ++ public void postProcess() { ++ ChunkTaskManager.processConfiguration(this); ++ } ++ } ++ ++ public ItemValidation itemValidation; ++ ++ public class ItemValidation extends ConfigurationPart { ++ public int displayName = 8192; ++ public int locName = 8192; // TODO not used anymore, can we remove? ++ public int loreLine = 8192; ++ public Book book; ++ ++ public class Book extends ConfigurationPart { ++ public int title = 8192; ++ public int author = 8192; ++ public int page = 16384; ++ } ++ ++ public BookSize bookSize; ++ ++ public class BookSize extends ConfigurationPart { ++ public int pageMax = 2560; // TODO this appears to be a duplicate setting with one above ++ public double totalMultiplier = 0.98D; // TODO this should probably be merged into the above inner class ++ } ++ public boolean resolveSelectorsInBooks = false; ++ } ++ ++ public PacketLimiter packetLimiter; ++ ++ public class PacketLimiter extends ConfigurationPart { ++ public String kickMessage = "&cSent too many packets"; // todo: minimessage ++ public PacketLimit allPackets = new PacketLimit(7.0, 500.0, PacketLimit.ViolateAction.KICK); ++ public Map>, PacketLimit> overrides = Map.of(ServerboundPlaceRecipePacket.class, new PacketLimit(4.0, 5.0, PacketLimit.ViolateAction.DROP)); ++ ++ @ConfigSerializable ++ public record PacketLimit(@Constraint(Constraints.Positive.class) @Required double interval, @Constraint(Constraints.Positive.class) @Required double maxPacketRate, ViolateAction action) { ++ public PacketLimit(final double interval, final double maxPacketRate, final @Nullable ViolateAction action) { ++ this.interval = interval; ++ this.maxPacketRate = maxPacketRate; ++ this.action = Objects.requireNonNullElse(action, ViolateAction.KICK); ++ } ++ ++ public boolean isEnabled() { ++ return this.interval > 0.0 && this.maxPacketRate > 0.0; ++ } ++ ++ public enum ViolateAction { ++ KICK, ++ DROP; ++ } ++ } ++ } ++ ++ public Collisions collisions; ++ ++ public class Collisions extends ConfigurationPart { ++ public boolean enablePlayerCollisions = true; ++ public boolean sendFullPosForHardCollidingEntities = true; ++ } ++ ++ public PlayerAutoSave playerAutoSave; ++ ++ ++ public class PlayerAutoSave extends ConfigurationPart { ++ public int rate = -1; ++ private int maxPerTick = -1; ++ public int maxPerTick() { ++ if (this.maxPerTick < 0) { ++ return (this.rate == 1 || this.rate > 100) ? 10 : 20; ++ } ++ return this.maxPerTick; ++ } ++ } ++ ++ public Misc misc; ++ ++ public class Misc extends ConfigurationPart { ++ public int maxJoinsPerTick = 3; ++ public boolean fixEntityPositionDesync = true; ++ public boolean loadPermissionsYmlBeforePlugins = true; ++ @Constraints.Min(4) ++ public int regionFileCacheSize = 256; ++ @Comment("See https://luckformula.emc.gs") ++ public boolean useAlternativeLuckFormula = false; ++ public boolean lagCompensateBlockBreaking = true; ++ public boolean useDimensionTypeForCustomSpawners = false; ++ } ++} +diff --git a/src/main/java/io/papermc/paper/configuration/InnerClassFieldDiscoverer.java b/src/main/java/io/papermc/paper/configuration/InnerClassFieldDiscoverer.java +new file mode 100644 +index 0000000000000000000000000000000000000000..8c2acb00daf652c160904ceb977cb5547504b3c7 +--- /dev/null ++++ b/src/main/java/io/papermc/paper/configuration/InnerClassFieldDiscoverer.java +@@ -0,0 +1,112 @@ ++package io.papermc.paper.configuration; ++ ++import org.checkerframework.checker.nullness.qual.Nullable; ++import org.spigotmc.SpigotWorldConfig; ++import org.spongepowered.configurate.objectmapping.FieldDiscoverer; ++import org.spongepowered.configurate.serialize.SerializationException; ++import org.spongepowered.configurate.util.CheckedSupplier; ++ ++import java.lang.reflect.AnnotatedType; ++import java.lang.reflect.Constructor; ++import java.lang.reflect.Field; ++import java.lang.reflect.Modifier; ++import java.util.Collections; ++import java.util.HashMap; ++import java.util.Map; ++ ++import static io.leangen.geantyref.GenericTypeReflector.erase; ++ ++final class InnerClassFieldDiscoverer implements FieldDiscoverer> { ++ ++ private final Map, Object> instanceMap = new HashMap<>(); ++ private final Map, Object> overrides; ++ @SuppressWarnings("unchecked") ++ private final FieldDiscoverer> delegate = (FieldDiscoverer>) FieldDiscoverer.object(target -> { ++ final Class type = erase(target.getType()); ++ if (this.overrides().containsKey(type)) { ++ this.instanceMap.put(type, this.overrides().get(type)); ++ return () -> this.overrides().get(type); ++ } ++ if (ConfigurationPart.class.isAssignableFrom(type) && !this.instanceMap.containsKey(type)) { ++ try { ++ final Constructor constructor; ++ final CheckedSupplier instanceSupplier; ++ if (type.getEnclosingClass() != null && !Modifier.isStatic(type.getModifiers())) { ++ final @Nullable Object instance = this.instanceMap.get(type.getEnclosingClass()); ++ if (instance == null) { ++ throw new SerializationException("Cannot create a new instance of an inner class " + type.getName() + " without an instance of its enclosing class " + type.getEnclosingClass().getName()); ++ } ++ constructor = type.getDeclaredConstructor(type.getEnclosingClass()); ++ instanceSupplier = () -> constructor.newInstance(instance); ++ } else { ++ constructor = type.getDeclaredConstructor(); ++ instanceSupplier = constructor::newInstance; ++ } ++ constructor.setAccessible(true); ++ final Object instance = instanceSupplier.get(); ++ this.instanceMap.put(type, instance); ++ return () -> instance; ++ } catch (ReflectiveOperationException e) { ++ throw new SerializationException(ConfigurationPart.class, target + " must be a valid ConfigurationPart", e); ++ } ++ } else { ++ throw new SerializationException(target + " must be a valid ConfigurationPart"); ++ } ++ }, "Object must be a unique ConfigurationPart"); ++ ++ InnerClassFieldDiscoverer(Map, Object> overrides) { ++ this.overrides = overrides; ++ } ++ ++ @Override ++ public @Nullable InstanceFactory> discover(AnnotatedType target, FieldCollector, V> collector) throws SerializationException { ++ final Class clazz = erase(target.getType()); ++ if (ConfigurationPart.class.isAssignableFrom(clazz)) { ++ final FieldDiscoverer.@Nullable InstanceFactory> instanceFactoryDelegate = this.delegate.discover(target, (name, type, annotations, deserializer, serializer) -> { ++ if (!erase(type.getType()).equals(clazz.getEnclosingClass())) { // don't collect synth fields for inner classes ++ collector.accept(name, type, annotations, deserializer, serializer); ++ } ++ }); ++ if (instanceFactoryDelegate instanceof FieldDiscoverer.MutableInstanceFactory> mutableInstanceFactoryDelegate) { ++ return new MutableInstanceFactory<>() { ++ @Override ++ public Map begin() { ++ return mutableInstanceFactoryDelegate.begin(); ++ } ++ ++ @Override ++ public void complete(Object instance, Map intermediate) throws SerializationException { ++ mutableInstanceFactoryDelegate.complete(instance, intermediate); ++ } ++ ++ @Override ++ public Object complete(Map intermediate) throws SerializationException { ++ Object value = mutableInstanceFactoryDelegate.complete(intermediate); ++ if (value instanceof ConfigurationPart.Post post) { ++ post.postProcess(); ++ } ++ return value; ++ } ++ ++ @Override ++ public boolean canCreateInstances() { ++ return mutableInstanceFactoryDelegate.canCreateInstances(); ++ } ++ }; ++ } ++ } ++ return null; ++ } ++ ++ private Map, Object> overrides() { ++ return this.overrides; ++ } ++ ++ static FieldDiscoverer worldConfig(SpigotWorldConfig spigotConfig) { ++ return new InnerClassFieldDiscoverer(Map.of(WorldConfiguration.class, new WorldConfiguration(spigotConfig))); ++ } ++ ++ static FieldDiscoverer globalConfig() { ++ return new InnerClassFieldDiscoverer(Collections.emptyMap()); ++ } ++} +diff --git a/src/main/java/io/papermc/paper/configuration/NestedSetting.java b/src/main/java/io/papermc/paper/configuration/NestedSetting.java +new file mode 100644 +index 0000000000000000000000000000000000000000..69add4a7f1147015806bc9b63a8340d1893356c1 +--- /dev/null ++++ b/src/main/java/io/papermc/paper/configuration/NestedSetting.java +@@ -0,0 +1,32 @@ ++package io.papermc.paper.configuration; ++ ++import org.checkerframework.checker.nullness.qual.Nullable; ++import org.spongepowered.configurate.objectmapping.meta.NodeResolver; ++ ++import java.lang.annotation.Documented; ++import java.lang.annotation.ElementType; ++import java.lang.annotation.Retention; ++import java.lang.annotation.RetentionPolicy; ++import java.lang.annotation.Target; ++import java.lang.reflect.AnnotatedElement; ++ ++@Documented ++@Retention(RetentionPolicy.RUNTIME) ++@Target(ElementType.FIELD) ++public @interface NestedSetting { ++ ++ String[] value(); ++ ++ class Factory implements NodeResolver.Factory { ++ @Override ++ public @Nullable NodeResolver make(String name, AnnotatedElement element) { ++ if (element.isAnnotationPresent(NestedSetting.class)) { ++ Object[] path = element.getAnnotation(NestedSetting.class).value(); ++ if (path.length > 0) { ++ return node -> node.node(path); ++ } ++ } ++ return null; ++ } ++ } ++} +diff --git a/src/main/java/io/papermc/paper/configuration/PaperConfigurations.java b/src/main/java/io/papermc/paper/configuration/PaperConfigurations.java +new file mode 100644 +index 0000000000000000000000000000000000000000..6c19825de43b82ba3fe6e44123e7d24748698614 +--- /dev/null ++++ b/src/main/java/io/papermc/paper/configuration/PaperConfigurations.java +@@ -0,0 +1,325 @@ ++package io.papermc.paper.configuration; ++ ++import com.google.common.collect.Table; ++import com.mojang.logging.LogUtils; ++import io.leangen.geantyref.TypeToken; ++import io.papermc.paper.configuration.legacy.RequiresSpigotInitialization; ++import io.papermc.paper.configuration.serializer.FastutilMapSerializer; ++import io.papermc.paper.configuration.serializer.PacketClassSerializer; ++import io.papermc.paper.configuration.serializer.StringRepresentableSerializer; ++import io.papermc.paper.configuration.serializer.TableSerializer; ++import io.papermc.paper.configuration.serializer.collections.MapSerializer; ++import io.papermc.paper.configuration.serializer.registry.RegistryHolderSerializer; ++import io.papermc.paper.configuration.serializer.registry.RegistryValueSerializer; ++import io.papermc.paper.configuration.transformation.global.LegacyPaperConfig; ++import io.papermc.paper.configuration.transformation.world.LegacyPaperWorldConfig; ++import io.papermc.paper.configuration.type.BooleanOrDefault; ++import io.papermc.paper.configuration.type.DoubleOrDefault; ++import io.papermc.paper.configuration.type.Duration; ++import io.papermc.paper.configuration.type.IntOrDefault; ++import io.papermc.paper.configuration.type.fallback.FallbackValueSerializer; ++import it.unimi.dsi.fastutil.objects.Reference2IntMap; ++import it.unimi.dsi.fastutil.objects.Reference2IntOpenHashMap; ++import it.unimi.dsi.fastutil.objects.Reference2LongMap; ++import it.unimi.dsi.fastutil.objects.Reference2LongOpenHashMap; ++import net.minecraft.core.Registry; ++import net.minecraft.data.BuiltinRegistries; ++import net.minecraft.server.MinecraftServer; ++import net.minecraft.server.level.ServerLevel; ++import net.minecraft.world.entity.EntityType; ++import net.minecraft.world.item.Item; ++import net.minecraft.world.level.levelgen.feature.ConfiguredFeature; ++import org.bukkit.command.Command; ++import org.bukkit.configuration.ConfigurationSection; ++import org.bukkit.configuration.file.YamlConfiguration; ++import org.jetbrains.annotations.VisibleForTesting; ++import org.slf4j.Logger; ++import org.spigotmc.SpigotWorldConfig; ++import org.spongepowered.configurate.BasicConfigurationNode; ++import org.spongepowered.configurate.ConfigurateException; ++import org.spongepowered.configurate.ConfigurationNode; ++import org.spongepowered.configurate.ConfigurationOptions; ++import org.spongepowered.configurate.objectmapping.ObjectMapper; ++import org.spongepowered.configurate.yaml.YamlConfigurationLoader; + +import java.io.File; +import java.io.IOException; -+import java.lang.reflect.InvocationTargetException; -+import java.lang.reflect.Method; -+import java.lang.reflect.Modifier; ++import java.lang.reflect.Type; ++import java.nio.file.Files; ++import java.nio.file.Path; ++import java.nio.file.StandardCopyOption; +import java.util.HashMap; ++import java.util.Map; ++import java.util.function.UnaryOperator; ++ ++import static com.google.common.base.Preconditions.checkState; ++import static io.leangen.geantyref.GenericTypeReflector.erase; ++ ++@SuppressWarnings("Convert2Diamond") ++public class PaperConfigurations extends Configurations { ++ ++ private static final Logger LOGGER = LogUtils.getLogger(); ++ static final String GLOBAL_CONFIG_FILE_NAME = "paper-global.yml"; ++ static final String WORLD_DEFAULTS_CONFIG_FILE_NAME = "paper-world-defaults.yml"; ++ static final String WORLD_CONFIG_FILE_NAME = "paper-world.yml"; ++ private static final Path BACKUP_DIR = Path.of("legacy-backup"); ++ ++ private static final String GLOBAL_HEADER = """ ++ This is the global configuration file for Paper. ++ As you can see, there's tons to configure. Some options may impact gameplay, so use ++ with caution, and make sure you know what each option does before configuring. ++ ++ If you need help with the configuration or have any questions related to Paper, ++ join us in our Discord or IRC channel. ++ ++ The world configuration options have been moved to their own files. ++ ++ Discord: https://discord.gg/papermc ++ IRC: #paper @ irc.esper.net ( https://webchat.esper.net/?channels=paper ) ++ Website: https://papermc.io/ ++ Docs: https://docs.papermc.io/"""; ++ ++ private static final String WORLD_DEFAULTS_HEADER = """ ++ This is the world defaults configuration file for Paper. ++ As you can see, there's tons to configure. Some options may impact gameplay, so use ++ with caution, and make sure you know what each option does before configuring. ++ ++ If you need help with the configuration or have any questions related to Paper, ++ join us in our Discord or IRC channel. ++ ++ Configuration options here apply to all worlds, unless you specify overrides inside ++ the world-specific config file inside each world folder. ++ ++ Discord: https://discord.gg/papermc ++ IRC: #paper @ irc.esper.net ( https://webchat.esper.net/?channels=paper ) ++ Website: https://papermc.io/ ++ Docs: https://docs.papermc.io/"""; ++ ++ private static final String WORLD_HEADER = """ ++ This is a world configuration file for Paper. ++ This file may start empty but can be filled with settings to override ones in the config/world-defaults.yml"""; ++ ++ ++ public PaperConfigurations(final Path globalFolder) { ++ super(globalFolder, GlobalConfiguration.class, WorldConfiguration.class, GLOBAL_CONFIG_FILE_NAME, WORLD_DEFAULTS_CONFIG_FILE_NAME, WORLD_CONFIG_FILE_NAME); ++ } ++ ++ @Override ++ protected YamlConfigurationLoader.Builder createLoaderBuilder() { ++ return super.createLoaderBuilder() ++ .defaultOptions(PaperConfigurations::defaultOptions); ++ } ++ ++ private static ConfigurationOptions defaultOptions(ConfigurationOptions options) { ++ return options.serializers(builder -> builder.register(MapSerializer.TYPE, new MapSerializer())); ++ } ++ ++ @Override ++ protected ObjectMapper.Factory.Builder createGlobalObjectMapperFactoryBuilder() { ++ return defaultGlobalFactoryBuilder(super.createGlobalObjectMapperFactoryBuilder()); ++ } ++ ++ private static ObjectMapper.Factory.Builder defaultGlobalFactoryBuilder(ObjectMapper.Factory.Builder builder) { ++ return builder.addDiscoverer(InnerClassFieldDiscoverer.globalConfig()); ++ } ++ ++ @Override ++ protected YamlConfigurationLoader.Builder createGlobalLoaderBuilder() { ++ return super.createGlobalLoaderBuilder() ++ .defaultOptions(PaperConfigurations::defaultGlobalOptions); ++ } ++ ++ private static ConfigurationOptions defaultGlobalOptions(ConfigurationOptions options) { ++ return options ++ .header(GLOBAL_HEADER) ++ .serializers(builder -> builder.register(new PacketClassSerializer())); ++ } ++ ++ @Override ++ public GlobalConfiguration initializeGlobalConfiguration() throws ConfigurateException { ++ GlobalConfiguration configuration = super.initializeGlobalConfiguration(); ++ GlobalConfiguration.set(configuration); ++ return configuration; ++ } ++ ++ @Override ++ protected void applyGlobalConfigTransformations(org.spongepowered.configurate.ConfigurationNode node) throws org.spongepowered.configurate.ConfigurateException { ++ super.applyGlobalConfigTransformations(node); ++ } ++ ++ @Override ++ protected ObjectMapper.Factory.Builder createWorldObjectMapperFactoryBuilder(final String levelName, final SpigotWorldConfig spigotConfig) { ++ return super.createWorldObjectMapperFactoryBuilder(levelName, spigotConfig) ++ .addNodeResolver(new RequiresSpigotInitialization.Factory(spigotConfig)) ++ .addNodeResolver(new NestedSetting.Factory()) ++ .addDiscoverer(InnerClassFieldDiscoverer.worldConfig(spigotConfig)); ++ } ++ ++ @Override ++ protected YamlConfigurationLoader.Builder createWorldConfigLoaderBuilder(final String levelName, final SpigotWorldConfig spigotConfig) { ++ return super.createWorldConfigLoaderBuilder(levelName, spigotConfig) ++ .defaultOptions(options -> options ++ .header(levelName.equals(WORLD_DEFAULTS) ? WORLD_DEFAULTS_HEADER : WORLD_HEADER) ++ .serializers(serializers -> serializers ++ .register(new TypeToken>() {}, new FastutilMapSerializer.SomethingToPrimitive>(Reference2IntOpenHashMap::new, Integer.TYPE)) ++ .register(new TypeToken>() {}, new FastutilMapSerializer.SomethingToPrimitive>(Reference2LongOpenHashMap::new, Long.TYPE)) ++ .register(new TypeToken>() {}, new TableSerializer()) ++ .register(new StringRepresentableSerializer()) ++ .register(IntOrDefault.SERIALIZER) ++ .register(DoubleOrDefault.SERIALIZER) ++ .register(BooleanOrDefault.SERIALIZER) ++ .register(Duration.SERIALIZER) ++ .register(FallbackValueSerializer.create(spigotConfig, MinecraftServer::getServer)) ++ .register(new RegistryValueSerializer<>(new TypeToken>() {}, Registry.ENTITY_TYPE, true)) ++ .register(new RegistryValueSerializer<>(Item.class, Registry.ITEM, true)) ++ .register(new RegistryHolderSerializer<>(new TypeToken>() {}, BuiltinRegistries.CONFIGURED_FEATURE, false)) ++ .register(new RegistryHolderSerializer<>(Item.class, Registry.ITEM, true)) ++ ) ++ ); ++ } ++ ++ @Override ++ protected void applyWorldConfigTransformations(final String world, final ConfigurationNode node) throws ConfigurateException { ++ final ConfigurationNode version = node.node(Configuration.VERSION_FIELD); ++ if (version.virtual()) { ++ LOGGER.warn("The world config file for " + world + " didn't have a version set, assuming latest"); ++ version.raw(WorldConfiguration.CURRENT_VERSION); ++ } ++ // ADD FUTURE TRANSFORMS HERE ++ } ++ ++ @Override ++ public WorldConfiguration createWorldConfig(final Path dir, final String levelName, final SpigotWorldConfig spigotConfig) { ++ try { ++ return super.createWorldConfig(dir, levelName, spigotConfig); ++ } catch (IOException exception) { ++ throw new RuntimeException("Could not create world config for " + levelName, exception); ++ } ++ } ++ ++ @Override ++ protected boolean isConfigType(final Type type) { ++ return ConfigurationPart.class.isAssignableFrom(erase(type)); ++ } ++ ++ public void reloadConfigs(MinecraftServer server) { ++ try { ++ this.initializeGlobalConfiguration(reloader(this.globalConfigClass, GlobalConfiguration.get())); ++ this.initializeWorldDefaultsConfiguration(); ++ for (ServerLevel level : server.getAllLevels()) { ++ this.createWorldConfig(level.convertable.levelDirectory.path(), level.serverLevelData.getLevelName(), level.spigotConfig, reloader(this.worldConfigClass, level.paperConfig())); ++ } ++ } catch (Exception ex) { ++ throw new RuntimeException("Could not reload paper configuration files", ex); ++ } ++ } ++ ++ public static PaperConfigurations setup(final Path legacyConfig, final Path configDir, final Path worldFolder, final File spigotConfig) throws Exception { ++ if (needsConverting(legacyConfig)) { ++ try { ++ Files.createDirectories(configDir.resolve(BACKUP_DIR)); ++ final Path legacyConfigBackup = configDir.resolve(BACKUP_DIR).resolve(legacyConfig.getFileName().toString() + ".old"); ++ Files.move(legacyConfig, legacyConfigBackup, StandardCopyOption.REPLACE_EXISTING); // make backup ++ convert(legacyConfigBackup, configDir, worldFolder, spigotConfig); ++ } catch (final IOException ex) { ++ throw new RuntimeException("Could not convert paper.yml to the new configuration format", ex); ++ } ++ } ++ try { ++ Files.createDirectories(configDir); ++ return new PaperConfigurations(configDir); ++ } catch (final IOException ex) { ++ throw new RuntimeException("Could not setup PaperConfigurations", ex); ++ } ++ } ++ ++ private static void convert(final Path legacyConfig, final Path configDir, final Path worldFolder, final File spigotConfig) throws Exception { ++ Files.createDirectories(configDir); ++ ++ final YamlConfigurationLoader legacyLoader = ConfigurationLoaders.naturallySortedWithoutHeader(legacyConfig); ++ final YamlConfigurationLoader globalLoader = ConfigurationLoaders.naturallySortedWithoutHeader(configDir.resolve(GLOBAL_CONFIG_FILE_NAME)); ++ final YamlConfigurationLoader worldDefaultsLoader = ConfigurationLoaders.naturallySortedWithoutHeader(configDir.resolve(WORLD_DEFAULTS_CONFIG_FILE_NAME)); ++ ++ final ConfigurationNode legacy = legacyLoader.load(); ++ checkState(!legacy.virtual(), "can't be virtual"); ++ final int version = legacy.node(Configuration.LEGACY_CONFIG_VERSION_FIELD).getInt(); ++ ++ final ConfigurationNode legacyWorldSettings = legacy.node("world-settings").copy(); ++ checkState(!legacyWorldSettings.virtual(), "can't be virtual"); ++ legacy.removeChild("world-settings"); ++ ++ // Apply legacy transformations before settings flatten ++ final YamlConfiguration spigotConfiguration = loadLegacyConfigFile(spigotConfig); // needs to change spigot config values in this transformation ++ LegacyPaperConfig.transformation(spigotConfiguration).apply(legacy); ++ spigotConfiguration.save(spigotConfig); ++ legacy.mergeFrom(legacy.node("settings")); // flatten "settings" to root ++ legacy.removeChild("settings"); ++ LegacyPaperConfig.toNewFormat().apply(legacy); ++ globalLoader.save(legacy); // save converted node to new global location ++ ++ final ConfigurationNode worldDefaults = legacyWorldSettings.node("default").copy(); ++ checkState(!worldDefaults.virtual()); ++ worldDefaults.node(Configuration.LEGACY_CONFIG_VERSION_FIELD).raw(version); ++ legacyWorldSettings.removeChild("default"); ++ LegacyPaperWorldConfig.transformation().apply(worldDefaults); ++ LegacyPaperWorldConfig.toNewFormat().apply(worldDefaults); ++ worldDefaultsLoader.save(worldDefaults); ++ ++ legacyWorldSettings.childrenMap().forEach((world, legacyWorldNode) -> { ++ try { ++ legacyWorldNode.node(Configuration.LEGACY_CONFIG_VERSION_FIELD).raw(version); ++ LegacyPaperWorldConfig.transformation().apply(legacyWorldNode); ++ LegacyPaperWorldConfig.toNewFormat().apply(legacyWorldNode); ++ ConfigurationLoaders.naturallySortedWithoutHeader(worldFolder.resolve(world.toString()).resolve(WORLD_CONFIG_FILE_NAME)).save(legacyWorldNode); // save converted node to new location ++ } catch (final ConfigurateException ex) { ++ ex.printStackTrace(); ++ } ++ }); ++ } ++ ++ private static boolean needsConverting(final Path legacyConfig) { ++ return Files.exists(legacyConfig) && Files.isRegularFile(legacyConfig); ++ } ++ ++ private static final Map COMMANDS = new HashMap<>(); ++ static { ++ } ++ ++ public static void registerCommands(final MinecraftServer server) { ++ COMMANDS.forEach((s, command) -> { ++ server.server.getCommandMap().register(s, "Paper", command); ++ }); ++ } ++ ++ @Deprecated ++ public YamlConfiguration createLegacyObject(final MinecraftServer server) { ++ YamlConfiguration global = YamlConfiguration.loadConfiguration(this.globalFolder.resolve(this.globalConfigFileName).toFile()); ++ ConfigurationSection worlds = global.createSection("__________WORLDS__________"); ++ worlds.set("__defaults__", YamlConfiguration.loadConfiguration(this.globalFolder.resolve(this.defaultWorldConfigFileName).toFile())); ++ for (ServerLevel level : server.getAllLevels()) { ++ worlds.set(level.getWorld().getName(), YamlConfiguration.loadConfiguration(getWorldConfigFile(level).toFile())); ++ } ++ return global; ++ } ++ ++ @Deprecated ++ public static YamlConfiguration loadLegacyConfigFile(File configFile) throws Exception { ++ YamlConfiguration config = new YamlConfiguration(); ++ if (configFile.exists()) { ++ try { ++ config.load(configFile); ++ } catch (Exception ex) { ++ throw new Exception("Failed to load configuration file: " + configFile.getName(), ex); ++ } ++ } ++ return config; ++ } ++ ++ @VisibleForTesting ++ static ConfigurationNode createForTesting() { ++ ObjectMapper.Factory factory = defaultGlobalFactoryBuilder(ObjectMapper.factoryBuilder()).build(); ++ ConfigurationOptions options = defaultGlobalOptions(defaultOptions(ConfigurationOptions.defaults())) ++ .serializers(builder -> builder.register(type -> ConfigurationPart.class.isAssignableFrom(erase(type)), factory.asTypeSerializer())); ++ return BasicConfigurationNode.root(options); ++ } ++} +diff --git a/src/main/java/io/papermc/paper/configuration/WorldConfiguration.java b/src/main/java/io/papermc/paper/configuration/WorldConfiguration.java +new file mode 100644 +index 0000000000000000000000000000000000000000..87ebdc61a3802ea33d3c77904122d5005fac77c2 +--- /dev/null ++++ b/src/main/java/io/papermc/paper/configuration/WorldConfiguration.java +@@ -0,0 +1,447 @@ ++package io.papermc.paper.configuration; ++ ++import com.destroystokyo.paper.antixray.ChunkPacketBlockControllerAntiXray; ++import com.google.common.collect.HashBasedTable; ++import com.google.common.collect.Table; ++import io.papermc.paper.configuration.constraint.Constraint; ++import io.papermc.paper.configuration.constraint.Constraints; ++import io.papermc.paper.configuration.legacy.MaxEntityCollisionsInitializer; ++import io.papermc.paper.configuration.legacy.RequiresSpigotInitialization; ++import io.papermc.paper.configuration.legacy.SpawnLoadedRangeInitializer; ++import io.papermc.paper.configuration.type.BooleanOrDefault; ++import io.papermc.paper.configuration.type.DoubleOrDefault; ++import io.papermc.paper.configuration.type.Duration; ++import io.papermc.paper.configuration.type.IntOrDefault; ++import io.papermc.paper.configuration.type.fallback.ArrowDespawnRate; ++import io.papermc.paper.configuration.type.fallback.AutosavePeriod; ++import it.unimi.dsi.fastutil.objects.Reference2IntMap; ++import it.unimi.dsi.fastutil.objects.Reference2IntOpenHashMap; ++import it.unimi.dsi.fastutil.objects.Reference2LongMap; ++import it.unimi.dsi.fastutil.objects.Reference2LongOpenHashMap; ++import net.minecraft.Util; ++import net.minecraft.core.Holder; ++import net.minecraft.core.Registry; ++import net.minecraft.world.Difficulty; ++import net.minecraft.world.entity.EntityType; ++import net.minecraft.world.entity.MobCategory; ++import net.minecraft.world.entity.monster.Vindicator; ++import net.minecraft.world.entity.monster.Zombie; ++import net.minecraft.world.item.Item; ++import net.minecraft.world.item.Items; ++import net.minecraft.world.level.NaturalSpawner; ++import net.minecraft.world.level.levelgen.feature.ConfiguredFeature; ++import org.spigotmc.SpigotWorldConfig; ++import org.spongepowered.configurate.objectmapping.ConfigSerializable; ++import org.spongepowered.configurate.objectmapping.meta.Required; ++import org.spongepowered.configurate.objectmapping.meta.Setting; ++ ++import java.util.Arrays; +import java.util.List; +import java.util.Map; -+import java.util.concurrent.TimeUnit; -+import java.util.logging.Level; -+import java.util.regex.Pattern; ++import java.util.function.Function; ++import java.util.stream.Collectors; + -+import net.minecraft.server.MinecraftServer; -+import org.bukkit.Bukkit; -+import org.bukkit.command.Command; -+import org.bukkit.configuration.ConfigurationSection; -+import org.bukkit.configuration.InvalidConfigurationException; -+import org.bukkit.configuration.file.YamlConfiguration; ++@SuppressWarnings({"FieldCanBeLocal", "FieldMayBeFinal", "NotNullFieldNotInitialized", "InnerClassMayBeStatic"}) ++public class WorldConfiguration extends ConfigurationPart { ++ static final int CURRENT_VERSION = 28; + -+public class PaperConfig { ++ private transient final SpigotWorldConfig spigotConfig; ++ WorldConfiguration(SpigotWorldConfig spigotConfig) { ++ this.spigotConfig = spigotConfig; ++ } + -+ private static File CONFIG_FILE; -+ private static final String HEADER = "This is the main configuration file for Paper.\n" -+ + "As you can see, there's tons to configure. Some options may impact gameplay, so use\n" -+ + "with caution, and make sure you know what each option does before configuring.\n" -+ + "\n" -+ + "If you need help with the configuration or have any questions related to Paper,\n" -+ + "join us in our Discord or IRC channel.\n" -+ + "\n" -+ + "Discord: https://discord.gg/papermc\n" -+ + "IRC: #paper @ irc.esper.net ( https://webchat.esper.net/?channels=paper ) \n" -+ + "Website: https://papermc.io/ \n" -+ + "Docs: https://docs.papermc.io/ \n"; -+ /*========================================================================*/ -+ public static YamlConfiguration config; -+ static int version; -+ static Map commands; -+ private static boolean verbose; -+ private static boolean fatalError; -+ /*========================================================================*/ ++ @Setting(Configuration.VERSION_FIELD) ++ public int version = CURRENT_VERSION; + -+ public static void init(File configFile) { -+ CONFIG_FILE = configFile; -+ config = new YamlConfiguration(); -+ try { -+ config.load(CONFIG_FILE); -+ } catch (IOException ex) { -+ } catch (InvalidConfigurationException ex) { -+ Bukkit.getLogger().log(Level.SEVERE, "Could not load paper.yml, please correct your syntax errors", ex); -+ throw Throwables.propagate(ex); ++ public AntiCheat anticheat; ++ ++ public class AntiCheat extends ConfigurationPart { ++ ++ public Obfuscation obfuscation; ++ ++ public class Obfuscation extends ConfigurationPart { ++ public Items items = new Items(); ++ public class Items extends ConfigurationPart { ++ public boolean hideItemmeta = false; ++ public boolean hideDurability = false; ++ } + } -+ config.options().header(HEADER); -+ config.options().copyDefaults(true); -+ verbose = getBoolean("verbose", false); + -+ commands = new HashMap(); -+ commands.put("paper", new PaperCommand("paper")); ++ public AntiXRay antiXray; + -+ version = getInt("config-version", 27); -+ set("config-version", 27); -+ readConfig(PaperConfig.class, null); -+ } -+ -+ protected static void logError(String s) { -+ Bukkit.getLogger().severe(s); -+ } -+ -+ protected static void fatal(String s) { -+ fatalError = true; -+ throw new RuntimeException("Fatal paper.yml config error: " + s); -+ } -+ -+ protected static void log(String s) { -+ if (verbose) { -+ Bukkit.getLogger().info(s); ++ public class AntiXRay extends ConfigurationPart { ++ public boolean enabled = false; ++ public ChunkPacketBlockControllerAntiXray.EngineMode engineMode = ChunkPacketBlockControllerAntiXray.EngineMode.HIDE; ++ public int maxBlockHeight = 64; ++ public int updateRadius = 2; ++ public boolean lavaObscures = false; ++ public boolean usePermission = false; ++ public List hiddenBlocks = List.of("copper_ore", "deepslate_copper_ore", "gold_ore", "deepslate_gold_ore", "iron_ore", "deepslate_iron_ore", ++ "coal_ore", "deepslate_coal_ore", "lapis_ore", "deepslate_lapis_ore", "mossy_cobblestone", "obsidian", "chest", "diamond_ore", "deepslate_diamond_ore", ++ "redstone_ore", "deepslate_redstone_ore", "clay", "emerald_ore", "deepslate_emerald_ore", "ender_chest"); // TODO update type to List ++ public List replacementBlocks = List.of("stone", "oak_planks", "deepslate"); // TODO update type to List + } + } + -+ public static void registerCommands() { -+ for (Map.Entry entry : commands.entrySet()) { -+ MinecraftServer.getServer().server.getCommandMap().register(entry.getKey(), "Paper", entry.getValue()); -+ } -+ } ++ public Entities entities; + -+ static void readConfig(Class clazz, Object instance) { -+ for (Method method : clazz.getDeclaredMethods()) { -+ if (Modifier.isPrivate(method.getModifiers())) { -+ if (method.getParameterTypes().length == 0 && method.getReturnType() == Void.TYPE) { -+ try { -+ method.setAccessible(true); -+ method.invoke(instance); -+ } catch (InvocationTargetException ex) { -+ throw Throwables.propagate(ex.getCause()); -+ } catch (Exception ex) { -+ Bukkit.getLogger().log(Level.SEVERE, "Error invoking " + method, ex); ++ public class Entities extends ConfigurationPart { ++ public boolean entitiesTargetWithFollowRange = false; ++ public MobEffects mobEffects; ++ ++ public class MobEffects extends ConfigurationPart { ++ public boolean undeadImmuneToCertainEffects = true; ++ public boolean spidersImmuneToPoisonEffect = true; ++ public ImmuneToWitherEffect immuneToWitherEffect; ++ ++ public class ImmuneToWitherEffect extends ConfigurationPart { ++ public boolean wither = true; ++ public boolean witherSkeleton = true; ++ } ++ } ++ ++ public ArmorStands armorStands; ++ ++ public class ArmorStands extends ConfigurationPart { ++ public boolean doCollisionEntityLookups = true; ++ public boolean tick = true; ++ } ++ ++ public Spawning spawning; ++ ++ public class Spawning extends ConfigurationPart { ++ public ArrowDespawnRate nonPlayerArrowDespawnRate = ArrowDespawnRate.def(WorldConfiguration.this.spigotConfig); ++ public ArrowDespawnRate creativeArrowDespawnRate = ArrowDespawnRate.def(WorldConfiguration.this.spigotConfig); ++ public boolean filterNbtDataFromSpawnEggsAndRelated = true; ++ public boolean disableMobSpawnerSpawnEggTransformation = false; ++ public boolean perPlayerMobSpawns = true; ++ public boolean scanForLegacyEnderDragon = true; ++ public Reference2IntMap spawnLimits = Util.make(new Reference2IntOpenHashMap<>(NaturalSpawner.SPAWNING_CATEGORIES.length), map -> Arrays.stream(NaturalSpawner.SPAWNING_CATEGORIES).forEach(mobCategory -> map.put(mobCategory, -1))); ++ public Map despawnRanges = Arrays.stream(MobCategory.values()).collect(Collectors.toMap(Function.identity(), category -> new DespawnRange(category.getNoDespawnDistance(), category.getDespawnDistance()))); ++ ++ @ConfigSerializable ++ public record DespawnRange(@Required int soft, @Required int hard) { ++ } ++ ++ public WaterAnimalSpawnHeight wateranimalSpawnHeight; ++ ++ public class WaterAnimalSpawnHeight extends ConfigurationPart { ++ public IntOrDefault maximum = IntOrDefault.USE_DEFAULT; ++ public IntOrDefault minimum = IntOrDefault.USE_DEFAULT; ++ } ++ ++ public SlimeSpawnHeight slimeSpawnHeight; ++ ++ public class SlimeSpawnHeight extends ConfigurationPart { ++ ++ public SwampBiome swampBiome; ++ ++ public class SwampBiome extends ConfigurationPart { ++ public double maximum = 70; ++ public double minimum = 50; ++ } ++ ++ public SlimeChunk slimeChunk; ++ ++ public class SlimeChunk extends ConfigurationPart { ++ public double maximum = 40; ++ } ++ } ++ ++ public WanderingTrader wanderingTrader; ++ ++ public class WanderingTrader extends ConfigurationPart { ++ public int spawnMinuteLength = 1200; ++ public int spawnDayLength = 24000; ++ public int spawnChanceFailureIncrement = 25; ++ public int spawnChanceMin = 25; ++ public int spawnChanceMax = 75; ++ } ++ ++ public boolean allChunksAreSlimeChunks = false; ++ @Constraint(Constraints.BelowZeroDoubleToDefault.class) ++ public DoubleOrDefault skeletonHorseThunderSpawnChance = DoubleOrDefault.USE_DEFAULT; ++ public boolean ironGolemsCanSpawnInAir = false; ++ public boolean countAllMobsForSpawning = false; ++ public int monsterSpawnMaxLightLevel = -1; ++ public DuplicateUUID duplicateUuid; ++ ++ public class DuplicateUUID extends ConfigurationPart { ++ public DuplicateUUIDMode mode = DuplicateUUIDMode.SAFE_REGEN; ++ public int safeRegenDeleteRange = 32; ++ ++ public enum DuplicateUUIDMode { ++ SAFE_REGEN, DELETE, NOTHING, WARN; ++ } ++ } ++ public AltItemDespawnRate altItemDespawnRate; ++ ++ public class AltItemDespawnRate extends ConfigurationPart { ++ public boolean enabled = false; ++ public Reference2IntMap items = new Reference2IntOpenHashMap<>(Map.of(Items.COBBLESTONE, 300)); ++ } ++ } ++ ++ public Behavior behavior; ++ ++ public class Behavior extends ConfigurationPart { ++ public boolean disableChestCatDetection = false; ++ public boolean spawnerNerfedMobsShouldJump = false; ++ public int experienceMergeMaxValue = -1; ++ public boolean shouldRemoveDragon = false; ++ public boolean zombiesTargetTurtleEggs = true; ++ public boolean piglinsGuardChests = true; ++ public double babyZombieMovementModifier = 0.5; ++ public DoorBreakingDifficulty doorBreakingDifficulty; ++ ++ public class DoorBreakingDifficulty extends ConfigurationPart { // TODO convert to map at some point ++ public List zombie = Arrays.stream(Difficulty.values()).filter(Zombie.DOOR_BREAKING_PREDICATE).toList(); ++ public List husk = Arrays.stream(Difficulty.values()).filter(Zombie.DOOR_BREAKING_PREDICATE).toList(); ++ @Setting("zombie_villager") ++ public List zombieVillager = Arrays.stream(Difficulty.values()).filter(Zombie.DOOR_BREAKING_PREDICATE).toList(); ++ @Setting("zombified_piglin") ++ public List zombified_piglin = Arrays.stream(Difficulty.values()).filter(Zombie.DOOR_BREAKING_PREDICATE).toList(); ++ public List vindicator = Arrays.stream(Difficulty.values()).filter(Vindicator.DOOR_BREAKING_PREDICATE).toList(); ++ ++ // TODO remove when this becomes a proper map ++ public List get(EntityType type) { ++ return this.getOrDefault(type, null); ++ } ++ ++ public List getOrDefault(EntityType type, List fallback) { ++ if (type == EntityType.ZOMBIE) { ++ return this.zombie; ++ } else if (type == EntityType.HUSK) { ++ return this.husk; ++ } else if (type == EntityType.ZOMBIE_VILLAGER) { ++ return this.zombieVillager; ++ } else if (type == EntityType.ZOMBIFIED_PIGLIN) { ++ return this.zombified_piglin; ++ } else if (type == EntityType.VINDICATOR) { ++ return this.vindicator; ++ } else { ++ return fallback; + } + } + } ++ ++ public boolean disableCreeperLingeringEffect = false; ++ public boolean enderDragonsDeathAlwaysPlacesDragonEgg = false; ++ public boolean phantomsDoNotSpawnOnCreativePlayers = true; ++ public boolean phantomsOnlyAttackInsomniacs = true; ++ public boolean parrotsAreUnaffectedByPlayerMovement = false; ++ public double zombieVillagerInfectionChance = -1.0; ++ public MobsCanAlwaysPickUpLoot mobsCanAlwaysPickUpLoot; ++ ++ public class MobsCanAlwaysPickUpLoot extends ConfigurationPart { ++ public boolean zombies = false; ++ public boolean skeletons = false; ++ } ++ ++ public boolean disablePlayerCrits = false; ++ public boolean nerfPigmenFromNetherPortals = false; ++ public PillagerPatrols pillagerPatrols; ++ ++ public class PillagerPatrols extends ConfigurationPart { ++ public boolean disable = false; ++ public double spawnChance = 0.2; ++ public SpawnDelay spawnDelay; ++ public Start start; ++ ++ public class SpawnDelay extends ConfigurationPart { ++ public boolean perPlayer = false; ++ public int ticks = 12000; ++ } ++ ++ public class Start extends ConfigurationPart { ++ public boolean perPlayer = false; ++ public int day = 5; ++ } ++ } + } -+ saveConfig(); + } + -+ static void saveConfig() { -+ try { -+ config.save(CONFIG_FILE); -+ } catch (IOException ex) { -+ Bukkit.getLogger().log(Level.SEVERE, "Could not save " + CONFIG_FILE, ex); ++ public Lootables lootables; ++ ++ public class Lootables extends ConfigurationPart { ++ public boolean autoReplenish = false; ++ public boolean restrictPlayerReloot = true; ++ public boolean resetSeedOnFill = true; ++ public int maxRefills = -1; ++ public Duration refreshMin = Duration.of("12h"); ++ public Duration refreshMax = Duration.of("2d"); ++ } ++ ++ public MaxGrowthHeight maxGrowthHeight; ++ ++ public class MaxGrowthHeight extends ConfigurationPart { ++ public int cactus = 3; ++ public int reeds = 3; ++ public Bamboo bamboo; ++ ++ public class Bamboo extends ConfigurationPart { ++ public int max = 16; ++ public int min = 11; + } + } + ++ public Scoreboards scoreboards; ++ ++ public class Scoreboards extends ConfigurationPart { ++ public boolean allowNonPlayerEntitiesOnScoreboards = false; ++ public boolean useVanillaWorldScoreboardNameColoring = false; ++ } ++ ++ public Environment environment; ++ ++ public class Environment extends ConfigurationPart { ++ public boolean disableThunder = false; ++ public boolean disableIceAndSnow = false; ++ public boolean optimizeExplosions = false; ++ public boolean disableExplosionKnockback = false; ++ public boolean generateFlatBedrock = false; ++ public FrostedIce frostedIce; ++ ++ public class FrostedIce extends ConfigurationPart { ++ public boolean enabled = true; ++ public Delay delay; ++ ++ public class Delay extends ConfigurationPart { ++ public int min = 20; ++ public int max = 40; ++ } ++ } ++ ++ public TreasureMaps treasureMaps; ++ public class TreasureMaps extends ConfigurationPart { ++ public boolean enabled = true; ++ @NestedSetting({"find-already-discovered", "villager-trade"}) ++ public boolean findAlreadyDiscoveredVillager = false; ++ @NestedSetting({"find-already-discovered", "loot-tables"}) ++ public BooleanOrDefault findAlreadyDiscoveredLootTable = BooleanOrDefault.USE_DEFAULT; ++ } ++ ++ public int waterOverLavaFlowSpeed = 5; ++ public int portalSearchRadius = 128; ++ public int portalCreateRadius = 16; ++ public boolean portalSearchVanillaDimensionScaling = true; ++ public boolean disableTeleportationSuffocationCheck = false; ++ public int netherCeilingVoidDamageHeight = 0; ++ } ++ ++ public Spawn spawn; ++ ++ public class Spawn extends ConfigurationPart { ++ @RequiresSpigotInitialization(SpawnLoadedRangeInitializer.class) ++ public short keepSpawnLoadedRange = 10; ++ public boolean keepSpawnLoaded = true; ++ public boolean allowUsingSignsInsideSpawnProtection = false; ++ } ++ ++ public Maps maps; ++ ++ public class Maps extends ConfigurationPart { ++ public int itemFrameCursorLimit = 128; ++ public int itemFrameCursorUpdateInterval = 10; ++ } ++ ++ public Fixes fixes; ++ ++ public class Fixes extends ConfigurationPart { ++ public boolean fixItemsMergingThroughWalls = false; ++ public boolean disableUnloadedChunkEnderpearlExploit = true; ++ public boolean preventTntFromMovingInWater = false; ++ public boolean splitOverstackedLoot = true; ++ public boolean fixCuringZombieVillagerDiscountExploit = true; ++ public int fallingBlockHeightNerf = 0; ++ public int tntEntityHeightNerf = 0; ++ } ++ ++ public UnsupportedSettings unsupportedSettings; ++ ++ public class UnsupportedSettings extends ConfigurationPart { ++ public boolean fixInvulnerableEndCrystalExploit = true; ++ } ++ ++ public Hopper hopper; ++ ++ public class Hopper extends ConfigurationPart { ++ public boolean cooldownWhenFull = true; ++ public boolean disableMoveEvent = false; ++ public boolean ignoreOccludingBlocks = false; ++ } ++ ++ public Collisions collisions; ++ ++ public class Collisions extends ConfigurationPart { ++ public boolean onlyPlayersCollide = false; ++ public boolean allowVehicleCollisions = true; ++ public boolean fixClimbingBypassingCrammingRule = false; ++ @RequiresSpigotInitialization(MaxEntityCollisionsInitializer.class) ++ public int maxEntityCollisions = 8; ++ public boolean allowPlayerCrammingDamage = false; ++ } ++ ++ public Chunks chunks; ++ ++ public class Chunks extends ConfigurationPart { ++ public AutosavePeriod autoSaveInterval = AutosavePeriod.def(); ++ public int maxAutoSaveChunksPerTick = 24; ++ public int fixedChunkInhabitedTime = -1; ++ public boolean preventMovingIntoUnloadedChunks = false; ++ public Duration delayChunkUnloadsBy = Duration.of("10s"); ++ public Reference2IntMap> entityPerChunkSaveLimit = Util.make(new Reference2IntOpenHashMap<>(Registry.ENTITY_TYPE.size()), map -> { ++ map.defaultReturnValue(-1); ++ map.put(EntityType.EXPERIENCE_ORB, -1); ++ map.put(EntityType.SNOWBALL, -1); ++ map.put(EntityType.ENDER_PEARL, -1); ++ map.put(EntityType.ARROW, -1); ++ map.put(EntityType.FIREBALL, -1); ++ map.put(EntityType.SMALL_FIREBALL, -1); ++ }); ++ } ++ ++ public FishingTimeRange fishingTimeRange; ++ ++ public class FishingTimeRange extends ConfigurationPart { ++ public int minimum = 100; ++ public int maximum = 600; ++ } ++ ++ public TickRates tickRates; ++ ++ public class TickRates extends ConfigurationPart { ++ public int grassSpread = 1; ++ public int containerUpdate = 1; ++ public int mobSpawner = 1; ++ public Table, String, Integer> sensor = Util.make(HashBasedTable.create(), table -> table.put(EntityType.VILLAGER, "secondarypoisensor", 40)); ++ public Table, String, Integer> behavior = Util.make(HashBasedTable.create(), table -> table.put(EntityType.VILLAGER, "validatenearbypoi", -1)); ++ } ++ ++ public FeatureSeeds featureSeeds; ++ ++ public class FeatureSeeds extends ConfigurationPart { ++ public boolean generateRandomSeedsForAll = false; ++ public Reference2LongMap>> features = new Reference2LongOpenHashMap<>(); ++ // TODO post processing to generate random seeds if generateRandomSeedsForAll == true ++ } ++ ++ public Misc misc; ++ ++ public class Misc extends ConfigurationPart { ++ public int lightQueueSize = 20; ++ public boolean updatePathfindingOnBlockUpdate = true; ++ public boolean showSignClickCommandFailureMsgsToPlayer = false; ++ public RedstoneImplementation redstoneImplementation = RedstoneImplementation.VANILLA; ++ public boolean disableEndCredits = false; ++ public float maxLeashDistance = 10f; ++ public boolean disableSprintInterruptionOnAttack = false; ++ public int shieldBlockingDelay = 5; ++ public boolean disableRelativeProjectileVelocity = false; ++ ++ public enum RedstoneImplementation { ++ VANILLA, EIGENCRAFT, ALTERNATE_CURRENT ++ } ++ } ++ ++} +diff --git a/src/main/java/io/papermc/paper/configuration/constraint/Constraint.java b/src/main/java/io/papermc/paper/configuration/constraint/Constraint.java +new file mode 100644 +index 0000000000000000000000000000000000000000..514be9a11e2ca368ea72dd2bac1b84bff5468814 +--- /dev/null ++++ b/src/main/java/io/papermc/paper/configuration/constraint/Constraint.java +@@ -0,0 +1,30 @@ ++package io.papermc.paper.configuration.constraint; ++ ++import java.lang.annotation.Documented; ++import java.lang.annotation.ElementType; ++import java.lang.annotation.Retention; ++import java.lang.annotation.RetentionPolicy; ++import java.lang.annotation.Target; ++import java.lang.reflect.Constructor; ++import java.lang.reflect.Type; ++ ++@Documented ++@Retention(RetentionPolicy.RUNTIME) ++@Target({ElementType.FIELD, ElementType.TYPE, ElementType.PARAMETER}) ++public @interface Constraint { ++ Class> value(); ++ ++ class Factory implements org.spongepowered.configurate.objectmapping.meta.Constraint.Factory { ++ @SuppressWarnings("unchecked") ++ @Override ++ public org.spongepowered.configurate.objectmapping.meta.Constraint make(final Constraint data, final Type type) { ++ try { ++ final Constructor> constructor = data.value().getDeclaredConstructor(); ++ constructor.trySetAccessible(); ++ return (org.spongepowered.configurate.objectmapping.meta.Constraint) constructor.newInstance(); ++ } catch (final ReflectiveOperationException e) { ++ throw new RuntimeException("Could not create constraint", e); ++ } ++ } ++ } ++} +diff --git a/src/main/java/io/papermc/paper/configuration/constraint/Constraints.java b/src/main/java/io/papermc/paper/configuration/constraint/Constraints.java +new file mode 100644 +index 0000000000000000000000000000000000000000..57f8765a827aeab592e952875b4ed8f503b1f757 +--- /dev/null ++++ b/src/main/java/io/papermc/paper/configuration/constraint/Constraints.java +@@ -0,0 +1,68 @@ ++package io.papermc.paper.configuration.constraint; ++ ++import io.papermc.paper.configuration.GlobalConfiguration; ++import io.papermc.paper.configuration.type.DoubleOrDefault; ++import org.checkerframework.checker.nullness.qual.Nullable; ++import org.spongepowered.configurate.objectmapping.meta.Constraint; ++import org.spongepowered.configurate.serialize.SerializationException; ++ ++import java.lang.annotation.Documented; ++import java.lang.annotation.ElementType; ++import java.lang.annotation.Retention; ++import java.lang.annotation.RetentionPolicy; ++import java.lang.annotation.Target; ++import java.lang.reflect.Type; ++import java.util.OptionalDouble; ++ ++public final class Constraints { ++ private Constraints() { ++ } ++ ++ public static final class Velocity implements Constraint { ++ @Override ++ public void validate(final GlobalConfiguration.Proxies.@Nullable Velocity value) throws SerializationException { ++ if (value != null && value.enabled && value.secret.isEmpty()) { ++ throw new SerializationException("Velocity is enabled, but no secret key was specified. A secret key is required!"); ++ } ++ } ++ } ++ ++ public static final class Positive implements Constraint { ++ @Override ++ public void validate(@Nullable Number value) throws SerializationException { ++ if (value != null && value.doubleValue() <= 0) { ++ throw new SerializationException(value + " should be positive"); ++ } ++ } ++ } ++ ++ public static final class BelowZeroDoubleToDefault implements Constraint { ++ @Override ++ public void validate(final @Nullable DoubleOrDefault container) { ++ if (container != null) { ++ final OptionalDouble value = container.value(); ++ if (value.isPresent() && value.getAsDouble() < 0) { ++ container.value(OptionalDouble.empty()); ++ } ++ } ++ } ++ } ++ ++ @Documented ++ @Retention(RetentionPolicy.RUNTIME) ++ @Target(ElementType.FIELD) ++ public @interface Min { ++ int value(); ++ ++ final class Factory implements Constraint.Factory { ++ @Override ++ public Constraint make(Min data, Type type) { ++ return value -> { ++ if (value != null && value.intValue() < data.value()) { ++ throw new SerializationException(value + " is less than the min " + data.value()); ++ } ++ }; ++ } ++ } ++ } ++} +diff --git a/src/main/java/io/papermc/paper/configuration/legacy/MaxEntityCollisionsInitializer.java b/src/main/java/io/papermc/paper/configuration/legacy/MaxEntityCollisionsInitializer.java +new file mode 100644 +index 0000000000000000000000000000000000000000..62b43280f59163f7910f79cc901b50d05cdd024e +--- /dev/null ++++ b/src/main/java/io/papermc/paper/configuration/legacy/MaxEntityCollisionsInitializer.java +@@ -0,0 +1,29 @@ ++package io.papermc.paper.configuration.legacy; ++ ++import org.checkerframework.checker.nullness.qual.Nullable; ++import org.spigotmc.SpigotWorldConfig; ++import org.spongepowered.configurate.ConfigurationNode; ++import org.spongepowered.configurate.objectmapping.meta.NodeResolver; ++import org.spongepowered.configurate.util.NamingSchemes; ++ ++public class MaxEntityCollisionsInitializer implements NodeResolver { ++ ++ private final String name; ++ private final SpigotWorldConfig spigotConfig; ++ ++ public MaxEntityCollisionsInitializer(String name, SpigotWorldConfig spigotConfig) { ++ this.name = name; ++ this.spigotConfig = spigotConfig; ++ } ++ ++ @Override ++ public @Nullable ConfigurationNode resolve(ConfigurationNode parent) { ++ final String key = NamingSchemes.LOWER_CASE_DASHED.coerce(this.name); ++ final ConfigurationNode node = parent.node(key); ++ final int old = this.spigotConfig.getInt("max-entity-collisions", -1, false); ++ if (node.virtual() && old > -1) { ++ node.raw(old); ++ } ++ return node; ++ } ++} +diff --git a/src/main/java/io/papermc/paper/configuration/legacy/RequiresSpigotInitialization.java b/src/main/java/io/papermc/paper/configuration/legacy/RequiresSpigotInitialization.java +new file mode 100644 +index 0000000000000000000000000000000000000000..611bdbcef3d52e09179aa8b1677ab1e198c70b02 +--- /dev/null ++++ b/src/main/java/io/papermc/paper/configuration/legacy/RequiresSpigotInitialization.java +@@ -0,0 +1,51 @@ ++package io.papermc.paper.configuration.legacy; ++ ++import com.google.common.collect.HashBasedTable; ++import com.google.common.collect.Table; ++import org.checkerframework.checker.nullness.qual.Nullable; ++import org.spigotmc.SpigotWorldConfig; ++import org.spongepowered.configurate.objectmapping.meta.NodeResolver; ++ ++import java.lang.annotation.Documented; ++import java.lang.annotation.ElementType; ++import java.lang.annotation.Retention; ++import java.lang.annotation.RetentionPolicy; ++import java.lang.annotation.Target; ++import java.lang.reflect.AnnotatedElement; ++import java.lang.reflect.Constructor; ++import java.util.Map; ++import java.util.concurrent.ConcurrentHashMap; ++ ++@Documented ++@Retention(RetentionPolicy.RUNTIME) ++@Target(ElementType.FIELD) ++public @interface RequiresSpigotInitialization { ++ ++ Class value(); ++ ++ final class Factory implements NodeResolver.Factory { ++ ++ private final SpigotWorldConfig spigotWorldConfig; ++ private final Table, String, NodeResolver> cache = HashBasedTable.create(); ++ ++ public Factory(SpigotWorldConfig spigotWorldConfig) { ++ this.spigotWorldConfig = spigotWorldConfig; ++ } ++ ++ @Override ++ public @Nullable NodeResolver make(String name, AnnotatedElement element) { ++ if (element.isAnnotationPresent(RequiresSpigotInitialization.class)) { ++ return this.cache.row(element.getAnnotation(RequiresSpigotInitialization.class).value()).computeIfAbsent(name, key -> { ++ try { ++ final Constructor constructor = element.getAnnotation(RequiresSpigotInitialization.class).value().getDeclaredConstructor(String.class, SpigotWorldConfig.class); ++ constructor.trySetAccessible(); ++ return constructor.newInstance(key, this.spigotWorldConfig); ++ } catch (final ReflectiveOperationException e) { ++ throw new RuntimeException("Could not create constraint", e); ++ } ++ }); ++ } ++ return null; ++ } ++ } ++} +diff --git a/src/main/java/io/papermc/paper/configuration/legacy/SpawnLoadedRangeInitializer.java b/src/main/java/io/papermc/paper/configuration/legacy/SpawnLoadedRangeInitializer.java +new file mode 100644 +index 0000000000000000000000000000000000000000..fe5cc1c097f8d8c135e6ead6f458426bb84a8ebe +--- /dev/null ++++ b/src/main/java/io/papermc/paper/configuration/legacy/SpawnLoadedRangeInitializer.java +@@ -0,0 +1,27 @@ ++package io.papermc.paper.configuration.legacy; ++ ++import org.spigotmc.SpigotWorldConfig; ++import org.spongepowered.configurate.ConfigurationNode; ++import org.spongepowered.configurate.objectmapping.meta.NodeResolver; ++import org.spongepowered.configurate.util.NamingSchemes; ++ ++public final class SpawnLoadedRangeInitializer implements NodeResolver { ++ ++ private final String name; ++ private final SpigotWorldConfig spigotConfig; ++ ++ public SpawnLoadedRangeInitializer(String name, SpigotWorldConfig spigotConfig) { ++ this.name = name; ++ this.spigotConfig = spigotConfig; ++ } ++ ++ @Override ++ public ConfigurationNode resolve(ConfigurationNode parent) { ++ final String key = NamingSchemes.LOWER_CASE_DASHED.coerce(this.name); ++ final ConfigurationNode node = parent.node(key); ++ if (node.virtual()) { ++ node.raw(Math.min(spigotConfig.viewDistance, 10)); ++ } ++ return node; ++ } ++} +diff --git a/src/main/java/io/papermc/paper/configuration/package-info.java b/src/main/java/io/papermc/paper/configuration/package-info.java +new file mode 100644 +index 0000000000000000000000000000000000000000..4e3bcd7c478096384fcc643d48771ab94318deb3 +--- /dev/null ++++ b/src/main/java/io/papermc/paper/configuration/package-info.java +@@ -0,0 +1,5 @@ ++@DefaultQualifier(NonNull.class) ++package io.papermc.paper.configuration; ++ ++import org.checkerframework.checker.nullness.qual.NonNull; ++import org.checkerframework.framework.qual.DefaultQualifier; +\ No newline at end of file +diff --git a/src/main/java/io/papermc/paper/configuration/serializer/FastutilMapSerializer.java b/src/main/java/io/papermc/paper/configuration/serializer/FastutilMapSerializer.java +new file mode 100644 +index 0000000000000000000000000000000000000000..f2f362883d1825084c277608c791f82165828ebe +--- /dev/null ++++ b/src/main/java/io/papermc/paper/configuration/serializer/FastutilMapSerializer.java +@@ -0,0 +1,69 @@ ++package io.papermc.paper.configuration.serializer; ++ ++import io.leangen.geantyref.GenericTypeReflector; ++import io.leangen.geantyref.TypeFactory; ++import org.checkerframework.checker.nullness.qual.Nullable; ++import org.spongepowered.configurate.ConfigurationNode; ++import org.spongepowered.configurate.serialize.SerializationException; ++import org.spongepowered.configurate.serialize.TypeSerializer; ++ ++import java.lang.reflect.ParameterizedType; ++import java.lang.reflect.Type; ++import java.util.Collections; ++import java.util.Map; ++import java.util.function.Function; ++ ++@SuppressWarnings("rawtypes") ++public abstract class FastutilMapSerializer> implements TypeSerializer { ++ private final Function factory; ++ ++ protected FastutilMapSerializer(final Function factory) { ++ this.factory = factory; ++ } ++ ++ @Override ++ public M deserialize(final Type type, final ConfigurationNode node) throws SerializationException { ++ @Nullable final Map map = (Map) node.get(this.createBaseMapType((ParameterizedType) type)); ++ return this.factory.apply(map == null ? Collections.emptyMap() : map); ++ } ++ ++ @Override ++ public void serialize(final Type type, @Nullable final M obj, final ConfigurationNode node) throws SerializationException { ++ if (obj == null || obj.isEmpty()) { ++ node.raw(null); ++ } else { ++ final Type baseMapType = this.createBaseMapType((ParameterizedType) type); ++ node.set(baseMapType, obj); ++ } ++ } ++ ++ protected abstract Type createBaseMapType(final ParameterizedType type); ++ ++ public static final class SomethingToPrimitive> extends FastutilMapSerializer { ++ private final Type primitiveType; ++ ++ public SomethingToPrimitive(final Function factory, final Type primitiveType) { ++ super(factory); ++ this.primitiveType = primitiveType; ++ } ++ ++ @Override ++ protected Type createBaseMapType(final ParameterizedType type) { ++ return TypeFactory.parameterizedClass(Map.class, type.getActualTypeArguments()[0], GenericTypeReflector.box(this.primitiveType)); ++ } ++ } ++ ++ public static final class PrimitiveToSomething> extends FastutilMapSerializer { ++ private final Type primitiveType; ++ ++ public PrimitiveToSomething(final Function factory, final Type primitiveType) { ++ super(factory); ++ this.primitiveType = primitiveType; ++ } ++ ++ @Override ++ protected Type createBaseMapType(final ParameterizedType type) { ++ return TypeFactory.parameterizedClass(Map.class, GenericTypeReflector.box(this.primitiveType), type.getActualTypeArguments()[0]); ++ } ++ } ++} +diff --git a/src/main/java/io/papermc/paper/configuration/serializer/PacketClassSerializer.java b/src/main/java/io/papermc/paper/configuration/serializer/PacketClassSerializer.java +new file mode 100644 +index 0000000000000000000000000000000000000000..ed58ae2fee2ccd2a83e3c2641f2a197ef47d57d6 +--- /dev/null ++++ b/src/main/java/io/papermc/paper/configuration/serializer/PacketClassSerializer.java +@@ -0,0 +1,59 @@ ++package io.papermc.paper.configuration.serializer; ++ ++import io.leangen.geantyref.TypeToken; ++import io.papermc.paper.util.ObfHelper; ++import java.lang.reflect.Type; ++import java.util.Collection; ++import java.util.Collections; ++import java.util.List; ++import java.util.Map; ++import java.util.Optional; ++import java.util.function.Predicate; ++import java.util.stream.Collectors; ++import net.minecraft.network.protocol.Packet; ++import org.checkerframework.checker.nullness.qual.Nullable; ++import org.spongepowered.configurate.serialize.ScalarSerializer; ++import org.spongepowered.configurate.serialize.SerializationException; ++ ++@SuppressWarnings("Convert2Diamond") ++public final class PacketClassSerializer extends ScalarSerializer>> { ++ private static final TypeToken>> TYPE = new TypeToken>>() {}; ++ private static final List SUBPACKAGES = List.of("game", "handshake", "login", "status"); ++ private static final Map MOJANG_TO_OBF = Optional.ofNullable(ObfHelper.INSTANCE.mappingsByObfName()) ++ .map(Map::entrySet) ++ .map(Collection::stream) ++ .map(stream -> stream.collect(Collectors.toMap(entry -> entry.getValue().mojangName(), entry -> entry.getValue().obfName()))) ++ .orElseGet(Collections::emptyMap); ++ ++ public PacketClassSerializer() { ++ super(TYPE); ++ } ++ ++ @SuppressWarnings("unchecked") ++ @Override ++ public Class> deserialize(final Type type, final Object obj) throws SerializationException { ++ @Nullable Class packetClass = null; ++ for (final String subpackage : SUBPACKAGES) { ++ final String fullClassName = "net.minecraft.network.protocol." + subpackage + "." + obj; ++ try { ++ packetClass = Class.forName(fullClassName); ++ } catch (final ClassNotFoundException ex) { ++ final @Nullable String spigotClassName = MOJANG_TO_OBF.get(fullClassName); ++ if (spigotClassName != null) { ++ try { ++ packetClass = Class.forName(spigotClassName); ++ } catch (final ClassNotFoundException ignore) {} ++ } ++ } ++ } ++ if (packetClass == null || !Packet.class.isAssignableFrom(packetClass)) { ++ throw new SerializationException("Could not deserialize a packet from " + obj); ++ } ++ return (Class>) packetClass; ++ } ++ ++ @Override ++ protected Object serialize(final Class> item, final Predicate> typeSupported) { ++ return item.getSimpleName(); ++ } ++} +diff --git a/src/main/java/io/papermc/paper/configuration/serializer/StringRepresentableSerializer.java b/src/main/java/io/papermc/paper/configuration/serializer/StringRepresentableSerializer.java +new file mode 100644 +index 0000000000000000000000000000000000000000..add9d16bac9e4570fbdcf8368d7ba03116e97ddf +--- /dev/null ++++ b/src/main/java/io/papermc/paper/configuration/serializer/StringRepresentableSerializer.java +@@ -0,0 +1,43 @@ ++package io.papermc.paper.configuration.serializer; ++ ++import net.minecraft.util.StringRepresentable; ++import net.minecraft.world.entity.MobCategory; ++import org.spongepowered.configurate.serialize.ScalarSerializer; ++import org.spongepowered.configurate.serialize.SerializationException; ++ ++import java.lang.reflect.Type; ++import java.util.Collections; ++import java.util.Map; ++import java.util.function.Function; ++import java.util.function.Predicate; ++ ++public final class StringRepresentableSerializer extends ScalarSerializer { ++ private static final Map> TYPES = Collections.synchronizedMap(Map.ofEntries( ++ Map.entry(MobCategory.class, s -> { ++ for (MobCategory value : MobCategory.values()) { ++ if (value.getSerializedName().equals(s)) { ++ return value; ++ } ++ } ++ return null; ++ }) ++ )); ++ ++ public StringRepresentableSerializer() { ++ super(StringRepresentable.class); ++ } ++ ++ @Override ++ public StringRepresentable deserialize(Type type, Object obj) throws SerializationException { ++ Function function = TYPES.get(type); ++ if (function == null) { ++ throw new SerializationException(type + " isn't registered"); ++ } ++ return function.apply(obj.toString()); ++ } ++ ++ @Override ++ protected Object serialize(StringRepresentable item, Predicate> typeSupported) { ++ return item.getSerializedName(); ++ } ++} +diff --git a/src/main/java/io/papermc/paper/configuration/serializer/TableSerializer.java b/src/main/java/io/papermc/paper/configuration/serializer/TableSerializer.java +new file mode 100644 +index 0000000000000000000000000000000000000000..0b235ebe6e79d7aa420d6b8a52aedb3a4d8b6629 +--- /dev/null ++++ b/src/main/java/io/papermc/paper/configuration/serializer/TableSerializer.java +@@ -0,0 +1,89 @@ ++package io.papermc.paper.configuration.serializer; ++ ++import com.google.common.collect.HashBasedTable; ++import com.google.common.collect.ImmutableTable; ++import com.google.common.collect.Table; ++import io.leangen.geantyref.TypeFactory; ++import org.checkerframework.checker.nullness.qual.Nullable; ++import org.spongepowered.configurate.BasicConfigurationNode; ++import org.spongepowered.configurate.ConfigurationNode; ++import org.spongepowered.configurate.ConfigurationOptions; ++import org.spongepowered.configurate.serialize.SerializationException; ++import org.spongepowered.configurate.serialize.TypeSerializer; ++ ++import java.lang.reflect.ParameterizedType; ++import java.lang.reflect.Type; ++import java.util.Map; ++import java.util.Objects; ++ ++public class TableSerializer implements TypeSerializer> { ++ private static final int ROW_TYPE_ARGUMENT_INDEX = 0; ++ private static final int COLUMN_TYPE_ARGUMENT_INDEX = 1; ++ private static final int VALUE_TYPE_ARGUMENT_INDEX = 2; ++ ++ @Override ++ public Table deserialize(final Type type, final ConfigurationNode node) throws SerializationException { ++ final Table table = HashBasedTable.create(); ++ if (!node.empty() && node.isMap()) { ++ this.deserialize0(table, (ParameterizedType) type, node); ++ } ++ return table; ++ } ++ ++ @SuppressWarnings("unchecked") ++ private void deserialize0(final Table table, final ParameterizedType type, final ConfigurationNode node) throws SerializationException { ++ final Type rowType = type.getActualTypeArguments()[ROW_TYPE_ARGUMENT_INDEX]; ++ final Type columnType = type.getActualTypeArguments()[COLUMN_TYPE_ARGUMENT_INDEX]; ++ final Type valueType = type.getActualTypeArguments()[VALUE_TYPE_ARGUMENT_INDEX]; ++ ++ final @Nullable TypeSerializer rowKeySerializer = (TypeSerializer) node.options().serializers().get(rowType); ++ if (rowKeySerializer == null) { ++ throw new SerializationException("Could not find serializer for table row type " + rowType); ++ } ++ ++ final Type mapType = TypeFactory.parameterizedClass(Map.class, columnType, valueType); ++ final @Nullable TypeSerializer> columnValueSerializer = (TypeSerializer>) node.options().serializers().get(mapType); ++ if (columnValueSerializer == null) { ++ throw new SerializationException("Could not find serializer for table column-value map " + type); ++ } ++ ++ final BasicConfigurationNode rowKeyNode = BasicConfigurationNode.root(node.options()); ++ ++ for (final Object key : node.childrenMap().keySet()) { ++ rowKeySerializer.deserialize(rowType, rowKeyNode.set(key)); ++ final Map map = columnValueSerializer.deserialize(mapType, node.node(rowKeyNode.raw())); ++ map.forEach((column, value) -> table.put((R) rowKeyNode.raw(), column, value)); ++ } ++ } ++ ++ @Override ++ public void serialize(final Type type, @Nullable final Table table, final ConfigurationNode node) throws SerializationException { ++ if (table != null) { ++ this.serialize0(table, (ParameterizedType) type, node); ++ } ++ } ++ ++ @SuppressWarnings({"rawtypes", "unchecked"}) ++ private void serialize0(final Table table, final ParameterizedType type, final ConfigurationNode node) throws SerializationException { ++ final Type rowType = type.getActualTypeArguments()[ROW_TYPE_ARGUMENT_INDEX]; ++ final Type columnType = type.getActualTypeArguments()[COLUMN_TYPE_ARGUMENT_INDEX]; ++ final Type valueType = type.getActualTypeArguments()[VALUE_TYPE_ARGUMENT_INDEX]; ++ ++ final @Nullable TypeSerializer rowKeySerializer = node.options().serializers().get(rowType); ++ if (rowKeySerializer == null) { ++ throw new SerializationException("Could not find a serializer for table row type " + rowType); ++ } ++ ++ final BasicConfigurationNode rowKeyNode = BasicConfigurationNode.root(node.options()); ++ for (final R key : table.rowKeySet()) { ++ rowKeySerializer.serialize(rowType, key, rowKeyNode.set(key)); ++ final Object keyObj = Objects.requireNonNull(rowKeyNode.raw()); ++ node.node(keyObj).set(TypeFactory.parameterizedClass(Map.class, columnType, valueType), table.row(key)); ++ } ++ } ++ ++ @Override ++ public @Nullable Table emptyValue(Type specificType, ConfigurationOptions options) { ++ return ImmutableTable.of(); ++ } ++} +diff --git a/src/main/java/io/papermc/paper/configuration/serializer/collections/MapSerializer.java b/src/main/java/io/papermc/paper/configuration/serializer/collections/MapSerializer.java +new file mode 100644 +index 0000000000000000000000000000000000000000..0de8542c0cfd37b788b624b1a196acb7e28afd4c +--- /dev/null ++++ b/src/main/java/io/papermc/paper/configuration/serializer/collections/MapSerializer.java +@@ -0,0 +1,129 @@ ++package io.papermc.paper.configuration.serializer.collections; ++ ++import com.mojang.logging.LogUtils; ++import io.leangen.geantyref.TypeToken; ++import io.papermc.paper.configuration.Configuration; ++import org.checkerframework.checker.nullness.qual.Nullable; ++import org.slf4j.Logger; ++import org.spongepowered.configurate.BasicConfigurationNode; ++import org.spongepowered.configurate.ConfigurationNode; ++import org.spongepowered.configurate.ConfigurationOptions; ++import org.spongepowered.configurate.NodePath; ++import org.spongepowered.configurate.serialize.SerializationException; ++import org.spongepowered.configurate.serialize.TypeSerializer; ++ ++import java.lang.reflect.ParameterizedType; ++import java.lang.reflect.Type; ++import java.util.Collections; ++import java.util.HashSet; ++import java.util.LinkedHashMap; ++import java.util.Map; ++import java.util.Set; ++ ++import static java.util.Objects.requireNonNull; ++ ++/** ++ * Map serializer that does not throw errors on individual entry serialization failures. ++ */ ++public class MapSerializer implements TypeSerializer> { ++ ++ public static final TypeToken> TYPE = new TypeToken>() {}; ++ ++ private static final Logger LOGGER = LogUtils.getLogger(); ++ ++ @Override ++ public Map deserialize(Type type, ConfigurationNode node) throws SerializationException { ++ final Map map = new LinkedHashMap<>(); ++ if (node.isMap()) { ++ if (!(type instanceof ParameterizedType parameterizedType)) { ++ throw new SerializationException(type, "Raw types are not supported for collections"); ++ } ++ if (parameterizedType.getActualTypeArguments().length != 2) { ++ throw new SerializationException(type, "Map expected two type arguments!"); ++ } ++ final Type key = parameterizedType.getActualTypeArguments()[0]; ++ final Type value = parameterizedType.getActualTypeArguments()[1]; ++ final @Nullable TypeSerializer keySerializer = node.options().serializers().get(key); ++ final @Nullable TypeSerializer valueSerializer = node.options().serializers().get(value); ++ if (keySerializer == null) { ++ throw new SerializationException(type, "No type serializer available for key type " + key); ++ } ++ if (valueSerializer == null) { ++ throw new SerializationException(type, "No type serializer available for value type " + value); ++ } ++ ++ final BasicConfigurationNode keyNode = BasicConfigurationNode.root(node.options()); ++ for (Map.Entry ent : node.childrenMap().entrySet()) { ++ final @Nullable Object keyValue = deserialize(key, keySerializer, "key", keyNode.set(ent.getKey()), node.path()); ++ final @Nullable Object valueValue = deserialize(value, valueSerializer, "value", ent.getValue(), ent.getValue().path()); ++ if (keyValue == null || valueValue == null) { ++ continue; ++ } ++ map.put(keyValue, valueValue); ++ } ++ } ++ return map; ++ } ++ ++ private @Nullable Object deserialize(Type type, TypeSerializer serializer, String mapPart, ConfigurationNode node, NodePath path) { ++ try { ++ return serializer.deserialize(type, node); ++ } catch (SerializationException exception) { ++ LOGGER.error("Could not deserialize {} {} into {} at {}", mapPart, node.raw(), type, path, exception); ++ } ++ return null; ++ } ++ ++ @Override ++ public void serialize(Type type, @Nullable Map obj, ConfigurationNode node) throws SerializationException { ++ if (!(type instanceof ParameterizedType parameterizedType)) { ++ throw new SerializationException(type, "Raw types are not supported for collections"); ++ } ++ if (parameterizedType.getActualTypeArguments().length != 2) { ++ throw new SerializationException(type, "Map expected two type arguments!"); ++ } ++ final Type key = parameterizedType.getActualTypeArguments()[0]; ++ final Type value = parameterizedType.getActualTypeArguments()[1]; ++ final @Nullable TypeSerializer keySerializer = node.options().serializers().get(key); ++ final @Nullable TypeSerializer valueSerializer = node.options().serializers().get(value); ++ ++ if (keySerializer == null) { ++ throw new SerializationException(type, "No type serializer available for key type " + key); ++ } ++ ++ if (valueSerializer == null) { ++ throw new SerializationException(type, "No type serializer available for value type " + value); ++ } ++ ++ if (obj == null || obj.isEmpty()) { ++ node.set(Collections.emptyMap()); ++ } else { ++ final BasicConfigurationNode keyNode = BasicConfigurationNode.root(node.options()); ++ for (Map.Entry ent : obj.entrySet()) { ++ if (!serialize(key, keySerializer, ent.getKey(), "key", keyNode, node.path())) { ++ continue; ++ } ++ final Object keyObj = requireNonNull(keyNode.raw(), "Key must not be null!"); ++ final ConfigurationNode child = node.node(keyObj); ++ serialize(value, valueSerializer, ent.getValue(), "value", child, child.path()); ++ } ++ } ++ } ++ ++ @SuppressWarnings({"rawtypes", "unchecked"}) ++ private boolean serialize(Type type, TypeSerializer serializer, Object object, String mapPart, ConfigurationNode node, NodePath path) { ++ try { ++ serializer.serialize(type, object, node); ++ return true; ++ } catch (SerializationException ex) { ++ ex.initPath(node::path); ++ LOGGER.error("Could not serialize {} {} from {} at {}", mapPart, object, type, path, ex); ++ } ++ return false; ++ } ++ ++ @Override ++ public @Nullable Map emptyValue(Type specificType, ConfigurationOptions options) { ++ return new LinkedHashMap<>(); ++ } ++} +diff --git a/src/main/java/io/papermc/paper/configuration/serializer/registry/RegistryEntrySerializer.java b/src/main/java/io/papermc/paper/configuration/serializer/registry/RegistryEntrySerializer.java +new file mode 100644 +index 0000000000000000000000000000000000000000..aa4dc13878567732f514344eab5fcd73d0a63238 +--- /dev/null ++++ b/src/main/java/io/papermc/paper/configuration/serializer/registry/RegistryEntrySerializer.java +@@ -0,0 +1,61 @@ ++package io.papermc.paper.configuration.serializer.registry; ++ ++import io.leangen.geantyref.TypeToken; ++import net.minecraft.core.Registry; ++import net.minecraft.resources.ResourceKey; ++import net.minecraft.resources.ResourceLocation; ++import org.checkerframework.checker.nullness.qual.Nullable; ++import org.spongepowered.configurate.serialize.ScalarSerializer; ++import org.spongepowered.configurate.serialize.SerializationException; ++ ++import java.lang.reflect.Type; ++import java.util.function.Predicate; ++ ++abstract class RegistryEntrySerializer extends ScalarSerializer { ++ ++ private final Registry registry; ++ private final boolean omitMinecraftNamespace; ++ ++ protected RegistryEntrySerializer(TypeToken type, Registry registry, boolean omitMinecraftNamespace) { ++ super(type); ++ this.registry = registry; ++ this.omitMinecraftNamespace = omitMinecraftNamespace; ++ } ++ ++ protected RegistryEntrySerializer(Class type, Registry registry, boolean omitMinecraftNamespace) { ++ super(type); ++ this.registry = registry; ++ this.omitMinecraftNamespace = omitMinecraftNamespace; ++ } ++ ++ protected final Registry registry() { ++ return this.registry; ++ } ++ ++ protected abstract T convertFromResourceKey(ResourceKey key) throws SerializationException; ++ ++ @Override ++ public final T deserialize(Type type, Object obj) throws SerializationException { ++ return this.convertFromResourceKey(this.deserializeKey(obj)); ++ } ++ ++ protected abstract ResourceKey convertToResourceKey(T value); ++ ++ @Override ++ protected final Object serialize(T item, Predicate> typeSupported) { ++ final ResourceKey key = this.convertToResourceKey(item); ++ if (this.omitMinecraftNamespace && key.location().getNamespace().equals(ResourceLocation.DEFAULT_NAMESPACE)) { ++ return key.location().getPath(); ++ } else { ++ return key.location().toString(); ++ } ++ } ++ ++ private ResourceKey deserializeKey(final Object input) throws SerializationException { ++ final @Nullable ResourceLocation key = ResourceLocation.tryParse(input.toString()); ++ if (key == null) { ++ throw new SerializationException("Could not create a key from " + input); ++ } ++ return ResourceKey.create(this.registry.key(), key); ++ } ++} +diff --git a/src/main/java/io/papermc/paper/configuration/serializer/registry/RegistryHolderSerializer.java b/src/main/java/io/papermc/paper/configuration/serializer/registry/RegistryHolderSerializer.java +new file mode 100644 +index 0000000000000000000000000000000000000000..bfac00959d7fc6a1ddabfb5a975d163537bdbbdb +--- /dev/null ++++ b/src/main/java/io/papermc/paper/configuration/serializer/registry/RegistryHolderSerializer.java +@@ -0,0 +1,34 @@ ++package io.papermc.paper.configuration.serializer.registry; ++ ++import com.google.common.base.Preconditions; ++import io.leangen.geantyref.TypeFactory; ++import io.leangen.geantyref.TypeToken; ++import net.minecraft.core.Holder; ++import net.minecraft.core.Registry; ++import net.minecraft.resources.ResourceKey; ++import org.spongepowered.configurate.serialize.SerializationException; ++ ++import java.util.function.Function; ++ ++public final class RegistryHolderSerializer extends RegistryEntrySerializer, T> { ++ ++ @SuppressWarnings("unchecked") ++ public RegistryHolderSerializer(TypeToken typeToken, Registry registry, boolean omitMinecraftNamespace) { ++ super((TypeToken>) TypeToken.get(TypeFactory.parameterizedClass(Holder.class, typeToken.getType())), registry, omitMinecraftNamespace); ++ } ++ ++ public RegistryHolderSerializer(Class type, Registry registry, boolean omitMinecraftNamespace) { ++ this(TypeToken.get(type), registry, omitMinecraftNamespace); ++ Preconditions.checkArgument(type.getTypeParameters().length == 0, "%s must have 0 type parameters", type); ++ } ++ ++ @Override ++ protected Holder convertFromResourceKey(ResourceKey key) throws SerializationException { ++ return this.registry().getHolder(key).orElseThrow(() -> new SerializationException("Missing holder in " + this.registry().key() + " with key " + key)); ++ } ++ ++ @Override ++ protected ResourceKey convertToResourceKey(Holder value) { ++ return value.unwrap().map(Function.identity(), r -> this.registry().getResourceKey(r).orElseThrow()); ++ } ++} +diff --git a/src/main/java/io/papermc/paper/configuration/serializer/registry/RegistryValueSerializer.java b/src/main/java/io/papermc/paper/configuration/serializer/registry/RegistryValueSerializer.java +new file mode 100644 +index 0000000000000000000000000000000000000000..87a79b67186987ca4d02e4f7789c329f425a5a67 +--- /dev/null ++++ b/src/main/java/io/papermc/paper/configuration/serializer/registry/RegistryValueSerializer.java +@@ -0,0 +1,34 @@ ++package io.papermc.paper.configuration.serializer.registry; ++ ++import io.leangen.geantyref.TypeToken; ++import net.minecraft.core.Registry; ++import net.minecraft.resources.ResourceKey; ++import org.spongepowered.configurate.serialize.SerializationException; ++ ++/** ++ * Use {@link RegistryHolderSerializer} for datapack-configurable things. ++ */ ++public final class RegistryValueSerializer extends RegistryEntrySerializer { ++ ++ public RegistryValueSerializer(TypeToken type, Registry registry, boolean omitMinecraftNamespace) { ++ super(type, registry, omitMinecraftNamespace); ++ } ++ ++ public RegistryValueSerializer(Class type, Registry registry, boolean omitMinecraftNamespace) { ++ super(type, registry, omitMinecraftNamespace); ++ } ++ ++ @Override ++ protected T convertFromResourceKey(ResourceKey key) throws SerializationException { ++ final T value = this.registry().get(key); ++ if (value == null) { ++ throw new SerializationException("Missing value in " + this.registry() + " with key " + key.location()); ++ } ++ return value; ++ } ++ ++ @Override ++ protected ResourceKey convertToResourceKey(T value) { ++ return this.registry().getResourceKey(value).orElseThrow(); ++ } ++} +diff --git a/src/main/java/io/papermc/paper/configuration/transformation/Transformations.java b/src/main/java/io/papermc/paper/configuration/transformation/Transformations.java +new file mode 100644 +index 0000000000000000000000000000000000000000..c1b787a48c1197f64fa753e1a254d17198806a96 +--- /dev/null ++++ b/src/main/java/io/papermc/paper/configuration/transformation/Transformations.java +@@ -0,0 +1,28 @@ ++package io.papermc.paper.configuration.transformation; ++ ++import org.spongepowered.configurate.NodePath; ++import org.spongepowered.configurate.transformation.ConfigurationTransformation; ++ ++import static org.spongepowered.configurate.NodePath.path; ++ ++public final class Transformations { ++ private Transformations() { ++ } ++ ++ public static void moveFromRoot(final ConfigurationTransformation.Builder builder, final String key, final String... parents) { ++ moveFromRootAndRename(builder, key, key, parents); ++ } ++ ++ public static void moveFromRootAndRename(final ConfigurationTransformation.Builder builder, final String oldKey, final String newKey, final String... parents) { ++ moveFromRootAndRename(builder, path(oldKey), newKey, parents); ++ } ++ ++ public static void moveFromRootAndRename(final ConfigurationTransformation.Builder builder, final NodePath oldKey, final String newKey, final String... parents) { ++ builder.addAction(oldKey, (path, value) -> { ++ final Object[] newPath = new Object[parents.length + 1]; ++ newPath[parents.length] = newKey; ++ System.arraycopy(parents, 0, newPath, 0, parents.length); ++ return newPath; ++ }); ++ } ++} +diff --git a/src/main/java/io/papermc/paper/configuration/transformation/global/LegacyPaperConfig.java b/src/main/java/io/papermc/paper/configuration/transformation/global/LegacyPaperConfig.java +new file mode 100644 +index 0000000000000000000000000000000000000000..ecea36a434e0f4893899ee4694166768ded1e7c2 +--- /dev/null ++++ b/src/main/java/io/papermc/paper/configuration/transformation/global/LegacyPaperConfig.java +@@ -0,0 +1,184 @@ ++package io.papermc.paper.configuration.transformation.global; ++ ++import com.mojang.logging.LogUtils; ++import io.papermc.paper.configuration.Configuration; ++import io.papermc.paper.configuration.serializer.PacketClassSerializer; ++import io.papermc.paper.util.ObfHelper; ++import net.minecraft.network.protocol.Packet; ++import org.bukkit.configuration.file.YamlConfiguration; ++import org.checkerframework.checker.nullness.qual.Nullable; ++import org.slf4j.Logger; ++import org.spongepowered.configurate.BasicConfigurationNode; ++import org.spongepowered.configurate.ConfigurationNode; ++import org.spongepowered.configurate.transformation.ConfigurationTransformation; ++import org.spongepowered.configurate.transformation.TransformAction; ++ ++import static org.spongepowered.configurate.NodePath.path; ++ ++public final class LegacyPaperConfig { ++ private static final Logger LOGGER = LogUtils.getLogger(); ++ private static final PacketClassSerializer PACKET_CLASS_SERIALIZER = new PacketClassSerializer(); ++ ++ private LegacyPaperConfig() { ++ } ++ ++ public static ConfigurationTransformation transformation(final YamlConfiguration spigotConfiguration) { ++ return ConfigurationTransformation.chain(versioned(), notVersioned(spigotConfiguration)); ++ } ++ ++ // Represents version transforms lifted directly from the old PaperConfig class ++ // must be run BEFORE the "settings" flatten ++ private static ConfigurationTransformation.Versioned versioned() { ++ return ConfigurationTransformation.versionedBuilder() ++ .versionKey(Configuration.LEGACY_CONFIG_VERSION_FIELD) ++ .addVersion(11, ConfigurationTransformation.builder().addAction(path("settings", "play-in-use-item-spam-threshold"), TransformAction.rename("incoming-packet-spam-threshold")).build()) ++ .addVersion(14, ConfigurationTransformation.builder().addAction(path("settings", "spam-limiter", "tab-spam-increment"), (path, value) -> { ++ if (value.getInt() == 10) { ++ value.set(2); ++ } ++ return null; ++ }).build()) ++ .addVersion(15, ConfigurationTransformation.builder().addAction(path("settings"), (path, value) -> { ++ value.node("async-chunks", "threads").set(-1); ++ return null; ++ }).build()) ++ .addVersion(21, ConfigurationTransformation.builder().addAction(path("use-display-name-in-quit-message"), (path, value) -> new Object[]{"settings", "use-display-name-in-quit-message"}).build()) ++ .addVersion(23, ConfigurationTransformation.builder().addAction(path("settings", "chunk-loading", "global-max-chunk-load-rate"), (path, value) -> { ++ if (value.getDouble() == 300.0) { ++ value.set(-1.0); ++ } ++ return null; ++ }).build()) ++ .addVersion(25, ConfigurationTransformation.builder().addAction(path("settings", "chunk-loading", "player-max-concurrent-loads"), (path, value) -> { ++ if (value.getDouble() == 4.0) { ++ value.set(20.0); ++ } ++ return null; ++ }).build()) ++ .build(); ++ } ++ ++ // other non-versioned transforms found in PaperConfig ++ // must be run BEFORE the "settings" flatten ++ private static ConfigurationTransformation notVersioned(final YamlConfiguration spigotConfiguration) { ++ return ConfigurationTransformation.builder() ++ .addAction(path("settings"), (path, value) -> { ++ final ConfigurationNode node = value.node("async-chunks"); ++ if (node.hasChild("load-threads")) { ++ if (!node.hasChild("threads")) { ++ node.node("threads").set(node.node("load-threads").getInt()); ++ } ++ node.removeChild("load-threads"); ++ } ++ node.removeChild("generation"); ++ node.removeChild("enabled"); ++ node.removeChild("thread-per-world-generation"); ++ return null; ++ }) ++ .addAction(path("allow-perm-block-break-exploits"), (path, value) -> new Object[]{"settings", "unsupported-settings", "allow-permanent-block-break-exploits"}) ++ .addAction(path("settings", "unsupported-settings", "allow-tnt-duplication"), TransformAction.rename("allow-piston-duplication")) ++ .addAction(path("settings", "save-player-data"), (path, value) -> { ++ final @Nullable Object val = value.raw(); ++ if (val instanceof Boolean bool) { ++ spigotConfiguration.set("players.disable-saving", !bool); ++ } ++ value.raw(null); ++ return null; ++ }) ++ .addAction(path("settings", "log-named-entity-deaths"), (path, value) -> { ++ final @Nullable Object val = value.raw(); ++ if (val instanceof Boolean bool && !bool) { ++ spigotConfiguration.set("settings.log-named-deaths", false); ++ } ++ value.raw(null); ++ return null; ++ }) ++ .build(); ++ } ++ ++ // transforms to new format with configurate ++ // must be run AFTER the "settings" flatten ++ public static ConfigurationTransformation toNewFormat() { ++ return ConfigurationTransformation.chain( ++ ConfigurationTransformation.versionedBuilder().versionKey(Configuration.LEGACY_CONFIG_VERSION_FIELD).addVersion(Configuration.FINAL_LEGACY_VERSION + 1, newFormatTransformation()).build(), ++ ConfigurationTransformation.builder().addAction(path(Configuration.LEGACY_CONFIG_VERSION_FIELD), TransformAction.rename(Configuration.VERSION_FIELD)).build() // rename to _version to place at the top ++ ); ++ } ++ ++ private static ConfigurationTransformation newFormatTransformation() { ++ final ConfigurationTransformation.Builder builder = ConfigurationTransformation.builder() ++ .addAction(path("verbose"), TransformAction.remove()) // not needed ++ .addAction(path("unsupported-settings", "allow-headless-pistons-readme"), TransformAction.remove()) ++ .addAction(path("unsupported-settings", "allow-permanent-block-break-exploits-readme"), TransformAction.remove()) ++ .addAction(path("unsupported-settings", "allow-piston-duplication-readme"), TransformAction.remove()) ++ .addAction(path("packet-limiter", "limits", "all"), (path, value) -> new Object[]{"packet-limiter", "all-packets"}) ++ .addAction(path("packet-limiter", "limits"), (path, value) -> new Object[]{"packet-limiter", "overrides"}) ++ .addAction(path("packet-limiter", "overrides", ConfigurationTransformation.WILDCARD_OBJECT), (path, value) -> { ++ if (ObfHelper.INSTANCE.mappingsByObfName() != null) { // requires mappings to be present ++ final Class> packet = PACKET_CLASS_SERIALIZER.deserialize(Void.TYPE /* doesn't matter */, BasicConfigurationNode.root(value.options()).set(value.key())); ++ final Object[] newPath = new Object[path.size()]; ++ newPath[path.size() - 1] = packet.getSimpleName(); ++ return newPath; ++ } else { ++ LOGGER.warn("Could not convert spigot-mapped packet class names because no mappings were found in the jar"); ++ } ++ return null; ++ }).addAction(path("loggers"), TransformAction.rename("logging")); ++ ++ moveFromRootAndRename(builder, "incoming-packet-spam-threshold", "incoming-packet-threshold", "spam-limiter"); ++ ++ moveFromRoot(builder, "save-empty-scoreboard-teams", "scoreboards"); ++ moveFromRoot(builder, "track-plugin-scoreboards", "scoreboards"); ++ ++ moveFromRoot(builder, "suggest-player-names-when-null-tab-completions", "commands"); ++ moveFromRoot(builder, "time-command-affects-all-worlds", "commands"); ++ moveFromRoot(builder, "fix-target-selector-tag-completion", "commands"); ++ ++ moveFromRoot(builder, "log-player-ip-addresses", "loggers"); ++ ++ moveFromRoot(builder, "use-display-name-in-quit-message", "messages"); ++ ++ moveFromRootAndRename(builder, "console-has-all-permissions", "has-all-permissions", "console"); ++ ++ moveFromRootAndRename(builder, "bungee-online-mode", "online-mode", "proxies", "bungee-cord"); ++ moveFromRootAndRename(builder, "velocity-support", "velocity", "proxies"); ++ ++ moveFromRoot(builder, "book-size", "item-validation"); ++ moveFromRoot(builder, "resolve-selectors-in-books", "item-validation"); ++ ++ moveFromRoot(builder, "enable-player-collisions", "collisions"); ++ moveFromRoot(builder, "send-full-pos-for-hard-colliding-entities", "collisions"); ++ ++ moveFromRootAndRename(builder, "player-auto-save-rate", "rate", "player-auto-save"); ++ moveFromRootAndRename(builder, "max-player-auto-save-per-tick", "max-per-tick", "player-auto-save"); ++ ++ moveFromRootToMisc(builder, "max-joins-per-tick"); ++ moveFromRootToMisc(builder, "fix-entity-position-desync"); ++ moveFromRootToMisc(builder, "load-permissions-yml-before-plugins"); ++ moveFromRootToMisc(builder, "region-file-cache-size"); ++ moveFromRootToMisc(builder, "use-alternative-luck-formula"); ++ moveFromRootToMisc(builder, "lag-compensate-block-breaking"); ++ moveFromRootToMisc(builder, "use-dimension-type-for-custom-spawners"); ++ ++ moveFromRoot(builder, "proxy-protocol", "proxies"); ++ ++ return builder.build(); ++ } ++ ++ private static void moveFromRootToMisc(final ConfigurationTransformation.Builder builder, String key) { ++ moveFromRoot(builder, key, "misc"); ++ } ++ ++ private static void moveFromRoot(final ConfigurationTransformation.Builder builder, final String key, final String... parents) { ++ moveFromRootAndRename(builder, key, key, parents); ++ } ++ ++ private static void moveFromRootAndRename(final ConfigurationTransformation.Builder builder, final String oldKey, final String newKey, final String... parents) { ++ builder.addAction(path(oldKey), (path, value) -> { ++ final Object[] newPath = new Object[parents.length + 1]; ++ newPath[parents.length] = newKey; ++ System.arraycopy(parents, 0, newPath, 0, parents.length); ++ return newPath; ++ }); ++ } ++} +diff --git a/src/main/java/io/papermc/paper/configuration/transformation/world/LegacyPaperWorldConfig.java b/src/main/java/io/papermc/paper/configuration/transformation/world/LegacyPaperWorldConfig.java +new file mode 100644 +index 0000000000000000000000000000000000000000..c638016e3b231cba2e795a4e0f8063df44d4ea5a +--- /dev/null ++++ b/src/main/java/io/papermc/paper/configuration/transformation/world/LegacyPaperWorldConfig.java +@@ -0,0 +1,283 @@ ++package io.papermc.paper.configuration.transformation.world; ++ ++import io.papermc.paper.configuration.Configuration; ++import io.papermc.paper.configuration.WorldConfiguration; ++import net.minecraft.core.Holder; ++import net.minecraft.core.Registry; ++import net.minecraft.resources.ResourceKey; ++import net.minecraft.resources.ResourceLocation; ++import net.minecraft.world.entity.MobCategory; ++import net.minecraft.world.item.Item; ++import org.bukkit.Material; ++import org.checkerframework.checker.nullness.qual.Nullable; ++import org.spongepowered.configurate.transformation.ConfigurationTransformation; ++import org.spongepowered.configurate.transformation.TransformAction; ++ ++import java.util.List; ++import java.util.Optional; ++ ++import static io.papermc.paper.configuration.transformation.Transformations.moveFromRoot; ++import static io.papermc.paper.configuration.transformation.Transformations.moveFromRootAndRename; ++import static org.spongepowered.configurate.NodePath.path; ++ ++public final class LegacyPaperWorldConfig { ++ ++ private LegacyPaperWorldConfig() { ++ } ++ ++ public static ConfigurationTransformation transformation() { ++ return ConfigurationTransformation.chain(versioned(), notVersioned()); ++ } ++ ++ private static ConfigurationTransformation.Versioned versioned() { ++ return ConfigurationTransformation.versionedBuilder().versionKey(Configuration.LEGACY_CONFIG_VERSION_FIELD) ++ .addVersion(13, ConfigurationTransformation.builder().addAction(path("enable-old-tnt-cannon-behaviors"), TransformAction.rename("prevent-tnt-from-moving-in-water")).build()).addVersion(16, ConfigurationTransformation.builder().addAction(path("use-chunk-inhabited-timer"), (path, value) -> { ++ if (!value.getBoolean(true)) { ++ value.raw(0); ++ } ++ final Object[] newPath = path.array(); ++ newPath[newPath.length - 1] = "fixed-chunk-inhabited-time"; ++ return newPath; ++ }).build()) ++ .addVersion(18, ConfigurationTransformation.builder().addAction(path("nether-ceiling-void-damage"), (path, value) -> { ++ if (value.getBoolean(false)) { ++ value.raw(128); ++ } ++ final Object[] newPath = path.array(); ++ newPath[newPath.length - 1] = "nether-ceiling-void-damage-height"; ++ return newPath; ++ }).build()) ++ .addVersion(19, ConfigurationTransformation.builder() ++ .addAction(path("anti-xray", "hidden-blocks"), (path, value) -> { ++ @Nullable final List hiddenBlocks = value.getList(String.class); ++ if (hiddenBlocks != null) { ++ hiddenBlocks.remove("lit_redstone_ore"); ++ } ++ return null; ++ }) ++ .addAction(path("anti-xray", "replacement-blocks"), (path, value) -> { ++ @Nullable final List replacementBlocks = value.getList(String.class); ++ if (replacementBlocks != null) { ++ final int index = replacementBlocks.indexOf("planks"); ++ if (index != -1) { ++ replacementBlocks.set(index, "oak_planks"); ++ } ++ } ++ value.raw(replacementBlocks); ++ return null; ++ }).build()) ++ .addVersion(20, ConfigurationTransformation.builder().addAction(path("baby-zombie-movement-speed"), TransformAction.rename("baby-zombie-movement-modifier")).build()) ++ .addVersion(22, ConfigurationTransformation.builder().addAction(path("per-player-mob-spawns"), (path, value) -> { ++ value.raw(true); ++ return null; ++ }).build()) ++ .addVersion(24, ++ ConfigurationTransformation.builder() ++ .addAction(path("spawn-limits", "monsters"), TransformAction.rename("monster")) ++ .addAction(path("spawn-limits", "animals"), TransformAction.rename("creature")) ++ .addAction(path("spawn-limits", "water-animals"), TransformAction.rename("water_creature")) ++ .addAction(path("spawn-limits", "water-ambient"), TransformAction.rename("water_ambient")) ++ .build(), ++ ConfigurationTransformation.builder().addAction(path("despawn-ranges"), (path, value) -> { ++ final int softDistance = value.node("soft").getInt(32); ++ final int hardDistance = value.node("hard").getInt(128); ++ value.node("soft").raw(null); ++ value.node("hard").raw(null); ++ for (final MobCategory category : MobCategory.values()) { ++ if (softDistance != 32) { ++ value.node(category.getName(), "soft").raw(softDistance); ++ } ++ if (hardDistance != 128) { ++ value.node(category.getName(), "hard").raw(hardDistance); ++ } ++ } ++ return null; ++ }).build() ++ ) ++ .addVersion(26, ConfigurationTransformation.builder().addAction(path("alt-item-despawn-rate", "items", ConfigurationTransformation.WILDCARD_OBJECT), (path, value) -> { ++ String itemName = path.get(path.size() - 1).toString(); ++ final Optional> item = Registry.ITEM.getHolder(ResourceKey.create(Registry.ITEM_REGISTRY, new ResourceLocation(itemName))); ++ if (item.isEmpty()) { ++ itemName = Material.valueOf(itemName).getKey().toString(); ++ } ++ final Object[] newPath = path.array(); ++ newPath[newPath.length - 1] = itemName; ++ return newPath; ++ }).build()) ++ .addVersion(27, ConfigurationTransformation.builder().addAction(path("use-faster-eigencraft-redstone"), (path, value) -> { ++ final WorldConfiguration.Misc.RedstoneImplementation redstoneImplementation = value.getBoolean(false) ? WorldConfiguration.Misc.RedstoneImplementation.EIGENCRAFT : WorldConfiguration.Misc.RedstoneImplementation.VANILLA; ++ value.raw(redstoneImplementation); ++ final Object[] newPath = path.array(); ++ newPath[newPath.length - 1] = "redstone-implementation"; ++ return newPath; ++ }).build()) ++ .build(); ++ } ++ ++ // other transformations found in PaperWorldConfig that aren't versioned ++ private static ConfigurationTransformation notVersioned() { ++ return ConfigurationTransformation.builder() ++ .addAction(path("treasure-maps-return-already-discovered"), (path, value) -> { ++ boolean prevValue = value.getBoolean(false); ++ value.node("villager-trade").set(prevValue); ++ value.node("loot-tables").set(prevValue); ++ return path.with(path.size() - 1, "treasure-maps-find-already-discovered").array(); ++ }) ++ .build(); ++ } ++ ++ public static ConfigurationTransformation toNewFormat() { ++ return ConfigurationTransformation.chain(ConfigurationTransformation.versionedBuilder().versionKey(Configuration.LEGACY_CONFIG_VERSION_FIELD).addVersion(Configuration.FINAL_LEGACY_VERSION + 1, newFormatTransformation()).build(), ConfigurationTransformation.builder().addAction(path(Configuration.LEGACY_CONFIG_VERSION_FIELD), TransformAction.rename(Configuration.VERSION_FIELD)).build()); ++ } ++ ++ private static ConfigurationTransformation newFormatTransformation() { ++ final ConfigurationTransformation.Builder builder = ConfigurationTransformation.builder(); ++ ++ moveFromRoot(builder, "anti-xray", "anticheat"); ++ ++ moveFromRootAndRename(builder, "armor-stands-do-collision-entity-lookups", "do-collision-entity-lookups", "entities", "armor-stands"); ++ moveFromRootAndRename(builder, "armor-stands-tick", "tick", "entities", "armor-stands"); ++ ++ moveFromRoot(builder, "auto-save-interval", "chunks"); ++ moveFromRoot(builder, "delay-chunk-unloads-by", "chunks"); ++ moveFromRoot(builder, "entity-per-chunk-save-limit", "chunks"); ++ moveFromRoot(builder, "fixed-chunk-inhabited-time", "chunks"); ++ moveFromRoot(builder, "max-auto-save-chunks-per-tick", "chunks"); ++ moveFromRoot(builder, "prevent-moving-into-unloaded-chunks", "chunks"); ++ ++ moveFromRoot(builder, "entities-target-with-follow-range", "entities"); ++ moveFromRoot(builder, "mob-effects", "entities"); ++ ++ moveFromRoot(builder, "filter-nbt-data-from-spawn-eggs-and-related", "entities", "spawning"); ++ moveFromGameMechanics(builder, "disable-mob-spawner-spawn-egg-transformation", "entities", "spawning"); ++ moveFromRoot(builder, "per-player-mob-spawns", "entities", "spawning"); ++ moveFromGameMechanics(builder, "scan-for-legacy-ender-dragon", "entities", "spawning"); ++ moveFromRoot(builder, "spawn-limits", "entities", "spawning"); ++ moveFromRoot(builder, "despawn-ranges", "entities", "spawning"); ++ moveFromRoot(builder, "wateranimal-spawn-height", "entities", "spawning"); ++ moveFromRoot(builder, "slime-spawn-height", "entities", "spawning"); ++ moveFromRoot(builder, "wandering-trader", "entities", "spawning"); ++ moveFromRoot(builder, "all-chunks-are-slime-chunks", "entities", "spawning"); ++ moveFromRoot(builder, "skeleton-horse-thunder-spawn-chance", "entities", "spawning"); ++ moveFromRoot(builder, "iron-golems-can-spawn-in-air", "entities", "spawning"); ++ moveFromRoot(builder, "alt-item-despawn-rate", "entities", "spawning"); ++ moveFromRoot(builder, "count-all-mobs-for-spawning", "entities", "spawning"); ++ moveFromRoot(builder, "creative-arrow-despawn-rate", "entities", "spawning"); ++ moveFromRoot(builder, "non-player-arrow-despawn-rate", "entities", "spawning"); ++ moveFromRoot(builder, "monster-spawn-max-light-level", "entities", "spawning"); ++ ++ ++ moveFromRootAndRename(builder, "duplicate-uuid-saferegen-delete-range", "safe-regen-delete-range", "entities", "spawning", "duplicate-uuid"); ++ ++ moveFromRoot(builder, "baby-zombie-movement-modifier", "entities", "behavior"); ++ moveFromRoot(builder, "disable-creeper-lingering-effect", "entities", "behavior"); ++ moveFromRoot(builder, "door-breaking-difficulty", "entities", "behavior"); ++ moveFromGameMechanics(builder, "disable-chest-cat-detection", "entities", "behavior"); ++ moveFromGameMechanics(builder, "disable-player-crits", "entities", "behavior"); ++ moveFromRoot(builder, "experience-merge-max-value", "entities", "behavior"); ++ moveFromRoot(builder, "mobs-can-always-pick-up-loot", "entities", "behavior"); ++ moveFromGameMechanics(builder, "nerf-pigmen-from-nether-portals", "entities", "behavior"); ++ moveFromRoot(builder, "parrots-are-unaffected-by-player-movement", "entities", "behavior"); ++ moveFromRoot(builder, "phantoms-do-not-spawn-on-creative-players", "entities", "behavior"); ++ moveFromRoot(builder, "phantoms-only-attack-insomniacs", "entities", "behavior"); ++ moveFromRoot(builder, "piglins-guard-chests", "entities", "behavior"); ++ moveFromRoot(builder, "spawner-nerfed-mobs-should-jump", "entities", "behavior"); ++ moveFromRoot(builder, "zombie-villager-infection-chance", "entities", "behavior"); ++ moveFromRoot(builder, "zombies-target-turtle-eggs", "entities", "behavior"); ++ moveFromRoot(builder, "ender-dragons-death-always-places-dragon-egg", "entities", "behavior"); ++ moveFromGameMechanicsAndRename(builder, "disable-pillager-patrols", "disable", "game-mechanics", "pillager-patrols"); ++ moveFromGameMechanics(builder, "pillager-patrols", "entities", "behavior"); ++ moveFromRoot(builder, "should-remove-dragon", "entities", "behavior"); ++ ++ moveFromRootAndRename(builder, "map-item-frame-cursor-limit", "item-frame-cursor-limit", "maps"); ++ moveFromRootAndRename(builder, "map-item-frame-cursor-update-interval", "item-frame-cursor-update-interval", "maps"); ++ ++ moveFromRootAndRename(builder, "mob-spawner-tick-rate", "mob-spawner", "tick-rates"); ++ moveFromRootAndRename(builder, "container-update-tick-rate", "container-update", "tick-rates"); ++ moveFromRootAndRename(builder, "grass-spread-tick-rate", "grass-spread", "tick-rates"); ++ ++ moveFromRoot(builder, "allow-non-player-entities-on-scoreboards", "scoreboards"); ++ moveFromRoot(builder, "use-vanilla-world-scoreboard-name-coloring", "scoreboards"); ++ ++ moveFromRoot(builder, "disable-thunder", "environment"); ++ moveFromRoot(builder, "disable-ice-and-snow", "environment"); ++ moveFromRoot(builder, "optimize-explosions", "environment"); ++ moveFromRoot(builder, "disable-explosion-knockback", "environment"); ++ moveFromRoot(builder, "frosted-ice", "environment"); ++ moveFromRoot(builder, "disable-teleportation-suffocation-check", "environment"); ++ moveFromRoot(builder, "portal-create-radius", "environment"); ++ moveFromRoot(builder, "portal-search-radius", "environment"); ++ moveFromRoot(builder, "portal-search-vanilla-dimension-scaling", "environment"); ++ moveFromRootAndRename(builder, "enable-treasure-maps", "enabled", "environment", "treasure-maps"); ++ moveFromRootAndRename(builder, "treasure-maps-find-already-discovered", "find-already-discovered", "environment", "treasure-maps"); ++ moveFromRoot(builder, "water-over-lava-flow-speed", "environment"); ++ moveFromRoot(builder, "nether-ceiling-void-damage-height", "environment"); ++ ++ moveFromRoot(builder, "keep-spawn-loaded", "spawn"); ++ moveFromRoot(builder, "keep-spawn-loaded-range", "spawn"); ++ moveFromRoot(builder, "allow-using-signs-inside-spawn-protection", "spawn"); ++ ++ moveFromRoot(builder, "max-entity-collisions", "collisions"); ++ moveFromRoot(builder, "allow-vehicle-collisions", "collisions"); ++ moveFromRoot(builder, "fix-climbing-bypassing-cramming-rule", "collisions"); ++ moveFromRoot(builder, "only-players-collide", "collisions"); ++ moveFromRoot(builder, "allow-player-cramming-damage", "collisions"); ++ ++ moveFromRoot(builder, "falling-block-height-nerf", "fixes"); ++ moveFromRoot(builder, "fix-items-merging-through-walls", "fixes"); ++ moveFromRoot(builder, "prevent-tnt-from-moving-in-water", "fixes"); ++ moveFromRoot(builder, "remove-corrupt-tile-entities", "fixes"); ++ moveFromRoot(builder, "split-overstacked-loot", "fixes"); ++ moveFromRoot(builder, "tnt-entity-height-nerf", "fixes"); ++ moveFromGameMechanics(builder, "disable-unloaded-chunk-enderpearl-exploit", "fixes"); ++ moveFromGameMechanics(builder, "fix-curing-zombie-villager-discount-exploit", "fixes"); ++ ++ builder.addAction(path("fishing-time-range", "MaximumTicks"), TransformAction.rename("maximum")); ++ builder.addAction(path("fishing-time-range", "MinimumTicks"), TransformAction.rename("minimum")); ++ ++ builder.addAction(path("generator-settings", "flat-bedrock"), (path, value) -> new Object[]{"environment", "generate-flat-bedrock"}); ++ builder.addAction(path("generator-settings"), TransformAction.remove()); ++ ++ builder.addAction(path("game-mechanics", ConfigurationTransformation.WILDCARD_OBJECT), (path, value) -> new Object[]{"misc", path.array()[1]}); ++ builder.addAction(path("game-mechanics"), TransformAction.remove()); ++ ++ builder.addAction(path("feature-seeds", ConfigurationTransformation.WILDCARD_OBJECT), (path, value) -> { ++ final String key = path.array()[path.size() - 1].toString(); ++ if (!key.equals("generate-random-seeds-for-all")) { ++ return new Object[]{"feature-seeds", "features", key}; ++ } ++ return null; ++ }); ++ ++ builder.addAction(path("duplicate-uuid-resolver"), (path, value) -> { ++ final WorldConfiguration.Entities.Spawning.DuplicateUUID.DuplicateUUIDMode duplicateUUIDMode = switch (value.require(String.class)) { ++ case "regen", "regenerate", "saferegen", "saferegenerate" -> WorldConfiguration.Entities.Spawning.DuplicateUUID.DuplicateUUIDMode.SAFE_REGEN; ++ case "remove", "delete" -> WorldConfiguration.Entities.Spawning.DuplicateUUID.DuplicateUUIDMode.DELETE; ++ case "silent", "nothing" -> WorldConfiguration.Entities.Spawning.DuplicateUUID.DuplicateUUIDMode.NOTHING; ++ default -> WorldConfiguration.Entities.Spawning.DuplicateUUID.DuplicateUUIDMode.WARN; ++ }; ++ value.set(duplicateUUIDMode); ++ return new Object[]{"entities", "spawning", "duplicate-uuid", "mode"}; ++ }); ++ ++ moveToMisc(builder, "light-queue-size"); ++ moveToMisc(builder, "update-pathfinding-on-block-update"); ++ moveToMisc(builder, "show-sign-click-command-failure-msgs-to-player"); ++ moveToMisc(builder, "redstone-implementation"); ++ moveToMisc(builder, "max-leash-distance"); ++ ++ return builder.build(); ++ } ++ ++ private static void moveToMisc(final ConfigurationTransformation.Builder builder, String... key) { ++ moveFromRootAndRename(builder, path((Object[]) key), key[key.length - 1], "misc"); ++ } ++ ++ private static void moveFromGameMechanics(final ConfigurationTransformation.Builder builder, final String key, final String... parents) { ++ moveFromGameMechanicsAndRename(builder, key, key, parents); ++ } ++ ++ private static void moveFromGameMechanicsAndRename(final ConfigurationTransformation.Builder builder, final String oldKey, final String newKey, final String... parents) { ++ moveFromRootAndRename(builder, path("game-mechanics", oldKey), newKey, parents); ++ } ++} +diff --git a/src/main/java/io/papermc/paper/configuration/type/BooleanOrDefault.java b/src/main/java/io/papermc/paper/configuration/type/BooleanOrDefault.java +new file mode 100644 +index 0000000000000000000000000000000000000000..3e422b74a377fa3edaf82dd960e7449c998c2912 +--- /dev/null ++++ b/src/main/java/io/papermc/paper/configuration/type/BooleanOrDefault.java +@@ -0,0 +1,53 @@ ++package io.papermc.paper.configuration.type; ++ ++import org.apache.commons.lang3.BooleanUtils; ++import org.checkerframework.checker.nullness.qual.Nullable; ++import org.spongepowered.configurate.serialize.ScalarSerializer; ++import org.spongepowered.configurate.serialize.SerializationException; ++ ++import java.lang.reflect.Type; ++import java.util.Locale; ++import java.util.function.Predicate; ++ ++public record BooleanOrDefault(@Nullable Boolean value) { ++ private static final String DEFAULT_VALUE = "default"; ++ public static final BooleanOrDefault USE_DEFAULT = new BooleanOrDefault(null); ++ public static final ScalarSerializer SERIALIZER = new Serializer(); ++ ++ public boolean or(boolean fallback) { ++ return this.value != null && this.value; ++ } ++ ++ private static final class Serializer extends ScalarSerializer { ++ Serializer() { ++ super(BooleanOrDefault.class); ++ } ++ ++ @Override ++ public BooleanOrDefault deserialize(Type type, Object obj) throws SerializationException { ++ if (obj instanceof String string) { ++ if (DEFAULT_VALUE.equalsIgnoreCase(string)) { ++ return USE_DEFAULT; ++ } ++ try { ++ return new BooleanOrDefault(BooleanUtils.toBoolean(string.toLowerCase(Locale.ENGLISH), "true", "false")); ++ } catch (IllegalArgumentException ex) { ++ throw new SerializationException(BooleanOrDefault.class, obj + "(" + type + ") is not a boolean or '" + DEFAULT_VALUE + "'", ex); ++ } ++ } else if (obj instanceof Boolean bool) { ++ return new BooleanOrDefault(bool); ++ } ++ throw new SerializationException(obj + "(" + type + ") is not a boolean or '" + DEFAULT_VALUE + "'"); ++ } ++ ++ @Override ++ protected Object serialize(BooleanOrDefault item, Predicate> typeSupported) { ++ final @Nullable Boolean value = item.value; ++ if (value != null) { ++ return value.toString(); ++ } else { ++ return DEFAULT_VALUE; ++ } ++ } ++ } ++} +diff --git a/src/main/java/io/papermc/paper/configuration/type/DoubleOrDefault.java b/src/main/java/io/papermc/paper/configuration/type/DoubleOrDefault.java +new file mode 100644 +index 0000000000000000000000000000000000000000..37aa2873eb7fbfb9cfbf890e5ca2a3965f8d612f +--- /dev/null ++++ b/src/main/java/io/papermc/paper/configuration/type/DoubleOrDefault.java +@@ -0,0 +1,64 @@ ++package io.papermc.paper.configuration.type; ++ ++import org.apache.commons.lang3.math.NumberUtils; ++import org.spongepowered.configurate.serialize.ScalarSerializer; ++import org.spongepowered.configurate.serialize.SerializationException; ++ ++import java.lang.reflect.Type; ++import java.util.OptionalDouble; ++import java.util.function.Predicate; ++ ++public final class DoubleOrDefault { ++ private static final String DEFAULT_VALUE = "default"; ++ public static final DoubleOrDefault USE_DEFAULT = new DoubleOrDefault(OptionalDouble.empty()); ++ public static final ScalarSerializer SERIALIZER = new Serializer(); ++ ++ private OptionalDouble value; ++ ++ public DoubleOrDefault(final OptionalDouble value) { ++ this.value = value; ++ } ++ ++ public OptionalDouble value() { ++ return this.value; ++ } ++ ++ public void value(final OptionalDouble value) { ++ this.value = value; ++ } ++ ++ public double or(final double fallback) { ++ return this.value.orElse(fallback); ++ } ++ ++ private static final class Serializer extends ScalarSerializer { ++ Serializer() { ++ super(DoubleOrDefault.class); ++ } ++ ++ @Override ++ public DoubleOrDefault deserialize(final Type type, final Object obj) throws SerializationException { ++ if (obj instanceof String string) { ++ if (DEFAULT_VALUE.equalsIgnoreCase(string)) { ++ return USE_DEFAULT; ++ } ++ if (NumberUtils.isParsable(string)) { ++ return new DoubleOrDefault(OptionalDouble.of(Double.parseDouble(string))); ++ } ++ } else if (obj instanceof Double num) { ++ return new DoubleOrDefault(OptionalDouble.of(num)); ++ } ++ throw new SerializationException(obj + " is of an unexpected type " + type); ++ } ++ ++ @Override ++ protected Object serialize(final DoubleOrDefault item, final Predicate> typeSupported) { ++ final OptionalDouble value = item.value(); ++ if (value.isPresent()) { ++ return value.getAsDouble(); ++ } else { ++ return DEFAULT_VALUE; ++ } ++ } ++ } ++} +diff --git a/src/main/java/io/papermc/paper/configuration/type/Duration.java b/src/main/java/io/papermc/paper/configuration/type/Duration.java +new file mode 100644 +index 0000000000000000000000000000000000000000..fdc906b106a5c6fff2675d5399650f5b793deb70 +--- /dev/null ++++ b/src/main/java/io/papermc/paper/configuration/type/Duration.java +@@ -0,0 +1,97 @@ ++package io.papermc.paper.configuration.type; ++ ++import org.checkerframework.checker.nullness.qual.Nullable; ++import org.spongepowered.configurate.serialize.ScalarSerializer; ++import org.spongepowered.configurate.serialize.SerializationException; ++ ++import java.lang.reflect.Type; ++import java.util.Objects; ++import java.util.function.Predicate; ++import java.util.regex.Pattern; ++ ++public final class Duration { ++ + private static final Pattern SPACE = Pattern.compile(" "); + private static final Pattern NOT_NUMERIC = Pattern.compile("[^-\\d.]"); -+ public static int getSeconds(String str) { ++ public static final Serializer SERIALIZER = new Serializer(); ++ ++ private final long seconds; ++ private final String value; ++ ++ private Duration(String value) { ++ this.value = value; ++ this.seconds = getSeconds(value); ++ } ++ ++ public long seconds() { ++ return this.seconds; ++ } ++ ++ public long ticks() { ++ return this.seconds * 20; ++ } ++ ++ public String value() { ++ return this.value; ++ } ++ ++ @Override ++ public boolean equals(@Nullable Object o) { ++ if (this == o) return true; ++ if (o == null || getClass() != o.getClass()) return false; ++ Duration duration = (Duration) o; ++ return seconds == duration.seconds && this.value.equals(duration.value); ++ } ++ ++ @Override ++ public int hashCode() { ++ return Objects.hash(this.seconds, this.value); ++ } ++ ++ @Override ++ public String toString() { ++ return "Duration{" + ++ "seconds=" + this.seconds + ++ ", value='" + this.value + '\'' + ++ '}'; ++ } ++ ++ public static Duration of(String time) { ++ return new Duration(time); ++ } ++ ++ private static int getSeconds(String str) { + str = SPACE.matcher(str).replaceAll(""); + final char unit = str.charAt(str.length() - 1); + str = NOT_NUMERIC.matcher(str).replaceAll(""); @@ -146,355 +3039,508 @@ index 0000000000000000000000000000000000000000..80a3d5890aab91e6a48d573414018785 + return (int) num; + } + -+ protected static String timeSummary(int seconds) { -+ String time = ""; -+ -+ if (seconds > 60 * 60 * 24) { -+ time += TimeUnit.SECONDS.toDays(seconds) + "d"; -+ seconds %= 60 * 60 * 24; ++ private static final class Serializer extends ScalarSerializer { ++ private Serializer() { ++ super(Duration.class); + } + -+ if (seconds > 60 * 60) { -+ time += TimeUnit.SECONDS.toHours(seconds) + "h"; -+ seconds %= 60 * 60; ++ @Override ++ public Duration deserialize(Type type, Object obj) throws SerializationException { ++ return new Duration(obj.toString()); + } + -+ if (seconds > 0) { -+ time += TimeUnit.SECONDS.toMinutes(seconds) + "m"; ++ @Override ++ protected Object serialize(Duration item, Predicate> typeSupported) { ++ return item.value(); + } -+ return time; -+ } -+ -+ private static void set(String path, Object val) { -+ config.set(path, val); -+ } -+ -+ private static boolean getBoolean(String path, boolean def) { -+ config.addDefault(path, def); -+ return config.getBoolean(path, config.getBoolean(path)); -+ } -+ -+ private static double getDouble(String path, double def) { -+ config.addDefault(path, def); -+ return config.getDouble(path, config.getDouble(path)); -+ } -+ -+ private static float getFloat(String path, float def) { -+ // TODO: Figure out why getFloat() always returns the default value. -+ return (float) getDouble(path, (double) def); -+ } -+ -+ private static int getInt(String path, int def) { -+ config.addDefault(path, def); -+ return config.getInt(path, config.getInt(path)); -+ } -+ -+ private static List getList(String path, T def) { -+ config.addDefault(path, def); -+ return (List) config.getList(path, config.getList(path)); -+ } -+ -+ private static String getString(String path, String def) { -+ config.addDefault(path, def); -+ return config.getString(path, config.getString(path)); + } +} -diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java +diff --git a/src/main/java/io/papermc/paper/configuration/type/IntOrDefault.java b/src/main/java/io/papermc/paper/configuration/type/IntOrDefault.java new file mode 100644 -index 0000000000000000000000000000000000000000..0853ff7641103447f458b2dc08076c27e3937074 +index 0000000000000000000000000000000000000000..18a77c5694dc9739c7e2b52deb7dbfebb01b6c38 --- /dev/null -+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -@@ -0,0 +1,104 @@ -+package com.destroystokyo.paper; ++++ b/src/main/java/io/papermc/paper/configuration/type/IntOrDefault.java +@@ -0,0 +1,49 @@ ++package io.papermc.paper.configuration.type; + -+import java.util.List; ++import java.lang.reflect.Type; ++import java.util.OptionalInt; ++import java.util.function.Predicate; ++import org.apache.commons.lang3.math.NumberUtils; ++import org.spongepowered.configurate.serialize.ScalarSerializer; ++import org.spongepowered.configurate.serialize.SerializationException; ++ ++public record IntOrDefault(OptionalInt value) { ++ private static final String DEFAULT_VALUE = "default"; ++ public static final IntOrDefault USE_DEFAULT = new IntOrDefault(OptionalInt.empty()); ++ public static final ScalarSerializer SERIALIZER = new Serializer(); ++ ++ public int or(final int fallback) { ++ return this.value.orElse(fallback); ++ } ++ ++ private static final class Serializer extends ScalarSerializer { ++ Serializer() { ++ super(IntOrDefault.class); ++ } ++ ++ @Override ++ public IntOrDefault deserialize(final Type type, final Object obj) throws SerializationException { ++ if (obj instanceof String string) { ++ if (DEFAULT_VALUE.equalsIgnoreCase(string)) { ++ return USE_DEFAULT; ++ } ++ if (NumberUtils.isParsable(string)) { ++ return new IntOrDefault(OptionalInt.of(Integer.parseInt(string))); ++ } ++ } else if (obj instanceof Integer num) { ++ return new IntOrDefault(OptionalInt.of(num)); ++ } ++ throw new SerializationException(obj + "(" + type + ") is not a integer or '" + DEFAULT_VALUE + "'"); ++ } ++ ++ @Override ++ protected Object serialize(final IntOrDefault item, final Predicate> typeSupported) { ++ final OptionalInt value = item.value(); ++ if (value.isPresent()) { ++ return value.getAsInt(); ++ } else { ++ return DEFAULT_VALUE; ++ } ++ } ++ } ++} +diff --git a/src/main/java/io/papermc/paper/configuration/type/fallback/ArrowDespawnRate.java b/src/main/java/io/papermc/paper/configuration/type/fallback/ArrowDespawnRate.java +new file mode 100644 +index 0000000000000000000000000000000000000000..24763d3d270c29c95e0b3e85111145234f660a62 +--- /dev/null ++++ b/src/main/java/io/papermc/paper/configuration/type/fallback/ArrowDespawnRate.java +@@ -0,0 +1,38 @@ ++package io.papermc.paper.configuration.type.fallback; + -+import java.util.stream.Collectors; -+import org.bukkit.Bukkit; -+import org.bukkit.configuration.file.YamlConfiguration; +import org.spigotmc.SpigotWorldConfig; ++import org.spongepowered.configurate.serialize.SerializationException; + -+import static com.destroystokyo.paper.PaperConfig.log; -+import static com.destroystokyo.paper.PaperConfig.logError; -+import static com.destroystokyo.paper.PaperConfig.saveConfig; ++import java.util.Map; ++import java.util.OptionalInt; ++import java.util.Set; + -+public class PaperWorldConfig { ++public class ArrowDespawnRate extends FallbackValue.Int { + -+ private final String worldName; -+ private final SpigotWorldConfig spigotConfig; -+ private YamlConfiguration config; -+ private boolean verbose; -+ -+ public PaperWorldConfig(String worldName, SpigotWorldConfig spigotConfig) { -+ this.worldName = worldName; -+ this.spigotConfig = spigotConfig; -+ this.config = PaperConfig.config; -+ init(); ++ ArrowDespawnRate(Map, Object> context, Object value) throws SerializationException { ++ super(context, fromObject(value)); + } + -+ public void init() { -+ this.config = PaperConfig.config; // grab updated reference -+ log("-------- World Settings For [" + worldName + "] --------"); -+ PaperConfig.readConfig(PaperWorldConfig.class, this); ++ private ArrowDespawnRate(Map, Object> context) { ++ super(context, OptionalInt.empty()); + } + -+ private void set(String path, Object val) { -+ config.set("world-settings.default." + path, val); -+ if (config.get("world-settings." + worldName + "." + path) != null) { -+ config.set("world-settings." + worldName + "." + path, val); ++ @Override ++ protected OptionalInt process(int value) { ++ return Util.negToDef(value); ++ } ++ ++ @Override ++ public Set> required() { ++ return Set.of(FallbackValue.SPIGOT_WORLD_CONFIG); ++ } ++ ++ @Override ++ protected int fallback() { ++ return this.get(FallbackValue.SPIGOT_WORLD_CONFIG).arrowDespawnRate; ++ } ++ ++ public static ArrowDespawnRate def(SpigotWorldConfig spigotConfig) { ++ return new ArrowDespawnRate(FallbackValue.SPIGOT_WORLD_CONFIG.singleton(spigotConfig)); ++ } ++} +diff --git a/src/main/java/io/papermc/paper/configuration/type/fallback/AutosavePeriod.java b/src/main/java/io/papermc/paper/configuration/type/fallback/AutosavePeriod.java +new file mode 100644 +index 0000000000000000000000000000000000000000..0f2765b2edc63c11ba3c57ff55c536054826a995 +--- /dev/null ++++ b/src/main/java/io/papermc/paper/configuration/type/fallback/AutosavePeriod.java +@@ -0,0 +1,39 @@ ++package io.papermc.paper.configuration.type.fallback; ++ ++import net.minecraft.server.MinecraftServer; ++import org.spongepowered.configurate.serialize.SerializationException; ++ ++import java.util.Map; ++import java.util.OptionalInt; ++import java.util.Set; ++import java.util.function.Supplier; ++ ++public class AutosavePeriod extends FallbackValue.Int { ++ ++ AutosavePeriod(Map, Object> contextMap, Object value) throws SerializationException { ++ super(contextMap, fromObject(value)); ++ } ++ ++ private AutosavePeriod(Map, Object> contextMap) { ++ super(contextMap, OptionalInt.empty()); ++ } ++ ++ @Override ++ protected OptionalInt process(int value) { ++ return Util.negToDef(value); ++ } ++ ++ @Override ++ protected Set> required() { ++ return Set.of(FallbackValue.MINECRAFT_SERVER); ++ } ++ ++ @Override ++ protected int fallback() { ++ return this.get(FallbackValue.MINECRAFT_SERVER).get().autosavePeriod; ++ } ++ ++ public static AutosavePeriod def() { ++ return new AutosavePeriod(FallbackValue.MINECRAFT_SERVER.singleton(MinecraftServer::getServer)); ++ } ++} +diff --git a/src/main/java/io/papermc/paper/configuration/type/fallback/FallbackValue.java b/src/main/java/io/papermc/paper/configuration/type/fallback/FallbackValue.java +new file mode 100644 +index 0000000000000000000000000000000000000000..d279ef02a44e2a8fc971cbf8ec816444271ccfc9 +--- /dev/null ++++ b/src/main/java/io/papermc/paper/configuration/type/fallback/FallbackValue.java +@@ -0,0 +1,101 @@ ++package io.papermc.paper.configuration.type.fallback; ++ ++import com.google.common.base.Preconditions; ++import net.minecraft.server.MinecraftServer; ++import org.apache.commons.lang3.math.NumberUtils; ++import org.spigotmc.SpigotWorldConfig; ++import org.spongepowered.configurate.serialize.SerializationException; ++ ++import java.util.Map; ++import java.util.Objects; ++import java.util.OptionalInt; ++import java.util.Set; ++import java.util.function.Supplier; ++ ++public sealed abstract class FallbackValue permits FallbackValue.Int { ++ ++ private static final String DEFAULT_VALUE = "default"; ++ static final ContextKey SPIGOT_WORLD_CONFIG = new ContextKey<>("SpigotWorldConfig"); ++ static final ContextKey> MINECRAFT_SERVER = new ContextKey<>("MinecraftServer"); ++ ++ private final Map, Object> contextMap; ++ ++ protected FallbackValue(Map, Object> contextMap) { ++ for (ContextKey contextKey : this.required()) { ++ Preconditions.checkArgument(contextMap.containsKey(contextKey), contextMap + " is missing " + contextKey); ++ } ++ this.contextMap = contextMap; ++ } ++ ++ protected abstract String serialize(); ++ ++ protected abstract Set> required(); ++ ++ @SuppressWarnings("unchecked") ++ protected T get(ContextKey contextKey) { ++ return (T) Objects.requireNonNull(this.contextMap.get(contextKey), "Missing " + contextKey); ++ } ++ ++ public non-sealed abstract static class Int extends FallbackValue { ++ ++ private final OptionalInt value; ++ ++ Int(Map, Object> contextMap, OptionalInt value) { ++ super(contextMap); ++ if (value.isEmpty()) { ++ this.value = value; ++ } else { ++ this.value = this.process(value.getAsInt()); ++ } ++ } ++ ++ public int value() { ++ return value.orElseGet(this::fallback); ++ } ++ ++ @Override ++ protected final String serialize() { ++ return value.isPresent() ? String.valueOf(this.value.getAsInt()) : DEFAULT_VALUE; ++ } ++ ++ protected OptionalInt process(int value) { ++ return OptionalInt.of(value); ++ } ++ ++ protected abstract int fallback(); ++ ++ protected static OptionalInt fromObject(Object obj) throws SerializationException { ++ if (obj instanceof OptionalInt optionalInt) { ++ return optionalInt; ++ } else if (obj instanceof String string) { ++ if (DEFAULT_VALUE.equalsIgnoreCase(string)) { ++ return OptionalInt.empty(); ++ } ++ if (NumberUtils.isParsable(string)) { ++ return OptionalInt.of(Integer.parseInt(string)); ++ } ++ } else if (obj instanceof Integer num) { ++ return OptionalInt.of(num); ++ } ++ throw new SerializationException(obj + " is not a integer or '" + DEFAULT_VALUE + "'"); + } + } + -+ private void remove(String path) { -+ config.addDefault("world-settings.default." + path, null); -+ set(path, null); -+ } ++ static class ContextKey { + -+ public void removeOldValues() { -+ boolean needsSave = false; ++ private final String name; + -+ if (needsSave) { -+ saveConfig(); ++ ContextKey(String name) { ++ this.name = name; ++ } ++ ++ @Override ++ public String toString() { ++ return this.name; ++ } ++ ++ Map, Object> singleton(T value) { ++ return Map.of(this, value); + } + } ++} +diff --git a/src/main/java/io/papermc/paper/configuration/type/fallback/FallbackValueSerializer.java b/src/main/java/io/papermc/paper/configuration/type/fallback/FallbackValueSerializer.java +new file mode 100644 +index 0000000000000000000000000000000000000000..8d0fcd038e12c70a3a5aaf2669452589d9055255 +--- /dev/null ++++ b/src/main/java/io/papermc/paper/configuration/type/fallback/FallbackValueSerializer.java +@@ -0,0 +1,55 @@ ++package io.papermc.paper.configuration.type.fallback; + -+ private boolean getBoolean(String path, boolean def) { -+ return this.getBoolean(path, def, true); ++import net.minecraft.server.MinecraftServer; ++import org.checkerframework.checker.nullness.qual.Nullable; ++import org.spigotmc.SpigotWorldConfig; ++import org.spongepowered.configurate.serialize.ScalarSerializer; ++import org.spongepowered.configurate.serialize.SerializationException; ++ ++import java.lang.reflect.Type; ++import java.util.HashMap; ++import java.util.Map; ++import java.util.function.Predicate; ++import java.util.function.Supplier; ++ ++import static io.leangen.geantyref.GenericTypeReflector.erase; ++ ++public class FallbackValueSerializer extends ScalarSerializer { ++ ++ private static final Map, FallbackCreator> REGISTRY = new HashMap<>(); ++ ++ static { ++ REGISTRY.put(ArrowDespawnRate.class, ArrowDespawnRate::new); ++ REGISTRY.put(AutosavePeriod.class, AutosavePeriod::new); + } -+ private boolean getBoolean(String path, boolean def, boolean setDefault) { -+ if (setDefault) { -+ config.addDefault("world-settings.default." + path, def); ++ ++ FallbackValueSerializer(Map, Object> contextMap) { ++ super(FallbackValue.class); ++ this.contextMap = contextMap; ++ } ++ ++ @FunctionalInterface ++ private interface FallbackCreator { ++ T create(Map, Object> context, Object value) throws SerializationException; ++ } ++ ++ private final Map, Object> contextMap; ++ ++ @Override ++ public FallbackValue deserialize(Type type, Object obj) throws SerializationException { ++ final @Nullable FallbackCreator creator = REGISTRY.get(erase(type)); ++ if (creator == null) { ++ throw new SerializationException(type + " does not have a FallbackCreator registered"); + } -+ return config.getBoolean("world-settings." + worldName + "." + path, config.getBoolean("world-settings.default." + path, def)); ++ return creator.create(this.contextMap, obj); + } + -+ private double getDouble(String path, double def) { -+ config.addDefault("world-settings.default." + path, def); -+ return config.getDouble("world-settings." + worldName + "." + path, config.getDouble("world-settings.default." + path)); ++ @Override ++ protected Object serialize(FallbackValue item, Predicate> typeSupported) { ++ return item.serialize(); + } + -+ private int getInt(String path, int def) { -+ return getInt(path, def, true); ++ public static FallbackValueSerializer create(SpigotWorldConfig config, Supplier server) { ++ return new FallbackValueSerializer(Map.of(FallbackValue.SPIGOT_WORLD_CONFIG, config, FallbackValue.MINECRAFT_SERVER, server)); + } ++} +diff --git a/src/main/java/io/papermc/paper/configuration/type/fallback/Util.java b/src/main/java/io/papermc/paper/configuration/type/fallback/Util.java +new file mode 100644 +index 0000000000000000000000000000000000000000..70cc7b45e7355f6c8476a74a070f1266e4cca189 +--- /dev/null ++++ b/src/main/java/io/papermc/paper/configuration/type/fallback/Util.java +@@ -0,0 +1,10 @@ ++package io.papermc.paper.configuration.type.fallback; + -+ private int getInt(String path, int def, boolean setDefault) { -+ if (setDefault) { -+ config.addDefault("world-settings.default." + path, def); -+ } -+ return config.getInt("world-settings." + worldName + "." + path, config.getInt("world-settings.default." + path, def)); -+ } ++import java.util.OptionalInt; + -+ private long getLong(String path, long def) { -+ config.addDefault("world-settings.default." + path, def); -+ return config.getLong("world-settings." + worldName + "." + path, config.getLong("world-settings.default." + path)); -+ } ++final class Util { + -+ private float getFloat(String path, float def) { -+ // TODO: Figure out why getFloat() always returns the default value. -+ return (float) getDouble(path, (double) def); -+ } -+ -+ private List getList(String path, List def) { -+ config.addDefault("world-settings.default." + path, def); -+ return (List) config.getList("world-settings." + worldName + "." + path, config.getList("world-settings.default." + path)); -+ } -+ -+ private String getString(String path, String def) { -+ config.addDefault("world-settings.default." + path, def); -+ return config.getString("world-settings." + worldName + "." + path, config.getString("world-settings.default." + path)); -+ } -+ -+ private > List getEnumList(String path, List def, Class type) { -+ config.addDefault("world-settings.default." + path, def.stream().map(Enum::name).collect(Collectors.toList())); -+ return ((List) (config.getList("world-settings." + worldName + "." + path, config.getList("world-settings.default." + path)))).stream().map(s -> Enum.valueOf(type, s)).collect(Collectors.toList()); ++ static OptionalInt negToDef(int value) { ++ return value < 0 ? OptionalInt.empty() : OptionalInt.of(value); + } +} diff --git a/src/main/java/net/minecraft/server/Main.java b/src/main/java/net/minecraft/server/Main.java -index 853e7c2019f5147e9681e95a82eaef0825b6341e..97dc1d188a57b9f499c9cdc2ec54535af380e5cb 100644 +index 853e7c2019f5147e9681e95a82eaef0825b6341e..a48a12a31a3d09a9373b688dcc093035f8f8a300 100644 --- a/src/main/java/net/minecraft/server/Main.java +++ b/src/main/java/net/minecraft/server/Main.java -@@ -110,6 +110,12 @@ public class Main { +@@ -110,6 +110,11 @@ public class Main { DedicatedServerSettings dedicatedserversettings = new DedicatedServerSettings(optionset); // CraftBukkit - CLI argument support dedicatedserversettings.forceSave(); + // Paper start - load config files for access below if needed -+ org.bukkit.configuration.file.YamlConfiguration bukkitConfiguration = loadConfigFile((File) optionset.valueOf("bukkit-settings")); -+ org.bukkit.configuration.file.YamlConfiguration spigotConfiguration = loadConfigFile((File) optionset.valueOf("spigot-settings")); -+ org.bukkit.configuration.file.YamlConfiguration paperConfiguration = loadConfigFile((File) optionset.valueOf("paper-settings")); ++ org.bukkit.configuration.file.YamlConfiguration bukkitConfiguration = io.papermc.paper.configuration.PaperConfigurations.loadLegacyConfigFile((File) optionset.valueOf("bukkit-settings")); ++ org.bukkit.configuration.file.YamlConfiguration spigotConfiguration = io.papermc.paper.configuration.PaperConfigurations.loadLegacyConfigFile((File) optionset.valueOf("spigot-settings")); + // Paper end + Path path1 = Paths.get("eula.txt"); Eula eula = new Eula(path1); -@@ -280,6 +286,20 @@ public class Main { +@@ -133,7 +138,7 @@ public class Main { + } - } - -+ // Paper start - load config files -+ private static org.bukkit.configuration.file.YamlConfiguration loadConfigFile(File configFile) throws Exception { -+ org.bukkit.configuration.file.YamlConfiguration config = new org.bukkit.configuration.file.YamlConfiguration(); -+ if (configFile.exists()) { -+ try { -+ config.load(configFile); -+ } catch (Exception ex) { -+ throw new Exception("Failed to load configuration file: " + configFile.getName(), ex); -+ } -+ } -+ return config; -+ } -+ // Paper end -+ - public static void forceUpgrade(LevelStorageSource.LevelStorageAccess session, DataFixer dataFixer, boolean eraseCache, BooleanSupplier continueCheck, WorldGenSettings generatorOptions) { - Main.LOGGER.info("Forcing world upgrade! {}", session.getLevelId()); // CraftBukkit - WorldUpgrader worldupgrader = new WorldUpgrader(session, dataFixer, generatorOptions, eraseCache); + File file = (File) optionset.valueOf("universe"); // CraftBukkit +- Services services = Services.create(new YggdrasilAuthenticationService(Proxy.NO_PROXY), file); ++ Services services = Services.create(new YggdrasilAuthenticationService(Proxy.NO_PROXY), file, optionset); // Paper + // CraftBukkit start + String s = (String) Optional.ofNullable((String) optionset.valueOf("world")).orElse(dedicatedserversettings.getProperties().levelName); + LevelStorageSource convertable = LevelStorageSource.createDefault(file.toPath()); diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index 6cc81495d8d09ff1fbb09f2e63a16ec4fa6138ec..e24b27eb8647a90eb83ec0f78f3bb9568161ba9b 100644 +index 6cc81495d8d09ff1fbb09f2e63a16ec4fa6138ec..73662a463fc9d38b39c4c779fcfaa09a4689d704 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java -@@ -569,6 +569,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop S spin(Function serverFactory) { + AtomicReference atomicreference = new AtomicReference(); +@@ -369,6 +370,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop> 4, net.minecraft.util.Mth.floor(entity.getZ()) >> 4)); -+ } -+ // Paper end -+ - public boolean isPositionTicking(long pos) { - ChunkHolder playerchunk = this.getVisibleChunkIfPresent(pos); - -diff --git a/src/main/java/net/minecraft/world/entity/EntityType.java b/src/main/java/net/minecraft/world/entity/EntityType.java -index cdf8020194f2ec1fe7b65b22c8e1f5b1c23eaefa..d14757d30040c3c9030309a8bb4a37e0c9a4d8db 100644 ---- a/src/main/java/net/minecraft/world/entity/EntityType.java -+++ b/src/main/java/net/minecraft/world/entity/EntityType.java -@@ -673,4 +673,10 @@ public class EntityType implements EntityTypeTest { - - T create(EntityType type, Level world); - } -+ -+ // Paper start -+ public static java.util.Set getEntityNameList() { -+ return Registry.ENTITY_TYPE.keySet(); -+ } -+ // Paper end - } +diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java +index 5f7965076b14a694f644bf8fef9ba4f7b7a473ad..2aed985d76cb845c6e55d36d6536bcb2cb6dfa07 100644 +--- a/src/main/java/net/minecraft/server/level/ServerLevel.java ++++ b/src/main/java/net/minecraft/server/level/ServerLevel.java +@@ -225,7 +225,7 @@ public class ServerLevel extends Level implements WorldGenLevel { + public ServerLevel(MinecraftServer minecraftserver, Executor executor, LevelStorageSource.LevelStorageAccess convertable_conversionsession, PrimaryLevelData iworlddataserver, ResourceKey resourcekey, LevelStem worlddimension, ChunkProgressListener worldloadlistener, boolean flag, long i, List list, boolean flag1, org.bukkit.World.Environment env, org.bukkit.generator.ChunkGenerator gen, org.bukkit.generator.BiomeProvider biomeProvider) { + // Holder holder = worlddimension.typeHolder(); // CraftBukkit - decompile error + // Objects.requireNonNull(minecraftserver); // CraftBukkit - decompile error +- super(iworlddataserver, resourcekey, worlddimension.typeHolder(), minecraftserver::getProfiler, false, flag, i, minecraftserver.getMaxChainedNeighborUpdates(), gen, biomeProvider, env); ++ super(iworlddataserver, resourcekey, worlddimension.typeHolder(), minecraftserver::getProfiler, false, flag, i, minecraftserver.getMaxChainedNeighborUpdates(), gen, biomeProvider, env, spigotConfig -> minecraftserver.paperConfigurations.createWorldConfig(convertable_conversionsession.levelDirectory.path(), iworlddataserver.getLevelName(), spigotConfig)); // Paper + 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/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java -index c1194f459414dc6ca9626ab8cec48cb48cdd926b..5576da91821926cdd9c5ef09534deb843986d202 100644 +index c1194f459414dc6ca9626ab8cec48cb48cdd926b..649df119b24dc8c390f45e9f813cf8c37994e0cf 100644 --- a/src/main/java/net/minecraft/world/level/Level.java +++ b/src/main/java/net/minecraft/world/level/Level.java -@@ -150,6 +150,8 @@ public abstract class Level implements LevelAccessor, AutoCloseable { +@@ -149,6 +149,12 @@ public abstract class Level implements LevelAccessor, AutoCloseable { + public final it.unimi.dsi.fastutil.objects.Object2LongOpenHashMap ticksPerSpawnCategory = new it.unimi.dsi.fastutil.objects.Object2LongOpenHashMap<>(); public boolean populating; public final org.spigotmc.SpigotWorldConfig spigotConfig; // Spigot ++ // Paper start ++ private final io.papermc.paper.configuration.WorldConfiguration paperConfig; ++ public io.papermc.paper.configuration.WorldConfiguration paperConfig() { ++ return this.paperConfig; ++ } ++ // Paper end -+ public final com.destroystokyo.paper.PaperWorldConfig paperConfig; // Paper -+ public final SpigotTimings.WorldTimingsHandler timings; // Spigot public static BlockPos lastPhysicsProblem; // Spigot - private org.spigotmc.TickLimiter entityLimiter; -@@ -168,6 +170,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable { +@@ -166,8 +172,9 @@ public abstract class Level implements LevelAccessor, AutoCloseable { - protected Level(WritableLevelData worlddatamutable, ResourceKey resourcekey, 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) { + public abstract ResourceKey getTypeKey(); + +- protected Level(WritableLevelData worlddatamutable, ResourceKey resourcekey, 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) { ++ protected Level(WritableLevelData worlddatamutable, ResourceKey resourcekey, 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) { // Paper this.spigotConfig = new org.spigotmc.SpigotWorldConfig(((net.minecraft.world.level.storage.PrimaryLevelData) worlddatamutable).getLevelName()); // Spigot -+ this.paperConfig = new com.destroystokyo.paper.PaperWorldConfig(((net.minecraft.world.level.storage.PrimaryLevelData) worlddatamutable).getLevelName(), this.spigotConfig); // Paper ++ this.paperConfig = paperWorldConfigCreator.apply(this.spigotConfig); // Paper this.generator = gen; this.world = new CraftWorld((ServerLevel) this, gen, biomeProvider, env); diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -index 1d94c0fbdead83155aefc8d4a16dbcb95b3c9838..cd6ef8cfba7367fec87dd238add23cfd365a5ceb 100644 +index 1d94c0fbdead83155aefc8d4a16dbcb95b3c9838..cb03d577ee25ceba3263febe186f6f668d1c7e7a 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java @@ -861,6 +861,7 @@ public final class CraftServer implements Server { } org.spigotmc.SpigotConfig.init((File) console.options.valueOf("spigot-settings")); // Spigot -+ com.destroystokyo.paper.PaperConfig.init((File) console.options.valueOf("paper-settings")); // Paper ++ this.console.paperConfigurations.reloadConfigs(this.console); for (ServerLevel world : this.console.getAllLevels()) { world.serverLevelData.setDifficulty(config.difficulty); world.setSpawnSettings(config.spawnMonsters, config.spawnAnimals); -@@ -876,12 +877,14 @@ public final class CraftServer implements Server { - } - } - world.spigotConfig.init(); // Spigot -+ world.paperConfig.init(); // Paper - } - - this.pluginManager.clearPlugins(); +@@ -882,6 +883,7 @@ public final class CraftServer implements Server { this.commandMap.clearCommands(); this.reloadData(); org.spigotmc.SpigotConfig.registerCommands(); // Spigot -+ com.destroystokyo.paper.PaperConfig.registerCommands(); // Paper ++ io.papermc.paper.configuration.PaperConfigurations.registerCommands(this.console); this.overrideAllCommandBlockCommands = this.commandsConfiguration.getStringList("command-block-overrides").contains("*"); this.ignoreVanillaPermissions = this.commandsConfiguration.getBoolean("ignore-vanilla-permissions"); -@@ -2314,4 +2317,35 @@ public final class CraftServer implements Server { - return this.spigot; - } - // Spigot end -+ -+ // Paper start -+ @SuppressWarnings({"rawtypes", "unchecked"}) -+ public static java.nio.file.Path dumpHeap(java.nio.file.Path dir, String name) { -+ try { -+ java.nio.file.Files.createDirectories(dir); -+ -+ javax.management.MBeanServer server = java.lang.management.ManagementFactory.getPlatformMBeanServer(); -+ java.nio.file.Path file; -+ -+ try { -+ Class clazz = Class.forName("openj9.lang.management.OpenJ9DiagnosticsMXBean"); -+ Object openj9Mbean = java.lang.management.ManagementFactory.newPlatformMXBeanProxy(server, "openj9.lang.management:type=OpenJ9Diagnostics", clazz); -+ java.lang.reflect.Method m = clazz.getMethod("triggerDumpToFile", String.class, String.class); -+ file = dir.resolve(name + ".phd"); -+ m.invoke(openj9Mbean, "heap", file.toString()); -+ } catch (ClassNotFoundException e) { -+ Class clazz = Class.forName("com.sun.management.HotSpotDiagnosticMXBean"); -+ Object hotspotMBean = java.lang.management.ManagementFactory.newPlatformMXBeanProxy(server, "com.sun.management:type=HotSpotDiagnostic", clazz); -+ java.lang.reflect.Method m = clazz.getMethod("dumpHeap", String.class, boolean.class); -+ file = dir.resolve(name + ".hprof"); -+ m.invoke(hotspotMBean, file.toString(), true); -+ } -+ -+ return file; -+ } catch (Throwable t) { -+ Bukkit.getLogger().log(Level.SEVERE, "Could not write heap", t); -+ return null; -+ } -+ } -+ // Paper end - } diff --git a/src/main/java/org/bukkit/craftbukkit/Main.java b/src/main/java/org/bukkit/craftbukkit/Main.java index e5008c75054df38356af193fd049110d7d56e2d4..c694c6dfed0b3aa098b1822676e39bd3eb04b45a 100644 --- a/src/main/java/org/bukkit/craftbukkit/Main.java @@ -514,6 +3560,19 @@ index e5008c75054df38356af193fd049110d7d56e2d4..c694c6dfed0b3aa098b1822676e39bd3 } }; +diff --git a/src/main/java/org/spigotmc/SpigotConfig.java b/src/main/java/org/spigotmc/SpigotConfig.java +index a96cb7a5f7c94cd9a46b31cf8ec90b544221557b..7c35d86eac0d69ba4be48faf364fd6dc84fa7e87 100644 +--- a/src/main/java/org/spigotmc/SpigotConfig.java ++++ b/src/main/java/org/spigotmc/SpigotConfig.java +@@ -96,7 +96,7 @@ public class SpigotConfig + } + } + +- static void readConfig(Class clazz, Object instance) ++ public static void readConfig(Class clazz, Object instance) // Paper - package-private -> public + { + for ( Method method : clazz.getDeclaredMethods() ) + { diff --git a/src/main/java/org/spigotmc/SpigotWorldConfig.java b/src/main/java/org/spigotmc/SpigotWorldConfig.java index a04da0a7d690fe3fcf10810b4e8c92a8ae027b86..feef74e3a6d50344245c4a61ece5b2194af1072f 100644 --- a/src/main/java/org/spigotmc/SpigotWorldConfig.java @@ -535,3 +3594,41 @@ index a04da0a7d690fe3fcf10810b4e8c92a8ae027b86..feef74e3a6d50344245c4a61ece5b219 } public List getList(String path, T def) +diff --git a/src/test/java/io/papermc/paper/configuration/GlobalConfigTestingBase.java b/src/test/java/io/papermc/paper/configuration/GlobalConfigTestingBase.java +new file mode 100644 +index 0000000000000000000000000000000000000000..0396589795da1f83ddf62426236dde9a3afa1376 +--- /dev/null ++++ b/src/test/java/io/papermc/paper/configuration/GlobalConfigTestingBase.java +@@ -0,0 +1,20 @@ ++package io.papermc.paper.configuration; ++ ++import org.spongepowered.configurate.ConfigurationNode; ++import org.spongepowered.configurate.serialize.SerializationException; ++ ++public final class GlobalConfigTestingBase { ++ ++ public static void setupGlobalConfigForTest() { ++ //noinspection ConstantConditions ++ if (GlobalConfiguration.get() == null) { ++ ConfigurationNode node = PaperConfigurations.createForTesting(); ++ try { ++ GlobalConfiguration globalConfiguration = node.require(GlobalConfiguration.class); ++ GlobalConfiguration.set(globalConfiguration); ++ } catch (SerializationException e) { ++ throw new RuntimeException(e); ++ } ++ } ++ } ++} +diff --git a/src/test/java/org/bukkit/support/AbstractTestingBase.java b/src/test/java/org/bukkit/support/AbstractTestingBase.java +index b58962026c739ed06fbe0f702cb2877fbfa7b2e4..7de91b0b669664be3406b77a453d517604170404 100644 +--- a/src/test/java/org/bukkit/support/AbstractTestingBase.java ++++ b/src/test/java/org/bukkit/support/AbstractTestingBase.java +@@ -45,6 +45,7 @@ public abstract class AbstractTestingBase { + + DummyServer.setup(); + DummyEnchantments.setup(); ++ io.papermc.paper.configuration.GlobalConfigTestingBase.setupGlobalConfigForTest(); // Paper + + ImmutableList.Builder builder = ImmutableList.builder(); + for (Material m : Material.values()) { diff --git a/patches/server/0005-MC-Dev-fixes.patch b/patches/server/0005-MC-Dev-fixes.patch index 57ebf7d8be..478d3ead35 100644 --- a/patches/server/0005-MC-Dev-fixes.patch +++ b/patches/server/0005-MC-Dev-fixes.patch @@ -141,10 +141,10 @@ index 82764c462f82163ee49f4e9466f383366cd23b8b..8da1226a6c293abb038d10c7921a77ed }); } diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index e24b27eb8647a90eb83ec0f78f3bb9568161ba9b..46fb83911e353f3682a250e62c4ecd7aceabaff8 100644 +index 73662a463fc9d38b39c4c779fcfaa09a4689d704..415f2191c10c39f8a48e6c9a2d74426ac4bdfb82 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java -@@ -1736,7 +1736,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java -index 5f7965076b14a694f644bf8fef9ba4f7b7a473ad..44f6e5cfdceb30934c2aafa85dc5492677d177d7 100644 +index 2cf12d6429eb46398069d9bfa60ebcc3a840f60f..a0140ea91f51e52174cff43738a9a159c3d24536 100644 --- a/src/main/java/net/minecraft/server/level/ServerLevel.java +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java @@ -289,7 +289,7 @@ public class ServerLevel extends Level implements WorldGenLevel { @@ -67,10 +67,10 @@ index 9998e1c94b72b90dd3ba4bcce1b4b3653b9b1b2b..963ad3ce1ef83888ae1537ff01accdbb this.registryAccess = registryManager; this.structureTemplateManager = structureTemplateManager; diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -index cd6ef8cfba7367fec87dd238add23cfd365a5ceb..daf5dc59a1883570569798630c4991e676e34c1c 100644 +index cb03d577ee25ceba3263febe186f6f668d1c7e7a..036aa7daa097c2ba0f08a1fcc66c2962883ca72f 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -@@ -2249,7 +2249,13 @@ public final class CraftServer implements Server { +@@ -2248,7 +2248,13 @@ public final class CraftServer implements Server { Validate.notNull(key, "NamespacedKey cannot be null"); LootTables registry = this.getServer().getLootTables(); diff --git a/patches/server/0007-MC-Utils.patch b/patches/server/0007-MC-Utils.patch index a187708d75..1f1e7ad13c 100644 --- a/patches/server/0007-MC-Utils.patch +++ b/patches/server/0007-MC-Utils.patch @@ -5016,18 +5016,18 @@ index 0000000000000000000000000000000000000000..9f292deee1b793d52b5774304318e940 + } +} diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index 46fb83911e353f3682a250e62c4ecd7aceabaff8..c763b4d9cc16f8c3ced91ce8656bd238205dedc0 100644 +index 415f2191c10c39f8a48e6c9a2d74426ac4bdfb82..1ad7797dbef61f8e8011ae6db3089939a279071c 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java -@@ -279,6 +279,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop S spin(Function serverFactory) { AtomicReference atomicreference = new AtomicReference(); -@@ -918,6 +919,9 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop> 4, net.minecraft.util.Mth.floor(entity.getZ()) >> 4)); ++ } ++ // Paper end ++ + public boolean isPositionTicking(long pos) { + ChunkHolder playerchunk = this.getVisibleChunkIfPresent(pos); + diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java -index 44f6e5cfdceb30934c2aafa85dc5492677d177d7..501fd02fedf1a47da28d07fd04b63f89368723ce 100644 +index a0140ea91f51e52174cff43738a9a159c3d24536..54bff89aed25ba49bf9fbf01c59efa61e021fd03 100644 --- a/src/main/java/net/minecraft/server/level/ServerLevel.java +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java @@ -166,6 +166,7 @@ import org.bukkit.event.weather.LightningStrikeEvent; @@ -6301,7 +6314,7 @@ index 3c707d6674b2594b09503b959a31c1f4ad3981e6..db61b6b0158a9bcc0e1d735e34fe3671 public BlockState getBlockState(BlockPos pos) { return Blocks.AIR.defaultBlockState(); diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java -index 5576da91821926cdd9c5ef09534deb843986d202..914e42e983d56d9c85b1583f57afab699054f4d6 100644 +index 45191c9d8dfe0c5e94d08f2c3b3fd20fe9903e18..c351e38cc12b5c58a2f85b707a7d04b59a1ef198 100644 --- a/src/main/java/net/minecraft/world/level/Level.java +++ b/src/main/java/net/minecraft/world/level/Level.java @@ -85,6 +85,7 @@ import org.bukkit.craftbukkit.CraftServer; @@ -6312,7 +6325,7 @@ index 5576da91821926cdd9c5ef09534deb843986d202..914e42e983d56d9c85b1583f57afab69 import org.bukkit.craftbukkit.block.data.CraftBlockData; import org.bukkit.craftbukkit.util.CraftSpawnCategory; import org.bukkit.craftbukkit.util.CraftNamespacedKey; -@@ -280,18 +281,51 @@ public abstract class Level implements LevelAccessor, AutoCloseable { +@@ -284,18 +285,51 @@ public abstract class Level implements LevelAccessor, AutoCloseable { return y < -20000000 || y >= 20000000; } @@ -6368,7 +6381,7 @@ index 5576da91821926cdd9c5ef09534deb843986d202..914e42e983d56d9c85b1583f57afab69 ChunkAccess ichunkaccess = this.getChunkSource().getChunk(chunkX, chunkZ, leastStatus, create); if (ichunkaccess == null && create) { -@@ -302,7 +336,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable { +@@ -306,7 +340,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable { } @Override @@ -6377,7 +6390,7 @@ index 5576da91821926cdd9c5ef09534deb843986d202..914e42e983d56d9c85b1583f57afab69 return this.setBlock(pos, state, flags, 512); } -@@ -546,7 +580,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable { +@@ -550,7 +584,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable { if (this.isOutsideBuildHeight(pos)) { return Blocks.VOID_AIR.defaultBlockState(); } else { @@ -7072,7 +7085,7 @@ index d40c0d8be1b0153d62021b8bcb6e8b37fd0acb4e..e38e57b1f9ef27020de35d7ddcb36a66 public void clear() { // Create new array to reset memory usage to initial capacity diff --git a/src/main/java/org/spigotmc/SpigotConfig.java b/src/main/java/org/spigotmc/SpigotConfig.java -index a96cb7a5f7c94cd9a46b31cf8ec90b544221557b..43aa6b0129892b8ab8ec25c16a131541c6607487 100644 +index 8a63098d821b7aacec8529811865e0743d78c021..3dacdbb28db72ecd8ddf82f75d6d19bb386f8df0 100644 --- a/src/main/java/org/spigotmc/SpigotConfig.java +++ b/src/main/java/org/spigotmc/SpigotConfig.java @@ -118,7 +118,11 @@ public class SpigotConfig diff --git a/patches/server/0008-Adventure.patch b/patches/server/0008-Adventure.patch index 42e3dc7f57..5f24691b32 100644 --- a/patches/server/0008-Adventure.patch +++ b/patches/server/0008-Adventure.patch @@ -6,24 +6,6 @@ Subject: [PATCH] Adventure Co-authored-by: zml Co-authored-by: Jake Potrebic -diff --git a/src/main/java/com/destroystokyo/paper/PaperConfig.java b/src/main/java/com/destroystokyo/paper/PaperConfig.java -index 80a3d5890aab91e6a48d5734140187851106bde3..c1eb4201ecb0541c606ef0d05b828ae9c87c8a2c 100644 ---- a/src/main/java/com/destroystokyo/paper/PaperConfig.java -+++ b/src/main/java/com/destroystokyo/paper/PaperConfig.java -@@ -185,4 +185,13 @@ public class PaperConfig { - config.addDefault(path, def); - return config.getString(path, config.getString(path)); - } -+ -+ public static boolean useDisplayNameInQuit = false; -+ private static void useDisplayNameInQuit() { -+ if (version < 21) { -+ boolean oldValue = getBoolean("use-display-name-in-quit-message", useDisplayNameInQuit); -+ set("settings.use-display-name-in-quit-message", oldValue); -+ } -+ useDisplayNameInQuit = getBoolean("settings.use-display-name-in-quit-message", useDisplayNameInQuit); -+ } - } diff --git a/src/main/java/io/papermc/paper/adventure/AdventureComponent.java b/src/main/java/io/papermc/paper/adventure/AdventureComponent.java new file mode 100644 index 0000000000000000000000000000000000000000..07cd02c6f9df00844b808218be2afd793c24b69a @@ -1435,7 +1417,7 @@ index 56996af65ef7478adb90d3b2f4cd3351fc49200b..7002d5f5700570e32ebf0b63e340d87d // CraftBukkit end this.chatVisibility = packet.chatVisibility(); diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index 2cbe0230173ad391fe70b0a31d8999927461b5e6..f5f2a60b0c20d64a7523a4339b14f40e15c62633 100644 +index 2cbe0230173ad391fe70b0a31d8999927461b5e6..56e1886b4cf63fd1f14cd8420ccdba1271cf2d6c 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java @@ -172,6 +172,8 @@ import org.apache.commons.lang3.StringUtils; @@ -1473,7 +1455,7 @@ index 2cbe0230173ad391fe70b0a31d8999927461b5e6..f5f2a60b0c20d64a7523a4339b14f40e return; } - String leaveMessage = ChatFormatting.YELLOW + this.player.getScoreboardName() + " left the game."; -+ net.kyori.adventure.text.Component leaveMessage = net.kyori.adventure.text.Component.translatable("multiplayer.player.left", net.kyori.adventure.text.format.NamedTextColor.YELLOW, com.destroystokyo.paper.PaperConfig.useDisplayNameInQuit ? this.player.getBukkitEntity().displayName() : net.kyori.adventure.text.Component.text(this.player.getScoreboardName())); // Paper - Adventure ++ net.kyori.adventure.text.Component leaveMessage = net.kyori.adventure.text.Component.translatable("multiplayer.player.left", net.kyori.adventure.text.format.NamedTextColor.YELLOW, io.papermc.paper.configuration.GlobalConfiguration.get().messages.useDisplayNameInQuitMessage ? this.player.getBukkitEntity().displayName() : net.kyori.adventure.text.Component.text(this.player.getScoreboardName())); // Paper - Adventure - PlayerKickEvent event = new PlayerKickEvent(this.player.getBukkitEntity(), s, leaveMessage); + PlayerKickEvent event = new PlayerKickEvent(this.player.getBukkitEntity(), reason, leaveMessage); // Paper - Adventure @@ -1599,7 +1581,7 @@ index 8670f3fab7ec2a80d69e5dd3f945fc15aaa1a36f..5d368e34c90fc5191d9ed2352f7aa44c @Override diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java -index 2fc5519020af0f18e93bf11cc0d33f65f1b23b55..821b9c0ba003163195a461dd0bce1fa9ffd0a146 100644 +index 2fc5519020af0f18e93bf11cc0d33f65f1b23b55..9e0c61b63cc402c26ca1306313ca6054efb108b8 100644 --- a/src/main/java/net/minecraft/server/players/PlayerList.java +++ b/src/main/java/net/minecraft/server/players/PlayerList.java @@ -8,6 +8,7 @@ import com.mojang.logging.LogUtils; @@ -1666,7 +1648,7 @@ index 2fc5519020af0f18e93bf11cc0d33f65f1b23b55..821b9c0ba003163195a461dd0bce1fa9 } - PlayerQuitEvent playerQuitEvent = new PlayerQuitEvent(entityplayer.getBukkitEntity(), entityplayer.kickLeaveMessage != null ? entityplayer.kickLeaveMessage : "\u00A7e" + entityplayer.getScoreboardName() + " left the game"); -+ PlayerQuitEvent playerQuitEvent = new PlayerQuitEvent(entityplayer.getBukkitEntity(), net.kyori.adventure.text.Component.translatable("multiplayer.player.left", net.kyori.adventure.text.format.NamedTextColor.YELLOW, com.destroystokyo.paper.PaperConfig.useDisplayNameInQuit ? entityplayer.getBukkitEntity().displayName() : net.kyori.adventure.text.Component.text(entityplayer.getScoreboardName()))); ++ PlayerQuitEvent playerQuitEvent = new PlayerQuitEvent(entityplayer.getBukkitEntity(), net.kyori.adventure.text.Component.translatable("multiplayer.player.left", net.kyori.adventure.text.format.NamedTextColor.YELLOW, io.papermc.paper.configuration.GlobalConfiguration.get().messages.useDisplayNameInQuitMessage ? entityplayer.getBukkitEntity().displayName() : net.kyori.adventure.text.Component.text(entityplayer.getScoreboardName()))); this.cserver.getPluginManager().callEvent(playerQuitEvent); entityplayer.getBukkitEntity().disconnect(playerQuitEvent.getQuitMessage()); @@ -1832,7 +1814,7 @@ index 595b56b2ab9a813ba71399d306117294fa90dc65..3527d40102d512d0e276edc969ea3c18 } collection = icons; diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -index daf5dc59a1883570569798630c4991e676e34c1c..d3d8935bafb2e0773c96c5807ebd23f20de26592 100644 +index 036aa7daa097c2ba0f08a1fcc66c2962883ca72f..f9ddb9835cad1b76eecd639dff8fa29472954421 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java @@ -581,8 +581,10 @@ public final class CraftServer implements Server { @@ -1846,7 +1828,7 @@ index daf5dc59a1883570569798630c4991e676e34c1c..d3d8935bafb2e0773c96c5807ebd23f2 } @Override -@@ -1404,7 +1406,15 @@ public final class CraftServer implements Server { +@@ -1403,7 +1405,15 @@ public final class CraftServer implements Server { return this.configuration.getInt("settings.spawn-radius", -1); } @@ -1862,7 +1844,7 @@ index daf5dc59a1883570569798630c4991e676e34c1c..d3d8935bafb2e0773c96c5807ebd23f2 public String getShutdownMessage() { return this.configuration.getString("settings.shutdown-message"); } -@@ -1562,7 +1572,20 @@ public final class CraftServer implements Server { +@@ -1561,7 +1571,20 @@ public final class CraftServer implements Server { } @Override @@ -1883,7 +1865,7 @@ index daf5dc59a1883570569798630c4991e676e34c1c..d3d8935bafb2e0773c96c5807ebd23f2 Set recipients = new HashSet<>(); for (Permissible permissible : this.getPluginManager().getPermissionSubscriptions(permission)) { if (permissible instanceof CommandSender && permissible.hasPermission(permission)) { -@@ -1570,14 +1593,14 @@ public final class CraftServer implements Server { +@@ -1569,14 +1592,14 @@ public final class CraftServer implements Server { } } @@ -1900,7 +1882,7 @@ index daf5dc59a1883570569798630c4991e676e34c1c..d3d8935bafb2e0773c96c5807ebd23f2 for (CommandSender recipient : recipients) { recipient.sendMessage(message); -@@ -1828,6 +1851,14 @@ public final class CraftServer implements Server { +@@ -1827,6 +1850,14 @@ public final class CraftServer implements Server { return CraftInventoryCreator.INSTANCE.createInventory(owner, type); } @@ -1915,7 +1897,7 @@ index daf5dc59a1883570569798630c4991e676e34c1c..d3d8935bafb2e0773c96c5807ebd23f2 @Override public Inventory createInventory(InventoryHolder owner, InventoryType type, String title) { Validate.isTrue(type.isCreatable(), "Cannot open an inventory of type ", type); -@@ -1840,13 +1871,28 @@ public final class CraftServer implements Server { +@@ -1839,13 +1870,28 @@ public final class CraftServer implements Server { return CraftInventoryCreator.INSTANCE.createInventory(owner, size); } @@ -1944,7 +1926,7 @@ index daf5dc59a1883570569798630c4991e676e34c1c..d3d8935bafb2e0773c96c5807ebd23f2 public Merchant createMerchant(String title) { return new CraftMerchantCustom(title == null ? InventoryType.MERCHANT.getDefaultTitle() : title); } -@@ -1906,6 +1952,12 @@ public final class CraftServer implements Server { +@@ -1905,6 +1951,12 @@ public final class CraftServer implements Server { return Thread.currentThread().equals(console.serverThread) || this.console.hasStopped() || !org.spigotmc.AsyncCatcher.enabled; // All bets are off if we have shut down (e.g. due to watchdog) } @@ -1957,10 +1939,10 @@ index daf5dc59a1883570569798630c4991e676e34c1c..d3d8935bafb2e0773c96c5807ebd23f2 @Override public String getMotd() { return this.console.getMotd(); -@@ -2353,5 +2405,15 @@ public final class CraftServer implements Server { - return null; - } +@@ -2322,4 +2374,15 @@ public final class CraftServer implements Server { + return this.spigot; } + // Spigot end + + // Paper start + private Iterable adventure$audiences; @@ -1971,7 +1953,7 @@ index daf5dc59a1883570569798630c4991e676e34c1c..d3d8935bafb2e0773c96c5807ebd23f2 + } + return this.adventure$audiences; + } - // Paper end ++ // Paper end } diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java index 40421cc8ef25f1bef32a0a5d2f0f25165efe230a..1357bc97801f892e59fc8e89c3cc2d697894ccfb 100644 diff --git a/patches/server/0009-Paper-command.patch b/patches/server/0009-Paper-command.patch index 4d90a3e7c9..9252181e56 100644 --- a/patches/server/0009-Paper-command.patch +++ b/patches/server/0009-Paper-command.patch @@ -6,10 +6,10 @@ Subject: [PATCH] Paper command diff --git a/src/main/java/com/destroystokyo/paper/PaperCommand.java b/src/main/java/com/destroystokyo/paper/PaperCommand.java new file mode 100644 -index 0000000000000000000000000000000000000000..0c7738412ce5c9b8c66e3f1c1e13fcd2a2154195 +index 0000000000000000000000000000000000000000..e75134a6aa92c86aa86430c7603e111280077d16 --- /dev/null +++ b/src/main/java/com/destroystokyo/paper/PaperCommand.java -@@ -0,0 +1,289 @@ +@@ -0,0 +1,286 @@ +package com.destroystokyo.paper; + +import com.google.common.base.Functions; @@ -83,7 +83,7 @@ index 0000000000000000000000000000000000000000..0c7738412ce5c9b8c66e3f1c1e13fcd2 + if (args.length == 2) + return getListMatchingLast(sender, args, "help", "list"); + if (args.length == 3) -+ return getListMatchingLast(sender, args, EntityType.getEntityNameList().stream().map(ResourceLocation::toString).sorted().toArray(String[]::new)); ++ return getListMatchingLast(sender, args, Registry.ENTITY_TYPE.keySet().stream().map(ResourceLocation::toString).sorted().toArray(String[]::new)); + break; + } + return Collections.emptyList(); @@ -188,7 +188,7 @@ index 0000000000000000000000000000000000000000..0c7738412ce5c9b8c66e3f1c1e13fcd2 + filter = args[2]; + } + final String cleanfilter = filter.replace("?", ".?").replace("*", ".*?"); -+ Set names = EntityType.getEntityNameList().stream() ++ Set names = Registry.ENTITY_TYPE.keySet().stream() + .filter(n -> n.toString().matches(cleanfilter)) + .collect(Collectors.toSet()); + @@ -289,13 +289,68 @@ index 0000000000000000000000000000000000000000..0c7738412ce5c9b8c66e3f1c1e13fcd2 + Command.broadcastCommandMessage(sender, text("Please note that this command is not supported and may cause issues.", RED)); + Command.broadcastCommandMessage(sender, text("If you encounter any issues please use the /stop command to restart your server.", RED)); + -+ MinecraftServer console = MinecraftServer.getServer(); -+ com.destroystokyo.paper.PaperConfig.init((File) console.options.valueOf("paper-settings")); -+ for (ServerLevel world : console.getAllLevels()) { -+ world.paperConfig.init(); -+ } -+ console.server.reloadCount++; ++ MinecraftServer server = ((CraftServer) sender.getServer()).getServer(); ++ server.paperConfigurations.reloadConfigs(server); ++ server.server.reloadCount++; + + Command.broadcastCommandMessage(sender, text("Paper config reload complete.", GREEN)); + } +} +diff --git a/src/main/java/io/papermc/paper/configuration/PaperConfigurations.java b/src/main/java/io/papermc/paper/configuration/PaperConfigurations.java +index 6c19825de43b82ba3fe6e44123e7d24748698614..f06f130b2fa703e105f9d49bc755e8374d023f2e 100644 +--- a/src/main/java/io/papermc/paper/configuration/PaperConfigurations.java ++++ b/src/main/java/io/papermc/paper/configuration/PaperConfigurations.java +@@ -1,5 +1,6 @@ + package io.papermc.paper.configuration; + ++import com.destroystokyo.paper.PaperCommand; + import com.google.common.collect.Table; + import com.mojang.logging.LogUtils; + import io.leangen.geantyref.TypeToken; +@@ -283,6 +284,7 @@ public class PaperConfigurations extends Configurations COMMANDS = new HashMap<>(); + static { ++ COMMANDS.put("paper", new PaperCommand("paper")); + } + + public static void registerCommands(final MinecraftServer server) { +diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java +index f9ddb9835cad1b76eecd639dff8fa29472954421..268715e19a6fa7d26510d9d0a8f19b158835b279 100644 +--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java ++++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java +@@ -2376,6 +2376,34 @@ public final class CraftServer implements Server { + // Spigot end + + // Paper start ++ @SuppressWarnings({"rawtypes", "unchecked"}) ++ public static java.nio.file.Path dumpHeap(java.nio.file.Path dir, String name) { ++ try { ++ java.nio.file.Files.createDirectories(dir); ++ ++ javax.management.MBeanServer server = java.lang.management.ManagementFactory.getPlatformMBeanServer(); ++ java.nio.file.Path file; ++ ++ try { ++ Class clazz = Class.forName("openj9.lang.management.OpenJ9DiagnosticsMXBean"); ++ Object openj9Mbean = java.lang.management.ManagementFactory.newPlatformMXBeanProxy(server, "openj9.lang.management:type=OpenJ9Diagnostics", clazz); ++ java.lang.reflect.Method m = clazz.getMethod("triggerDumpToFile", String.class, String.class); ++ file = dir.resolve(name + ".phd"); ++ m.invoke(openj9Mbean, "heap", file.toString()); ++ } catch (ClassNotFoundException e) { ++ Class clazz = Class.forName("com.sun.management.HotSpotDiagnosticMXBean"); ++ Object hotspotMBean = java.lang.management.ManagementFactory.newPlatformMXBeanProxy(server, "com.sun.management:type=HotSpotDiagnostic", clazz); ++ java.lang.reflect.Method m = clazz.getMethod("dumpHeap", String.class, boolean.class); ++ file = dir.resolve(name + ".hprof"); ++ m.invoke(hotspotMBean, file.toString(), true); ++ } ++ ++ return file; ++ } catch (Throwable t) { ++ Bukkit.getLogger().log(Level.SEVERE, "Could not write heap", t); ++ return null; ++ } ++ } + private Iterable adventure$audiences; + @Override + public Iterable audiences() { diff --git a/patches/server/0011-Paper-Metrics.patch b/patches/server/0011-Paper-Metrics.patch index 9d3f659bbc..f49fd015ac 100644 --- a/patches/server/0011-Paper-Metrics.patch +++ b/patches/server/0011-Paper-Metrics.patch @@ -15,7 +15,7 @@ decisions on behalf of the project. diff --git a/src/main/java/com/destroystokyo/paper/Metrics.java b/src/main/java/com/destroystokyo/paper/Metrics.java new file mode 100644 -index 0000000000000000000000000000000000000000..e3b74dbdf8e14219a56fab939f3174e0c2f66de6 +index 0000000000000000000000000000000000000000..5a19e30a9b7e65a70f68a429b8ca741f788a303b --- /dev/null +++ b/src/main/java/com/destroystokyo/paper/Metrics.java @@ -0,0 +1,670 @@ @@ -576,8 +576,8 @@ index 0000000000000000000000000000000000000000..e3b74dbdf8e14219a56fab939f3174e0 + + } + -+ static class PaperMetrics { -+ static void startMetrics() { ++ public static class PaperMetrics { ++ public static void startMetrics() { + // Get the config file + File configFile = new File(new File((File) MinecraftServer.getServer().options.valueOf("plugins"), "bStats"), "config.yml"); + YamlConfiguration config = YamlConfiguration.loadConfiguration(configFile); @@ -689,22 +689,29 @@ index 0000000000000000000000000000000000000000..e3b74dbdf8e14219a56fab939f3174e0 + } + } +} -diff --git a/src/main/java/com/destroystokyo/paper/PaperConfig.java b/src/main/java/com/destroystokyo/paper/PaperConfig.java -index c1eb4201ecb0541c606ef0d05b828ae9c87c8a2c..52e9dca37dab4cacdded3b084c40d4dd75182bb5 100644 ---- a/src/main/java/com/destroystokyo/paper/PaperConfig.java -+++ b/src/main/java/com/destroystokyo/paper/PaperConfig.java -@@ -42,6 +42,7 @@ public class PaperConfig { - private static boolean verbose; - private static boolean fatalError; - /*========================================================================*/ -+ private static boolean metricsStarted; +diff --git a/src/main/java/io/papermc/paper/configuration/PaperConfigurations.java b/src/main/java/io/papermc/paper/configuration/PaperConfigurations.java +index f06f130b2fa703e105f9d49bc755e8374d023f2e..ef407d6a961c327631656cfd4cc610a22a9e53ac 100644 +--- a/src/main/java/io/papermc/paper/configuration/PaperConfigurations.java ++++ b/src/main/java/io/papermc/paper/configuration/PaperConfigurations.java +@@ -1,5 +1,6 @@ + package io.papermc.paper.configuration; - public static void init(File configFile) { - CONFIG_FILE = configFile; -@@ -84,6 +85,11 @@ public class PaperConfig { - for (Map.Entry entry : commands.entrySet()) { - MinecraftServer.getServer().server.getCommandMap().register(entry.getKey(), "Paper", entry.getValue()); - } ++import com.destroystokyo.paper.Metrics; + import com.destroystokyo.paper.PaperCommand; + import com.google.common.collect.Table; + import com.mojang.logging.LogUtils; +@@ -283,6 +284,7 @@ public class PaperConfigurations extends Configurations COMMANDS = new HashMap<>(); ++ private static boolean metricsStarted = false; + static { + COMMANDS.put("paper", new PaperCommand("paper")); + } +@@ -291,6 +293,11 @@ public class PaperConfigurations extends Configurations { + server.server.getCommandMap().register(s, "Paper", command); + }); + + if (!metricsStarted) { + Metrics.PaperMetrics.startMetrics(); @@ -712,9 +719,9 @@ index c1eb4201ecb0541c606ef0d05b828ae9c87c8a2c..52e9dca37dab4cacdded3b084c40d4dd + } } - static void readConfig(Class clazz, Object instance) { + @Deprecated diff --git a/src/main/java/org/spigotmc/SpigotConfig.java b/src/main/java/org/spigotmc/SpigotConfig.java -index 43aa6b0129892b8ab8ec25c16a131541c6607487..9d3d65de7cb0be25aa7fc40353390280943b55f4 100644 +index ed8ae212fc0ca781438fa9667f3f5cccc0af4cee..051d7c7fc5796ad056ae1ba5e5e630fde8794108 100644 --- a/src/main/java/org/spigotmc/SpigotConfig.java +++ b/src/main/java/org/spigotmc/SpigotConfig.java @@ -83,6 +83,7 @@ public class SpigotConfig @@ -732,4 +739,4 @@ index 43aa6b0129892b8ab8ec25c16a131541c6607487..9d3d65de7cb0be25aa7fc40353390280 + */ // Paper end } - static void readConfig(Class clazz, Object instance) + public static void readConfig(Class clazz, Object instance) // Paper - package-private -> public diff --git a/patches/server/0012-Timings-v2.patch b/patches/server/0012-Timings-v2.patch index 4d58ea5d0e..ffb1643f34 100644 --- a/patches/server/0012-Timings-v2.patch +++ b/patches/server/0012-Timings-v2.patch @@ -6,13 +6,14 @@ Subject: [PATCH] Timings v2 diff --git a/src/main/java/co/aikar/timings/MinecraftTimings.java b/src/main/java/co/aikar/timings/MinecraftTimings.java new file mode 100644 -index 0000000000000000000000000000000000000000..b47b7dce26805badd422c1867733ff4bfd00e9f4 +index 0000000000000000000000000000000000000000..9fdc3e9936262b8eb8d502c4dd2ba47a7eceacce --- /dev/null +++ b/src/main/java/co/aikar/timings/MinecraftTimings.java -@@ -0,0 +1,151 @@ +@@ -0,0 +1,168 @@ +package co.aikar.timings; + +import com.google.common.collect.MapMaker; ++import io.papermc.paper.configuration.GlobalConfiguration; +import net.minecraft.commands.CommandFunction; +import net.minecraft.network.protocol.Packet; +import net.minecraft.world.level.block.Block; @@ -160,6 +161,22 @@ index 0000000000000000000000000000000000000000..b47b7dce26805badd422c1867733ff4b + public static Timing getCommandFunctionTiming(CommandFunction function) { + return Timings.ofSafe("Command Function - " + function.getId()); + } ++ ++ public static void processConfig(GlobalConfiguration.Timings config) { ++ TimingsManager.url = config.url; ++ if (!TimingsManager.url.endsWith("/")) { ++ TimingsManager.url += "/"; ++ } ++ TimingsManager.privacy = config.serverNamePrivacy; ++ if (!config.hiddenConfigEntries.contains("proxies.velocity.secret")) { ++ config.hiddenConfigEntries.add("proxies.velocity.secret"); ++ } ++ TimingsManager.hiddenConfigs = config.hiddenConfigEntries; ++ co.aikar.timings.Timings.setVerboseTimingsEnabled(config.verbose); ++ co.aikar.timings.Timings.setTimingsEnabled(config.enabled); ++ co.aikar.timings.Timings.setHistoryInterval(config.historyInterval * 20); ++ co.aikar.timings.Timings.setHistoryLength(config.historyLength * 20); ++ } +} diff --git a/src/main/java/co/aikar/timings/TimingsExport.java b/src/main/java/co/aikar/timings/TimingsExport.java new file mode 100644 @@ -677,62 +694,6 @@ index 0000000000000000000000000000000000000000..0fda52841b5e1643efeda92106124998 + return Timings.ofSafe(((PrimaryLevelData) worldserver.getLevelData()).getLevelName() + " - Scheduled " + timingsType); + } +} -diff --git a/src/main/java/com/destroystokyo/paper/PaperConfig.java b/src/main/java/com/destroystokyo/paper/PaperConfig.java -index 52e9dca37dab4cacdded3b084c40d4dd75182bb5..7bbcee19248933f67fd40f46db43363890593c73 100644 ---- a/src/main/java/com/destroystokyo/paper/PaperConfig.java -+++ b/src/main/java/com/destroystokyo/paper/PaperConfig.java -@@ -14,12 +14,15 @@ import java.util.concurrent.TimeUnit; - import java.util.logging.Level; - import java.util.regex.Pattern; - -+import com.google.common.collect.Lists; - import net.minecraft.server.MinecraftServer; - import org.bukkit.Bukkit; - import org.bukkit.command.Command; - import org.bukkit.configuration.ConfigurationSection; - import org.bukkit.configuration.InvalidConfigurationException; - import org.bukkit.configuration.file.YamlConfiguration; -+import co.aikar.timings.Timings; -+import co.aikar.timings.TimingsManager; - - public class PaperConfig { - -@@ -200,4 +203,35 @@ public class PaperConfig { - } - useDisplayNameInQuit = getBoolean("settings.use-display-name-in-quit-message", useDisplayNameInQuit); - } -+ -+ public static String timingsServerName; -+ private static void timings() { -+ boolean timings = getBoolean("timings.enabled", true); -+ boolean verboseTimings = getBoolean("timings.verbose", true); -+ TimingsManager.url = getString("timings.url", "https://timings.aikar.co/"); -+ if (!TimingsManager.url.endsWith("/")) { -+ TimingsManager.url += "/"; -+ } -+ TimingsManager.privacy = getBoolean("timings.server-name-privacy", false); -+ TimingsManager.hiddenConfigs = getList("timings.hidden-config-entries", Lists.newArrayList("database", "settings.bungeecord-addresses", "settings.velocity-support.secret")); -+ if (!TimingsManager.hiddenConfigs.contains("settings.velocity-support.secret")) { -+ TimingsManager.hiddenConfigs.add("settings.velocity-support.secret"); -+ } -+ int timingHistoryInterval = getInt("timings.history-interval", 300); -+ int timingHistoryLength = getInt("timings.history-length", 3600); -+ timingsServerName = getString("timings.server-name", "Unknown Server"); -+ -+ -+ Timings.setVerboseTimingsEnabled(verboseTimings); -+ Timings.setTimingsEnabled(timings); -+ Timings.setHistoryInterval(timingHistoryInterval * 20); -+ Timings.setHistoryLength(timingHistoryLength * 20); -+ -+ log("Timings: " + timings + -+ " - Url: " + TimingsManager.url + -+ " - Verbose: " + verboseTimings + -+ " - Interval: " + timeSummary(Timings.getHistoryInterval() / 20) + -+ " - Length: " + timeSummary(Timings.getHistoryLength() / 20) + -+ " - Server Name: " + timingsServerName); -+ } - } diff --git a/src/main/java/net/minecraft/commands/CommandFunction.java b/src/main/java/net/minecraft/commands/CommandFunction.java index ca1a9884ab09fc7e575b1d30e2dd0aaff324fb73..b94038e2da0f986403c1ec9b27384344e2bb22f0 100644 --- a/src/main/java/net/minecraft/commands/CommandFunction.java @@ -768,7 +729,7 @@ index 13421daa96b4ba302581f36abcd730952713d8cd..049e64c355d5f064009b1107ad15d28c } catch (Exception exception) { if (listener.shouldPropagateHandlingExceptions()) { diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index c763b4d9cc16f8c3ced91ce8656bd238205dedc0..9be29fbb97aced80da8adb693521a8bd870870c5 100644 +index 1ad7797dbef61f8e8011ae6db3089939a279071c..1190d62594c5b1be1c11d55e646ee0bac27307cb 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java @@ -175,7 +175,7 @@ import org.bukkit.craftbukkit.generator.CustomWorldChunkManager; @@ -780,7 +741,7 @@ index c763b4d9cc16f8c3ced91ce8656bd238205dedc0..9be29fbb97aced80da8adb693521a8bd public abstract class MinecraftServer extends ReentrantBlockableEventLoop implements CommandSource, AutoCloseable { -@@ -850,6 +850,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop= 5000000000L) { -@@ -1219,15 +1240,18 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop 0 && this.tickCount % this.autosavePeriod == 0) { // CraftBukkit @@ -862,7 +823,7 @@ index c763b4d9cc16f8c3ced91ce8656bd238205dedc0..9be29fbb97aced80da8adb693521a8bd this.profiler.push("tallying"); long l = this.tickTimes[this.tickCount % 100] = Util.getNanos() - i; -@@ -1237,30 +1261,29 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop { // CraftBukkit start - fire RemoteServerCommandEvent -@@ -687,10 +689,39 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface +@@ -683,10 +685,39 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface if (event.isCancelled()) { return; } @@ -1093,7 +1054,7 @@ index ef23f9f81a909348ee4ae3d7eb51dbcc430530ca..e9a2a71b1f2bf6c701d4eba8dc31a100 } diff --git a/src/main/java/net/minecraft/server/level/ServerChunkCache.java b/src/main/java/net/minecraft/server/level/ServerChunkCache.java -index b0c46312dfb00c13421bb643dbf246610aff897b..63e11397d6efb293b140c4c4bca91e49464e8ea6 100644 +index 186a8f5895fedbaf27a7949d9bdbb1a9f2e36fbf..86acdd910eebb8beac4536942119c9e97580ff2e 100644 --- a/src/main/java/net/minecraft/server/level/ServerChunkCache.java +++ b/src/main/java/net/minecraft/server/level/ServerChunkCache.java @@ -517,13 +517,15 @@ public class ServerChunkCache extends ChunkSource { @@ -1185,7 +1146,7 @@ index b0c46312dfb00c13421bb643dbf246610aff897b..63e11397d6efb293b140c4c4bca91e49 } diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java -index 501fd02fedf1a47da28d07fd04b63f89368723ce..53280aeb1ec8088dfb34068e16fd2743c0cf86cb 100644 +index 006d7ee33542fe6eba955410fc0054786662f82b..379e546faa873d4d13751e54d38942f98c0bdf35 100644 --- a/src/main/java/net/minecraft/server/level/ServerLevel.java +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java @@ -1,6 +1,8 @@ @@ -1301,7 +1262,7 @@ index 501fd02fedf1a47da28d07fd04b63f89368723ce..53280aeb1ec8088dfb34068e16fd2743 this.entityManager.saveAll(); } else { diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index f5f2a60b0c20d64a7523a4339b14f40e15c62633..a75353e96d0e0a017e4a5dc84c04a5c594535439 100644 +index 56e1886b4cf63fd1f14cd8420ccdba1271cf2d6c..e65175696d4d99225e87d79cf3e59cf2f29637e1 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java @@ -310,7 +310,6 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser @@ -1348,7 +1309,7 @@ index f5f2a60b0c20d64a7523a4339b14f40e15c62633..a75353e96d0e0a017e4a5dc84c04a5c5 } // CraftBukkit end diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java -index 821b9c0ba003163195a461dd0bce1fa9ffd0a146..870fb4ffb01ba291d9d3aabfd722e669a477e209 100644 +index 9e0c61b63cc402c26ca1306313ca6054efb108b8..dbd53de61057eb9eb8be651abf9abcad18423ab1 100644 --- a/src/main/java/net/minecraft/server/players/PlayerList.java +++ b/src/main/java/net/minecraft/server/players/PlayerList.java @@ -1,5 +1,6 @@ @@ -1408,7 +1369,7 @@ index 277a9fc7b61361f472eae171a3546c85da4f30b4..76dc492e9c2239a09de9ead5de50abb8 protected boolean isHorizontalCollisionMinor(Vec3 adjustedMovement) { diff --git a/src/main/java/net/minecraft/world/entity/EntityType.java b/src/main/java/net/minecraft/world/entity/EntityType.java -index d14757d30040c3c9030309a8bb4a37e0c9a4d8db..0c7c8b8671738d9ec408f5dc7f2950a9991858b8 100644 +index cdf8020194f2ec1fe7b65b22c8e1f5b1c23eaefa..2db27f5e3e3c1bb0502c055f78c4a81eb00fcf1b 100644 --- a/src/main/java/net/minecraft/world/entity/EntityType.java +++ b/src/main/java/net/minecraft/world/entity/EntityType.java @@ -305,7 +305,14 @@ public class EntityType implements EntityTypeTest { @@ -1542,7 +1503,7 @@ index ba7037a44b2fba6aafcbc4081c5c481a2cdcfd3b..c7017b86a3268aef0baff2ae0a56155a if (!this.level.isClientSide && this.isSensitiveToWater() && this.isInWaterRainOrBubble()) { this.hurt(DamageSource.DROWN, 1.0F); diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java -index 914e42e983d56d9c85b1583f57afab699054f4d6..861ebb82ab009588809fe2c8a4f05fbdcfe6f750 100644 +index 0fa91ed5ed41c944f7398a88f9352742f34d4af5..39d64f3aeb998df5452699e098148d86fdd48c98 100644 --- a/src/main/java/net/minecraft/world/level/Level.java +++ b/src/main/java/net/minecraft/world/level/Level.java @@ -83,7 +83,6 @@ import org.bukkit.Bukkit; @@ -1553,16 +1514,16 @@ index 914e42e983d56d9c85b1583f57afab699054f4d6..861ebb82ab009588809fe2c8a4f05fbd import org.bukkit.craftbukkit.block.CapturedBlockState; import org.bukkit.craftbukkit.block.CraftBlockState; import org.bukkit.craftbukkit.block.data.CraftBlockData; -@@ -153,7 +152,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable { - - public final com.destroystokyo.paper.PaperWorldConfig paperConfig; // Paper +@@ -157,7 +156,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable { + } + // Paper end - public final SpigotTimings.WorldTimingsHandler timings; // Spigot + public final co.aikar.timings.WorldTimingsHandler timings; // Paper public static BlockPos lastPhysicsProblem; // Spigot private org.spigotmc.TickLimiter entityLimiter; private org.spigotmc.TickLimiter tileLimiter; -@@ -249,7 +248,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable { +@@ -253,7 +252,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable { public void onBorderSetDamageSafeZOne(WorldBorder border, double safeZoneRadius) {} }); // CraftBukkit end @@ -1571,7 +1532,7 @@ index 914e42e983d56d9c85b1583f57afab699054f4d6..861ebb82ab009588809fe2c8a4f05fbd this.entityLimiter = new org.spigotmc.TickLimiter(spigotConfig.entityMaxTickTime); this.tileLimiter = new org.spigotmc.TickLimiter(spigotConfig.tileMaxTickTime); } -@@ -685,15 +684,14 @@ public abstract class Level implements LevelAccessor, AutoCloseable { +@@ -689,15 +688,14 @@ public abstract class Level implements LevelAccessor, AutoCloseable { timings.tileEntityTick.stopTiming(); // Spigot this.tickingBlockEntities = false; @@ -1673,10 +1634,10 @@ index 98ba88896c73651591b8ad8e070868fb443ae999..864e2e0355a5fb8c1d4a5b0896ba299f }; } diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -index d3d8935bafb2e0773c96c5807ebd23f20de26592..d2267cd447a7666f4404500ccd6bde5f3b932a32 100644 +index 268715e19a6fa7d26510d9d0a8f19b158835b279..c9e528c66cc2dab4895ff8b33e63d458c44cfc36 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -@@ -2344,12 +2344,31 @@ public final class CraftServer implements Server { +@@ -2343,12 +2343,31 @@ public final class CraftServer implements Server { private final org.bukkit.Server.Spigot spigot = new org.bukkit.Server.Spigot() { @@ -1702,7 +1663,7 @@ index d3d8935bafb2e0773c96c5807ebd23f20de26592..d2267cd447a7666f4404500ccd6bde5f + @Override + public YamlConfiguration getPaperConfig() + { -+ return com.destroystokyo.paper.PaperConfig.config; ++ return CraftServer.this.console.paperConfigurations.createLegacyObject(CraftServer.this.console); + } + @Override @@ -2074,7 +2035,7 @@ index e52ef47b783785dc214746b678e7b549aea9a274..3d90b3426873a3528af14f7f1ab0adae this.value = value; } diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java -index 43e31362a980a4f300864321224bdf3ca92110ff..482be6fc06d034fe41ac3aab9201295f529c574f 100644 +index 43e31362a980a4f300864321224bdf3ca92110ff..cf49ba1e6a8b7f62deefbbf2fc645034d5d27bef 100644 --- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java +++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java @@ -217,6 +217,12 @@ public final class CraftMagicNumbers implements UnsafeValues { @@ -2097,7 +2058,7 @@ index 43e31362a980a4f300864321224bdf3ca92110ff..482be6fc06d034fe41ac3aab9201295f + // Paper start + @Override + public String getTimingsServerName() { -+ return com.destroystokyo.paper.PaperConfig.timingsServerName; ++ return io.papermc.paper.configuration.GlobalConfiguration.get().timings.serverName; + } + // Paper end + diff --git a/patches/server/0013-Add-command-line-option-to-load-extra-plugin-jars-no.patch b/patches/server/0013-Add-command-line-option-to-load-extra-plugin-jars-no.patch index 44a2100b07..71568677fa 100644 --- a/patches/server/0013-Add-command-line-option-to-load-extra-plugin-jars-no.patch +++ b/patches/server/0013-Add-command-line-option-to-load-extra-plugin-jars-no.patch @@ -7,7 +7,7 @@ Subject: [PATCH] Add command line option to load extra plugin jars not in the ex: java -jar paperclip.jar nogui -add-plugin=/path/to/plugin.jar -add-plugin=/path/to/another/plugin_jar.jar diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -index b3061e6f6c2d645520cecc6cfd8f2a079a8f7f96..4764f4da6dd6a0a8d197d9ddb0a641316a2d5f2d 100644 +index c9e528c66cc2dab4895ff8b33e63d458c44cfc36..7c82bce3d17ff466ea4bd157fd4961826e31ae1d 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java @@ -394,10 +394,15 @@ public final class CraftServer implements Server { diff --git a/patches/server/0014-Configurable-cactus-bamboo-and-reed-growth-heights.patch b/patches/server/0014-Configurable-cactus-bamboo-and-reed-growth-heights.patch index c0caf34180..e794b359ef 100644 --- a/patches/server/0014-Configurable-cactus-bamboo-and-reed-growth-heights.patch +++ b/patches/server/0014-Configurable-cactus-bamboo-and-reed-growth-heights.patch @@ -6,29 +6,8 @@ Subject: [PATCH] Configurable cactus bamboo and reed growth heights Bamboo - Both the minimum fully-grown heights and the maximum are configurable - Machine_Maker -diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -index 0853ff7641103447f458b2dc08076c27e3937074..3f7ec17466e4fae7139672854e2c8223ada16b76 100644 ---- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -@@ -101,4 +101,16 @@ public class PaperWorldConfig { - config.addDefault("world-settings.default." + path, def.stream().map(Enum::name).collect(Collectors.toList())); - return ((List) (config.getList("world-settings." + worldName + "." + path, config.getList("world-settings.default." + path)))).stream().map(s -> Enum.valueOf(type, s)).collect(Collectors.toList()); - } -+ -+ public int cactusMaxHeight; -+ public int reedMaxHeight; -+ public int bambooMaxHeight; -+ public int bambooMinHeight; -+ private void blockGrowthHeight() { -+ cactusMaxHeight = getInt("max-growth-height.cactus", 3); -+ reedMaxHeight = getInt("max-growth-height.reeds", 3); -+ bambooMaxHeight = getInt("max-growth-height.bamboo.max", 16); -+ bambooMinHeight = getInt("max-growth-height.bamboo.min", 11); -+ log("Max height for cactus growth " + cactusMaxHeight + ". Max height for reed growth " + reedMaxHeight + ". Max height for bamboo growth " + bambooMaxHeight + ". Min height for fully-grown bamboo " + bambooMinHeight + "."); -+ } - } diff --git a/src/main/java/net/minecraft/world/level/block/BambooBlock.java b/src/main/java/net/minecraft/world/level/block/BambooBlock.java -index 4d9c6b462101dd533b0d08c40e0257e39ccbead3..081c6732e78bf732d6f2328249dc4fe8b04397b8 100644 +index 4d9c6b462101dd533b0d08c40e0257e39ccbead3..4eaf778f43b67210321ffafa3da622cb4262d57b 100644 --- a/src/main/java/net/minecraft/world/level/block/BambooBlock.java +++ b/src/main/java/net/minecraft/world/level/block/BambooBlock.java @@ -130,7 +130,7 @@ public class BambooBlock extends Block implements BonemealableBlock { @@ -36,7 +15,7 @@ index 4d9c6b462101dd533b0d08c40e0257e39ccbead3..081c6732e78bf732d6f2328249dc4fe8 int i = this.getHeightBelowUpToMax(world, pos) + 1; - if (i < 16) { -+ if (i < world.paperConfig.bambooMaxHeight) { // Paper ++ if (i < world.paperConfig().maxGrowthHeight.bamboo.max) { // Paper this.growBamboo(state, world, pos, random, i); } } @@ -45,7 +24,7 @@ index 4d9c6b462101dd533b0d08c40e0257e39ccbead3..081c6732e78bf732d6f2328249dc4fe8 int j = this.getHeightBelowUpToMax(world, pos); - return i + j + 1 < 16 && (Integer) world.getBlockState(pos.above(i)).getValue(BambooBlock.STAGE) != 1; -+ return i + j + 1 < ((Level) world).paperConfig.bambooMaxHeight && (Integer) world.getBlockState(pos.above(i)).getValue(BambooBlock.STAGE) != 1; // Paper ++ return i + j + 1 < ((Level) world).paperConfig().maxGrowthHeight.bamboo.max && (Integer) world.getBlockState(pos.above(i)).getValue(BambooBlock.STAGE) != 1; // Paper } @Override @@ -54,7 +33,7 @@ index 4d9c6b462101dd533b0d08c40e0257e39ccbead3..081c6732e78bf732d6f2328249dc4fe8 BlockState iblockdata1 = world.getBlockState(blockposition1); - if (k >= 16 || !iblockdata1.is(Blocks.BAMBOO) || (Integer) iblockdata1.getValue(BambooBlock.STAGE) == 1 || !world.isEmptyBlock(blockposition1.above())) { // CraftBukkit - If the BlockSpreadEvent was cancelled, we have no bamboo here -+ if (k >= world.paperConfig.bambooMaxHeight || !iblockdata1.is(Blocks.BAMBOO) || (Integer) iblockdata1.getValue(BambooBlock.STAGE) == 1 || !world.isEmptyBlock(blockposition1.above())) { // CraftBukkit - If the BlockSpreadEvent was cancelled, we have no bamboo here // Paper - Configurable cactus bamboo and reed growth heights ++ if (k >= world.paperConfig().maxGrowthHeight.bamboo.max || !iblockdata1.is(Blocks.BAMBOO) || (Integer) iblockdata1.getValue(BambooBlock.STAGE) == 1 || !world.isEmptyBlock(blockposition1.above())) { // CraftBukkit - If the BlockSpreadEvent was cancelled, we have no bamboo here // Paper - Configurable cactus bamboo and reed growth heights return; } @@ -63,7 +42,7 @@ index 4d9c6b462101dd533b0d08c40e0257e39ccbead3..081c6732e78bf732d6f2328249dc4fe8 int j = (Integer) state.getValue(BambooBlock.AGE) != 1 && !iblockdata2.is(Blocks.BAMBOO) ? 0 : 1; - int k = (height < 11 || random.nextFloat() >= 0.25F) && height != 15 ? 0 : 1; -+ int k = (height < world.paperConfig.bambooMinHeight || random.nextFloat() >= 0.25F) && height != (world.paperConfig.bambooMaxHeight - 1) ? 0 : 1; // Paper ++ int k = (height < world.paperConfig().maxGrowthHeight.bamboo.min || random.nextFloat() >= 0.25F) && height != (world.paperConfig().maxGrowthHeight.bamboo.max - 1) ? 0 : 1; // Paper // CraftBukkit start if (org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockSpreadEvent(world, pos, pos.above(), (BlockState) ((BlockState) ((BlockState) this.defaultBlockState().setValue(BambooBlock.AGE, j)).setValue(BambooBlock.LEAVES, blockpropertybamboosize)).setValue(BambooBlock.STAGE, k), 3)) { @@ -72,7 +51,7 @@ index 4d9c6b462101dd533b0d08c40e0257e39ccbead3..081c6732e78bf732d6f2328249dc4fe8 int i; - for (i = 0; i < 16 && world.getBlockState(pos.above(i + 1)).is(Blocks.BAMBOO); ++i) { -+ for (i = 0; i < ((Level) world).paperConfig.bambooMaxHeight && world.getBlockState(pos.above(i + 1)).is(Blocks.BAMBOO); ++i) { // Paper ++ for (i = 0; i < ((Level) world).paperConfig().maxGrowthHeight.bamboo.max && world.getBlockState(pos.above(i + 1)).is(Blocks.BAMBOO); ++i) { // Paper ; } @@ -81,12 +60,12 @@ index 4d9c6b462101dd533b0d08c40e0257e39ccbead3..081c6732e78bf732d6f2328249dc4fe8 int i; - for (i = 0; i < 16 && world.getBlockState(pos.below(i + 1)).is(Blocks.BAMBOO); ++i) { -+ for (i = 0; i < ((Level) world).paperConfig.bambooMaxHeight && world.getBlockState(pos.below(i + 1)).is(Blocks.BAMBOO); ++i) { // Paper ++ for (i = 0; i < ((Level) world).paperConfig().maxGrowthHeight.bamboo.max && world.getBlockState(pos.below(i + 1)).is(Blocks.BAMBOO); ++i) { // Paper ; } diff --git a/src/main/java/net/minecraft/world/level/block/CactusBlock.java b/src/main/java/net/minecraft/world/level/block/CactusBlock.java -index 3b4be44e4204435a360bc224a9b2651952dedf02..0d255201ebce3bb495a4e086da5e4d9195cbc091 100644 +index 3b4be44e4204435a360bc224a9b2651952dedf02..cb3d26af146859b87fc471174f8f63dfe7caa5fd 100644 --- a/src/main/java/net/minecraft/world/level/block/CactusBlock.java +++ b/src/main/java/net/minecraft/world/level/block/CactusBlock.java @@ -55,7 +55,7 @@ public class CactusBlock extends Block { @@ -94,12 +73,12 @@ index 3b4be44e4204435a360bc224a9b2651952dedf02..0d255201ebce3bb495a4e086da5e4d91 } - if (i < 3) { -+ if (i < world.paperConfig.cactusMaxHeight) { // Paper - Configurable growth height ++ if (i < world.paperConfig().maxGrowthHeight.cactus) { // Paper - Configurable growth height int j = (Integer) state.getValue(CactusBlock.AGE); if (j >= (byte) range(3, ((100.0F / world.spigotConfig.cactusModifier) * 15) + 0.5F, 15)) { // Spigot diff --git a/src/main/java/net/minecraft/world/level/block/SugarCaneBlock.java b/src/main/java/net/minecraft/world/level/block/SugarCaneBlock.java -index e5956a2a68f168a4c08c6c409ae7b288eb792660..3c893c7b1cdb56e527553f07c2bd8ba4b6707b77 100644 +index e5956a2a68f168a4c08c6c409ae7b288eb792660..5554889adbade3af627b11348e9cc04191bfea36 100644 --- a/src/main/java/net/minecraft/world/level/block/SugarCaneBlock.java +++ b/src/main/java/net/minecraft/world/level/block/SugarCaneBlock.java @@ -52,7 +52,7 @@ public class SugarCaneBlock extends Block { @@ -107,7 +86,7 @@ index e5956a2a68f168a4c08c6c409ae7b288eb792660..3c893c7b1cdb56e527553f07c2bd8ba4 } - if (i < 3) { -+ if (i < world.paperConfig.reedMaxHeight) { // Paper - Configurable growth height ++ if (i < world.paperConfig().maxGrowthHeight.reeds) { // Paper - Configurable growth height int j = (Integer) state.getValue(SugarCaneBlock.AGE); if (j >= (byte) range(3, ((100.0F / world.spigotConfig.caneModifier) * 15) + 0.5F, 15)) { // Spigot diff --git a/patches/server/0015-Configurable-baby-zombie-movement-speed.patch b/patches/server/0015-Configurable-baby-zombie-movement-speed.patch index 574818bc6f..e0d10bc34b 100644 --- a/patches/server/0015-Configurable-baby-zombie-movement-speed.patch +++ b/patches/server/0015-Configurable-baby-zombie-movement-speed.patch @@ -4,40 +4,19 @@ Date: Tue, 1 Mar 2016 13:09:16 -0600 Subject: [PATCH] Configurable baby zombie movement speed -diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -index 3f7ec17466e4fae7139672854e2c8223ada16b76..4d787f0596be1a44724ade309cc00e115778a797 100644 ---- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -@@ -113,4 +113,15 @@ public class PaperWorldConfig { - bambooMinHeight = getInt("max-growth-height.bamboo.min", 11); - log("Max height for cactus growth " + cactusMaxHeight + ". Max height for reed growth " + reedMaxHeight + ". Max height for bamboo growth " + bambooMaxHeight + ". Min height for fully-grown bamboo " + bambooMinHeight + "."); - } -+ -+ public double babyZombieMovementModifier; -+ private void babyZombieMovementModifier() { -+ babyZombieMovementModifier = getDouble("baby-zombie-movement-modifier", 0.5D); -+ if (PaperConfig.version < 20) { -+ babyZombieMovementModifier = getDouble("baby-zombie-movement-speed", 0.5D); -+ set("baby-zombie-movement-modifier", babyZombieMovementModifier); -+ } -+ -+ log("Baby zombies will move at the speed of " + babyZombieMovementModifier); -+ } - } diff --git a/src/main/java/net/minecraft/world/entity/monster/Zombie.java b/src/main/java/net/minecraft/world/entity/monster/Zombie.java -index ee91459775aada8cc2e5c4403436b11c15e8e674..cf80a2592e923967fa440f8c383a9dc977177638 100644 +index ee91459775aada8cc2e5c4403436b11c15e8e674..1b48576beca178af14bfab297bd427b5f5bdaf42 100644 --- a/src/main/java/net/minecraft/world/entity/monster/Zombie.java +++ b/src/main/java/net/minecraft/world/entity/monster/Zombie.java -@@ -76,7 +76,7 @@ import org.bukkit.event.entity.EntityTransformEvent; - public class Zombie extends Monster { +@@ -77,6 +77,7 @@ public class Zombie extends Monster { private static final UUID SPEED_MODIFIER_BABY_UUID = UUID.fromString("B9766B59-9566-4402-BC1F-2EE2A276D836"); -- private static final AttributeModifier SPEED_MODIFIER_BABY = new AttributeModifier(Zombie.SPEED_MODIFIER_BABY_UUID, "Baby speed boost", 0.5D, AttributeModifier.Operation.MULTIPLY_BASE); -+ private final AttributeModifier SPEED_MODIFIER_BABY = new AttributeModifier(Zombie.SPEED_MODIFIER_BABY_UUID, "Baby speed boost", 0.5D, AttributeModifier.Operation.MULTIPLY_BASE); private final AttributeModifier babyModifier = this.SPEED_MODIFIER_BABY; // Paper - remove static - Make baby speed configurable + private static final AttributeModifier SPEED_MODIFIER_BABY = new AttributeModifier(Zombie.SPEED_MODIFIER_BABY_UUID, "Baby speed boost", 0.5D, AttributeModifier.Operation.MULTIPLY_BASE); ++ private final AttributeModifier babyModifier = new net.minecraft.world.entity.ai.attributes.AttributeModifier(SPEED_MODIFIER_BABY.getId(), SPEED_MODIFIER_BABY.getName(), this.level.paperConfig().entities.behavior.babyZombieMovementModifier, SPEED_MODIFIER_BABY.getOperation()); // Paper - Make baby speed configurable private static final EntityDataAccessor DATA_BABY_ID = SynchedEntityData.defineId(Zombie.class, EntityDataSerializers.BOOLEAN); private static final EntityDataAccessor DATA_SPECIAL_TYPE_ID = SynchedEntityData.defineId(Zombie.class, EntityDataSerializers.INT); public static final EntityDataAccessor DATA_DROWNED_CONVERSION_ID = SynchedEntityData.defineId(Zombie.class, EntityDataSerializers.BOOLEAN); -@@ -184,9 +184,9 @@ public class Zombie extends Monster { +@@ -184,9 +185,9 @@ public class Zombie extends Monster { if (this.level != null && !this.level.isClientSide) { AttributeInstance attributemodifiable = this.getAttribute(Attributes.MOVEMENT_SPEED); diff --git a/patches/server/0016-Configurable-fishing-time-ranges.patch b/patches/server/0016-Configurable-fishing-time-ranges.patch index 1c7ac7762b..71d66591ff 100644 --- a/patches/server/0016-Configurable-fishing-time-ranges.patch +++ b/patches/server/0016-Configurable-fishing-time-ranges.patch @@ -4,25 +4,8 @@ Date: Tue, 1 Mar 2016 13:14:11 -0600 Subject: [PATCH] Configurable fishing time ranges -diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -index 4d787f0596be1a44724ade309cc00e115778a797..4b9122a3e094aa9e0a789f35fb6b0f9a7a53f772 100644 ---- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -@@ -124,4 +124,12 @@ public class PaperWorldConfig { - - log("Baby zombies will move at the speed of " + babyZombieMovementModifier); - } -+ -+ public int fishingMinTicks; -+ public int fishingMaxTicks; -+ private void fishingTickRange() { -+ fishingMinTicks = getInt("fishing-time-range.MinimumTicks", 100); -+ fishingMaxTicks = getInt("fishing-time-range.MaximumTicks", 600); -+ log("Fishing time ranges are between " + fishingMinTicks +" and " + fishingMaxTicks + " ticks"); -+ } - } diff --git a/src/main/java/net/minecraft/world/entity/projectile/FishingHook.java b/src/main/java/net/minecraft/world/entity/projectile/FishingHook.java -index 792d85ea46d392a27ac89c42e037dc90d33fad7f..91fde59289100133a4f473bee176ff1b6805faae 100644 +index 792d85ea46d392a27ac89c42e037dc90d33fad7f..00fe96650e4d973e97b46968297f55f4c3674629 100644 --- a/src/main/java/net/minecraft/world/entity/projectile/FishingHook.java +++ b/src/main/java/net/minecraft/world/entity/projectile/FishingHook.java @@ -85,6 +85,10 @@ public class FishingHook extends Projectile { @@ -30,8 +13,8 @@ index 792d85ea46d392a27ac89c42e037dc90d33fad7f..91fde59289100133a4f473bee176ff1b this.luck = Math.max(0, luckOfTheSeaLevel); this.lureSpeed = Math.max(0, lureLevel); + // Paper start -+ minWaitTime = world.paperConfig.fishingMinTicks; -+ maxWaitTime = world.paperConfig.fishingMaxTicks; ++ minWaitTime = world.paperConfig().fishingTimeRange.minimum; ++ maxWaitTime = world.paperConfig().fishingTimeRange.maximum; + // Paper end } diff --git a/patches/server/0017-Allow-nerfed-mobs-to-jump-and-take-water-damage.patch b/patches/server/0017-Allow-nerfed-mobs-to-jump-and-take-water-damage.patch index 6c43ebf7bc..c142430702 100644 --- a/patches/server/0017-Allow-nerfed-mobs-to-jump-and-take-water-damage.patch +++ b/patches/server/0017-Allow-nerfed-mobs-to-jump-and-take-water-damage.patch @@ -4,32 +4,6 @@ Date: Tue, 1 Mar 2016 13:24:16 -0600 Subject: [PATCH] Allow nerfed mobs to jump and take water damage -diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -index 4b9122a3e094aa9e0a789f35fb6b0f9a7a53f772..d2ac0123812224181afae8fca96058ddc8cdff1e 100644 ---- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -@@ -132,4 +132,9 @@ public class PaperWorldConfig { - fishingMaxTicks = getInt("fishing-time-range.MaximumTicks", 600); - log("Fishing time ranges are between " + fishingMinTicks +" and " + fishingMaxTicks + " ticks"); - } -+ -+ public boolean nerfedMobsShouldJump; -+ private void nerfedMobsShouldJump() { -+ nerfedMobsShouldJump = getBoolean("spawner-nerfed-mobs-should-jump", false); -+ } - } -diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java -index 76dc492e9c2239a09de9ead5de50abb86a97f452..4b55e1a3b373f141f60f4ba392abeda37d2364e0 100644 ---- a/src/main/java/net/minecraft/world/entity/Entity.java -+++ b/src/main/java/net/minecraft/world/entity/Entity.java -@@ -1296,6 +1296,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource { - return this.isInWater() || this.isInRain(); - } - -+ @Deprecated public final boolean isInWaterOrRainOrBubble() { return isInWaterRainOrBubble(); } // Paper - OBFHELPER - public boolean isInWaterRainOrBubble() { - return this.isInWater() || this.isInRain() || this.isInBubbleColumn(); - } diff --git a/src/main/java/net/minecraft/world/entity/Mob.java b/src/main/java/net/minecraft/world/entity/Mob.java index decf753d088983ef6bbf32a32a6ee8d3cca3ee69..4f58fae1b3738e7e0507a46df275a258c94fcec4 100644 --- a/src/main/java/net/minecraft/world/entity/Mob.java @@ -62,14 +36,14 @@ index decf753d088983ef6bbf32a32a6ee8d3cca3ee69..4f58fae1b3738e7e0507a46df275a258 this.sensing.tick(); this.level.getProfiler().pop(); diff --git a/src/main/java/net/minecraft/world/entity/ai/goal/FloatGoal.java b/src/main/java/net/minecraft/world/entity/ai/goal/FloatGoal.java -index 01950951ea06e43bedeeede489a112e577617829..0e86eb2595cf9fbf24f789e0e9b4f05929d3164c 100644 +index 01950951ea06e43bedeeede489a112e577617829..7093c62be53fe99ed9880fc8ddaa07440fe4f715 100644 --- a/src/main/java/net/minecraft/world/entity/ai/goal/FloatGoal.java +++ b/src/main/java/net/minecraft/world/entity/ai/goal/FloatGoal.java @@ -9,6 +9,7 @@ public class FloatGoal extends Goal { public FloatGoal(Mob mob) { this.mob = mob; -+ if (mob.getCommandSenderWorld().paperConfig.nerfedMobsShouldJump) mob.goalFloat = this; // Paper ++ if (mob.getCommandSenderWorld().paperConfig().entities.behavior.spawnerNerfedMobsShouldJump) mob.goalFloat = this; // Paper this.setFlags(EnumSet.of(Goal.Flag.JUMP)); mob.getNavigation().setCanFloat(true); } diff --git a/patches/server/0018-Add-configurable-despawn-distances-for-living-entiti.patch b/patches/server/0018-Add-configurable-despawn-distances-for-living-entiti.patch index 0be452f163..2724d12408 100644 --- a/patches/server/0018-Add-configurable-despawn-distances-for-living-entiti.patch +++ b/patches/server/0018-Add-configurable-despawn-distances-for-living-entiti.patch @@ -4,68 +4,8 @@ Date: Tue, 1 Mar 2016 13:51:54 -0600 Subject: [PATCH] Add configurable despawn distances for living entities -diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -index d2ac0123812224181afae8fca96058ddc8cdff1e..3afadc8d916714398974d77aa0f1093729e008ca 100644 ---- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -@@ -3,6 +3,9 @@ package com.destroystokyo.paper; - import java.util.List; - - import java.util.stream.Collectors; -+import it.unimi.dsi.fastutil.objects.Reference2IntMap; -+import it.unimi.dsi.fastutil.objects.Reference2IntOpenHashMap; -+import net.minecraft.world.entity.MobCategory; - import org.bukkit.Bukkit; - import org.bukkit.configuration.file.YamlConfiguration; - import org.spigotmc.SpigotWorldConfig; -@@ -46,6 +49,13 @@ public class PaperWorldConfig { - public void removeOldValues() { - boolean needsSave = false; - -+ if (PaperConfig.version < 24) { -+ needsSave = true; -+ -+ set("despawn-ranges.soft", null); -+ set("despawn-ranges.hard", null); -+ } -+ - if (needsSave) { - saveConfig(); - } -@@ -137,4 +147,31 @@ public class PaperWorldConfig { - private void nerfedMobsShouldJump() { - nerfedMobsShouldJump = getBoolean("spawner-nerfed-mobs-should-jump", false); - } -+ -+ public final Reference2IntMap softDespawnDistances = new Reference2IntOpenHashMap<>(MobCategory.values().length); -+ public final Reference2IntMap hardDespawnDistances = new Reference2IntOpenHashMap<>(MobCategory.values().length); -+ private void despawnDistances() { -+ if (PaperConfig.version < 24) { -+ int softDistance = getInt("despawn-ranges.soft", 32, false); // 32^2 = 1024, Minecraft Default -+ int hardDistance = getInt("despawn-ranges.hard", 128, false); // 128^2 = 16384, Minecraft Default -+ for (MobCategory value : MobCategory.values()) { -+ if (softDistance != 32) { -+ softDespawnDistances.put(value, softDistance); -+ } -+ if (hardDistance != 128) { -+ hardDespawnDistances.put(value, hardDistance); -+ } -+ } -+ } -+ for (MobCategory category : MobCategory.values()) { -+ int softDistance = getInt("despawn-ranges." + category.getName() + ".soft", softDespawnDistances.getOrDefault(category, category.getNoDespawnDistance())); -+ int hardDistance = getInt("despawn-ranges." + category.getName() + ".hard", hardDespawnDistances.getOrDefault(category, category.getDespawnDistance())); -+ if (softDistance > hardDistance) { -+ softDistance = hardDistance; -+ } -+ log("Mobs in " + category.getName() + " Despawn Ranges: Soft" + softDistance + " Hard: " + hardDistance); -+ softDespawnDistances.put(category, softDistance); -+ hardDespawnDistances.put(category, hardDistance); -+ } -+ } - } diff --git a/src/main/java/net/minecraft/world/entity/Mob.java b/src/main/java/net/minecraft/world/entity/Mob.java -index 4f58fae1b3738e7e0507a46df275a258c94fcec4..88b021b7d1b71bd3fa64b54ca0fd52fef93ea9f0 100644 +index 4f58fae1b3738e7e0507a46df275a258c94fcec4..854653b2481ebe3a04f671ef0af2aecf3093fc0b 100644 --- a/src/main/java/net/minecraft/world/entity/Mob.java +++ b/src/main/java/net/minecraft/world/entity/Mob.java @@ -788,14 +788,14 @@ public abstract class Mob extends LivingEntity { @@ -73,7 +13,7 @@ index 4f58fae1b3738e7e0507a46df275a258c94fcec4..88b021b7d1b71bd3fa64b54ca0fd52fe if (entityhuman != null) { double d0 = entityhuman.distanceToSqr((Entity) this); - int i = this.getType().getCategory().getDespawnDistance(); -+ int i = this.level.paperConfig.hardDespawnDistances.getInt(this.getType().getCategory()); // Paper - custom despawn distances ++ int i = this.level.paperConfig().entities.spawning.despawnRanges.get(this.getType().getCategory()).hard(); // Paper - custom despawn distances int j = i * i; if (d0 > (double) j && this.removeWhenFarAway(d0)) { @@ -81,7 +21,7 @@ index 4f58fae1b3738e7e0507a46df275a258c94fcec4..88b021b7d1b71bd3fa64b54ca0fd52fe } - int k = this.getType().getCategory().getNoDespawnDistance(); -+ int k = this.level.paperConfig.softDespawnDistances.getInt(this.getType().getCategory()); // Paper - custom despawn distances ++ int k = this.level.paperConfig().entities.spawning.despawnRanges.get(this.getType().getCategory()).soft(); // Paper - custom despawn distances int l = k * k; if (this.noActionTime > 600 && this.random.nextInt(800) == 0 && d0 > (double) l && this.removeWhenFarAway(d0)) { diff --git a/patches/server/0019-Allow-for-toggling-of-spawn-chunks.patch b/patches/server/0019-Allow-for-toggling-of-spawn-chunks.patch index 4f5b39ed6e..201871655a 100644 --- a/patches/server/0019-Allow-for-toggling-of-spawn-chunks.patch +++ b/patches/server/0019-Allow-for-toggling-of-spawn-chunks.patch @@ -4,30 +4,15 @@ Date: Thu, 3 Mar 2016 03:53:43 -0600 Subject: [PATCH] Allow for toggling of spawn chunks -diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -index 3afadc8d916714398974d77aa0f1093729e008ca..f32726275d18772904883b618be66893ca5d84fd 100644 ---- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -@@ -174,4 +174,10 @@ public class PaperWorldConfig { - hardDespawnDistances.put(category, hardDistance); - } - } -+ -+ public boolean keepSpawnInMemory; -+ private void keepSpawnInMemory() { -+ keepSpawnInMemory = getBoolean("keep-spawn-loaded", true); -+ log("Keep spawn chunk loaded: " + keepSpawnInMemory); -+ } - } diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java -index 861ebb82ab009588809fe2c8a4f05fbdcfe6f750..efdab784bdec183425a6bc7f376f528c38a94752 100644 +index edf7448e197a2563dd62e4c24b29c139becccaca..5cc0546926ca1403aa325344fc138265f923fe1e 100644 --- a/src/main/java/net/minecraft/world/level/Level.java +++ b/src/main/java/net/minecraft/world/level/Level.java -@@ -249,6 +249,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable { +@@ -253,6 +253,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable { }); // CraftBukkit end timings = new co.aikar.timings.WorldTimingsHandler(this); // Paper - code below can generate new world and access timings -+ this.keepSpawnInMemory = this.paperConfig.keepSpawnInMemory; // Paper ++ this.keepSpawnInMemory = this.paperConfig().spawn.keepSpawnLoaded; // Paper this.entityLimiter = new org.spigotmc.TickLimiter(spigotConfig.entityMaxTickTime); this.tileLimiter = new org.spigotmc.TickLimiter(spigotConfig.tileMaxTickTime); } diff --git a/patches/server/0020-Drop-falling-block-and-tnt-entities-at-the-specified.patch b/patches/server/0020-Drop-falling-block-and-tnt-entities-at-the-specified.patch index a9e9ba68d4..ed1b412de9 100644 --- a/patches/server/0020-Drop-falling-block-and-tnt-entities-at-the-specified.patch +++ b/patches/server/0020-Drop-falling-block-and-tnt-entities-at-the-specified.patch @@ -5,27 +5,8 @@ Subject: [PATCH] Drop falling block and tnt entities at the specified height * Dec 2, 2020 Added tnt nerf for tnt minecarts - Machine_Maker -diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -index f32726275d18772904883b618be66893ca5d84fd..b41f6074e0d88b6becb5b931fc4ee94a1f9f2f0b 100644 ---- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -@@ -180,4 +180,14 @@ public class PaperWorldConfig { - keepSpawnInMemory = getBoolean("keep-spawn-loaded", true); - log("Keep spawn chunk loaded: " + keepSpawnInMemory); - } -+ -+ public int fallingBlockHeightNerf; -+ public int entityTNTHeightNerf; -+ private void heightNerfs() { -+ fallingBlockHeightNerf = getInt("falling-block-height-nerf", 0); -+ entityTNTHeightNerf = getInt("tnt-entity-height-nerf", 0); -+ -+ if (fallingBlockHeightNerf != 0) log("Falling Block Height Limit set to Y: " + fallingBlockHeightNerf); -+ if (entityTNTHeightNerf != 0) log("TNT Entity Height Limit set to Y: " + entityTNTHeightNerf); -+ } - } diff --git a/src/main/java/net/minecraft/world/entity/item/FallingBlockEntity.java b/src/main/java/net/minecraft/world/entity/item/FallingBlockEntity.java -index 7e1594e8df4fd09cd1aecbc5f3784797b04a8337..26ab6d0c98560e4dfebbad3482fd308861818e30 100644 +index 7e1594e8df4fd09cd1aecbc5f3784797b04a8337..bd357c3e6fcbd82f3c53ecc8dab46aa5d3708bc2 100644 --- a/src/main/java/net/minecraft/world/entity/item/FallingBlockEntity.java +++ b/src/main/java/net/minecraft/world/entity/item/FallingBlockEntity.java @@ -137,6 +137,17 @@ public class FallingBlockEntity extends Entity { @@ -34,7 +15,7 @@ index 7e1594e8df4fd09cd1aecbc5f3784797b04a8337..26ab6d0c98560e4dfebbad3482fd3088 this.move(MoverType.SELF, this.getDeltaMovement()); + + // Paper start - Configurable EntityFallingBlock height nerf -+ if (this.level.paperConfig.fallingBlockHeightNerf != 0 && this.getY() > this.level.paperConfig.fallingBlockHeightNerf) { ++ if (this.level.paperConfig().fixes.fallingBlockHeightNerf != 0 && this.getY() > this.level.paperConfig().fixes.fallingBlockHeightNerf) { + if (this.dropItem && this.level.getGameRules().getBoolean(GameRules.RULE_DOENTITYDROPS)) { + this.spawnAtLocation(block); + } @@ -47,7 +28,7 @@ index 7e1594e8df4fd09cd1aecbc5f3784797b04a8337..26ab6d0c98560e4dfebbad3482fd3088 BlockPos blockposition = this.blockPosition(); boolean flag = this.blockState.getBlock() instanceof ConcretePowderBlock; diff --git a/src/main/java/net/minecraft/world/entity/item/PrimedTnt.java b/src/main/java/net/minecraft/world/entity/item/PrimedTnt.java -index e24b46820394c5f220d5bf7c4e763ef95ff9e9ab..bbe15c66917781a8b6950307449f0243ffc3c8c7 100644 +index e24b46820394c5f220d5bf7c4e763ef95ff9e9ab..2d4a990da2402a6c24c03e8be7e518e33db99c8f 100644 --- a/src/main/java/net/minecraft/world/entity/item/PrimedTnt.java +++ b/src/main/java/net/minecraft/world/entity/item/PrimedTnt.java @@ -68,6 +68,12 @@ public class PrimedTnt extends Entity { @@ -55,7 +36,7 @@ index e24b46820394c5f220d5bf7c4e763ef95ff9e9ab..bbe15c66917781a8b6950307449f0243 this.move(MoverType.SELF, this.getDeltaMovement()); + // Paper start - Configurable TNT entity height nerf -+ if (this.level.paperConfig.entityTNTHeightNerf != 0 && this.getY() > this.level.paperConfig.entityTNTHeightNerf) { ++ if (this.level.paperConfig().fixes.tntEntityHeightNerf != 0 && this.getY() > this.level.paperConfig().fixes.tntEntityHeightNerf) { + this.discard(); + return; + } @@ -64,7 +45,7 @@ index e24b46820394c5f220d5bf7c4e763ef95ff9e9ab..bbe15c66917781a8b6950307449f0243 if (this.onGround) { this.setDeltaMovement(this.getDeltaMovement().multiply(0.7D, -0.5D, 0.7D)); diff --git a/src/main/java/net/minecraft/world/entity/vehicle/MinecartTNT.java b/src/main/java/net/minecraft/world/entity/vehicle/MinecartTNT.java -index c10c28eb441e65c6285c25b5d4760c876909c724..469dbae2e04a9ded9e46a576b2e1b020801c1395 100644 +index c10c28eb441e65c6285c25b5d4760c876909c724..136bd0168b573079dfad127d02ca8ba72c02fafb 100644 --- a/src/main/java/net/minecraft/world/entity/vehicle/MinecartTNT.java +++ b/src/main/java/net/minecraft/world/entity/vehicle/MinecartTNT.java @@ -46,6 +46,12 @@ public class MinecartTNT extends AbstractMinecart { @@ -72,7 +53,7 @@ index c10c28eb441e65c6285c25b5d4760c876909c724..469dbae2e04a9ded9e46a576b2e1b020 super.tick(); if (this.fuse > 0) { + // Paper start - Configurable TNT entity height nerf -+ if (this.level.paperConfig.entityTNTHeightNerf != 0 && this.getY() > this.level.paperConfig.entityTNTHeightNerf) { ++ if (this.level.paperConfig().fixes.tntEntityHeightNerf != 0 && this.getY() > this.level.paperConfig().fixes.tntEntityHeightNerf) { + this.discard(); + return; + } diff --git a/patches/server/0021-Show-Paper-in-client-crashes-server-lists-and-Mojang.patch b/patches/server/0021-Show-Paper-in-client-crashes-server-lists-and-Mojang.patch index a803a20447..957eb48276 100644 --- a/patches/server/0021-Show-Paper-in-client-crashes-server-lists-and-Mojang.patch +++ b/patches/server/0021-Show-Paper-in-client-crashes-server-lists-and-Mojang.patch @@ -6,10 +6,10 @@ Subject: [PATCH] Show 'Paper' in client crashes, server lists, and Mojang diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index 9be29fbb97aced80da8adb693521a8bd870870c5..bd549661ccfb29b9a4f9d69956c549ba3e888e31 100644 +index 1190d62594c5b1be1c11d55e646ee0bac27307cb..c38cfd4781911db0fe191412f089c55cc4e40f2a 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java -@@ -1414,7 +1414,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop withinDistance(double x, double y, double z, double max) { double d4 = max * max; diff --git a/src/main/java/net/minecraft/world/entity/Mob.java b/src/main/java/net/minecraft/world/entity/Mob.java -index 88b021b7d1b71bd3fa64b54ca0fd52fef93ea9f0..7827e40e824de85ae1f6ea6fc82455b2cea532cb 100644 +index 854653b2481ebe3a04f671ef0af2aecf3093fc0b..c09f1ac470c4055897f8d6c6201bd8dc421cdbfe 100644 --- a/src/main/java/net/minecraft/world/entity/Mob.java +++ b/src/main/java/net/minecraft/world/entity/Mob.java @@ -784,7 +784,7 @@ public abstract class Mob extends LivingEntity { @@ -117,7 +117,7 @@ index 7c5918f84d2b8f9c778258b7e7d745105effb082..cfb286020b8ee87bad7edbda4cd0b999 for(Player player : this.players()) { if (EntitySelector.NO_SPECTATORS.test(player) && EntitySelector.LIVING_ENTITY_STILL_ALIVE.test(player)) { diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -index f43a728eba966992831d040a0ed96f5720d8d15c..ab9880eb5a7db6951cee329656c06e9e956ec2ad 100644 +index fcff5e05818c81f72cb6e0f83a683c2bb3979737..d4c5e032c1c3e79c84ab99d7f90417e2b4c673df 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java @@ -1958,8 +1958,20 @@ public class CraftPlayer extends CraftHumanEntity implements Player { diff --git a/patches/server/0025-Further-improve-server-tick-loop.patch b/patches/server/0025-Further-improve-server-tick-loop.patch index a1536a0d2c..2cddfb3cd4 100644 --- a/patches/server/0025-Further-improve-server-tick-loop.patch +++ b/patches/server/0025-Further-improve-server-tick-loop.patch @@ -12,7 +12,7 @@ Previous implementation did not calculate TPS correctly. Switch to a realistic rolling average and factor in std deviation as an extra reporting variable diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index bd549661ccfb29b9a4f9d69956c549ba3e888e31..39a079ce407081ba1ff13c23cfbeeab9c5a78e07 100644 +index c38cfd4781911db0fe191412f089c55cc4e40f2a..8cc5b6bbe2d8cbeb72e88b9e08e87fbbb98a6f8a 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java @@ -267,7 +267,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop 0; } -+ private void netherVoidTopDamageHeight() { -+ netherVoidTopDamageHeight = getInt("nether-ceiling-void-damage-height", 0); -+ log("Top of the nether void damage height: " + netherVoidTopDamageHeight); -+ -+ if (PaperConfig.version < 18) { -+ boolean legacy = getBoolean("nether-ceiling-void-damage", false); -+ if (legacy) { -+ netherVoidTopDamageHeight = 128; -+ set("nether-ceiling-void-damage-height", netherVoidTopDamageHeight); -+ } -+ } -+ } - } diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java -index 9c967df2e9cb7102ec2d6e4f02971f3342295b5a..51475d726004b857e0fbaffa9df2c777c2942071 100644 +index 96864858f28337a6807cfa255b6b607bdbd337ce..3da8823a931d14cff60d3b99636cbf54d890b820 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java @@ -652,7 +652,11 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource { @@ -39,8 +15,8 @@ index 9c967df2e9cb7102ec2d6e4f02971f3342295b5a..51475d726004b857e0fbaffa9df2c777 - if (this.getY() < (double) (this.level.getMinBuildHeight() - 64)) { + // Paper start - Configurable nether ceiling damage + if (this.getY() < (double) (this.level.getMinBuildHeight() - 64) || (this.level.getWorld().getEnvironment() == org.bukkit.World.Environment.NETHER -+ && level.paperConfig.doNetherTopVoidDamage() -+ && this.getY() >= this.level.paperConfig.netherVoidTopDamageHeight)) { ++ && level.paperConfig().environment.netherCeilingVoidDamageHeight > 0 ++ && this.getY() >= this.level.paperConfig().environment.netherCeilingVoidDamageHeight)) { + // Paper end this.outOfWorld(); } diff --git a/patches/server/0032-Configurable-end-credits.patch b/patches/server/0032-Configurable-end-credits.patch index 5380b3788b..e494e69c4c 100644 --- a/patches/server/0032-Configurable-end-credits.patch +++ b/patches/server/0032-Configurable-end-credits.patch @@ -4,30 +4,15 @@ Date: Wed, 16 Mar 2016 02:21:39 -0500 Subject: [PATCH] Configurable end credits -diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -index 10c08ed945f950b9c2a5e308f8caa11955cb0088..067234ed44cae4454acc76b9ebe83ee1394fb913 100644 ---- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -@@ -205,4 +205,10 @@ public class PaperWorldConfig { - } - } - } -+ -+ public boolean disableEndCredits; -+ private void disableEndCredits() { -+ disableEndCredits = getBoolean("game-mechanics.disable-end-credits", false); -+ log("End credits disabled: " + disableEndCredits); -+ } - } diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java -index 7002d5f5700570e32ebf0b63e340d87d58357162..5940c2435dba421ee8480407f14827a2c876ac94 100644 +index 7002d5f5700570e32ebf0b63e340d87d58357162..66fa7e12a9a398d510a75549c3db135feb4c562c 100644 --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java @@ -989,6 +989,7 @@ public class ServerPlayer extends Player { this.unRide(); this.getLevel().removePlayerImmediately(this, Entity.RemovalReason.CHANGED_DIMENSION); if (!this.wonGame) { -+ if (level.paperConfig.disableEndCredits) this.seenCredits = true; // Paper - Toggle to always disable end credits ++ if (level.paperConfig().misc.disableEndCredits) this.seenCredits = true; // Paper - Toggle to always disable end credits this.wonGame = true; this.connection.send(new ClientboundGameEventPacket(ClientboundGameEventPacket.WIN_GAME, this.seenCredits ? 0.0F : 1.0F)); this.seenCredits = true; diff --git a/patches/server/0034-Optimize-explosions.patch b/patches/server/0034-Optimize-explosions.patch index e7930ba9f5..d573ea2c44 100644 --- a/patches/server/0034-Optimize-explosions.patch +++ b/patches/server/0034-Optimize-explosions.patch @@ -9,26 +9,11 @@ expensive when there are hundreds or more entities in range. This patch adds a per-tick cache that is used for storing and retrieving an entity's exposure during an explosion. -diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -index 067234ed44cae4454acc76b9ebe83ee1394fb913..73dda3becdf29dac35f4a0ceea070d174c546c8b 100644 ---- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -@@ -211,4 +211,10 @@ public class PaperWorldConfig { - disableEndCredits = getBoolean("game-mechanics.disable-end-credits", false); - log("End credits disabled: " + disableEndCredits); - } -+ -+ public boolean optimizeExplosions; -+ private void optimizeExplosions() { -+ optimizeExplosions = getBoolean("optimize-explosions", false); -+ log("Optimize explosions: " + optimizeExplosions); -+ } - } diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index 032e6819da27c8616b9b3b6c09bd559e69c35100..f037503a68f2b7b7c76b6ac7243dde2bf734afbd 100644 +index 8cc5b6bbe2d8cbeb72e88b9e08e87fbbb98a6f8a..21e09c039a4c3fa64f6456e5cc7d50463590f787 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java -@@ -1393,6 +1393,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop 0 && this.random.nextInt(this.spigotConfig.thunderChance) == 0) { // Spigot -+ if (!this.paperConfig.disableThunder && flag && this.isThundering() && this.spigotConfig.thunderChance > 0 && this.random.nextInt(this.spigotConfig.thunderChance) == 0) { // Spigot // Paper - disable thunder ++ if (!this.paperConfig().environment.disableThunder && flag && this.isThundering() && this.spigotConfig.thunderChance > 0 && this.random.nextInt(this.spigotConfig.thunderChance) == 0) { // Spigot // Paper - disable thunder blockposition = this.findLightningTargetAround(this.getBlockRandomPos(j, 0, k, 15)); if (this.isRainingAt(blockposition)) { DifficultyInstance difficultydamagescaler = this.getCurrentDifficultyAt(blockposition); diff --git a/patches/server/0037-Disable-ice-and-snow.patch b/patches/server/0037-Disable-ice-and-snow.patch index 714fbbc137..eed900bd52 100644 --- a/patches/server/0037-Disable-ice-and-snow.patch +++ b/patches/server/0037-Disable-ice-and-snow.patch @@ -4,22 +4,8 @@ Date: Wed, 2 Mar 2016 14:57:24 -0600 Subject: [PATCH] Disable ice and snow -diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -index a591d52ed44213d7932690136796d3e068b06987..18e7960624e4e882677145c3bedd00263a57b051 100644 ---- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -@@ -227,4 +227,9 @@ public class PaperWorldConfig { - private void disableThunder() { - disableThunder = getBoolean("disable-thunder", false); - } -+ -+ public boolean disableIceAndSnow; -+ private void disableIceAndSnow(){ -+ disableIceAndSnow = getBoolean("disable-ice-and-snow", false); -+ } - } diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java -index 94a796143e25a0e8914158efed4ce01a440f3bcc..a04e75293b1d196341bc641ee7da975bf9baec13 100644 +index 2a51916a3fc8bd8d6b0255051a024dbb7f6a9ad5..0023f18e7b856f6178e516d1b692d3697ba99631 100644 --- a/src/main/java/net/minecraft/server/level/ServerLevel.java +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java @@ -603,7 +603,7 @@ public class ServerLevel extends Level implements WorldGenLevel { @@ -27,7 +13,7 @@ index 94a796143e25a0e8914158efed4ce01a440f3bcc..a04e75293b1d196341bc641ee7da975b gameprofilerfiller.popPush("iceandsnow"); - if (this.random.nextInt(16) == 0) { -+ if (!this.paperConfig.disableIceAndSnow && this.random.nextInt(16) == 0) { // Paper - Disable ice and snow ++ if (!this.paperConfig().environment.disableIceAndSnow && this.random.nextInt(16) == 0) { // Paper - Disable ice and snow blockposition = this.getHeightmapPos(Heightmap.Types.MOTION_BLOCKING, this.getBlockRandomPos(j, 0, k, 15)); BlockPos blockposition1 = blockposition.below(); Biome biomebase = (Biome) this.getBiome(blockposition).value(); diff --git a/patches/server/0038-Configurable-mob-spawner-tick-rate.patch b/patches/server/0038-Configurable-mob-spawner-tick-rate.patch index 6e1a8bbec6..b33478a7a0 100644 --- a/patches/server/0038-Configurable-mob-spawner-tick-rate.patch +++ b/patches/server/0038-Configurable-mob-spawner-tick-rate.patch @@ -4,22 +4,8 @@ Date: Wed, 2 Mar 2016 15:03:53 -0600 Subject: [PATCH] Configurable mob spawner tick rate -diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -index 18e7960624e4e882677145c3bedd00263a57b051..fcbb0d6cd09a9c80a8725c9cf0c503fa0532f1e3 100644 ---- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -@@ -232,4 +232,9 @@ public class PaperWorldConfig { - private void disableIceAndSnow(){ - disableIceAndSnow = getBoolean("disable-ice-and-snow", false); - } -+ -+ public int mobSpawnerTickRate; -+ private void mobSpawnerTickRate() { -+ mobSpawnerTickRate = getInt("mob-spawner-tick-rate", 1); -+ } - } diff --git a/src/main/java/net/minecraft/world/level/BaseSpawner.java b/src/main/java/net/minecraft/world/level/BaseSpawner.java -index c5b9b19763fd944b4f31c6d3c9b71d372f8403cf..5bc0071c5309548219cbcd902d7020ff4a5ca6b7 100644 +index c5b9b19763fd944b4f31c6d3c9b71d372f8403cf..e5b56a85d76d1417dda2d14b1b03850bbb070f4c 100644 --- a/src/main/java/net/minecraft/world/level/BaseSpawner.java +++ b/src/main/java/net/minecraft/world/level/BaseSpawner.java @@ -42,6 +42,7 @@ public abstract class BaseSpawner { @@ -36,7 +22,7 @@ index c5b9b19763fd944b4f31c6d3c9b71d372f8403cf..5bc0071c5309548219cbcd902d7020ff public void serverTick(ServerLevel world, BlockPos pos) { + // Paper start - Configurable mob spawner tick rate + if (spawnDelay > 0 && --tickDelay > 0) return; -+ tickDelay = world.paperConfig.mobSpawnerTickRate; ++ tickDelay = world.paperConfig().tickRates.mobSpawner; + if (tickDelay == -1) { return; } // If disabled + // Paper end if (this.isNearPlayer(world, pos)) { diff --git a/patches/server/0039-Implement-PlayerLocaleChangeEvent.patch b/patches/server/0039-Implement-PlayerLocaleChangeEvent.patch index 66d29897e1..e8acf777c6 100644 --- a/patches/server/0039-Implement-PlayerLocaleChangeEvent.patch +++ b/patches/server/0039-Implement-PlayerLocaleChangeEvent.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Implement PlayerLocaleChangeEvent diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java -index 5940c2435dba421ee8480407f14827a2c876ac94..732622344982137b5ac051c6d510c7860fbe4e0a 100644 +index 66fa7e12a9a398d510a75549c3db135feb4c562c..e839487415ad88bdea1ce3f4f84a6f9649eb9da9 100644 --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java @@ -1755,7 +1755,7 @@ public class ServerPlayer extends Player { @@ -30,7 +30,7 @@ index 5940c2435dba421ee8480407f14827a2c876ac94..732622344982137b5ac051c6d510c786 this.locale = packet.language; // Paper start diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -index 9a2a6e9ba09f4f6347926579ad5f803de4a6033f..8fb5bcd3fcd7706fc62771b90107ed8efedd7d1c 100644 +index 7df667b54478d5e415cf6872984db33981b8e4f9..c5a02c5a6ccf14d2088ee0b65fd27db926b26eac 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java @@ -1958,8 +1958,10 @@ public class CraftPlayer extends CraftHumanEntity implements Player { diff --git a/patches/server/0040-Per-Player-View-Distance-API-placeholders.patch b/patches/server/0040-Per-Player-View-Distance-API-placeholders.patch index cb6553f075..e95005b267 100644 --- a/patches/server/0040-Per-Player-View-Distance-API-placeholders.patch +++ b/patches/server/0040-Per-Player-View-Distance-API-placeholders.patch @@ -7,7 +7,7 @@ I hope to look at this more in-depth soon. It appears doable. However this should not block the update. diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java -index 732622344982137b5ac051c6d510c7860fbe4e0a..cebd22696a672fc0f1c1fb0676ac76842244b6d3 100644 +index e839487415ad88bdea1ce3f4f84a6f9649eb9da9..447d4e724b5ff129bd6670f4d7b2111acfe33719 100644 --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java @@ -2242,4 +2242,6 @@ public class ServerPlayer extends Player { @@ -60,7 +60,7 @@ index 1357bc97801f892e59fc8e89c3cc2d697894ccfb..cf9c2456004ce5fc0e38da33251f66df // Spigot start private final org.bukkit.World.Spigot spigot = new org.bukkit.World.Spigot() diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -index 8fb5bcd3fcd7706fc62771b90107ed8efedd7d1c..794eea1b7c897f384e8eafe654fb5628e43f6fda 100644 +index c5a02c5a6ccf14d2088ee0b65fd27db926b26eac..5d35cd1b790197c92f2340426e5dd17827b3bfaa 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java @@ -402,6 +402,46 @@ public class CraftPlayer extends CraftHumanEntity implements Player { diff --git a/patches/server/0042-Configurable-container-update-tick-rate.patch b/patches/server/0042-Configurable-container-update-tick-rate.patch index 032bca1957..2cb4b00ecf 100644 --- a/patches/server/0042-Configurable-container-update-tick-rate.patch +++ b/patches/server/0042-Configurable-container-update-tick-rate.patch @@ -4,22 +4,8 @@ Date: Wed, 2 Mar 2016 23:34:44 -0600 Subject: [PATCH] Configurable container update tick rate -diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -index fcbb0d6cd09a9c80a8725c9cf0c503fa0532f1e3..156059d4951fa01b10cc36d70cd439037c636e4c 100644 ---- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -@@ -237,4 +237,9 @@ public class PaperWorldConfig { - private void mobSpawnerTickRate() { - mobSpawnerTickRate = getInt("mob-spawner-tick-rate", 1); - } -+ -+ public int containerUpdateTickRate; -+ private void containerUpdateTickRate() { -+ containerUpdateTickRate = getInt("container-update-tick-rate", 1); -+ } - } diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java -index cebd22696a672fc0f1c1fb0676ac76842244b6d3..a375d2d0bffc3694e76bae3f9ba13f60e629d859 100644 +index 447d4e724b5ff129bd6670f4d7b2111acfe33719..73fe1f1047e39eeeb8a1444fa353f7d1a8e651b3 100644 --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java @@ -226,6 +226,7 @@ public class ServerPlayer extends Player { @@ -38,7 +24,7 @@ index cebd22696a672fc0f1c1fb0676ac76842244b6d3..a375d2d0bffc3694e76bae3f9ba13f60 + // Paper start - Configurable container update tick rate + if (--containerUpdateDelay <= 0) { + this.containerMenu.broadcastChanges(); -+ containerUpdateDelay = level.paperConfig.containerUpdateTickRate; ++ containerUpdateDelay = level.paperConfig().tickRates.containerUpdate; + } + // Paper end if (!this.level.isClientSide && !this.containerMenu.stillValid(this)) { diff --git a/patches/server/0044-Disable-spigot-tick-limiters.patch b/patches/server/0044-Disable-spigot-tick-limiters.patch index f81394e570..7c6b018df0 100644 --- a/patches/server/0044-Disable-spigot-tick-limiters.patch +++ b/patches/server/0044-Disable-spigot-tick-limiters.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Disable spigot tick limiters diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java -index 7d86a8744d76e2fe8b3bf4b85152ea2203817713..e52d69675c823184303536db0f673762d8eca100 100644 +index 849f83944467ca3c505afebf2b84806e46670fb0..17da97bfece600438f6e872e8a1a2bee1d60c804 100644 --- a/src/main/java/net/minecraft/world/level/Level.java +++ b/src/main/java/net/minecraft/world/level/Level.java -@@ -660,9 +660,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable { +@@ -664,9 +664,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable { // Spigot start // Iterator iterator = this.blockEntityTickers.iterator(); int tilesThisCycle = 0; diff --git a/patches/server/0045-Add-PlayerInitialSpawnEvent.patch b/patches/server/0045-Add-PlayerInitialSpawnEvent.patch index fc908d1e03..bcfa1912ef 100644 --- a/patches/server/0045-Add-PlayerInitialSpawnEvent.patch +++ b/patches/server/0045-Add-PlayerInitialSpawnEvent.patch @@ -9,7 +9,7 @@ This is a duplicate API from spigot, so use our duplicate subclass and improve setPosition to use raw diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java -index 870fb4ffb01ba291d9d3aabfd722e669a477e209..4cf2264208ce681d92441cd06bf8120d586bc82a 100644 +index dbd53de61057eb9eb8be651abf9abcad18423ab1..16e1d0b62e01551a54d60c81ca12708f51aceef9 100644 --- a/src/main/java/net/minecraft/server/players/PlayerList.java +++ b/src/main/java/net/minecraft/server/players/PlayerList.java @@ -221,7 +221,7 @@ public abstract class PlayerList { diff --git a/patches/server/0046-Configurable-Disabling-Cat-Chest-Detection.patch b/patches/server/0046-Configurable-Disabling-Cat-Chest-Detection.patch index becda642b1..85180f4352 100644 --- a/patches/server/0046-Configurable-Disabling-Cat-Chest-Detection.patch +++ b/patches/server/0046-Configurable-Disabling-Cat-Chest-Detection.patch @@ -5,22 +5,8 @@ Subject: [PATCH] Configurable Disabling Cat Chest Detection Offers a gameplay feature to stop cats from blocking chests -diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -index 156059d4951fa01b10cc36d70cd439037c636e4c..adf5a83fc1b62e55ba4524893f8704ad6cd81e97 100644 ---- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -@@ -242,4 +242,9 @@ public class PaperWorldConfig { - private void containerUpdateTickRate() { - containerUpdateTickRate = getInt("container-update-tick-rate", 1); - } -+ -+ public boolean disableChestCatDetection; -+ private void disableChestCatDetection() { -+ disableChestCatDetection = getBoolean("game-mechanics.disable-chest-cat-detection", false); -+ } - } diff --git a/src/main/java/net/minecraft/world/level/block/ChestBlock.java b/src/main/java/net/minecraft/world/level/block/ChestBlock.java -index ccde1bef18a7ffe338d71a6feb2dd88228004c34..2f6b5142543aec14b27a996fe1a6817ac44c77b8 100644 +index ccde1bef18a7ffe338d71a6feb2dd88228004c34..c6b57d45383441aa35510e759ce3cb82bc98f305 100644 --- a/src/main/java/net/minecraft/world/level/block/ChestBlock.java +++ b/src/main/java/net/minecraft/world/level/block/ChestBlock.java @@ -361,6 +361,11 @@ public class ChestBlock extends AbstractChestBlock implements @@ -28,7 +14,7 @@ index ccde1bef18a7ffe338d71a6feb2dd88228004c34..2f6b5142543aec14b27a996fe1a6817a private static boolean isCatSittingOnChest(LevelAccessor world, BlockPos pos) { + // Paper start - Option to disable chest cat detection -+ if (((Level) world).paperConfig.disableChestCatDetection) { ++ if (world.getMinecraftWorld().paperConfig().entities.behavior.disableChestCatDetection) { + return false; + } + // Paper end diff --git a/patches/server/0047-Ensure-commands-are-not-ran-async.patch b/patches/server/0047-Ensure-commands-are-not-ran-async.patch index 6a4025dcba..a25f651755 100644 --- a/patches/server/0047-Ensure-commands-are-not-ran-async.patch +++ b/patches/server/0047-Ensure-commands-are-not-ran-async.patch @@ -14,7 +14,7 @@ big slowdown in execution but throwing an exception at same time to raise awaren that it is happening so that plugin authors can fix their code to stop executing commands async. diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index a75353e96d0e0a017e4a5dc84c04a5c594535439..984209f32015d765367fd7693fb759de571b9ad0 100644 +index e65175696d4d99225e87d79cf3e59cf2f29637e1..ea9a2b48d3d84fcf1ec263c920bacd80ae26cb27 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java @@ -1947,6 +1947,29 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser @@ -48,7 +48,7 @@ index a75353e96d0e0a017e4a5dc84c04a5c594535439..984209f32015d765367fd7693fb759de } else if (this.player.getChatVisibility() == ChatVisiblity.SYSTEM) { // Do nothing, this is coming from a plugin diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -index a7dcdb5cce888f8580b54f7de263110e69285311..c30ee88c7e49364a799c848ceb683084ae0febc8 100644 +index e700b38d8884f4228a8925f07c4cf1500dbdfa20..71be195aa194aa1c12a7e7b8f2cffcd81a1ebbba 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java @@ -852,6 +852,28 @@ public final class CraftServer implements Server { diff --git a/patches/server/0048-All-chunks-are-slime-spawn-chunks-toggle.patch b/patches/server/0048-All-chunks-are-slime-spawn-chunks-toggle.patch index 7016bc9d69..c510a84432 100644 --- a/patches/server/0048-All-chunks-are-slime-spawn-chunks-toggle.patch +++ b/patches/server/0048-All-chunks-are-slime-spawn-chunks-toggle.patch @@ -4,22 +4,8 @@ Date: Thu, 3 Mar 2016 01:19:22 -0600 Subject: [PATCH] All chunks are slime spawn chunks toggle -diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -index adf5a83fc1b62e55ba4524893f8704ad6cd81e97..567bad50508870001c3337bf109a407b6b4cde0e 100644 ---- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -@@ -247,4 +247,9 @@ public class PaperWorldConfig { - private void disableChestCatDetection() { - disableChestCatDetection = getBoolean("game-mechanics.disable-chest-cat-detection", false); - } -+ -+ public boolean allChunksAreSlimeChunks; -+ private void allChunksAreSlimeChunks() { -+ allChunksAreSlimeChunks = getBoolean("all-chunks-are-slime-chunks", false); -+ } - } diff --git a/src/main/java/net/minecraft/world/entity/monster/Slime.java b/src/main/java/net/minecraft/world/entity/monster/Slime.java -index a62f88048d8243f5b98834988c049471114c4199..61304f83aff18ae20316db7e16b673a652eb73a4 100644 +index a62f88048d8243f5b98834988c049471114c4199..7b95d18fb5edbd1575f6be92bfcbb3e0d7f691c8 100644 --- a/src/main/java/net/minecraft/world/entity/monster/Slime.java +++ b/src/main/java/net/minecraft/world/entity/monster/Slime.java @@ -316,7 +316,7 @@ public class Slime extends Mob implements Enemy { @@ -27,12 +13,12 @@ index a62f88048d8243f5b98834988c049471114c4199..61304f83aff18ae20316db7e16b673a6 ChunkPos chunkcoordintpair = new ChunkPos(pos); - boolean flag = WorldgenRandom.seedSlimeChunk(chunkcoordintpair.x, chunkcoordintpair.z, ((WorldGenLevel) world).getSeed(), world.getMinecraftWorld().spigotConfig.slimeSeed).nextInt(10) == 0; // Spigot -+ boolean flag = world.getMinecraftWorld().paperConfig.allChunksAreSlimeChunks || WorldgenRandom.seedSlimeChunk(chunkcoordintpair.x, chunkcoordintpair.z, ((WorldGenLevel) world).getSeed(), world.getMinecraftWorld().spigotConfig.slimeSeed).nextInt(10) == 0; // Spigot // Paper ++ boolean flag = world.getMinecraftWorld().paperConfig().entities.spawning.allChunksAreSlimeChunks || WorldgenRandom.seedSlimeChunk(chunkcoordintpair.x, chunkcoordintpair.z, ((WorldGenLevel) world).getSeed(), world.getMinecraftWorld().spigotConfig.slimeSeed).nextInt(10) == 0; // Spigot // Paper if (random.nextInt(10) == 0 && flag && pos.getY() < 40) { return checkMobSpawnRules(type, world, spawnReason, pos, random); diff --git a/src/main/java/org/bukkit/craftbukkit/CraftChunk.java b/src/main/java/org/bukkit/craftbukkit/CraftChunk.java -index d748eb01ecb2b15b081ab3d98b3b3d5804a2215a..0a72475c241e0392993c3e501f891b74c7f72019 100644 +index d748eb01ecb2b15b081ab3d98b3b3d5804a2215a..0d905269ab3bce4cfe68647b9b0cda8fff4aa17e 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftChunk.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftChunk.java @@ -220,7 +220,7 @@ public class CraftChunk implements Chunk { @@ -40,7 +26,7 @@ index d748eb01ecb2b15b081ab3d98b3b3d5804a2215a..0a72475c241e0392993c3e501f891b74 public boolean isSlimeChunk() { // 987234911L is deterimined in EntitySlime when seeing if a slime can spawn in a chunk - return WorldgenRandom.seedSlimeChunk(this.getX(), this.getZ(), this.getWorld().getSeed(), worldServer.spigotConfig.slimeSeed).nextInt(10) == 0; -+ return this.worldServer.paperConfig.allChunksAreSlimeChunks || WorldgenRandom.seedSlimeChunk(this.getX(), this.getZ(), this.getWorld().getSeed(), worldServer.spigotConfig.slimeSeed).nextInt(10) == 0; // Paper ++ return this.worldServer.paperConfig().entities.spawning.allChunksAreSlimeChunks || WorldgenRandom.seedSlimeChunk(this.getX(), this.getZ(), this.getWorld().getSeed(), worldServer.spigotConfig.slimeSeed).nextInt(10) == 0; // Paper } @Override diff --git a/patches/server/0049-Expose-server-CommandMap.patch b/patches/server/0049-Expose-server-CommandMap.patch index 32f3ab5a03..b709ae9895 100644 --- a/patches/server/0049-Expose-server-CommandMap.patch +++ b/patches/server/0049-Expose-server-CommandMap.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Expose server CommandMap diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -index c30ee88c7e49364a799c848ceb683084ae0febc8..5b002bb66d75f5a93492324fd77a91f851c47224 100644 +index 71be195aa194aa1c12a7e7b8f2cffcd81a1ebbba..4cb1d15c7f6d7720d696608cbb8fb4572358ffc7 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -@@ -1958,6 +1958,7 @@ public final class CraftServer implements Server { +@@ -1957,6 +1957,7 @@ public final class CraftServer implements Server { return this.helpMap; } diff --git a/patches/server/0052-Player-Tab-List-and-Title-APIs.patch b/patches/server/0052-Player-Tab-List-and-Title-APIs.patch index d026f9065d..69344c0bed 100644 --- a/patches/server/0052-Player-Tab-List-and-Title-APIs.patch +++ b/patches/server/0052-Player-Tab-List-and-Title-APIs.patch @@ -63,7 +63,7 @@ index bd808eb312ade7122973a47f4b96505829511da5..bf0f9cab7c66c089f35b851e799ba4a4 // Paper end buf.writeComponent(this.text); diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -index 794eea1b7c897f384e8eafe654fb5628e43f6fda..2c12861a76f2340fc4c8f0d4fd271ae8de35badd 100644 +index 5d35cd1b790197c92f2340426e5dd17827b3bfaa..b3e12f613117dd417f48981a7c2388597118b515 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java @@ -1,5 +1,6 @@ diff --git a/patches/server/0053-Add-configurable-portal-search-radius.patch b/patches/server/0053-Add-configurable-portal-search-radius.patch index 966fb4a9c7..0c56e97e6f 100644 --- a/patches/server/0053-Add-configurable-portal-search-radius.patch +++ b/patches/server/0053-Add-configurable-portal-search-radius.patch @@ -4,45 +4,27 @@ Date: Thu, 3 Mar 2016 02:46:17 -0600 Subject: [PATCH] Add configurable portal search radius -diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -index 567bad50508870001c3337bf109a407b6b4cde0e..66dd2ebda5692157e397f7ddafd96a492e53c9e9 100644 ---- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -@@ -252,4 +252,13 @@ public class PaperWorldConfig { - private void allChunksAreSlimeChunks() { - allChunksAreSlimeChunks = getBoolean("all-chunks-are-slime-chunks", false); - } -+ -+ public int portalSearchRadius; -+ public int portalCreateRadius; -+ public boolean portalSearchVanillaDimensionScaling; -+ private void portalSearchRadius() { -+ portalSearchRadius = getInt("portal-search-radius", 128); -+ portalCreateRadius = getInt("portal-create-radius", 16); -+ portalSearchVanillaDimensionScaling = getBoolean("portal-search-vanilla-dimension-scaling", true); -+ } - } diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java -index 51475d726004b857e0fbaffa9df2c777c2942071..d6bf1d3356a8894cdeacac270d96d7ea07c79879 100644 +index 3da8823a931d14cff60d3b99636cbf54d890b820..86b8747ec3aa9c92644fe313c7a73593f8bf4eae 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java -@@ -2940,7 +2940,13 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource { +@@ -2939,7 +2939,13 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource { double d0 = DimensionType.getTeleportationScale(this.level.dimensionType(), destination.dimensionType()); BlockPos blockposition = worldborder.clampToBounds(this.getX() * d0, this.getY(), this.getZ() * d0); // CraftBukkit start - CraftPortalEvent event = this.callPortalEvent(this, destination, blockposition, PlayerTeleportEvent.TeleportCause.NETHER_PORTAL, flag2 ? 16 : 128, 16); + // Paper start -+ int portalSearchRadius = destination.paperConfig.portalSearchRadius; -+ if (level.paperConfig.portalSearchVanillaDimensionScaling && flag2) { // == THE_NETHER ++ int portalSearchRadius = destination.paperConfig().environment.portalSearchRadius; ++ if (level.paperConfig().environment.portalSearchVanillaDimensionScaling && flag2) { // == THE_NETHER + portalSearchRadius = (int) (portalSearchRadius / destination.dimensionType().coordinateScale()); + } + // Paper end -+ CraftPortalEvent event = this.callPortalEvent(this, destination, blockposition, PlayerTeleportEvent.TeleportCause.NETHER_PORTAL, portalSearchRadius, destination.paperConfig.portalCreateRadius); // Paper start - configurable portal radius ++ CraftPortalEvent event = this.callPortalEvent(this, destination, blockposition, PlayerTeleportEvent.TeleportCause.NETHER_PORTAL, portalSearchRadius, destination.paperConfig().environment.portalCreateRadius); // Paper start - configurable portal radius if (event == null) { return null; } diff --git a/src/main/java/net/minecraft/world/level/portal/PortalForcer.java b/src/main/java/net/minecraft/world/level/portal/PortalForcer.java -index bb05ea288432ece497957c3503c3435655ce8997..8672545ba07205ef362442e1342f2ee5281f62cb 100644 +index bb05ea288432ece497957c3503c3435655ce8997..7aa6181237eaec1df2ed2fdcd3b1137dfe89ce69 100644 --- a/src/main/java/net/minecraft/world/level/portal/PortalForcer.java +++ b/src/main/java/net/minecraft/world/level/portal/PortalForcer.java @@ -43,7 +43,7 @@ public class PortalForcer { @@ -50,7 +32,7 @@ index bb05ea288432ece497957c3503c3435655ce8997..8672545ba07205ef362442e1342f2ee5 public Optional findPortalAround(BlockPos pos, boolean destIsNether, WorldBorder worldBorder) { // CraftBukkit start - return this.findPortalAround(pos, worldBorder, destIsNether ? 16 : 128); // Search Radius -+ return this.findPortalAround(pos, worldBorder, destIsNether ? level.paperConfig.portalCreateRadius : level.paperConfig.portalSearchRadius); // Search Radius // Paper - search Radius ++ return this.findPortalAround(pos, worldBorder, destIsNether ? level.paperConfig().environment.portalCreateRadius : level.paperConfig().environment.portalSearchRadius); // Search Radius // Paper - search Radius } public Optional findPortalAround(BlockPos blockposition, WorldBorder worldborder, int i) { diff --git a/patches/server/0054-Add-velocity-warnings.patch b/patches/server/0054-Add-velocity-warnings.patch index e701f05b92..0a0f757bd2 100644 --- a/patches/server/0054-Add-velocity-warnings.patch +++ b/patches/server/0054-Add-velocity-warnings.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Add velocity warnings diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -index 5b002bb66d75f5a93492324fd77a91f851c47224..ff7f1347619d4df2a5c217a4b6545878ed81293c 100644 +index 4cb1d15c7f6d7720d696608cbb8fb4572358ffc7..a8b963b336045c11c71dfff4e0ad0d66a9b47a92 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java @@ -274,6 +274,7 @@ public final class CraftServer implements Server { diff --git a/patches/server/0055-Configurable-inter-world-teleportation-safety.patch b/patches/server/0055-Configurable-inter-world-teleportation-safety.patch index 7153e96780..6702e121ce 100644 --- a/patches/server/0055-Configurable-inter-world-teleportation-safety.patch +++ b/patches/server/0055-Configurable-inter-world-teleportation-safety.patch @@ -15,22 +15,8 @@ Example setup to perform the glitch: http://puu.sh/ng3PC/cf072dcbdb.png The wanted destination was on top of the emerald block however the player ended on top of the diamond block. This only is the case if the player is teleporting between worlds. -diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -index 66dd2ebda5692157e397f7ddafd96a492e53c9e9..45b51fea6ba4381e4d245d70b5671f6e42c1f718 100644 ---- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -@@ -261,4 +261,9 @@ public class PaperWorldConfig { - portalCreateRadius = getInt("portal-create-radius", 16); - portalSearchVanillaDimensionScaling = getBoolean("portal-search-vanilla-dimension-scaling", true); - } -+ -+ public boolean disableTeleportationSuffocationCheck; -+ private void disableTeleportationSuffocationCheck() { -+ disableTeleportationSuffocationCheck = getBoolean("disable-teleportation-suffocation-check", false); -+ } - } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -index 2c12861a76f2340fc4c8f0d4fd271ae8de35badd..b3c02dc06fcf2c47f2f6d1cb517786cfd824f987 100644 +index b3e12f613117dd417f48981a7c2388597118b515..8fafbbf8556c295fd7bc21352c640101d15d3e7c 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java @@ -1031,7 +1031,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player { @@ -38,7 +24,7 @@ index 2c12861a76f2340fc4c8f0d4fd271ae8de35badd..b3c02dc06fcf2c47f2f6d1cb517786cf entity.connection.teleport(to); } else { - server.getHandle().respawn(entity, toWorld, true, to, true); -+ server.getHandle().respawn(entity, toWorld, true, to, !toWorld.paperConfig.disableTeleportationSuffocationCheck); // Paper ++ server.getHandle().respawn(entity, toWorld, true, to, !toWorld.paperConfig().environment.disableTeleportationSuffocationCheck); // Paper } return true; } diff --git a/patches/server/0056-Add-exception-reporting-event.patch b/patches/server/0056-Add-exception-reporting-event.patch index 79b0f9f447..eccaab33ae 100644 --- a/patches/server/0056-Add-exception-reporting-event.patch +++ b/patches/server/0056-Add-exception-reporting-event.patch @@ -100,7 +100,7 @@ index c6fb4c33d7ea52b88d8fc0d90748cbab7387c565..fed09b886f4fa0006d160e5f2abb00df } diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java -index e52d69675c823184303536db0f673762d8eca100..2bc5b3c76264a5a23170adbc2e04c55a5e4f2a6a 100644 +index 17da97bfece600438f6e872e8a1a2bee1d60c804..447ce111786a53fca6b0f6c8803b47f9cadd7df7 100644 --- a/src/main/java/net/minecraft/world/level/Level.java +++ b/src/main/java/net/minecraft/world/level/Level.java @@ -1,5 +1,10 @@ @@ -114,7 +114,7 @@ index e52d69675c823184303536db0f673762d8eca100..2bc5b3c76264a5a23170adbc2e04c55a import com.google.common.collect.Lists; import com.mojang.serialization.Codec; import java.io.IOException; -@@ -696,6 +701,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable { +@@ -700,6 +705,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable { // Paper start - Prevent tile entity and entity crashes final String msg = String.format("Entity threw exception at %s:%s,%s,%s", entity.level.getWorld().getName(), entity.getX(), entity.getY(), entity.getZ()); MinecraftServer.LOGGER.error(msg, throwable); diff --git a/patches/server/0058-Disable-Scoreboards-for-non-players-by-default.patch b/patches/server/0058-Disable-Scoreboards-for-non-players-by-default.patch index 558e5e9f25..6356ffba6b 100644 --- a/patches/server/0058-Disable-Scoreboards-for-non-players-by-default.patch +++ b/patches/server/0058-Disable-Scoreboards-for-non-players-by-default.patch @@ -10,41 +10,27 @@ this setting. So avoid looking up scoreboards and short circuit to the "not on a team" logic which is most likely to be true. -diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -index 45b51fea6ba4381e4d245d70b5671f6e42c1f718..397995fe4c360d837282535b9b7aaf7f3d93f85f 100644 ---- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -@@ -266,4 +266,9 @@ public class PaperWorldConfig { - private void disableTeleportationSuffocationCheck() { - disableTeleportationSuffocationCheck = getBoolean("disable-teleportation-suffocation-check", false); - } -+ -+ public boolean nonPlayerEntitiesOnScoreboards = false; -+ private void nonPlayerEntitiesOnScoreboards() { -+ nonPlayerEntitiesOnScoreboards = getBoolean("allow-non-player-entities-on-scoreboards", false); -+ } - } diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java -index d6bf1d3356a8894cdeacac270d96d7ea07c79879..e6917848029b1686e4e3a1a0eadac85eda92518d 100644 +index 86b8747ec3aa9c92644fe313c7a73593f8bf4eae..704a5aa2881c6f826d49ad9aed6003db7c5f5843 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java -@@ -2578,6 +2578,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource { +@@ -2577,6 +2577,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource { @Nullable public Team getTeam() { -+ if (!this.level.paperConfig.nonPlayerEntitiesOnScoreboards && !(this instanceof Player)) { return null; } // Paper ++ if (!this.level.paperConfig().scoreboards.allowNonPlayerEntitiesOnScoreboards && !(this instanceof Player)) { return null; } // Paper return this.level.getScoreboard().getPlayersTeam(this.getScoreboardName()); } diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java -index 062d8c0d48798199319da5ccb422af2f1564f6f6..3f82c88058edb5c37fff98d760d931de20a85b5d 100644 +index 4731869c1bd3b8abdd2a5133fd551a2a534a6b41..3710cf92bd29f69bb86d72a7adbb8df9bf4f8f08 100644 --- a/src/main/java/net/minecraft/world/entity/LivingEntity.java +++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java @@ -823,6 +823,7 @@ public abstract class LivingEntity extends Entity { if (nbt.contains("Team", 8)) { String s = nbt.getString("Team"); PlayerTeam scoreboardteam = this.level.getScoreboard().getPlayerTeam(s); -+ if (!level.paperConfig.nonPlayerEntitiesOnScoreboards && !(this instanceof net.minecraft.world.entity.player.Player)) { scoreboardteam = null; } // Paper ++ if (!level.paperConfig().scoreboards.allowNonPlayerEntitiesOnScoreboards && !(this instanceof net.minecraft.world.entity.player.Player)) { scoreboardteam = null; } // Paper boolean flag = scoreboardteam != null && this.level.getScoreboard().addPlayerToTeam(this.getStringUUID(), scoreboardteam); if (!flag) { diff --git a/patches/server/0061-Complete-resource-pack-API.patch b/patches/server/0061-Complete-resource-pack-API.patch index 84ad1ca892..607d5dd5da 100644 --- a/patches/server/0061-Complete-resource-pack-API.patch +++ b/patches/server/0061-Complete-resource-pack-API.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Complete resource pack API diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index 984209f32015d765367fd7693fb759de571b9ad0..9b057950417704669fdeb80efb2417904a010074 100644 +index ea9a2b48d3d84fcf1ec263c920bacd80ae26cb27..8b971fa96e55f3c2f990fb58cfb772d504d48acc 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java @@ -1686,8 +1686,11 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser @@ -23,7 +23,7 @@ index 984209f32015d765367fd7693fb759de571b9ad0..9b057950417704669fdeb80efb241790 @Override diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -index b3c02dc06fcf2c47f2f6d1cb517786cfd824f987..b737c2bfe539f9758bb8368675bec270f8365786 100644 +index 8fafbbf8556c295fd7bc21352c640101d15d3e7c..6b542ea548b078ca41f347614d25bcf00d30a87f 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java @@ -144,6 +144,7 @@ import org.bukkit.plugin.Plugin; diff --git a/patches/server/0062-Default-loading-permissions.yml-before-plugins.patch b/patches/server/0062-Default-loading-permissions.yml-before-plugins.patch index af94ea7f40..4ff738d96b 100644 --- a/patches/server/0062-Default-loading-permissions.yml-before-plugins.patch +++ b/patches/server/0062-Default-loading-permissions.yml-before-plugins.patch @@ -15,29 +15,15 @@ modify that. Under the previous logic, plugins were unable (cleanly) override pe A config option has been added for those who depend on the previous behavior, but I don't expect that. -diff --git a/src/main/java/com/destroystokyo/paper/PaperConfig.java b/src/main/java/com/destroystokyo/paper/PaperConfig.java -index 7bbcee19248933f67fd40f46db43363890593c73..16707c734f33f6080875e5e3ea338affe2d2fa0c 100644 ---- a/src/main/java/com/destroystokyo/paper/PaperConfig.java -+++ b/src/main/java/com/destroystokyo/paper/PaperConfig.java -@@ -234,4 +234,9 @@ public class PaperConfig { - " - Length: " + timeSummary(Timings.getHistoryLength() / 20) + - " - Server Name: " + timingsServerName); - } -+ -+ public static boolean loadPermsBeforePlugins = true; -+ private static void loadPermsBeforePlugins() { -+ loadPermsBeforePlugins = getBoolean("settings.load-permissions-yml-before-plugins", true); -+ } - } diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -index ff7f1347619d4df2a5c217a4b6545878ed81293c..c4860d85eb0a1cab7786982969d58a5729bc93c9 100644 +index a8b963b336045c11c71dfff4e0ad0d66a9b47a92..c5095243aad4fc39bbdc8784837b111993f8b9e3 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java @@ -451,6 +451,7 @@ public final class CraftServer implements Server { if (type == PluginLoadOrder.STARTUP) { this.helpMap.clear(); this.helpMap.initializeGeneralTopics(); -+ if (com.destroystokyo.paper.PaperConfig.loadPermsBeforePlugins) loadCustomPermissions(); // Paper ++ if (io.papermc.paper.configuration.GlobalConfiguration.get().misc.loadPermissionsYmlBeforePlugins) loadCustomPermissions(); // Paper } Plugin[] plugins = this.pluginManager.getPlugins(); @@ -46,7 +32,7 @@ index ff7f1347619d4df2a5c217a4b6545878ed81293c..c4860d85eb0a1cab7786982969d58a57 DefaultPermissions.registerCorePermissions(); CraftDefaultPermissions.registerCorePermissions(); - this.loadCustomPermissions(); -+ if (!com.destroystokyo.paper.PaperConfig.loadPermsBeforePlugins) this.loadCustomPermissions(); // Paper ++ if (!io.papermc.paper.configuration.GlobalConfiguration.get().misc.loadPermissionsYmlBeforePlugins) this.loadCustomPermissions(); // Paper this.helpMap.initializeCommands(); this.syncCommands(); } diff --git a/patches/server/0063-Allow-Reloading-of-Custom-Permissions.patch b/patches/server/0063-Allow-Reloading-of-Custom-Permissions.patch index f0a5b4eb78..b522bea2f4 100644 --- a/patches/server/0063-Allow-Reloading-of-Custom-Permissions.patch +++ b/patches/server/0063-Allow-Reloading-of-Custom-Permissions.patch @@ -6,10 +6,10 @@ Subject: [PATCH] Allow Reloading of Custom Permissions https://github.com/PaperMC/Paper/issues/49 diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -index c4860d85eb0a1cab7786982969d58a5729bc93c9..8aef55dc446c0fd62bc0913d65085132a63bbc71 100644 +index c5095243aad4fc39bbdc8784837b111993f8b9e3..0f8d35e2c37088b98e47e046e40544c4e7bb01c8 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -@@ -2504,5 +2504,23 @@ public final class CraftServer implements Server { +@@ -2501,5 +2501,23 @@ public final class CraftServer implements Server { } return this.adventure$audiences; } @@ -17,7 +17,7 @@ index c4860d85eb0a1cab7786982969d58a5729bc93c9..8aef55dc446c0fd62bc0913d65085132 + @Override + public void reloadPermissions() { + pluginManager.clearPermissions(); -+ if (com.destroystokyo.paper.PaperConfig.loadPermsBeforePlugins) loadCustomPermissions(); ++ if (io.papermc.paper.configuration.GlobalConfiguration.get().misc.loadPermissionsYmlBeforePlugins) loadCustomPermissions(); + for (Plugin plugin : pluginManager.getPlugins()) { + for (Permission perm : plugin.getDescription().getPermissions()) { + try { @@ -27,7 +27,7 @@ index c4860d85eb0a1cab7786982969d58a5729bc93c9..8aef55dc446c0fd62bc0913d65085132 + } + } + } -+ if (!com.destroystokyo.paper.PaperConfig.loadPermsBeforePlugins) loadCustomPermissions(); ++ if (!io.papermc.paper.configuration.GlobalConfiguration.get().misc.loadPermissionsYmlBeforePlugins) loadCustomPermissions(); + DefaultPermissions.registerCorePermissions(); + CraftDefaultPermissions.registerCorePermissions(); + } diff --git a/patches/server/0064-Remove-Metadata-on-reload.patch b/patches/server/0064-Remove-Metadata-on-reload.patch index 80c282ea15..fd4b1e3a7f 100644 --- a/patches/server/0064-Remove-Metadata-on-reload.patch +++ b/patches/server/0064-Remove-Metadata-on-reload.patch @@ -7,11 +7,11 @@ Metadata is not meant to persist reload as things break badly with non primitive This will remove metadata on reload so it does not crash everything if a plugin uses it. diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -index 8aef55dc446c0fd62bc0913d65085132a63bbc71..f40446e07308dd9f09622dba55933bc3486f80b8 100644 +index 0f8d35e2c37088b98e47e046e40544c4e7bb01c8..90a2ed1b851a948b8ebf4ad6157003db19f1916f 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -@@ -940,8 +940,16 @@ public final class CraftServer implements Server { - world.paperConfig.init(); // Paper +@@ -939,8 +939,16 @@ public final class CraftServer implements Server { + world.spigotConfig.init(); // Spigot } + Plugin[] pluginClone = pluginManager.getPlugins().clone(); // Paper @@ -26,4 +26,4 @@ index 8aef55dc446c0fd62bc0913d65085132a63bbc71..f40446e07308dd9f09622dba55933bc3 + // Paper end this.reloadData(); org.spigotmc.SpigotConfig.registerCommands(); // Spigot - com.destroystokyo.paper.PaperConfig.registerCommands(); // Paper + io.papermc.paper.configuration.PaperConfigurations.registerCommands(this.console); diff --git a/patches/server/0066-Configurable-Non-Player-Arrow-Despawn-Rate.patch b/patches/server/0066-Configurable-Non-Player-Arrow-Despawn-Rate.patch index 32cc3ea782..9544e6114a 100644 --- a/patches/server/0066-Configurable-Non-Player-Arrow-Despawn-Rate.patch +++ b/patches/server/0066-Configurable-Non-Player-Arrow-Despawn-Rate.patch @@ -5,32 +5,8 @@ Subject: [PATCH] Configurable Non Player Arrow Despawn Rate Can set a much shorter despawn rate for arrows that players can not pick up. -diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -index 397995fe4c360d837282535b9b7aaf7f3d93f85f..4c4385d3d20556a2695f69c95d6b3cff087d26d9 100644 ---- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -@@ -271,4 +271,19 @@ public class PaperWorldConfig { - private void nonPlayerEntitiesOnScoreboards() { - nonPlayerEntitiesOnScoreboards = getBoolean("allow-non-player-entities-on-scoreboards", false); - } -+ -+ public int nonPlayerArrowDespawnRate = -1; -+ public int creativeArrowDespawnRate = -1; -+ private void nonPlayerArrowDespawnRate() { -+ nonPlayerArrowDespawnRate = getInt("non-player-arrow-despawn-rate", -1); -+ if (nonPlayerArrowDespawnRate == -1) { -+ nonPlayerArrowDespawnRate = spigotConfig.arrowDespawnRate; -+ } -+ creativeArrowDespawnRate = getInt("creative-arrow-despawn-rate", -1); -+ if (creativeArrowDespawnRate == -1) { -+ creativeArrowDespawnRate = spigotConfig.arrowDespawnRate; -+ } -+ log("Non Player Arrow Despawn Rate: " + nonPlayerArrowDespawnRate); -+ log("Creative Arrow Despawn Rate: " + creativeArrowDespawnRate); -+ } - } diff --git a/src/main/java/net/minecraft/world/entity/projectile/AbstractArrow.java b/src/main/java/net/minecraft/world/entity/projectile/AbstractArrow.java -index 27c31a9e926f919c7edc8fc0cdd7fba70616d60c..046082ab7deb21574d9471b78a39a4a6bb296c2f 100644 +index 27c31a9e926f919c7edc8fc0cdd7fba70616d60c..7cd802be238cedf166174a61e816d9d4b29b87d2 100644 --- a/src/main/java/net/minecraft/world/entity/projectile/AbstractArrow.java +++ b/src/main/java/net/minecraft/world/entity/projectile/AbstractArrow.java @@ -311,7 +311,7 @@ public abstract class AbstractArrow extends Projectile { @@ -38,7 +14,7 @@ index 27c31a9e926f919c7edc8fc0cdd7fba70616d60c..046082ab7deb21574d9471b78a39a4a6 protected void tickDespawn() { ++this.life; - if (this.life >= ((this instanceof ThrownTrident) ? level.spigotConfig.tridentDespawnRate : level.spigotConfig.arrowDespawnRate)) { // Spigot -+ if (this.life >= (pickup == Pickup.CREATIVE_ONLY ? level.paperConfig.creativeArrowDespawnRate : (pickup == Pickup.DISALLOWED ? level.paperConfig.nonPlayerArrowDespawnRate : ((this instanceof ThrownTrident) ? level.spigotConfig.tridentDespawnRate : level.spigotConfig.arrowDespawnRate)))) { // Spigot // Paper - TODO: Extract this to init? ++ if (this.life >= (pickup == Pickup.CREATIVE_ONLY ? level.paperConfig().entities.spawning.creativeArrowDespawnRate.value() : (pickup == Pickup.DISALLOWED ? level.paperConfig().entities.spawning.nonPlayerArrowDespawnRate.value() : ((this instanceof ThrownTrident) ? level.spigotConfig.tridentDespawnRate : level.spigotConfig.arrowDespawnRate)))) { // Spigot // Paper - TODO: Extract this to init? this.discard(); } diff --git a/patches/server/0067-Add-World-Util-Methods.patch b/patches/server/0067-Add-World-Util-Methods.patch index 8cb3d3f7a9..a5ec2708b8 100644 --- a/patches/server/0067-Add-World-Util-Methods.patch +++ b/patches/server/0067-Add-World-Util-Methods.patch @@ -6,7 +6,7 @@ Subject: [PATCH] Add World Util Methods Methods that can be used for other patches to help improve logic. diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java -index a04e75293b1d196341bc641ee7da975bf9baec13..64661de5763ac184eed690b15a8665b1dc1a3603 100644 +index 0023f18e7b856f6178e516d1b692d3697ba99631..42489fe2054d75ce6fe7dd62e248387c85c0e4e5 100644 --- a/src/main/java/net/minecraft/server/level/ServerLevel.java +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java @@ -214,7 +214,7 @@ public class ServerLevel extends Level implements WorldGenLevel { @@ -19,10 +19,10 @@ index a04e75293b1d196341bc641ee7da975bf9baec13..64661de5763ac184eed690b15a8665b1 } diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java -index 2bc5b3c76264a5a23170adbc2e04c55a5e4f2a6a..7f52bf3e2b6588ce4e364906500f24e323bdb664 100644 +index 447ce111786a53fca6b0f6c8803b47f9cadd7df7..19aca3026b2c5a7eb4288ef1a0ea297989d1c948 100644 --- a/src/main/java/net/minecraft/world/level/Level.java +++ b/src/main/java/net/minecraft/world/level/Level.java -@@ -329,6 +329,22 @@ public abstract class Level implements LevelAccessor, AutoCloseable { +@@ -333,6 +333,22 @@ public abstract class Level implements LevelAccessor, AutoCloseable { return chunk == null ? null : chunk.getFluidState(blockposition); } diff --git a/patches/server/0068-Custom-replacement-for-eaten-items.patch b/patches/server/0068-Custom-replacement-for-eaten-items.patch index 8a21f1e5ab..1807001a73 100644 --- a/patches/server/0068-Custom-replacement-for-eaten-items.patch +++ b/patches/server/0068-Custom-replacement-for-eaten-items.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Custom replacement for eaten items diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java -index 3f82c88058edb5c37fff98d760d931de20a85b5d..0eafee2cb706a20f9eb7c5a7e4f2fc81b9f952c9 100644 +index 3710cf92bd29f69bb86d72a7adbb8df9bf4f8f08..ef820cd573a3c2366698df658dd8de6981c95e73 100644 --- a/src/main/java/net/minecraft/world/entity/LivingEntity.java +++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java @@ -3586,9 +3586,10 @@ public abstract class LivingEntity extends Entity { diff --git a/patches/server/0069-handle-NaN-health-absorb-values-and-repair-bad-data.patch b/patches/server/0069-handle-NaN-health-absorb-values-and-repair-bad-data.patch index 83b8e98680..bb72394a3d 100644 --- a/patches/server/0069-handle-NaN-health-absorb-values-and-repair-bad-data.patch +++ b/patches/server/0069-handle-NaN-health-absorb-values-and-repair-bad-data.patch @@ -5,7 +5,7 @@ Subject: [PATCH] handle NaN health/absorb values and repair bad data diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java -index 0eafee2cb706a20f9eb7c5a7e4f2fc81b9f952c9..80f8fe489ea403b48cd7b7218ce32d4926f98136 100644 +index ef820cd573a3c2366698df658dd8de6981c95e73..e9747640adff75df331e794f08397619379ae280 100644 --- a/src/main/java/net/minecraft/world/entity/LivingEntity.java +++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java @@ -784,7 +784,13 @@ public abstract class LivingEntity extends Entity { @@ -44,7 +44,7 @@ index 0eafee2cb706a20f9eb7c5a7e4f2fc81b9f952c9..80f8fe489ea403b48cd7b7218ce32d49 } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -index b737c2bfe539f9758bb8368675bec270f8365786..8c8f0df271cb1fab92aeb342289fa116cf5b93a8 100644 +index 6b542ea548b078ca41f347614d25bcf00d30a87f..213037a4c545db70ca5e66018057216cbb6532d3 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java @@ -1913,6 +1913,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player { diff --git a/patches/server/0070-Use-a-Shared-Random-for-Entities.patch b/patches/server/0070-Use-a-Shared-Random-for-Entities.patch index 7f8215de09..feee2d41f3 100644 --- a/patches/server/0070-Use-a-Shared-Random-for-Entities.patch +++ b/patches/server/0070-Use-a-Shared-Random-for-Entities.patch @@ -6,7 +6,7 @@ Subject: [PATCH] Use a Shared Random for Entities Reduces memory usage and provides ensures more randomness, Especially since a lot of garbage entity objects get created. diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java -index e6917848029b1686e4e3a1a0eadac85eda92518d..3e0f58a928931fd1b3ee32f9dadf65288d8798d6 100644 +index 704a5aa2881c6f826d49ad9aed6003db7c5f5843..e3fe98ef3a7537d3717824d3357cc84c632ee0ea 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java @@ -158,6 +158,74 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource { diff --git a/patches/server/0071-Configurable-spawn-chances-for-skeleton-horses.patch b/patches/server/0071-Configurable-spawn-chances-for-skeleton-horses.patch index 02dd1e38ec..d7bf4dabd7 100644 --- a/patches/server/0071-Configurable-spawn-chances-for-skeleton-horses.patch +++ b/patches/server/0071-Configurable-spawn-chances-for-skeleton-horses.patch @@ -4,25 +4,8 @@ Date: Tue, 22 Mar 2016 12:04:28 -0500 Subject: [PATCH] Configurable spawn chances for skeleton horses -diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -index 4c4385d3d20556a2695f69c95d6b3cff087d26d9..fa730fd8b969e39cf063a560d9820d3655709398 100644 ---- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -@@ -286,4 +286,12 @@ public class PaperWorldConfig { - log("Non Player Arrow Despawn Rate: " + nonPlayerArrowDespawnRate); - log("Creative Arrow Despawn Rate: " + creativeArrowDespawnRate); - } -+ -+ public double skeleHorseSpawnChance; -+ private void skeleHorseSpawnChance() { -+ skeleHorseSpawnChance = getDouble("skeleton-horse-thunder-spawn-chance", 0.01D); -+ if (skeleHorseSpawnChance < 0) { -+ skeleHorseSpawnChance = 0.01D; // Vanilla value -+ } -+ } - } diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java -index 64661de5763ac184eed690b15a8665b1dc1a3603..033a4324800d8e4f057d65a9e41ea46c9eebfc6e 100644 +index 42489fe2054d75ce6fe7dd62e248387c85c0e4e5..6b85a9ee89bf2f01385aa0d3aab2e92325381021 100644 --- a/src/main/java/net/minecraft/server/level/ServerLevel.java +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java @@ -583,7 +583,7 @@ public class ServerLevel extends Level implements WorldGenLevel { @@ -30,7 +13,7 @@ index 64661de5763ac184eed690b15a8665b1dc1a3603..033a4324800d8e4f057d65a9e41ea46c if (this.isRainingAt(blockposition)) { DifficultyInstance difficultydamagescaler = this.getCurrentDifficultyAt(blockposition); - boolean flag1 = this.getGameRules().getBoolean(GameRules.RULE_DOMOBSPAWNING) && this.random.nextDouble() < (double) difficultydamagescaler.getEffectiveDifficulty() * 0.01D && !this.getBlockState(blockposition.below()).is(Blocks.LIGHTNING_ROD); -+ boolean flag1 = this.getGameRules().getBoolean(GameRules.RULE_DOMOBSPAWNING) && this.random.nextDouble() < (double) difficultydamagescaler.getEffectiveDifficulty() * paperConfig.skeleHorseSpawnChance && !this.getBlockState(blockposition.below()).is(Blocks.LIGHTNING_ROD); // Paper ++ boolean flag1 = this.getGameRules().getBoolean(GameRules.RULE_DOMOBSPAWNING) && this.random.nextDouble() < (double) difficultydamagescaler.getEffectiveDifficulty() * this.paperConfig().entities.spawning.skeletonHorseThunderSpawnChance.or(0.01D) && !this.getBlockState(blockposition.below()).is(Blocks.LIGHTNING_ROD); // Paper if (flag1) { SkeletonHorse entityhorseskeleton = (SkeletonHorse) EntityType.SKELETON_HORSE.create(this); diff --git a/patches/server/0072-Optimize-isInWorldBounds-and-getBlockState-for-inlin.patch b/patches/server/0072-Optimize-isInWorldBounds-and-getBlockState-for-inlin.patch index 114a8307b8..1a901674b0 100644 --- a/patches/server/0072-Optimize-isInWorldBounds-and-getBlockState-for-inlin.patch +++ b/patches/server/0072-Optimize-isInWorldBounds-and-getBlockState-for-inlin.patch @@ -29,10 +29,10 @@ index 4587a3668b6be9222cdd74a38229f89f611d1af6..9f32861d791f7e4cb39d2ad01f48e191 this.x = x; this.y = y; diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java -index 7f52bf3e2b6588ce4e364906500f24e323bdb664..b087f8a58d18df43a04dae3f1a5a8083df10f6e0 100644 +index 19aca3026b2c5a7eb4288ef1a0ea297989d1c948..7c058e32b83847625bd4136bfed9b5804e8beca7 100644 --- a/src/main/java/net/minecraft/world/level/Level.java +++ b/src/main/java/net/minecraft/world/level/Level.java -@@ -272,7 +272,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable { +@@ -276,7 +276,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable { } public boolean isInWorldBounds(BlockPos pos) { diff --git a/patches/server/0073-Only-process-BlockPhysicsEvent-if-a-plugin-has-a-lis.patch b/patches/server/0073-Only-process-BlockPhysicsEvent-if-a-plugin-has-a-lis.patch index 7f2d4e883b..17853dc919 100644 --- a/patches/server/0073-Only-process-BlockPhysicsEvent-if-a-plugin-has-a-lis.patch +++ b/patches/server/0073-Only-process-BlockPhysicsEvent-if-a-plugin-has-a-lis.patch @@ -6,10 +6,10 @@ Subject: [PATCH] Only process BlockPhysicsEvent if a plugin has a listener Saves on some object allocation and processing when no plugin listens to this diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index 1a5ccea7daca76b7c5524c92ce431cea82c8b500..9bc6343887e0078c9778bffb24cd130e3ff53423 100644 +index 21e09c039a4c3fa64f6456e5cc7d50463590f787..cfbf7efb06f7ed6064930c4154c6e3e949dc0b25 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java -@@ -1354,6 +1354,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop { return worldserver + " " + worldserver.dimension().location(); diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java -index 033a4324800d8e4f057d65a9e41ea46c9eebfc6e..525ed4ddfbf898e7e8af5f2283fde7d5ba9a96d9 100644 +index 6b85a9ee89bf2f01385aa0d3aab2e92325381021..868db73e815a59f7f917de64f3cc45d89f5b6bb5 100644 --- a/src/main/java/net/minecraft/server/level/ServerLevel.java +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java @@ -213,6 +213,7 @@ public class ServerLevel extends Level implements WorldGenLevel { @@ -30,10 +30,10 @@ index 033a4324800d8e4f057d65a9e41ea46c9eebfc6e..525ed4ddfbf898e7e8af5f2283fde7d5 @Override public LevelChunk getChunkIfLoaded(int x, int z) { // Paper - this was added in world too but keeping here for NMS ABI return this.chunkSource.getChunk(x, z, false); diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java -index b087f8a58d18df43a04dae3f1a5a8083df10f6e0..5732a9a41a14e5297631d78f924b2082efcfe9da 100644 +index 7c058e32b83847625bd4136bfed9b5804e8beca7..46c7c63d4dced4e75079588cef2c155859e5ae36 100644 --- a/src/main/java/net/minecraft/world/level/Level.java +++ b/src/main/java/net/minecraft/world/level/Level.java -@@ -484,7 +484,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable { +@@ -488,7 +488,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable { // CraftBukkit start iblockdata1.updateIndirectNeighbourShapes(this, blockposition, k, j - 1); // Don't call an event for the old block to limit event spam CraftWorld world = ((ServerLevel) this).getWorld(); diff --git a/patches/server/0074-Entity-AddTo-RemoveFrom-World-Events.patch b/patches/server/0074-Entity-AddTo-RemoveFrom-World-Events.patch index 4f63011892..893f398481 100644 --- a/patches/server/0074-Entity-AddTo-RemoveFrom-World-Events.patch +++ b/patches/server/0074-Entity-AddTo-RemoveFrom-World-Events.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Entity AddTo/RemoveFrom World Events diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java -index 525ed4ddfbf898e7e8af5f2283fde7d5ba9a96d9..3e78f79c489899e00b375949b178cdea695f79b1 100644 +index 868db73e815a59f7f917de64f3cc45d89f5b6bb5..1115f4e444ae36d84a6f148930a3e2287e76b55a 100644 --- a/src/main/java/net/minecraft/server/level/ServerLevel.java +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java @@ -2115,6 +2115,7 @@ public class ServerLevel extends Level implements WorldGenLevel { diff --git a/patches/server/0075-Configurable-Chunk-Inhabited-Time.patch b/patches/server/0075-Configurable-Chunk-Inhabited-Time.patch index 8f07a9ae73..3dc363ab29 100644 --- a/patches/server/0075-Configurable-Chunk-Inhabited-Time.patch +++ b/patches/server/0075-Configurable-Chunk-Inhabited-Time.patch @@ -10,27 +10,8 @@ For people who want all chunks to be treated equally, you can chose a fixed valu This allows to fine-tune vanilla gameplay. -diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -index fa730fd8b969e39cf063a560d9820d3655709398..3e7a98073c86d94881e7c03786e3745db2c445cd 100644 ---- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -@@ -294,4 +294,14 @@ public class PaperWorldConfig { - skeleHorseSpawnChance = 0.01D; // Vanilla value - } - } -+ -+ public int fixedInhabitedTime; -+ private void fixedInhabitedTime() { -+ if (PaperConfig.version < 16) { -+ if (!config.getBoolean("world-settings.default.use-chunk-inhabited-timer", true)) config.set("world-settings.default.fixed-chunk-inhabited-time", 0); -+ if (!config.getBoolean("world-settings." + worldName + ".use-chunk-inhabited-timer", true)) config.set("world-settings." + worldName + ".fixed-chunk-inhabited-time", 0); -+ set("use-chunk-inhabited-timer", null); -+ } -+ fixedInhabitedTime = getInt("fixed-chunk-inhabited-time", -1); -+ } - } diff --git a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java -index a508b7c6dbf9f7acdca77c219d7dd2492cd7c6b8..605ec3ac08845178795721977b685dfbaab33156 100644 +index a508b7c6dbf9f7acdca77c219d7dd2492cd7c6b8..e9fae214f60fe682087d41cfaa55a1b25e5f4331 100644 --- a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java +++ b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java @@ -281,6 +281,13 @@ public class LevelChunk extends ChunkAccess { @@ -40,7 +21,7 @@ index a508b7c6dbf9f7acdca77c219d7dd2492cd7c6b8..605ec3ac08845178795721977b685dfb + // Paper start + @Override + public long getInhabitedTime() { -+ return this.level.paperConfig.fixedInhabitedTime < 0 ? super.getInhabitedTime() : this.level.paperConfig.fixedInhabitedTime; ++ return this.level.paperConfig().chunks.fixedChunkInhabitedTime < 0 ? super.getInhabitedTime() : this.level.paperConfig().chunks.fixedChunkInhabitedTime; + } + // Paper end + diff --git a/patches/server/0077-Sanitise-RegionFileCache-and-make-configurable.patch b/patches/server/0077-Sanitise-RegionFileCache-and-make-configurable.patch index 5745095f53..071a254a0c 100644 --- a/patches/server/0077-Sanitise-RegionFileCache-and-make-configurable.patch +++ b/patches/server/0077-Sanitise-RegionFileCache-and-make-configurable.patch @@ -10,22 +10,8 @@ used RegionFile. The implementation uses a LinkedHashMap as an LRU cache (modified from HashMap). The maximum size of the RegionFileCache is also made configurable. -diff --git a/src/main/java/com/destroystokyo/paper/PaperConfig.java b/src/main/java/com/destroystokyo/paper/PaperConfig.java -index 16707c734f33f6080875e5e3ea338affe2d2fa0c..584d3a0f839cbcb6b3161f695c7f7d4869d04577 100644 ---- a/src/main/java/com/destroystokyo/paper/PaperConfig.java -+++ b/src/main/java/com/destroystokyo/paper/PaperConfig.java -@@ -239,4 +239,9 @@ public class PaperConfig { - private static void loadPermsBeforePlugins() { - loadPermsBeforePlugins = getBoolean("settings.load-permissions-yml-before-plugins", true); - } -+ -+ public static int regionFileCacheSize = 256; -+ private static void regionFileCacheSize() { -+ regionFileCacheSize = Math.max(getInt("settings.region-file-cache-size", 256), 4); -+ } - } diff --git a/src/main/java/net/minecraft/world/level/chunk/storage/RegionFileStorage.java b/src/main/java/net/minecraft/world/level/chunk/storage/RegionFileStorage.java -index eaf22cec54b512e0f57606f50627d5fe9b39bd5c..deb852aa0fb2ad55a94d3c7ee542a0cc8013be42 100644 +index eaf22cec54b512e0f57606f50627d5fe9b39bd5c..5a35e5040726a981ae91f018f05b91c178a54ba0 100644 --- a/src/main/java/net/minecraft/world/level/chunk/storage/RegionFileStorage.java +++ b/src/main/java/net/minecraft/world/level/chunk/storage/RegionFileStorage.java @@ -36,7 +36,7 @@ public class RegionFileStorage implements AutoCloseable { @@ -33,7 +19,7 @@ index eaf22cec54b512e0f57606f50627d5fe9b39bd5c..deb852aa0fb2ad55a94d3c7ee542a0cc return regionfile; } else { - if (this.regionCache.size() >= 256) { -+ if (this.regionCache.size() >= com.destroystokyo.paper.PaperConfig.regionFileCacheSize) { // Paper - configurable ++ if (this.regionCache.size() >= io.papermc.paper.configuration.GlobalConfiguration.get().misc.regionFileCacheSize) { // Paper - configurable ((RegionFile) this.regionCache.removeLast()).close(); } diff --git a/patches/server/0079-Add-PlayerUseUnknownEntityEvent.patch b/patches/server/0079-Add-PlayerUseUnknownEntityEvent.patch index 5518141d9a..c78cbccc0c 100644 --- a/patches/server/0079-Add-PlayerUseUnknownEntityEvent.patch +++ b/patches/server/0079-Add-PlayerUseUnknownEntityEvent.patch @@ -20,7 +20,7 @@ index 8834ed411a7db86b4d2b88183a1315317107d719..c45b5ab6776f3ac79f856c3a6467c510 static final ServerboundInteractPacket.Action ATTACK_ACTION = new ServerboundInteractPacket.Action() { @Override diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index 9b057950417704669fdeb80efb2417904a010074..1b92ee3988c1bdcbc751f32bd480b2ad2f588139 100644 +index 8b971fa96e55f3c2f990fb58cfb772d504d48acc..e7d9af82a11fb5c1250c76d32f21cc720c002da2 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java @@ -2410,8 +2410,37 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser diff --git a/patches/server/0080-Configurable-Grass-Spread-Tick-Rate.patch b/patches/server/0080-Configurable-Grass-Spread-Tick-Rate.patch index 75c3aa331b..50a9c78703 100644 --- a/patches/server/0080-Configurable-Grass-Spread-Tick-Rate.patch +++ b/patches/server/0080-Configurable-Grass-Spread-Tick-Rate.patch @@ -4,23 +4,8 @@ Date: Sun, 3 Apr 2016 16:28:17 -0400 Subject: [PATCH] Configurable Grass Spread Tick Rate -diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -index 3e7a98073c86d94881e7c03786e3745db2c445cd..8dcb136f3f77bc69d5976cc17ecdafb91b5be1bc 100644 ---- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -@@ -304,4 +304,10 @@ public class PaperWorldConfig { - } - fixedInhabitedTime = getInt("fixed-chunk-inhabited-time", -1); - } -+ -+ public int grassUpdateRate = 1; -+ private void grassUpdateRate() { -+ grassUpdateRate = Math.max(0, getInt("grass-spread-tick-rate", grassUpdateRate)); -+ log("Grass Spread Tick Rate: " + grassUpdateRate); -+ } - } diff --git a/src/main/java/net/minecraft/world/level/block/SpreadingSnowyDirtBlock.java b/src/main/java/net/minecraft/world/level/block/SpreadingSnowyDirtBlock.java -index bd5a45765b53bf4f2f9aaea4769c71ffb008741d..845f086eb8cc7dd87c820065e7621c3c2a5cc04f 100644 +index bd5a45765b53bf4f2f9aaea4769c71ffb008741d..61783f17b655cbb6430d22fb3a81931ab3ea130c 100644 --- a/src/main/java/net/minecraft/world/level/block/SpreadingSnowyDirtBlock.java +++ b/src/main/java/net/minecraft/world/level/block/SpreadingSnowyDirtBlock.java @@ -2,6 +2,7 @@ package net.minecraft.world.level.block; @@ -35,7 +20,7 @@ index bd5a45765b53bf4f2f9aaea4769c71ffb008741d..845f086eb8cc7dd87c820065e7621c3c @Override public void randomTick(BlockState state, ServerLevel world, BlockPos pos, RandomSource random) { -+ if (this instanceof GrassBlock && world.paperConfig.grassUpdateRate != 1 && (world.paperConfig.grassUpdateRate < 1 || (MinecraftServer.currentTick + pos.hashCode()) % world.paperConfig.grassUpdateRate != 0)) { return; } // Paper ++ if (this instanceof GrassBlock && world.paperConfig().tickRates.grassSpread != 1 && (world.paperConfig().tickRates.grassSpread < 1 || (MinecraftServer.currentTick + pos.hashCode()) % world.paperConfig().tickRates.grassSpread != 0)) { return; } // Paper if (!SpreadingSnowyDirtBlock.canBeGrass(state, world, pos)) { // CraftBukkit start if (org.bukkit.craftbukkit.event.CraftEventFactory.callBlockFadeEvent(world, pos, Blocks.DIRT.defaultBlockState()).isCancelled()) { diff --git a/patches/server/0081-Fix-Cancelling-BlockPlaceEvent-triggering-physics.patch b/patches/server/0081-Fix-Cancelling-BlockPlaceEvent-triggering-physics.patch index 9186de1301..e19ba5a1e5 100644 --- a/patches/server/0081-Fix-Cancelling-BlockPlaceEvent-triggering-physics.patch +++ b/patches/server/0081-Fix-Cancelling-BlockPlaceEvent-triggering-physics.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Fix Cancelling BlockPlaceEvent triggering physics diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java -index 3e78f79c489899e00b375949b178cdea695f79b1..39343854ea106aaa2c1c9f490cbdae28eb2550e6 100644 +index 1115f4e444ae36d84a6f148930a3e2287e76b55a..a81fbe11d7b3af9ce17db1dc5dfe2eb7e043a4a5 100644 --- a/src/main/java/net/minecraft/server/level/ServerLevel.java +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java @@ -1361,6 +1361,7 @@ public class ServerLevel extends Level implements WorldGenLevel { diff --git a/patches/server/0083-Option-to-use-vanilla-per-world-scoreboard-coloring-.patch b/patches/server/0083-Option-to-use-vanilla-per-world-scoreboard-coloring-.patch index 462d3dc3cf..4b02783b1c 100644 --- a/patches/server/0083-Option-to-use-vanilla-per-world-scoreboard-coloring-.patch +++ b/patches/server/0083-Option-to-use-vanilla-per-world-scoreboard-coloring-.patch @@ -11,22 +11,8 @@ bukkit's concept of a display name would be preferable. There was a PR for this on CB at one point but I can't find it. We may need to do this ourselves at some point in the future. -diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -index 8dcb136f3f77bc69d5976cc17ecdafb91b5be1bc..8381b1c9ffa5d9f28281336d5a3df4d01253dd92 100644 ---- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -@@ -310,4 +310,9 @@ public class PaperWorldConfig { - grassUpdateRate = Math.max(0, getInt("grass-spread-tick-rate", grassUpdateRate)); - log("Grass Spread Tick Rate: " + grassUpdateRate); - } -+ -+ public boolean useVanillaScoreboardColoring; -+ private void useVanillaScoreboardColoring() { -+ useVanillaScoreboardColoring = getBoolean("use-vanilla-world-scoreboard-name-coloring", false); -+ } - } diff --git a/src/main/java/io/papermc/paper/adventure/ChatProcessor.java b/src/main/java/io/papermc/paper/adventure/ChatProcessor.java -index 3526bc0b6ad590776124966ea907fe2467cbbf5f..65005e9818ef603724ff8f8041f617f1e602a868 100644 +index 3526bc0b6ad590776124966ea907fe2467cbbf5f..b13d516d91788713768b5c336537ffe31653b074 100644 --- a/src/main/java/io/papermc/paper/adventure/ChatProcessor.java +++ b/src/main/java/io/papermc/paper/adventure/ChatProcessor.java @@ -16,6 +16,8 @@ import net.kyori.adventure.text.event.ClickEvent; @@ -42,14 +28,14 @@ index 3526bc0b6ad590776124966ea907fe2467cbbf5f..65005e9818ef603724ff8f8041f617f1 } private static String legacyDisplayName(final CraftPlayer player) { -+ if (((CraftWorld) player.getWorld()).getHandle().paperConfig.useVanillaScoreboardColoring) { ++ if (((org.bukkit.craftbukkit.CraftWorld) player.getWorld()).getHandle().paperConfig().scoreboards.useVanillaWorldScoreboardNameColoring) { + return LegacyComponentSerializer.legacySection().serialize(player.teamDisplayName()) + ChatColor.RESET; + } return player.getDisplayName(); } private static Component displayName(final CraftPlayer player) { -+ if (((CraftWorld) player.getWorld()).getHandle().paperConfig.useVanillaScoreboardColoring) { ++ if (((CraftWorld) player.getWorld()).getHandle().paperConfig().scoreboards.useVanillaWorldScoreboardNameColoring) { + return player.teamDisplayName(); + } return player.displayName(); diff --git a/patches/server/0084-Configurable-Player-Collision.patch b/patches/server/0084-Configurable-Player-Collision.patch index fa5cda3bb4..d4ad1021c4 100644 --- a/patches/server/0084-Configurable-Player-Collision.patch +++ b/patches/server/0084-Configurable-Player-Collision.patch @@ -4,22 +4,8 @@ Date: Wed, 13 Apr 2016 02:10:49 -0400 Subject: [PATCH] Configurable Player Collision -diff --git a/src/main/java/com/destroystokyo/paper/PaperConfig.java b/src/main/java/com/destroystokyo/paper/PaperConfig.java -index 584d3a0f839cbcb6b3161f695c7f7d4869d04577..ae48897bd52934d35fcb10c545ae79cc4fb57d5a 100644 ---- a/src/main/java/com/destroystokyo/paper/PaperConfig.java -+++ b/src/main/java/com/destroystokyo/paper/PaperConfig.java -@@ -244,4 +244,9 @@ public class PaperConfig { - private static void regionFileCacheSize() { - regionFileCacheSize = Math.max(getInt("settings.region-file-cache-size", 256), 4); - } -+ -+ public static boolean enablePlayerCollisions = true; -+ private static void enablePlayerCollisions() { -+ enablePlayerCollisions = getBoolean("settings.enable-player-collisions", true); -+ } - } diff --git a/src/main/java/net/minecraft/network/protocol/game/ClientboundSetPlayerTeamPacket.java b/src/main/java/net/minecraft/network/protocol/game/ClientboundSetPlayerTeamPacket.java -index 1294b38262505b0d54089e428df9b363219de1f0..c5339618c195507c1d1482e4e77e262e8db240a5 100644 +index 1294b38262505b0d54089e428df9b363219de1f0..ee37ec0de1ca969144824427ae42b0c81434a1b4 100644 --- a/src/main/java/net/minecraft/network/protocol/game/ClientboundSetPlayerTeamPacket.java +++ b/src/main/java/net/minecraft/network/protocol/game/ClientboundSetPlayerTeamPacket.java @@ -193,7 +193,7 @@ public class ClientboundSetPlayerTeamPacket implements Packet toRemove = scoreboard.getPlayerTeams().stream().filter(team -> team.getName().startsWith("collideRule_")).map(PlayerTeam::getName).collect(java.util.stream.Collectors.toList()); ++ final java.util.Collection toRemove = scoreboard.getPlayerTeams().stream().filter(team -> team.getName().startsWith("collideRule_")).map(net.minecraft.world.scores.PlayerTeam::getName).collect(java.util.stream.Collectors.toList()); + for (String teamName : toRemove) { + scoreboard.removePlayerTeam(scoreboard.getPlayerTeam(teamName)); // Clean up after ourselves + } + -+ if (!com.destroystokyo.paper.PaperConfig.enablePlayerCollisions) { ++ if (!io.papermc.paper.configuration.GlobalConfiguration.get().collisions.enablePlayerCollisions) { + this.getPlayerList().collideRuleTeamName = org.apache.commons.lang3.StringUtils.left("collideRule_" + java.util.concurrent.ThreadLocalRandom.current().nextInt(), 16); -+ PlayerTeam collideTeam = scoreboard.addPlayerTeam(this.getPlayerList().collideRuleTeamName); ++ net.minecraft.world.scores.PlayerTeam collideTeam = scoreboard.addPlayerTeam(this.getPlayerList().collideRuleTeamName); + collideTeam.setSeeFriendlyInvisibles(false); // Because we want to mimic them not being on a team at all + } + // Paper end @@ -65,7 +43,7 @@ index 68a4fa890250f6c54367cbe319dd9485c988bbb7..4a84a0cea0ccc5de699c5b1e1a6686a7 this.server.getPluginManager().callEvent(new ServerLoadEvent(ServerLoadEvent.LoadType.STARTUP)); this.connection.acceptConnections(); diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java -index 4cf2264208ce681d92441cd06bf8120d586bc82a..e0b279d9437b30ca4a18a3036bf59664570a746f 100644 +index 16e1d0b62e01551a54d60c81ca12708f51aceef9..3fe3d417b6c1ff49a412c308bfe6a43182d0986e 100644 --- a/src/main/java/net/minecraft/server/players/PlayerList.java +++ b/src/main/java/net/minecraft/server/players/PlayerList.java @@ -98,6 +98,7 @@ import net.minecraft.world.level.storage.PlayerDataStorage; diff --git a/patches/server/0087-EntityRegainHealthEvent-isFastRegen-API.patch b/patches/server/0087-EntityRegainHealthEvent-isFastRegen-API.patch index 548149f802..55d8376a9e 100644 --- a/patches/server/0087-EntityRegainHealthEvent-isFastRegen-API.patch +++ b/patches/server/0087-EntityRegainHealthEvent-isFastRegen-API.patch @@ -6,7 +6,7 @@ Subject: [PATCH] EntityRegainHealthEvent isFastRegen API Don't even get me started diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java -index 80f8fe489ea403b48cd7b7218ce32d4926f98136..7a4996d720cc093f5c4b72356f20fc316cf9c533 100644 +index e9747640adff75df331e794f08397619379ae280..3a597e7ce159b78078b1d64258a6f30e51645f3b 100644 --- a/src/main/java/net/minecraft/world/entity/LivingEntity.java +++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java @@ -1250,10 +1250,16 @@ public abstract class LivingEntity extends Entity { diff --git a/patches/server/0088-Add-ability-to-configure-frosted_ice-properties.patch b/patches/server/0088-Add-ability-to-configure-frosted_ice-properties.patch index 031b24d578..8e938c31ad 100644 --- a/patches/server/0088-Add-ability-to-configure-frosted_ice-properties.patch +++ b/patches/server/0088-Add-ability-to-configure-frosted_ice-properties.patch @@ -4,34 +4,15 @@ Date: Thu, 21 Apr 2016 23:51:55 -0700 Subject: [PATCH] Add ability to configure frosted_ice properties -diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -index 8381b1c9ffa5d9f28281336d5a3df4d01253dd92..2c7cdf91288eb9a88d1d453accc87a8d77e6daac 100644 ---- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -@@ -315,4 +315,14 @@ public class PaperWorldConfig { - private void useVanillaScoreboardColoring() { - useVanillaScoreboardColoring = getBoolean("use-vanilla-world-scoreboard-name-coloring", false); - } -+ -+ public boolean frostedIceEnabled = true; -+ public int frostedIceDelayMin = 20; -+ public int frostedIceDelayMax = 40; -+ private void frostedIce() { -+ this.frostedIceEnabled = this.getBoolean("frosted-ice.enabled", this.frostedIceEnabled); -+ this.frostedIceDelayMin = this.getInt("frosted-ice.delay.min", this.frostedIceDelayMin); -+ this.frostedIceDelayMax = this.getInt("frosted-ice.delay.max", this.frostedIceDelayMax); -+ log("Frosted Ice: " + (this.frostedIceEnabled ? "enabled" : "disabled") + " / delay: min=" + this.frostedIceDelayMin + ", max=" + this.frostedIceDelayMax); -+ } - } diff --git a/src/main/java/net/minecraft/world/level/block/FrostedIceBlock.java b/src/main/java/net/minecraft/world/level/block/FrostedIceBlock.java -index e1916fe8a7aa736d9266efde954bbfbda38a3a65..d2de8192cbdae37fc7baaef998254bd82485fc72 100644 +index e1916fe8a7aa736d9266efde954bbfbda38a3a65..331b642c36af97f7f05bd63f96d42d1af443e5a3 100644 --- a/src/main/java/net/minecraft/world/level/block/FrostedIceBlock.java +++ b/src/main/java/net/minecraft/world/level/block/FrostedIceBlock.java @@ -32,6 +32,7 @@ public class FrostedIceBlock extends IceBlock { @Override public void tick(BlockState state, ServerLevel world, BlockPos pos, RandomSource random) { -+ if (!world.paperConfig.frostedIceEnabled) return; // Paper - add ability to disable frosted ice ++ if (!world.paperConfig().environment.frostedIce.enabled) return; // Paper - add ability to disable frosted ice if ((random.nextInt(3) == 0 || this.fewerNeigboursThan(world, pos, 4)) && world.getMaxLocalRawBrightness(pos) > 11 - state.getValue(AGE) - state.getLightBlock(world, pos) && this.slightlyMelt(state, world, pos)) { BlockPos.MutableBlockPos mutableBlockPos = new BlockPos.MutableBlockPos(); @@ -40,13 +21,13 @@ index e1916fe8a7aa736d9266efde954bbfbda38a3a65..d2de8192cbdae37fc7baaef998254bd8 BlockState blockState = world.getBlockState(mutableBlockPos); if (blockState.is(this) && !this.slightlyMelt(blockState, world, mutableBlockPos)) { - world.scheduleTick(mutableBlockPos, this, Mth.nextInt(random, 20, 40)); -+ world.scheduleTick(mutableBlockPos, this, Mth.nextInt(random, world.paperConfig.frostedIceDelayMin, world.paperConfig.frostedIceDelayMax)); // Paper - use configurable min/max delay ++ world.scheduleTick(mutableBlockPos, this, Mth.nextInt(random, world.paperConfig().environment.frostedIce.delay.min, world.paperConfig().environment.frostedIce.delay.max)); // Paper - use configurable min/max delay } } } else { - world.scheduleTick(pos, this, Mth.nextInt(random, 20, 40)); -+ world.scheduleTick(pos, this, Mth.nextInt(random, world.paperConfig.frostedIceDelayMin, world.paperConfig.frostedIceDelayMax)); // Paper - use configurable min/max delay ++ world.scheduleTick(pos, this, Mth.nextInt(random, world.paperConfig().environment.frostedIce.delay.min, world.paperConfig().environment.frostedIce.delay.max)); // Paper - use configurable min/max delay } } diff --git a/patches/server/0089-remove-null-possibility-for-getServer-singleton.patch b/patches/server/0089-remove-null-possibility-for-getServer-singleton.patch index ddff56c751..f46410865e 100644 --- a/patches/server/0089-remove-null-possibility-for-getServer-singleton.patch +++ b/patches/server/0089-remove-null-possibility-for-getServer-singleton.patch @@ -6,10 +6,10 @@ Subject: [PATCH] remove null possibility for getServer singleton to stop IDE complaining about potential NPE diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index 4a84a0cea0ccc5de699c5b1e1a6686a72b954e40..b62d7b2e974f9eafb8e60ddb9ed58273b0393185 100644 +index 032ba4071f7562cd0c0bf3f2de46130692544ef0..681121909bdf81d5a05670f0b0150f6276d00281 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java -@@ -180,6 +180,7 @@ import co.aikar.timings.MinecraftTimings; // Paper +@@ -179,6 +179,7 @@ import co.aikar.timings.MinecraftTimings; // Paper public abstract class MinecraftServer extends ReentrantBlockableEventLoop implements CommandSource, AutoCloseable { diff --git a/patches/server/0090-Improve-Maps-in-item-frames-performance-and-bug-fixe.patch b/patches/server/0090-Improve-Maps-in-item-frames-performance-and-bug-fixe.patch index 2941dec59d..33d25bb6b0 100644 --- a/patches/server/0090-Improve-Maps-in-item-frames-performance-and-bug-fixe.patch +++ b/patches/server/0090-Improve-Maps-in-item-frames-performance-and-bug-fixe.patch @@ -13,7 +13,7 @@ custom renderers are in use, defaulting to the much simpler Vanilla system. Additionally, numerous issues to player position tracking on maps has been fixed. diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java -index 39343854ea106aaa2c1c9f490cbdae28eb2550e6..5ee25084459f4cfcc8a95001a9d480e4a235f9f0 100644 +index a81fbe11d7b3af9ce17db1dc5dfe2eb7e043a4a5..535cb7102ad69c34e3035422429c9874ba434e31 100644 --- a/src/main/java/net/minecraft/server/level/ServerLevel.java +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java @@ -2136,6 +2136,7 @@ public class ServerLevel extends Level implements WorldGenLevel { diff --git a/patches/server/0091-LootTable-API-Replenishable-Lootables-Feature.patch b/patches/server/0091-LootTable-API-Replenishable-Lootables-Feature.patch index ae65146bf6..9bbdc8509a 100644 --- a/patches/server/0091-LootTable-API-Replenishable-Lootables-Feature.patch +++ b/patches/server/0091-LootTable-API-Replenishable-Lootables-Feature.patch @@ -10,37 +10,6 @@ can automatically replenish after a given time. This feature is good for long term worlds so that newer players do not suffer with "Every chest has been looted" -diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -index 2c7cdf91288eb9a88d1d453accc87a8d77e6daac..a491af30f70f41e5f7b198ae4d40acfb6eec9b38 100644 ---- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -@@ -325,4 +325,26 @@ public class PaperWorldConfig { - this.frostedIceDelayMax = this.getInt("frosted-ice.delay.max", this.frostedIceDelayMax); - log("Frosted Ice: " + (this.frostedIceEnabled ? "enabled" : "disabled") + " / delay: min=" + this.frostedIceDelayMin + ", max=" + this.frostedIceDelayMax); - } -+ -+ public boolean autoReplenishLootables; -+ public boolean restrictPlayerReloot; -+ public boolean changeLootTableSeedOnFill; -+ public int maxLootableRefills; -+ public int lootableRegenMin; -+ public int lootableRegenMax; -+ private void enhancedLootables() { -+ autoReplenishLootables = getBoolean("lootables.auto-replenish", false); -+ restrictPlayerReloot = getBoolean("lootables.restrict-player-reloot", true); -+ changeLootTableSeedOnFill = getBoolean("lootables.reset-seed-on-fill", true); -+ maxLootableRefills = getInt("lootables.max-refills", -1); -+ lootableRegenMin = PaperConfig.getSeconds(getString("lootables.refresh-min", "12h")); -+ lootableRegenMax = PaperConfig.getSeconds(getString("lootables.refresh-max", "2d")); -+ if (autoReplenishLootables) { -+ log("Lootables: Replenishing every " + -+ PaperConfig.timeSummary(lootableRegenMin) + " to " + -+ PaperConfig.timeSummary(lootableRegenMax) + -+ (restrictPlayerReloot ? " (restricting reloot)" : "") -+ ); -+ } -+ } - } diff --git a/src/main/java/com/destroystokyo/paper/loottable/PaperContainerEntityLootableInventory.java b/src/main/java/com/destroystokyo/paper/loottable/PaperContainerEntityLootableInventory.java new file mode 100644 index 0000000000000000000000000000000000000000..88e32ed64f90bfd277dac84ba4bd84f0d943f5f8 @@ -185,7 +154,7 @@ index 0000000000000000000000000000000000000000..2fba5bc0f982e143ad5f5bda55d768ed +} diff --git a/src/main/java/com/destroystokyo/paper/loottable/PaperLootableInventory.java b/src/main/java/com/destroystokyo/paper/loottable/PaperLootableInventory.java new file mode 100644 -index 0000000000000000000000000000000000000000..16b3527d7bc782c47e6f6c3ecd7165bd16b0ab0a +index 0000000000000000000000000000000000000000..ce135d990c785b02df468391ea622aa236290f07 --- /dev/null +++ b/src/main/java/com/destroystokyo/paper/loottable/PaperLootableInventory.java @@ -0,0 +1,70 @@ @@ -208,7 +177,7 @@ index 0000000000000000000000000000000000000000..16b3527d7bc782c47e6f6c3ecd7165bd + + @Override + default boolean isRefillEnabled() { -+ return getNMSWorld().paperConfig.autoReplenishLootables; ++ return getNMSWorld().paperConfig().lootables.autoReplenish; + } + + @Override @@ -261,13 +230,13 @@ index 0000000000000000000000000000000000000000..16b3527d7bc782c47e6f6c3ecd7165bd +} diff --git a/src/main/java/com/destroystokyo/paper/loottable/PaperLootableInventoryData.java b/src/main/java/com/destroystokyo/paper/loottable/PaperLootableInventoryData.java new file mode 100644 -index 0000000000000000000000000000000000000000..20cfe7b9b7127ddeb97aa91d759fc17b4a548eaf +index 0000000000000000000000000000000000000000..e5ea9f27a1936ed9e329e74317c91c5df89b9fbd --- /dev/null +++ b/src/main/java/com/destroystokyo/paper/loottable/PaperLootableInventoryData.java @@ -0,0 +1,179 @@ +package com.destroystokyo.paper.loottable; + -+import com.destroystokyo.paper.PaperWorldConfig; ++import io.papermc.paper.configuration.WorldConfiguration; +import org.bukkit.entity.Player; +import org.bukkit.loot.LootTable; +import javax.annotation.Nullable; @@ -315,7 +284,7 @@ index 0000000000000000000000000000000000000000..20cfe7b9b7127ddeb97aa91d759fc17b + } + + // ALWAYS process the first fill or if the feature is disabled -+ if (this.lastFill == -1 || !this.lootable.getNMSWorld().paperConfig.autoReplenishLootables) { ++ if (this.lastFill == -1 || !this.lootable.getNMSWorld().paperConfig().lootables.autoReplenish) { + return true; + } + @@ -329,10 +298,10 @@ index 0000000000000000000000000000000000000000..20cfe7b9b7127ddeb97aa91d759fc17b + return false; + } + -+ final PaperWorldConfig paperConfig = this.lootable.getNMSWorld().paperConfig; ++ final WorldConfiguration paperConfig = this.lootable.getNMSWorld().paperConfig(); + + // Check if max refills has been hit -+ if (paperConfig.maxLootableRefills != -1 && this.numRefills >= paperConfig.maxLootableRefills) { ++ if (paperConfig.lootables.maxRefills != -1 && this.numRefills >= paperConfig.lootables.maxRefills) { + return false; + } + @@ -344,20 +313,20 @@ index 0000000000000000000000000000000000000000..20cfe7b9b7127ddeb97aa91d759fc17b + + final Player bukkitPlayer = (Player) player.getBukkitEntity(); + LootableInventoryReplenishEvent event = new LootableInventoryReplenishEvent(bukkitPlayer, lootable.getAPILootableInventory()); -+ if (paperConfig.restrictPlayerReloot && hasPlayerLooted(player.getUUID())) { ++ if (paperConfig.lootables.restrictPlayerReloot && hasPlayerLooted(player.getUUID())) { + event.setCancelled(true); + } + return event.callEvent(); + } + public void processRefill(@Nullable net.minecraft.world.entity.player.Player player) { + this.lastFill = System.currentTimeMillis(); -+ final PaperWorldConfig paperConfig = this.lootable.getNMSWorld().paperConfig; -+ if (paperConfig.autoReplenishLootables) { -+ int min = paperConfig.lootableRegenMin; -+ int max = paperConfig.lootableRegenMax; -+ this.nextRefill = this.lastFill + (min + RANDOM.nextInt(max - min + 1)) * 1000L; ++ final WorldConfiguration paperConfig = this.lootable.getNMSWorld().paperConfig(); ++ if (paperConfig.lootables.autoReplenish) { ++ long min = paperConfig.lootables.refreshMin.seconds(); ++ long max = paperConfig.lootables.refreshMax.seconds(); ++ this.nextRefill = this.lastFill + (min + RANDOM.nextLong(max - min + 1)) * 1000L; + this.numRefills++; -+ if (paperConfig.changeLootTableSeedOnFill) { ++ if (paperConfig.lootables.resetSeedOnFill) { + this.lootable.setSeed(0); + } + if (player != null) { // This means that numRefills can be incremented without a player being in the lootedPlayers list - Seems to be EntityMinecartChest specific @@ -516,7 +485,7 @@ index 0000000000000000000000000000000000000000..3377b86c337d0234bbb9b0349e4034a7 + } +} diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java -index 3e0f58a928931fd1b3ee32f9dadf65288d8798d6..cd4b9b659904e587933b83616dfdcffb2de8bea5 100644 +index e3fe98ef3a7537d3717824d3357cc84c632ee0ea..3d84055afbe0392ca1abf5628b3b621b8833265a 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java @@ -226,6 +226,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource { diff --git a/patches/server/0092-Don-t-save-empty-scoreboard-teams-to-scoreboard.dat.patch b/patches/server/0092-Don-t-save-empty-scoreboard-teams-to-scoreboard.dat.patch index 5f9e08e9ce..c233fb2657 100644 --- a/patches/server/0092-Don-t-save-empty-scoreboard-teams-to-scoreboard.dat.patch +++ b/patches/server/0092-Don-t-save-empty-scoreboard-teams-to-scoreboard.dat.patch @@ -4,29 +4,15 @@ Date: Sat, 7 May 2016 23:33:08 -0400 Subject: [PATCH] Don't save empty scoreboard teams to scoreboard.dat -diff --git a/src/main/java/com/destroystokyo/paper/PaperConfig.java b/src/main/java/com/destroystokyo/paper/PaperConfig.java -index ae48897bd52934d35fcb10c545ae79cc4fb57d5a..46ec9016e17805664531a61a75fc046e041b0848 100644 ---- a/src/main/java/com/destroystokyo/paper/PaperConfig.java -+++ b/src/main/java/com/destroystokyo/paper/PaperConfig.java -@@ -249,4 +249,9 @@ public class PaperConfig { - private static void enablePlayerCollisions() { - enablePlayerCollisions = getBoolean("settings.enable-player-collisions", true); - } -+ -+ public static boolean saveEmptyScoreboardTeams = false; -+ private static void saveEmptyScoreboardTeams() { -+ saveEmptyScoreboardTeams = getBoolean("settings.save-empty-scoreboard-teams", false); -+ } - } diff --git a/src/main/java/net/minecraft/world/scores/ScoreboardSaveData.java b/src/main/java/net/minecraft/world/scores/ScoreboardSaveData.java -index b837b6616a2384b253cca8ed62c9488b639f6298..0efb63d1a4cefede25712daf9cea0f5c3256980f 100644 +index b837b6616a2384b253cca8ed62c9488b639f6298..2be7a697f08045b974579e6942b38571e744efac 100644 --- a/src/main/java/net/minecraft/world/scores/ScoreboardSaveData.java +++ b/src/main/java/net/minecraft/world/scores/ScoreboardSaveData.java @@ -136,6 +136,7 @@ public class ScoreboardSaveData extends SavedData { ListTag listTag = new ListTag(); for(PlayerTeam playerTeam : this.scoreboard.getPlayerTeams()) { -+ if (!com.destroystokyo.paper.PaperConfig.saveEmptyScoreboardTeams && playerTeam.getPlayers().isEmpty()) continue; // Paper ++ if (!io.papermc.paper.configuration.GlobalConfiguration.get().scoreboards.saveEmptyScoreboardTeams && playerTeam.getPlayers().isEmpty()) continue; // Paper CompoundTag compoundTag = new CompoundTag(); compoundTag.putString("Name", playerTeam.getName()); compoundTag.putString("DisplayName", Component.Serializer.toJson(playerTeam.getDisplayName())); diff --git a/patches/server/0094-Async-GameProfileCache-saving.patch b/patches/server/0094-Async-GameProfileCache-saving.patch index c2f36b005e..c2a31948cd 100644 --- a/patches/server/0094-Async-GameProfileCache-saving.patch +++ b/patches/server/0094-Async-GameProfileCache-saving.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Async GameProfileCache saving diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index b62d7b2e974f9eafb8e60ddb9ed58273b0393185..9e5271d39e4a15a71c59a8560edd59c75ec6dd52 100644 +index 681121909bdf81d5a05670f0b0150f6276d00281..a4623129ffa537db39ee2f206fa775c950e07a21 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java @@ -942,7 +942,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop> consumer, Set trackedPlayers) { this.trackedPlayers = trackedPlayers; diff --git a/src/main/java/net/minecraft/world/entity/item/PrimedTnt.java b/src/main/java/net/minecraft/world/entity/item/PrimedTnt.java -index dfcca1fac06de7a4be9be3c238a738a0599fcd24..445d9d1ec6f02f32d819d8555ceddb8e1ada7acd 100644 +index 10f8b5ff56e4c1d8300835e045abdce719a99343..8101f358975b35b5a2dafbade3d14a910e408fa2 100644 --- a/src/main/java/net/minecraft/world/entity/item/PrimedTnt.java +++ b/src/main/java/net/minecraft/world/entity/item/PrimedTnt.java @@ -97,6 +97,27 @@ public class PrimedTnt extends Entity { @@ -45,7 +26,7 @@ index dfcca1fac06de7a4be9be3c238a738a0599fcd24..445d9d1ec6f02f32d819d8555ceddb8e } + // Paper start - Optional prevent TNT from moving in water -+ if (!this.isRemoved() && this.wasTouchingWater && this.level.paperConfig.preventTntFromMovingInWater) { ++ if (!this.isRemoved() && this.wasTouchingWater && this.level.paperConfig().fixes.preventTntFromMovingInWater) { + /* + * Author: Jedediah Smith + */ @@ -76,7 +57,7 @@ index dfcca1fac06de7a4be9be3c238a738a0599fcd24..445d9d1ec6f02f32d819d8555ceddb8e + // Paper start - Optional prevent TNT from moving in water + @Override + public boolean isPushedByFluid() { -+ return !level.paperConfig.preventTntFromMovingInWater && super.isPushedByFluid(); ++ return !level.paperConfig().fixes.preventTntFromMovingInWater && super.isPushedByFluid(); + } + // Paper end } diff --git a/patches/server/0096-Faster-redstone-torch-rapid-clock-removal.patch b/patches/server/0096-Faster-redstone-torch-rapid-clock-removal.patch index 187ff24825..d021ca0e2f 100644 --- a/patches/server/0096-Faster-redstone-torch-rapid-clock-removal.patch +++ b/patches/server/0096-Faster-redstone-torch-rapid-clock-removal.patch @@ -6,10 +6,10 @@ Subject: [PATCH] Faster redstone torch rapid clock removal Only resize the the redstone torch list once, since resizing arrays / lists is costly diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java -index 5732a9a41a14e5297631d78f924b2082efcfe9da..4b5d9b90658efe43fcb346dd94dc1e3372809b0e 100644 +index 46c7c63d4dced4e75079588cef2c155859e5ae36..2dc18abb447d1ba51d8b9c301becd7f618e5a404 100644 --- a/src/main/java/net/minecraft/world/level/Level.java +++ b/src/main/java/net/minecraft/world/level/Level.java -@@ -163,6 +163,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable { +@@ -167,6 +167,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable { private org.spigotmc.TickLimiter tileLimiter; private int tileTickPosition; public final Map explosionDensityCache = new HashMap<>(); // Paper - Optimize explosions diff --git a/patches/server/0102-Add-setting-for-proxy-online-mode-status.patch b/patches/server/0102-Add-setting-for-proxy-online-mode-status.patch index 8d12e30323..709990de52 100644 --- a/patches/server/0102-Add-setting-for-proxy-online-mode-status.patch +++ b/patches/server/0102-Add-setting-for-proxy-online-mode-status.patch @@ -5,41 +5,15 @@ Subject: [PATCH] Add setting for proxy online mode status TODO: Add isProxyOnlineMode check to Metrics -diff --git a/src/main/java/com/destroystokyo/paper/PaperConfig.java b/src/main/java/com/destroystokyo/paper/PaperConfig.java -index 46ec9016e17805664531a61a75fc046e041b0848..01b1eb60894a79bd10a035404cc796ce0d3725c8 100644 ---- a/src/main/java/com/destroystokyo/paper/PaperConfig.java -+++ b/src/main/java/com/destroystokyo/paper/PaperConfig.java -@@ -23,6 +23,7 @@ import org.bukkit.configuration.InvalidConfigurationException; - import org.bukkit.configuration.file.YamlConfiguration; - import co.aikar.timings.Timings; - import co.aikar.timings.TimingsManager; -+import org.spigotmc.SpigotConfig; - - public class PaperConfig { - -@@ -254,4 +255,13 @@ public class PaperConfig { - private static void saveEmptyScoreboardTeams() { - saveEmptyScoreboardTeams = getBoolean("settings.save-empty-scoreboard-teams", false); - } -+ -+ public static boolean bungeeOnlineMode = true; -+ private static void bungeeOnlineMode() { -+ bungeeOnlineMode = getBoolean("settings.bungee-online-mode", true); -+ } -+ -+ public static boolean isProxyOnlineMode() { -+ return Bukkit.getOnlineMode() || (SpigotConfig.bungee && bungeeOnlineMode); -+ } - } diff --git a/src/main/java/net/minecraft/server/players/GameProfileCache.java b/src/main/java/net/minecraft/server/players/GameProfileCache.java -index 87b7a669ef111b2dc40d152fe6fe4e75ff8ccc98..6087fff889458dc09d5a3eb52e7d4b0a77bde809 100644 +index 87b7a669ef111b2dc40d152fe6fe4e75ff8ccc98..40ddeaea58263820c32a4e901a2e907088eb7b6e 100644 --- a/src/main/java/net/minecraft/server/players/GameProfileCache.java +++ b/src/main/java/net/minecraft/server/players/GameProfileCache.java @@ -98,6 +98,7 @@ public class GameProfileCache { } }; -+ if (com.destroystokyo.paper.PaperConfig.isProxyOnlineMode()) // Paper - only run in online mode - 100 COL ++ if (io.papermc.paper.configuration.GlobalConfiguration.get().proxies.isProxyOnlineMode()) // Paper - only run in online mode - 100 COL repository.findProfilesByNames(new String[]{name}, Agent.MINECRAFT, profilelookupcallback); GameProfile gameprofile = (GameProfile) atomicreference.get(); @@ -48,12 +22,12 @@ index 87b7a669ef111b2dc40d152fe6fe4e75ff8ccc98..6087fff889458dc09d5a3eb52e7d4b0a private static boolean usesAuthentication() { - return GameProfileCache.usesAuthentication; -+ return com.destroystokyo.paper.PaperConfig.isProxyOnlineMode(); // Paper ++ return io.papermc.paper.configuration.GlobalConfiguration.get().proxies.isProxyOnlineMode(); // Paper } public void add(GameProfile profile) { diff --git a/src/main/java/net/minecraft/server/players/OldUsersConverter.java b/src/main/java/net/minecraft/server/players/OldUsersConverter.java -index da98f074ccd5a40c635824112c97fd174c393cb1..fd9c7e4cb637b67fbbcbee6f8e2449c4e62fc344 100644 +index da98f074ccd5a40c635824112c97fd174c393cb1..6599f874d9f97e9ef4862039ecad7277bbc5fd91 100644 --- a/src/main/java/net/minecraft/server/players/OldUsersConverter.java +++ b/src/main/java/net/minecraft/server/players/OldUsersConverter.java @@ -66,7 +66,8 @@ public class OldUsersConverter { @@ -62,20 +36,20 @@ index da98f074ccd5a40c635824112c97fd174c393cb1..fd9c7e4cb637b67fbbcbee6f8e2449c4 - if (server.usesAuthentication() || org.spigotmc.SpigotConfig.bungee) { // Spigot: bungee = online mode, for now. + if (server.usesAuthentication() -+ || (com.destroystokyo.paper.PaperConfig.isProxyOnlineMode())) { // Spigot: bungee = online mode, for now. // Paper - Handle via setting ++ || (io.papermc.paper.configuration.GlobalConfiguration.get().proxies.isProxyOnlineMode())) { // Spigot: bungee = online mode, for now. // Paper - Handle via setting server.getProfileRepository().findProfilesByNames(astring, Agent.MINECRAFT, callback); } else { String[] astring1 = astring; diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -index f40446e07308dd9f09622dba55933bc3486f80b8..abada046fd469cc5c423c26571d70b5ea062eda1 100644 +index 90a2ed1b851a948b8ebf4ad6157003db19f1916f..ad7efac7d32837c8de2c2a61552538398d24cf44 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -@@ -1686,7 +1686,7 @@ public final class CraftServer implements Server { +@@ -1685,7 +1685,7 @@ public final class CraftServer implements Server { // Spigot Start GameProfile profile = null; // Only fetch an online UUID in online mode - if ( this.getOnlineMode() || org.spigotmc.SpigotConfig.bungee ) -+ if ( this.getOnlineMode() || com.destroystokyo.paper.PaperConfig.isProxyOnlineMode() ) // Paper - Handle via setting ++ if ( this.getOnlineMode() || io.papermc.paper.configuration.GlobalConfiguration.get().proxies.isProxyOnlineMode() ) // Paper - Handle via setting { profile = this.console.getProfileCache().get(name).orElse(null); } diff --git a/patches/server/0104-Configurable-packet-in-spam-threshold.patch b/patches/server/0104-Configurable-packet-in-spam-threshold.patch index 7ddc015b3c..ba77c20c79 100644 --- a/patches/server/0104-Configurable-packet-in-spam-threshold.patch +++ b/patches/server/0104-Configurable-packet-in-spam-threshold.patch @@ -4,33 +4,15 @@ Date: Sun, 11 Sep 2016 14:30:57 -0500 Subject: [PATCH] Configurable packet in spam threshold -diff --git a/src/main/java/com/destroystokyo/paper/PaperConfig.java b/src/main/java/com/destroystokyo/paper/PaperConfig.java -index 01b1eb60894a79bd10a035404cc796ce0d3725c8..77e1a4b9b0734734bbcf03b6adc1cf0552063d1f 100644 ---- a/src/main/java/com/destroystokyo/paper/PaperConfig.java -+++ b/src/main/java/com/destroystokyo/paper/PaperConfig.java -@@ -264,4 +264,13 @@ public class PaperConfig { - public static boolean isProxyOnlineMode() { - return Bukkit.getOnlineMode() || (SpigotConfig.bungee && bungeeOnlineMode); - } -+ -+ public static int packetInSpamThreshold = 300; -+ private static void packetInSpamThreshold() { -+ if (version < 11) { -+ int oldValue = getInt("settings.play-in-use-item-spam-threshold", 300); -+ set("settings.incoming-packet-spam-threshold", oldValue); -+ } -+ packetInSpamThreshold = getInt("settings.incoming-packet-spam-threshold", 300); -+ } - } diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index 1b92ee3988c1bdcbc751f32bd480b2ad2f588139..f3146f65f8e3ac465763093e7f5b53274d4d3356 100644 +index e7d9af82a11fb5c1250c76d32f21cc720c002da2..e4f3b2516372cb21e7b53f1df9ee484476179035 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java @@ -1534,13 +1534,14 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser // Spigot start - limit place/interactions private int limitedPackets; private long lastLimitedPacket = -1; -+ private static final int THRESHOLD = com.destroystokyo.paper.PaperConfig.packetInSpamThreshold; // Paper - Configurable threshold ++ private static final int THRESHOLD = io.papermc.paper.configuration.GlobalConfiguration.get().spamLimiter.incomingPacketThreshold; // Paper - Configurable threshold private boolean checkLimit(long timestamp) { - if (this.lastLimitedPacket != -1 && timestamp - this.lastLimitedPacket < 30 && this.limitedPackets++ >= 4) { diff --git a/patches/server/0105-Configurable-flying-kick-messages.patch b/patches/server/0105-Configurable-flying-kick-messages.patch index c45c8577bc..3f13c59458 100644 --- a/patches/server/0105-Configurable-flying-kick-messages.patch +++ b/patches/server/0105-Configurable-flying-kick-messages.patch @@ -4,24 +4,8 @@ Date: Tue, 20 Sep 2016 00:58:01 +0000 Subject: [PATCH] Configurable flying kick messages -diff --git a/src/main/java/com/destroystokyo/paper/PaperConfig.java b/src/main/java/com/destroystokyo/paper/PaperConfig.java -index 77e1a4b9b0734734bbcf03b6adc1cf0552063d1f..2440e81ef23c3b8c91ca5bdf13347f13cb66f549 100644 ---- a/src/main/java/com/destroystokyo/paper/PaperConfig.java -+++ b/src/main/java/com/destroystokyo/paper/PaperConfig.java -@@ -273,4 +273,11 @@ public class PaperConfig { - } - packetInSpamThreshold = getInt("settings.incoming-packet-spam-threshold", 300); - } -+ -+ public static String flyingKickPlayerMessage = "Flying is not enabled on this server"; -+ public static String flyingKickVehicleMessage = "Flying is not enabled on this server"; -+ private static void flyingKickMessages() { -+ flyingKickPlayerMessage = getString("messages.kick.flying-player", flyingKickPlayerMessage); -+ flyingKickVehicleMessage = getString("messages.kick.flying-vehicle", flyingKickVehicleMessage); -+ } - } diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index f3146f65f8e3ac465763093e7f5b53274d4d3356..71b595a293e0add1ad9f7e5c3a2694a8a16771aa 100644 +index e4f3b2516372cb21e7b53f1df9ee484476179035..bfcbfc08fb329ebded5376c4a78d13e659323a64 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java @@ -326,7 +326,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser @@ -29,7 +13,7 @@ index f3146f65f8e3ac465763093e7f5b53274d4d3356..71b595a293e0add1ad9f7e5c3a2694a8 if (++this.aboveGroundTickCount > 80) { ServerGamePacketListenerImpl.LOGGER.warn("{} was kicked for floating too long!", this.player.getName().getString()); - this.disconnect(Component.translatable("multiplayer.disconnect.flying")); -+ this.disconnect(com.destroystokyo.paper.PaperConfig.flyingKickPlayerMessage); // Paper - use configurable kick message ++ this.disconnect(io.papermc.paper.configuration.GlobalConfiguration.get().messages.kick.flyingPlayer); // Paper - use configurable kick message return; } } else { @@ -38,7 +22,7 @@ index f3146f65f8e3ac465763093e7f5b53274d4d3356..71b595a293e0add1ad9f7e5c3a2694a8 if (++this.aboveGroundVehicleTickCount > 80) { ServerGamePacketListenerImpl.LOGGER.warn("{} was kicked for floating a vehicle too long!", this.player.getName().getString()); - this.disconnect(Component.translatable("multiplayer.disconnect.flying")); -+ this.disconnect(com.destroystokyo.paper.PaperConfig.flyingKickVehicleMessage); // Paper - use configurable kick message ++ this.disconnect(io.papermc.paper.configuration.GlobalConfiguration.get().messages.kick.flyingVehicle); // Paper - use configurable kick message return; } } else { diff --git a/patches/server/0107-Filter-bad-data-from-ArmorStand-and-SpawnEgg-items.patch b/patches/server/0107-Filter-bad-data-from-ArmorStand-and-SpawnEgg-items.patch index ae4a3a89c9..9fc8ffaeaf 100644 --- a/patches/server/0107-Filter-bad-data-from-ArmorStand-and-SpawnEgg-items.patch +++ b/patches/server/0107-Filter-bad-data-from-ArmorStand-and-SpawnEgg-items.patch @@ -4,25 +4,8 @@ Date: Sat, 12 Nov 2016 23:25:22 -0600 Subject: [PATCH] Filter bad data from ArmorStand and SpawnEgg items -diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -index 45712eb3967d61541580db57e1e9f84e6f5b9762..0b5e223594ff95b8ba7c300d4a66ca7a17e53802 100644 ---- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -@@ -357,4 +357,12 @@ public class PaperWorldConfig { - preventTntFromMovingInWater = getBoolean("prevent-tnt-from-moving-in-water", false); - log("Prevent TNT from moving in water: " + preventTntFromMovingInWater); - } -+ -+ public boolean filterNBTFromSpawnEgg = true; -+ private void fitlerNBTFromSpawnEgg() { -+ filterNBTFromSpawnEgg = getBoolean("filter-nbt-data-from-spawn-eggs-and-related", true); -+ if (!filterNBTFromSpawnEgg) { -+ Bukkit.getLogger().warning("Spawn Egg and Armor Stand NBT filtering disabled, this is a potential security risk"); -+ } -+ } - } diff --git a/src/main/java/net/minecraft/world/entity/item/FallingBlockEntity.java b/src/main/java/net/minecraft/world/entity/item/FallingBlockEntity.java -index 242e02646b8584a8d2a512374ad03729661d584f..08defb76e73a5f9121bf405c86a3c4c750ab1933 100644 +index 6c4be7da19d0d61f35942558d438587853231aaa..18d81e8e8f387a7fb531652cb78c61a9bd5ae600 100644 --- a/src/main/java/net/minecraft/world/entity/item/FallingBlockEntity.java +++ b/src/main/java/net/minecraft/world/entity/item/FallingBlockEntity.java @@ -316,6 +316,18 @@ public class FallingBlockEntity extends Entity { @@ -31,7 +14,7 @@ index 242e02646b8584a8d2a512374ad03729661d584f..08defb76e73a5f9121bf405c86a3c4c7 this.blockState = NbtUtils.readBlockState(nbt.getCompound("BlockState")); + // Paper start - Block FallingBlocks with Command Blocks + final Block b = this.blockState.getBlock(); -+ if (this.level.paperConfig.filterNBTFromSpawnEgg ++ if (this.level.paperConfig().entities.spawning.filterNbtDataFromSpawnEggsAndRelated + && (b == Blocks.COMMAND_BLOCK + || b == Blocks.REPEATING_COMMAND_BLOCK + || b == Blocks.CHAIN_COMMAND_BLOCK diff --git a/patches/server/0109-Allow-Reloading-of-Command-Aliases.patch b/patches/server/0109-Allow-Reloading-of-Command-Aliases.patch index 901dd8acb7..becbf4bcfe 100644 --- a/patches/server/0109-Allow-Reloading-of-Command-Aliases.patch +++ b/patches/server/0109-Allow-Reloading-of-Command-Aliases.patch @@ -6,10 +6,10 @@ Subject: [PATCH] Allow Reloading of Command Aliases Reload the aliases stored in commands.yml diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -index abada046fd469cc5c423c26571d70b5ea062eda1..ae1cfe01f285a773ab9d4bdb9b0dd897615f0b82 100644 +index ad7efac7d32837c8de2c2a61552538398d24cf44..437d479e319becb8d9d4ec9544a9fa2aebc72160 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -@@ -2530,5 +2530,24 @@ public final class CraftServer implements Server { +@@ -2527,5 +2527,24 @@ public final class CraftServer implements Server { DefaultPermissions.registerCorePermissions(); CraftDefaultPermissions.registerCorePermissions(); } diff --git a/patches/server/0111-Add-ProjectileCollideEvent.patch b/patches/server/0111-Add-ProjectileCollideEvent.patch index 5a9b67043d..9a3c0e77b0 100644 --- a/patches/server/0111-Add-ProjectileCollideEvent.patch +++ b/patches/server/0111-Add-ProjectileCollideEvent.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Add ProjectileCollideEvent diff --git a/src/main/java/net/minecraft/world/entity/projectile/AbstractArrow.java b/src/main/java/net/minecraft/world/entity/projectile/AbstractArrow.java -index 046082ab7deb21574d9471b78a39a4a6bb296c2f..62beefb6693d1801d9d8994c7247dca5bd646b0b 100644 +index 7cd802be238cedf166174a61e816d9d4b29b87d2..7f1f4813ac007fbf79e8ba254075c015fe15e3a1 100644 --- a/src/main/java/net/minecraft/world/entity/projectile/AbstractArrow.java +++ b/src/main/java/net/minecraft/world/entity/projectile/AbstractArrow.java @@ -226,6 +226,17 @@ public abstract class AbstractArrow extends Projectile { diff --git a/patches/server/0113-Optimize-World.isLoaded-BlockPosition-Z.patch b/patches/server/0113-Optimize-World.isLoaded-BlockPosition-Z.patch index a00d34dae8..4fecb3741c 100644 --- a/patches/server/0113-Optimize-World.isLoaded-BlockPosition-Z.patch +++ b/patches/server/0113-Optimize-World.isLoaded-BlockPosition-Z.patch @@ -6,10 +6,10 @@ Subject: [PATCH] Optimize World.isLoaded(BlockPosition)Z Reduce method invocations for World.isLoaded(BlockPosition)Z diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java -index 4b5d9b90658efe43fcb346dd94dc1e3372809b0e..b28fc4cf5deb543e78b91547c1ab7e1ab9e6f0e4 100644 +index 2dc18abb447d1ba51d8b9c301becd7f618e5a404..1686dbfc4b45c88105c71d284c024a4101795d08 100644 --- a/src/main/java/net/minecraft/world/level/Level.java +++ b/src/main/java/net/minecraft/world/level/Level.java -@@ -330,6 +330,11 @@ public abstract class Level implements LevelAccessor, AutoCloseable { +@@ -334,6 +334,11 @@ public abstract class Level implements LevelAccessor, AutoCloseable { return chunk == null ? null : chunk.getFluidState(blockposition); } diff --git a/patches/server/0115-Configurable-Cartographer-Treasure-Maps.patch b/patches/server/0115-Configurable-Cartographer-Treasure-Maps.patch index 40af4aae01..25ad0e6acc 100644 --- a/patches/server/0115-Configurable-Cartographer-Treasure-Maps.patch +++ b/patches/server/0115-Configurable-Cartographer-Treasure-Maps.patch @@ -8,50 +8,8 @@ Allow configuring for cartographers to return the same map location Also allow turning off treasure maps all together as they can eat up Map ID's which are limited in quantity. -diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -index 0b5e223594ff95b8ba7c300d4a66ca7a17e53802..8451982ba4fc9522f2d77f68fc63a0e12558955f 100644 ---- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -@@ -56,6 +56,11 @@ public class PaperWorldConfig { - set("despawn-ranges.hard", null); - } - -+ if (this.config.isSet("world-settings.default.treasure-maps-return-already-discovered") || this.config.isSet("world-settings." + worldName + ".treasure-maps-return-already-discovered")) { -+ set("treasure-maps-return-already-discovered", null); -+ needsSave = true; -+ } -+ - if (needsSave) { - saveConfig(); - } -@@ -365,4 +370,25 @@ public class PaperWorldConfig { - Bukkit.getLogger().warning("Spawn Egg and Armor Stand NBT filtering disabled, this is a potential security risk"); - } - } -+ -+ public boolean enableTreasureMaps = true; -+ public boolean treasureMapsAlreadyDiscoveredVillager = false; -+ public Boolean treasureMapsAlreadyDiscoveredLootTable = null; -+ private Boolean getBooleanOrNull(String path, Boolean defaultValue) { -+ this.config.addDefault("world-settings.default." + path, defaultValue == null ? "default" : defaultValue); -+ final Object value = this.config.get("world-settings." + worldName + "." + path, this.config.get("world-settings.default." + path)); -+ if (value instanceof Boolean bool) { -+ return bool; -+ } -+ return null; -+ } -+ private void treasureMapsAlreadyDiscovered() { -+ enableTreasureMaps = getBoolean("enable-treasure-maps", true); -+ if (getBoolean("treasure-maps-return-already-discovered", false, false)) { -+ treasureMapsAlreadyDiscoveredLootTable = true; -+ treasureMapsAlreadyDiscoveredVillager = true; -+ } -+ treasureMapsAlreadyDiscoveredVillager = getBoolean("treasure-maps-find-already-discovered.villager-trade", treasureMapsAlreadyDiscoveredVillager); -+ treasureMapsAlreadyDiscoveredLootTable = getBooleanOrNull("treasure-maps-find-already-discovered.loot-tables", treasureMapsAlreadyDiscoveredLootTable); -+ } - } diff --git a/src/main/java/net/minecraft/world/entity/npc/VillagerTrades.java b/src/main/java/net/minecraft/world/entity/npc/VillagerTrades.java -index f95999daa1955dd4d919d0e668fe099901a0481c..7360a0a70ddb3dc055d3ebc62071cb5327094e8e 100644 +index f95999daa1955dd4d919d0e668fe099901a0481c..770a91fcc351a2d1de4762c0fd9bae2b49c363b5 100644 --- a/src/main/java/net/minecraft/world/entity/npc/VillagerTrades.java +++ b/src/main/java/net/minecraft/world/entity/npc/VillagerTrades.java @@ -386,7 +386,8 @@ public class VillagerTrades { @@ -59,13 +17,13 @@ index f95999daa1955dd4d919d0e668fe099901a0481c..7360a0a70ddb3dc055d3ebc62071cb53 } else { ServerLevel serverLevel = (ServerLevel)entity.level; - BlockPos blockPos = serverLevel.findNearestMapStructure(this.destination, entity.blockPosition(), 100, true); -+ if (!serverLevel.paperConfig.enableTreasureMaps) return null; // Paper -+ BlockPos blockPos = serverLevel.findNearestMapStructure(this.destination, entity.blockPosition(), 100, !serverLevel.paperConfig.treasureMapsAlreadyDiscoveredVillager); // Paper ++ if (!serverLevel.paperConfig().environment.treasureMaps.enabled) return null; // Paper ++ BlockPos blockPos = serverLevel.findNearestMapStructure(this.destination, entity.blockPosition(), 100, !serverLevel.paperConfig().environment.treasureMaps.findAlreadyDiscoveredVillager); // Paper if (blockPos != null) { ItemStack itemStack = MapItem.create(serverLevel, blockPos.getX(), blockPos.getZ(), (byte)2, true, true); MapItem.renderBiomePreviewMap(serverLevel, itemStack); diff --git a/src/main/java/net/minecraft/world/level/storage/loot/functions/ExplorationMapFunction.java b/src/main/java/net/minecraft/world/level/storage/loot/functions/ExplorationMapFunction.java -index 321384730cacbdc22eedc53651e4d24f06c73b99..fa1387ce6029198109bed258c559cd008f531c08 100644 +index 321384730cacbdc22eedc53651e4d24f06c73b99..b734c0f9b831c20a239b5341ff3a0b4d6a6c102c 100644 --- a/src/main/java/net/minecraft/world/level/storage/loot/functions/ExplorationMapFunction.java +++ b/src/main/java/net/minecraft/world/level/storage/loot/functions/ExplorationMapFunction.java @@ -68,7 +68,16 @@ public class ExplorationMapFunction extends LootItemConditionalFunction { @@ -74,7 +32,7 @@ index 321384730cacbdc22eedc53651e4d24f06c73b99..fa1387ce6029198109bed258c559cd00 ServerLevel serverLevel = context.getLevel(); - BlockPos blockPos = serverLevel.findNearestMapStructure(this.destination, new BlockPos(vec3), this.searchRadius, this.skipKnownStructures); + // Paper start -+ if (!serverLevel.paperConfig.enableTreasureMaps) { ++ if (!serverLevel.paperConfig().environment.treasureMaps.enabled) { + /* + * NOTE: I fear users will just get a plain map as their "treasure" + * This is preferable to disrespecting the config. @@ -82,7 +40,7 @@ index 321384730cacbdc22eedc53651e4d24f06c73b99..fa1387ce6029198109bed258c559cd00 + return stack; + } + // Paper end -+ BlockPos blockPos = serverLevel.findNearestMapStructure(this.destination, new BlockPos(vec3), this.searchRadius, serverLevel.paperConfig.treasureMapsAlreadyDiscoveredLootTable == null ? this.skipKnownStructures : serverLevel.paperConfig.treasureMapsAlreadyDiscoveredLootTable); // Paper ++ BlockPos blockPos = serverLevel.findNearestMapStructure(this.destination, new BlockPos(vec3), this.searchRadius, serverLevel.paperConfig().environment.treasureMaps.findAlreadyDiscoveredLootTable.or(this.skipKnownStructures)); // Paper if (blockPos != null) { ItemStack itemStack = MapItem.create(serverLevel, blockPos.getX(), blockPos.getZ(), this.zoom, true, true); MapItem.renderBiomePreviewMap(serverLevel, itemStack); diff --git a/patches/server/0118-String-based-Action-Bar-API.patch b/patches/server/0118-String-based-Action-Bar-API.patch index 74b3d941d8..84496c9702 100644 --- a/patches/server/0118-String-based-Action-Bar-API.patch +++ b/patches/server/0118-String-based-Action-Bar-API.patch @@ -26,7 +26,7 @@ index 32ef3edebe94a2014168b7e438752a80b2687e5f..ab6c58eed6707ab7b0aa3e7549a871ad // Paper end buf.writeComponent(this.text); diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -index 8c8f0df271cb1fab92aeb342289fa116cf5b93a8..2f193f96eb5633fe1d06ec0d76fcbfc5b0ff5c7b 100644 +index 213037a4c545db70ca5e66018057216cbb6532d3..0b693866af8e0d8de275e87ca1232a03a6a35abe 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java @@ -274,6 +274,26 @@ public class CraftPlayer extends CraftHumanEntity implements Player { diff --git a/patches/server/0119-Properly-fix-item-duplication-bug.patch b/patches/server/0119-Properly-fix-item-duplication-bug.patch index 9a2108f653..24e0c61695 100644 --- a/patches/server/0119-Properly-fix-item-duplication-bug.patch +++ b/patches/server/0119-Properly-fix-item-duplication-bug.patch @@ -6,7 +6,7 @@ Subject: [PATCH] Properly fix item duplication bug Credit to prplz for figuring out the real issue diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java -index a375d2d0bffc3694e76bae3f9ba13f60e629d859..bd6e22b849d6328b2fcc0244cc83a79d9ffb08c8 100644 +index 73fe1f1047e39eeeb8a1444fa353f7d1a8e651b3..4b65dc12dc97e72b221d9fd15202a1a0622ef806 100644 --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java @@ -2199,7 +2199,7 @@ public class ServerPlayer extends Player { @@ -19,7 +19,7 @@ index a375d2d0bffc3694e76bae3f9ba13f60e629d859..bd6e22b849d6328b2fcc0244cc83a79d @Override diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index 71b595a293e0add1ad9f7e5c3a2694a8a16771aa..955985193a1713a6a938c6b8879a85fd329a89ab 100644 +index bfcbfc08fb329ebded5376c4a78d13e659323a64..3f1bda6c17fca41150bfaab2cd5a4e8849bd439d 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java @@ -3036,7 +3036,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser diff --git a/patches/server/0122-Provide-E-TE-Chunk-count-stat-methods.patch b/patches/server/0122-Provide-E-TE-Chunk-count-stat-methods.patch index 2b51a30217..a4d9d0f3f1 100644 --- a/patches/server/0122-Provide-E-TE-Chunk-count-stat-methods.patch +++ b/patches/server/0122-Provide-E-TE-Chunk-count-stat-methods.patch @@ -7,7 +7,7 @@ Provides counts without the ineffeciency of using .getEntities().size() which creates copy of the collections. diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java -index b28fc4cf5deb543e78b91547c1ab7e1ab9e6f0e4..4aea5e937e2e0e272e5aeb4e6b9ed750064f3828 100644 +index 1686dbfc4b45c88105c71d284c024a4101795d08..5577a560d41a2467bd713f2fa7511c83a73c2f2d 100644 --- a/src/main/java/net/minecraft/world/level/Level.java +++ b/src/main/java/net/minecraft/world/level/Level.java @@ -112,7 +112,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable { diff --git a/patches/server/0123-Enforce-Sync-Player-Saves.patch b/patches/server/0123-Enforce-Sync-Player-Saves.patch index 19d9063ed2..ec06df175a 100644 --- a/patches/server/0123-Enforce-Sync-Player-Saves.patch +++ b/patches/server/0123-Enforce-Sync-Player-Saves.patch @@ -7,7 +7,7 @@ Saving players async is extremely dangerous. This will force it to main the same way we handle async chunk loads. diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java -index e0b279d9437b30ca4a18a3036bf59664570a746f..5e6e4017f1ed84dbf5060f8d789f3cd766d9e0d2 100644 +index 3fe3d417b6c1ff49a412c308bfe6a43182d0986e..6c86e18cb59a4e9a906269d570d228f05c700a48 100644 --- a/src/main/java/net/minecraft/server/players/PlayerList.java +++ b/src/main/java/net/minecraft/server/players/PlayerList.java @@ -1040,11 +1040,13 @@ public abstract class PlayerList { diff --git a/patches/server/0124-Don-t-allow-entities-to-ride-themselves-572.patch b/patches/server/0124-Don-t-allow-entities-to-ride-themselves-572.patch index 620f0a5bbf..fdefd86788 100644 --- a/patches/server/0124-Don-t-allow-entities-to-ride-themselves-572.patch +++ b/patches/server/0124-Don-t-allow-entities-to-ride-themselves-572.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Don't allow entities to ride themselves - #572 diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java -index cd4b9b659904e587933b83616dfdcffb2de8bea5..a93426773dff94aebea8283ebd9f21fa841e01d7 100644 +index 3d84055afbe0392ca1abf5628b3b621b8833265a..25fb1785e76aa72eb59565dd51f9fc65b0509869 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java -@@ -2317,6 +2317,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource { +@@ -2316,6 +2316,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource { } protected boolean addPassenger(Entity entity) { // CraftBukkit diff --git a/patches/server/0125-ExperienceOrbs-API-for-Reason-Source-Triggering-play.patch b/patches/server/0125-ExperienceOrbs-API-for-Reason-Source-Triggering-play.patch index 46a55ef682..24d7d1f838 100644 --- a/patches/server/0125-ExperienceOrbs-API-for-Reason-Source-Triggering-play.patch +++ b/patches/server/0125-ExperienceOrbs-API-for-Reason-Source-Triggering-play.patch @@ -129,7 +129,7 @@ index b3433ce9c722bdab81848a6c2d121ca510c48509..227aca795efc99c4f81dfb30c00d31d2 @Override diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java -index 7a4996d720cc093f5c4b72356f20fc316cf9c533..8e6c9fb5eb58c20b97141551b2514c004eb4cedb 100644 +index 3a597e7ce159b78078b1d64258a6f30e51645f3b..86a624e505db71241e3acb0b9269372ea693031d 100644 --- a/src/main/java/net/minecraft/world/entity/LivingEntity.java +++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java @@ -1723,7 +1723,8 @@ public abstract class LivingEntity extends Entity { @@ -230,7 +230,7 @@ index b9a0fc52460ce0c50deea25112dee20c977e99c5..d7cb3d8b37f225ee4796246aa907da10 } diff --git a/src/main/java/net/minecraft/world/entity/projectile/FishingHook.java b/src/main/java/net/minecraft/world/entity/projectile/FishingHook.java -index 91fde59289100133a4f473bee176ff1b6805faae..d9256fe99309b7d085b2cc64c770cfcb61e3ef54 100644 +index 00fe96650e4d973e97b46968297f55f4c3674629..11ac510ad4095438d4904d521bfb18aa5f743faf 100644 --- a/src/main/java/net/minecraft/world/entity/projectile/FishingHook.java +++ b/src/main/java/net/minecraft/world/entity/projectile/FishingHook.java @@ -513,7 +513,7 @@ public class FishingHook extends Projectile { diff --git a/patches/server/0126-Cap-Entity-Collisions.patch b/patches/server/0126-Cap-Entity-Collisions.patch index 01b26c65cb..de16ae79d2 100644 --- a/patches/server/0126-Cap-Entity-Collisions.patch +++ b/patches/server/0126-Cap-Entity-Collisions.patch @@ -11,23 +11,8 @@ just as it does in Vanilla, but entity pushing logic will be capped. You can set this to 0 to disable collisions. -diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -index 8451982ba4fc9522f2d77f68fc63a0e12558955f..ee8ce0e5bdb0acb7d6ef3439a388e108ea1807de 100644 ---- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -@@ -391,4 +391,10 @@ public class PaperWorldConfig { - treasureMapsAlreadyDiscoveredVillager = getBoolean("treasure-maps-find-already-discovered.villager-trade", treasureMapsAlreadyDiscoveredVillager); - treasureMapsAlreadyDiscoveredLootTable = getBooleanOrNull("treasure-maps-find-already-discovered.loot-tables", treasureMapsAlreadyDiscoveredLootTable); - } -+ -+ public int maxCollisionsPerEntity = 8; -+ private void maxEntityCollision() { -+ maxCollisionsPerEntity = getInt( "max-entity-collisions", this.spigotConfig.getInt("max-entity-collisions", this.maxCollisionsPerEntity, false) ); -+ log( "Max Entity Collisions: " + maxCollisionsPerEntity ); -+ } - } diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java -index a93426773dff94aebea8283ebd9f21fa841e01d7..1e9589e08149bbbbe581ecb68d9f590d16ed897a 100644 +index 25fb1785e76aa72eb59565dd51f9fc65b0509869..bfc7736bfe538b615343b6f41f2a670493e2c701 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java @@ -373,6 +373,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource { @@ -39,7 +24,7 @@ index a93426773dff94aebea8283ebd9f21fa841e01d7..1e9589e08149bbbbe581ecb68d9f590d private org.bukkit.util.Vector origin; @javax.annotation.Nullable diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java -index 8e6c9fb5eb58c20b97141551b2514c004eb4cedb..2eed84529ad9a34ae88c4f37f2b0c7943f51b0ad 100644 +index 86a624e505db71241e3acb0b9269372ea693031d..7c50e9c28f9f26b42d2baa51d8fa735bb182ffa5 100644 --- a/src/main/java/net/minecraft/world/entity/LivingEntity.java +++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java @@ -3261,8 +3261,11 @@ public abstract class LivingEntity extends Entity { @@ -47,8 +32,8 @@ index 8e6c9fb5eb58c20b97141551b2514c004eb4cedb..2eed84529ad9a34ae88c4f37f2b0c794 } - for (j = 0; j < list.size(); ++j) { -+ this.numCollisions = Math.max(0, this.numCollisions - this.level.paperConfig.maxCollisionsPerEntity); // Paper -+ for (j = 0; j < list.size() && this.numCollisions < this.level.paperConfig.maxCollisionsPerEntity; ++j) { // Paper ++ this.numCollisions = Math.max(0, this.numCollisions - this.level.paperConfig().collisions.maxEntityCollisions); // Paper ++ for (j = 0; j < list.size() && this.numCollisions < this.level.paperConfig().collisions.maxEntityCollisions; ++j) { // Paper Entity entity = (Entity) list.get(j); + entity.numCollisions++; // Paper + this.numCollisions++; // Paper diff --git a/patches/server/0130-Properly-handle-async-calls-to-restart-the-server.patch b/patches/server/0130-Properly-handle-async-calls-to-restart-the-server.patch index 0df1495cb2..4674b4831d 100644 --- a/patches/server/0130-Properly-handle-async-calls-to-restart-the-server.patch +++ b/patches/server/0130-Properly-handle-async-calls-to-restart-the-server.patch @@ -30,10 +30,10 @@ will have plugins and worlds saving to the disk has a high potential to result in corruption/dataloss. diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index 9e5271d39e4a15a71c59a8560edd59c75ec6dd52..b2dfce9bb43360e1c405d32f255ef16e00d31b32 100644 +index a4623129ffa537db39ee2f206fa775c950e07a21..e4913a7dd431dc861fa93c099e9be97f00519a18 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java -@@ -220,6 +220,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop, ServerLevel> levels; private PlayerList playerList; private volatile boolean running; @@ -64,7 +64,7 @@ index 9e5271d39e4a15a71c59a8560edd59c75ec6dd52..b2dfce9bb43360e1c405d32f255ef16e if (flag) { try { diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java -index 5e6e4017f1ed84dbf5060f8d789f3cd766d9e0d2..b477f31ac8313e8f4c1f288fc0cf6bc2544c1f28 100644 +index 6c86e18cb59a4e9a906269d570d228f05c700a48..b28bb51e5476b250d9de91f2e380dd8ed2aa7041 100644 --- a/src/main/java/net/minecraft/server/players/PlayerList.java +++ b/src/main/java/net/minecraft/server/players/PlayerList.java @@ -1151,8 +1151,15 @@ public abstract class PlayerList { diff --git a/patches/server/0131-Add-option-to-make-parrots-stay-on-shoulders-despite.patch b/patches/server/0131-Add-option-to-make-parrots-stay-on-shoulders-despite.patch index 6ab6257b02..2222a24c55 100644 --- a/patches/server/0131-Add-option-to-make-parrots-stay-on-shoulders-despite.patch +++ b/patches/server/0131-Add-option-to-make-parrots-stay-on-shoulders-despite.patch @@ -10,23 +10,8 @@ I suspect Mojang may switch to this behavior before full release. To be converted into a Paper-API event at some point in the future? -diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -index ee8ce0e5bdb0acb7d6ef3439a388e108ea1807de..aa8a02c9fab8938e8064a60f1faf5421aab3892c 100644 ---- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -@@ -397,4 +397,10 @@ public class PaperWorldConfig { - maxCollisionsPerEntity = getInt( "max-entity-collisions", this.spigotConfig.getInt("max-entity-collisions", this.maxCollisionsPerEntity, false) ); - log( "Max Entity Collisions: " + maxCollisionsPerEntity ); - } -+ -+ public boolean parrotsHangOnBetter; -+ private void parrotsHangOnBetter() { -+ parrotsHangOnBetter = getBoolean("parrots-are-unaffected-by-player-movement", false); -+ log("Parrots are unaffected by player movement: " + parrotsHangOnBetter); -+ } - } diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index 955985193a1713a6a938c6b8879a85fd329a89ab..b50ca694f827b60ab6ae4b91772774b6fef55734 100644 +index 3f1bda6c17fca41150bfaab2cd5a4e8849bd439d..95b0c01d1eaf58ba8c93c896891dcfb1075d57da 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java @@ -2258,6 +2258,13 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser @@ -35,7 +20,7 @@ index 955985193a1713a6a938c6b8879a85fd329a89ab..b50ca694f827b60ab6ae4b91772774b6 this.player.setShiftKeyDown(true); + + // Paper start - Hang on! -+ if (this.player.level.paperConfig.parrotsHangOnBetter) { ++ if (this.player.level.paperConfig().entities.behavior.parrotsAreUnaffectedByPlayerMovement) { + this.player.removeEntitiesOnShoulder(); + } + // Paper end @@ -44,7 +29,7 @@ index 955985193a1713a6a938c6b8879a85fd329a89ab..b50ca694f827b60ab6ae4b91772774b6 case RELEASE_SHIFT_KEY: this.player.setShiftKeyDown(false); diff --git a/src/main/java/net/minecraft/world/entity/player/Player.java b/src/main/java/net/minecraft/world/entity/player/Player.java -index fdda98cb38ec96d0189931c41257cc01966373d5..0df33131bae2b6651eff4b5b34b3714625562b69 100644 +index fdda98cb38ec96d0189931c41257cc01966373d5..9aa134e56d661d033bb7229e6ab662534bf9cba9 100644 --- a/src/main/java/net/minecraft/world/entity/player/Player.java +++ b/src/main/java/net/minecraft/world/entity/player/Player.java @@ -587,7 +587,7 @@ public abstract class Player extends LivingEntity { @@ -52,7 +37,7 @@ index fdda98cb38ec96d0189931c41257cc01966373d5..0df33131bae2b6651eff4b5b34b37146 this.playShoulderEntityAmbientSound(this.getShoulderEntityRight()); if (!this.level.isClientSide && (this.fallDistance > 0.5F || this.isInWater()) || this.abilities.flying || this.isSleeping() || this.isInPowderSnow) { - this.removeEntitiesOnShoulder(); -+ if (!this.level.paperConfig.parrotsHangOnBetter) this.removeEntitiesOnShoulder(); // Paper - Hang on! ++ if (!this.level.paperConfig().entities.behavior.parrotsAreUnaffectedByPlayerMovement) this.removeEntitiesOnShoulder(); // Paper - Hang on! } } diff --git a/patches/server/0132-Add-configuration-option-to-prevent-player-names-fro.patch b/patches/server/0132-Add-configuration-option-to-prevent-player-names-fro.patch index 650fa3ffae..4f7f7a73b7 100644 --- a/patches/server/0132-Add-configuration-option-to-prevent-player-names-fro.patch +++ b/patches/server/0132-Add-configuration-option-to-prevent-player-names-fro.patch @@ -5,32 +5,18 @@ Subject: [PATCH] Add configuration option to prevent player names from being suggested -diff --git a/src/main/java/com/destroystokyo/paper/PaperConfig.java b/src/main/java/com/destroystokyo/paper/PaperConfig.java -index 2440e81ef23c3b8c91ca5bdf13347f13cb66f549..2a4aacd2461401a109d749eee262813367fe4a70 100644 ---- a/src/main/java/com/destroystokyo/paper/PaperConfig.java -+++ b/src/main/java/com/destroystokyo/paper/PaperConfig.java -@@ -280,4 +280,9 @@ public class PaperConfig { - flyingKickPlayerMessage = getString("messages.kick.flying-player", flyingKickPlayerMessage); - flyingKickVehicleMessage = getString("messages.kick.flying-vehicle", flyingKickVehicleMessage); - } -+ -+ public static boolean suggestPlayersWhenNullTabCompletions = true; -+ private static void suggestPlayersWhenNull() { -+ suggestPlayersWhenNullTabCompletions = getBoolean("settings.suggest-player-names-when-null-tab-completions", suggestPlayersWhenNullTabCompletions); -+ } - } diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -index ae1cfe01f285a773ab9d4bdb9b0dd897615f0b82..2d4292fa7e474d81ce974cfeda0cf56a2b5a19f2 100644 +index 437d479e319becb8d9d4ec9544a9fa2aebc72160..d4f944daae8139973b615983620957cf89d96e7b 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -@@ -2549,5 +2549,10 @@ public final class CraftServer implements Server { +@@ -2546,5 +2546,10 @@ public final class CraftServer implements Server { commandMap.registerServerAliases(); return true; } + + @Override + public boolean suggestPlayerNamesWhenNullTabCompletions() { -+ return com.destroystokyo.paper.PaperConfig.suggestPlayersWhenNullTabCompletions; ++ return io.papermc.paper.configuration.GlobalConfiguration.get().commands.suggestPlayerNamesWhenNullTabCompletions; + } // Paper end } diff --git a/patches/server/0133-Use-TerminalConsoleAppender-for-console-improvements.patch b/patches/server/0133-Use-TerminalConsoleAppender-for-console-improvements.patch index 81ee26e6e7..02db20f350 100644 --- a/patches/server/0133-Use-TerminalConsoleAppender-for-console-improvements.patch +++ b/patches/server/0133-Use-TerminalConsoleAppender-for-console-improvements.patch @@ -19,7 +19,7 @@ Other changes: configuration diff --git a/build.gradle.kts b/build.gradle.kts -index eef372c7f0a7fc057ee6d642f220ed0ecdd81ac0..0b5628ddf2332d12fc3d44bb32323a513c7240f2 100644 +index 9442f5e05869aeb267f8effd01974cad5f167188..a8bc19403fc82ef03e43afe8ddf5fa78890e8dda 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -8,7 +8,17 @@ plugins { @@ -112,10 +112,10 @@ index 0000000000000000000000000000000000000000..685deaa0e5d1ddc13e3a7c0471b1cfcf + +} diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index b2dfce9bb43360e1c405d32f255ef16e00d31b32..64a6f488be70dafc09c8d713aa4d9edd4a70177a 100644 +index e4913a7dd431dc861fa93c099e9be97f00519a18..2cdde6eaf2221bb634fd0d34db849c0a6833cfbd 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java -@@ -158,7 +158,7 @@ import org.slf4j.Logger; +@@ -157,7 +157,7 @@ import org.slf4j.Logger; import com.mojang.serialization.DynamicOps; import com.mojang.serialization.Lifecycle; import java.util.Random; @@ -124,7 +124,7 @@ index b2dfce9bb43360e1c405d32f255ef16e00d31b32..64a6f488be70dafc09c8d713aa4d9edd import joptsimple.OptionSet; import net.minecraft.server.bossevents.CustomBossEvents; import net.minecraft.server.dedicated.DedicatedServer; -@@ -269,7 +269,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop collection = this.getActiveEffects(); - if (!collection.isEmpty()) { -+ if (!collection.isEmpty() && !level.paperConfig.disableCreeperLingeringEffect) { // Paper ++ if (!collection.isEmpty() && !level.paperConfig().entities.behavior.disableCreeperLingeringEffect) { // Paper AreaEffectCloud entityareaeffectcloud = new AreaEffectCloud(this.level, this.getX(), this.getY(), this.getZ()); entityareaeffectcloud.setOwner(this); // CraftBukkit diff --git a/patches/server/0135-Item-canEntityPickup.patch b/patches/server/0135-Item-canEntityPickup.patch index 7602015cf8..f16e7c836b 100644 --- a/patches/server/0135-Item-canEntityPickup.patch +++ b/patches/server/0135-Item-canEntityPickup.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Item#canEntityPickup diff --git a/src/main/java/net/minecraft/world/entity/Mob.java b/src/main/java/net/minecraft/world/entity/Mob.java -index 7827e40e824de85ae1f6ea6fc82455b2cea532cb..932f54d8a6db9455d9fd947baad0de7850ccd563 100644 +index c09f1ac470c4055897f8d6c6201bd8dc421cdbfe..049a9c4547428d7306d82ed35bcd470ae6f3efc3 100644 --- a/src/main/java/net/minecraft/world/entity/Mob.java +++ b/src/main/java/net/minecraft/world/entity/Mob.java @@ -629,6 +629,11 @@ public abstract class Mob extends LivingEntity { diff --git a/patches/server/0138-Add-UnknownCommandEvent.patch b/patches/server/0138-Add-UnknownCommandEvent.patch index a9433ad336..f6dad1e352 100644 --- a/patches/server/0138-Add-UnknownCommandEvent.patch +++ b/patches/server/0138-Add-UnknownCommandEvent.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Add UnknownCommandEvent diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -index 565d3d16828dbd55ef3445d873398922671b16c2..9c522e7aa2f374543090cff7a49d06a7c15e450d 100644 +index a04f678289551208cfa42523ec6bf3d2e77e2fa4..19e5fade2c694664930e31c6b0acf82598db315b 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java @@ -881,7 +881,13 @@ public final class CraftServer implements Server { diff --git a/patches/server/0139-Basic-PlayerProfile-API.patch b/patches/server/0139-Basic-PlayerProfile-API.patch index eec24c882e..06d46bae87 100644 --- a/patches/server/0139-Basic-PlayerProfile-API.patch +++ b/patches/server/0139-Basic-PlayerProfile-API.patch @@ -7,13 +7,13 @@ Establishes base extension of profile systems for future edits too diff --git a/src/main/java/com/destroystokyo/paper/profile/CraftPlayerProfile.java b/src/main/java/com/destroystokyo/paper/profile/CraftPlayerProfile.java new file mode 100644 -index 0000000000000000000000000000000000000000..2041376dfd5520776f7e32c1828973f2b719d82a +index 0000000000000000000000000000000000000000..d945ea3484d0350096046d43112490b94e3b9bcd --- /dev/null +++ b/src/main/java/com/destroystokyo/paper/profile/CraftPlayerProfile.java @@ -0,0 +1,399 @@ +package com.destroystokyo.paper.profile; + -+import com.destroystokyo.paper.PaperConfig; ++import io.papermc.paper.configuration.GlobalConfiguration; +import com.google.common.base.Charsets; +import com.google.common.collect.Iterables; +import com.mojang.authlib.GameProfile; @@ -190,7 +190,7 @@ index 0000000000000000000000000000000000000000..2041376dfd5520776f7e32c1828973f2 + + @Override + public boolean completeFromCache() { -+ return completeFromCache(false, PaperConfig.isProxyOnlineMode()); ++ return completeFromCache(false, GlobalConfiguration.get().proxies.isProxyOnlineMode()); + } + + public boolean completeFromCache(boolean onlineMode) { @@ -233,7 +233,7 @@ index 0000000000000000000000000000000000000000..2041376dfd5520776f7e32c1828973f2 + } + + public boolean complete(boolean textures) { -+ return complete(textures, PaperConfig.isProxyOnlineMode()); ++ return complete(textures, GlobalConfiguration.get().proxies.isProxyOnlineMode()); + } + public boolean complete(boolean textures, boolean onlineMode) { + MinecraftServer server = MinecraftServer.getServer(); @@ -586,20 +586,20 @@ index 9f292deee1b793d52b5774304318e940128d1e26..0cf818fceddd76e7704fdc6625456787 * Calculates distance between 2 entities * @param e1 diff --git a/src/main/java/net/minecraft/server/Main.java b/src/main/java/net/minecraft/server/Main.java -index 97dc1d188a57b9f499c9cdc2ec54535af380e5cb..455a8d824540c66cf50b6440000b807bc1c71025 100644 +index a48a12a31a3d09a9373b688dcc093035f8f8a300..97b29bcb20e199c2d02457f8025e67e2d4a925fc 100644 --- a/src/main/java/net/minecraft/server/Main.java +++ b/src/main/java/net/minecraft/server/Main.java -@@ -139,7 +139,7 @@ public class Main { +@@ -138,7 +138,7 @@ public class Main { } File file = (File) optionset.valueOf("universe"); // CraftBukkit -- Services services = Services.create(new YggdrasilAuthenticationService(Proxy.NO_PROXY), file); -+ Services services = Services.create(new com.destroystokyo.paper.profile.PaperAuthenticationService(Proxy.NO_PROXY), file); // Paper +- Services services = Services.create(new YggdrasilAuthenticationService(Proxy.NO_PROXY), file, optionset); // Paper ++ Services services = Services.create(new com.destroystokyo.paper.profile.PaperAuthenticationService(Proxy.NO_PROXY), file, optionset); // Paper // CraftBukkit start String s = (String) Optional.ofNullable((String) optionset.valueOf("world")).orElse(dedicatedserversettings.getProperties().levelName); LevelStorageSource convertable = LevelStorageSource.createDefault(file.toPath()); diff --git a/src/main/java/net/minecraft/server/players/GameProfileCache.java b/src/main/java/net/minecraft/server/players/GameProfileCache.java -index 6087fff889458dc09d5a3eb52e7d4b0a77bde809..ddd78b2836c1f4a6b4fcd532153f5d3e17f91ea8 100644 +index 40ddeaea58263820c32a4e901a2e907088eb7b6e..ce3ed1572641599055edf654f20b2a5ecac952dc 100644 --- a/src/main/java/net/minecraft/server/players/GameProfileCache.java +++ b/src/main/java/net/minecraft/server/players/GameProfileCache.java @@ -135,6 +135,17 @@ public class GameProfileCache { @@ -621,7 +621,7 @@ index 6087fff889458dc09d5a3eb52e7d4b0a77bde809..ddd78b2836c1f4a6b4fcd532153f5d3e String s1 = name.toLowerCase(Locale.ROOT); GameProfileCache.GameProfileInfo usercache_usercacheentry = (GameProfileCache.GameProfileInfo) this.profilesByName.get(s1); diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -index 9c522e7aa2f374543090cff7a49d06a7c15e450d..fbe26f8a592ed0a3b970b6f02126b6e3e454d8af 100644 +index 19e5fade2c694664930e31c6b0acf82598db315b..eed64dedb3430bd01c53c230c280a7c475fdbfd5 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java @@ -239,6 +239,9 @@ import org.yaml.snakeyaml.error.MarkedYAMLException; @@ -642,9 +642,9 @@ index 9c522e7aa2f374543090cff7a49d06a7c15e450d..fbe26f8a592ed0a3b970b6f02126b6e3 CraftItemFactory.instance(); } -@@ -2563,5 +2567,37 @@ public final class CraftServer implements Server { +@@ -2560,5 +2564,37 @@ public final class CraftServer implements Server { public boolean suggestPlayerNamesWhenNullTabCompletions() { - return com.destroystokyo.paper.PaperConfig.suggestPlayersWhenNullTabCompletions; + return io.papermc.paper.configuration.GlobalConfiguration.get().commands.suggestPlayerNamesWhenNullTabCompletions; } + + @Override diff --git a/patches/server/0140-Shoulder-Entities-Release-API.patch b/patches/server/0140-Shoulder-Entities-Release-API.patch index 996536a930..62e01adf58 100644 --- a/patches/server/0140-Shoulder-Entities-Release-API.patch +++ b/patches/server/0140-Shoulder-Entities-Release-API.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Shoulder Entities Release API diff --git a/src/main/java/net/minecraft/world/entity/player/Player.java b/src/main/java/net/minecraft/world/entity/player/Player.java -index 0df33131bae2b6651eff4b5b34b3714625562b69..6e34a16ab02e733130a897bc9f8f2c1ffb090b46 100644 +index 9aa134e56d661d033bb7229e6ab662534bf9cba9..794081610e52b7b8e04403510d1ad05f4f11d320 100644 --- a/src/main/java/net/minecraft/world/entity/player/Player.java +++ b/src/main/java/net/minecraft/world/entity/player/Player.java @@ -2026,20 +2026,44 @@ public abstract class Player extends LivingEntity { diff --git a/patches/server/0143-Entity-fromMobSpawner.patch b/patches/server/0143-Entity-fromMobSpawner.patch index 94eef77ea1..a23ec80854 100644 --- a/patches/server/0143-Entity-fromMobSpawner.patch +++ b/patches/server/0143-Entity-fromMobSpawner.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Entity#fromMobSpawner() diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java -index 1e9589e08149bbbbe581ecb68d9f590d16ed897a..66a5a84098913b9bf6456e52df103332dcb147bb 100644 +index bfc7736bfe538b615343b6f41f2a670493e2c701..22c9fcb8b0a75e59fc6838b9f33430b6c476cdc1 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java @@ -374,6 +374,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource { @@ -16,7 +16,7 @@ index 1e9589e08149bbbbe581ecb68d9f590d16ed897a..66a5a84098913b9bf6456e52df103332 @javax.annotation.Nullable private org.bukkit.util.Vector origin; @javax.annotation.Nullable -@@ -1954,6 +1955,10 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource { +@@ -1953,6 +1954,10 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource { } nbt.put("Paper.Origin", this.newDoubleList(origin.getX(), origin.getY(), origin.getZ())); } @@ -27,7 +27,7 @@ index 1e9589e08149bbbbe581ecb68d9f590d16ed897a..66a5a84098913b9bf6456e52df103332 // Paper end return nbt; } catch (Throwable throwable) { -@@ -2091,6 +2096,8 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource { +@@ -2090,6 +2095,8 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource { this.originWorld = originWorld; origin = new org.bukkit.util.Vector(originTag.getDouble(0), originTag.getDouble(1), originTag.getDouble(2)); } @@ -37,7 +37,7 @@ index 1e9589e08149bbbbe581ecb68d9f590d16ed897a..66a5a84098913b9bf6456e52df103332 } catch (Throwable throwable) { diff --git a/src/main/java/net/minecraft/world/level/BaseSpawner.java b/src/main/java/net/minecraft/world/level/BaseSpawner.java -index 5bc0071c5309548219cbcd902d7020ff4a5ca6b7..54701d5cd45c119884f8e55f074792fb846687a7 100644 +index e5b56a85d76d1417dda2d14b1b03850bbb070f4c..5304b0455b070006922e1b5471e9c0ababc58aa2 100644 --- a/src/main/java/net/minecraft/world/level/BaseSpawner.java +++ b/src/main/java/net/minecraft/world/level/BaseSpawner.java @@ -159,6 +159,7 @@ public abstract class BaseSpawner { diff --git a/patches/server/0147-ProfileWhitelistVerifyEvent.patch b/patches/server/0147-ProfileWhitelistVerifyEvent.patch index 85f15ac288..6a1584c243 100644 --- a/patches/server/0147-ProfileWhitelistVerifyEvent.patch +++ b/patches/server/0147-ProfileWhitelistVerifyEvent.patch @@ -5,7 +5,7 @@ Subject: [PATCH] ProfileWhitelistVerifyEvent diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java -index 41924db9df7d3d9df0385d3274894ef8058cf2c6..fe1636a73f1af09314a200b99c196984d09a4b4a 100644 +index 9cb9e0a4d1467cb5c23dfd38e83d495a3907d984..4a94be565a3a7f7b8b330a35d97a14ef52ac4e50 100644 --- a/src/main/java/net/minecraft/server/players/PlayerList.java +++ b/src/main/java/net/minecraft/server/players/PlayerList.java @@ -619,9 +619,9 @@ public abstract class PlayerList { diff --git a/patches/server/0151-Reset-spawner-timer-when-spawner-event-is-cancelled.patch b/patches/server/0151-Reset-spawner-timer-when-spawner-event-is-cancelled.patch index fc8b20dc31..c47d4472ba 100644 --- a/patches/server/0151-Reset-spawner-timer-when-spawner-event-is-cancelled.patch +++ b/patches/server/0151-Reset-spawner-timer-when-spawner-event-is-cancelled.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Reset spawner timer when spawner event is cancelled diff --git a/src/main/java/net/minecraft/world/level/BaseSpawner.java b/src/main/java/net/minecraft/world/level/BaseSpawner.java -index 54701d5cd45c119884f8e55f074792fb846687a7..c104ea31c63fab8f23b4db71ba6e664f710e0bee 100644 +index 5304b0455b070006922e1b5471e9c0ababc58aa2..ac767d107ea0d856f3f8caccfe6f79b14e933005 100644 --- a/src/main/java/net/minecraft/world/level/BaseSpawner.java +++ b/src/main/java/net/minecraft/world/level/BaseSpawner.java @@ -160,6 +160,7 @@ public abstract class BaseSpawner { diff --git a/patches/server/0152-Allow-specifying-a-custom-authentication-servers-dow.patch b/patches/server/0152-Allow-specifying-a-custom-authentication-servers-dow.patch index 938d1cd9aa..fa71afd81d 100644 --- a/patches/server/0152-Allow-specifying-a-custom-authentication-servers-dow.patch +++ b/patches/server/0152-Allow-specifying-a-custom-authentication-servers-dow.patch @@ -5,29 +5,8 @@ Subject: [PATCH] Allow specifying a custom "authentication servers down" kick message -diff --git a/src/main/java/com/destroystokyo/paper/PaperConfig.java b/src/main/java/com/destroystokyo/paper/PaperConfig.java -index 2a4aacd2461401a109d749eee262813367fe4a70..a8de81b1a153525b2d0d6b01802b7733947527a2 100644 ---- a/src/main/java/com/destroystokyo/paper/PaperConfig.java -+++ b/src/main/java/com/destroystokyo/paper/PaperConfig.java -@@ -1,5 +1,6 @@ - package com.destroystokyo.paper; - -+import com.google.common.base.Strings; - import com.google.common.base.Throwables; - - import java.io.File; -@@ -285,4 +286,9 @@ public class PaperConfig { - private static void suggestPlayersWhenNull() { - suggestPlayersWhenNullTabCompletions = getBoolean("settings.suggest-player-names-when-null-tab-completions", suggestPlayersWhenNullTabCompletions); - } -+ -+ public static String authenticationServersDownKickMessage = ""; // empty = use translatable message -+ private static void authenticationServersDownKickMessage() { -+ authenticationServersDownKickMessage = Strings.emptyToNull(getString("messages.kick.authentication-servers-down", authenticationServersDownKickMessage)); -+ } - } diff --git a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java -index dc932515bada7f84a386827f3b7e1e8f69bd7159..6d015b226ea32f9d658ca9674b9500494c837949 100644 +index dc932515bada7f84a386827f3b7e1e8f69bd7159..9fe3ec7e6bd194b825a1b29bcff9fcd5e21f22ad 100644 --- a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java @@ -358,6 +358,10 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener @@ -35,8 +14,8 @@ index dc932515bada7f84a386827f3b7e1e8f69bd7159..6d015b226ea32f9d658ca9674b950049 ServerLoginPacketListenerImpl.this.state = ServerLoginPacketListenerImpl.State.READY_TO_ACCEPT; } else { + // Paper start -+ if (com.destroystokyo.paper.PaperConfig.authenticationServersDownKickMessage != null) { -+ ServerLoginPacketListenerImpl.this.disconnect(Component.literal(com.destroystokyo.paper.PaperConfig.authenticationServersDownKickMessage)); ++ if (!io.papermc.paper.configuration.GlobalConfiguration.get().messages.kick.authenticationServersDown.isEmpty()) { ++ ServerLoginPacketListenerImpl.this.disconnect(Component.literal(io.papermc.paper.configuration.GlobalConfiguration.get().messages.kick.authenticationServersDown)); + } else // Paper end ServerLoginPacketListenerImpl.this.disconnect(Component.translatable("multiplayer.disconnect.authservers_down")); ServerLoginPacketListenerImpl.LOGGER.error("Couldn't verify username because servers are unavailable"); diff --git a/patches/server/0153-Handle-plugin-prefixes-using-Log4J-configuration.patch b/patches/server/0153-Handle-plugin-prefixes-using-Log4J-configuration.patch index cc25afd1d5..8eb8888110 100644 --- a/patches/server/0153-Handle-plugin-prefixes-using-Log4J-configuration.patch +++ b/patches/server/0153-Handle-plugin-prefixes-using-Log4J-configuration.patch @@ -15,7 +15,7 @@ This may cause additional prefixes to be disabled for plugins bypassing the plugin logger. diff --git a/build.gradle.kts b/build.gradle.kts -index 0b5628ddf2332d12fc3d44bb32323a513c7240f2..e1cc5d05d9826ce897e5c2f71ddfe4811c010c38 100644 +index a8bc19403fc82ef03e43afe8ddf5fa78890e8dda..22038142efe960acebba84a4cc81f5ce7eaa0512 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -17,7 +17,7 @@ dependencies { @@ -28,7 +28,7 @@ index 0b5628ddf2332d12fc3d44bb32323a513c7240f2..e1cc5d05d9826ce897e5c2f71ddfe481 implementation("org.apache.logging.log4j:log4j-iostreams:2.17.1") // Paper implementation("org.ow2.asm:asm:9.3") diff --git a/src/main/java/org/spigotmc/SpigotConfig.java b/src/main/java/org/spigotmc/SpigotConfig.java -index 9d3d65de7cb0be25aa7fc40353390280943b55f4..cd5add5a38919dfcf7510758b2d3e2f7c40c18fd 100644 +index a4ec0d7791deed7cb64d4a35e19ceb3d9d798221..2e684d28948d23a310b5d5029903a871e6f9b1ca 100644 --- a/src/main/java/org/spigotmc/SpigotConfig.java +++ b/src/main/java/org/spigotmc/SpigotConfig.java @@ -290,7 +290,7 @@ public class SpigotConfig diff --git a/patches/server/0155-Add-PlayerJumpEvent.patch b/patches/server/0155-Add-PlayerJumpEvent.patch index f7358f8c53..0368a0a50b 100644 --- a/patches/server/0155-Add-PlayerJumpEvent.patch +++ b/patches/server/0155-Add-PlayerJumpEvent.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Add PlayerJumpEvent diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index b50ca694f827b60ab6ae4b91772774b6fef55734..03ddcbaedc8282cc8964014692dd90c87912e46f 100644 +index 95b0c01d1eaf58ba8c93c896891dcfb1075d57da..0ee7a16e0595118d0135cafbc2c96b17b9cf9c70 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java @@ -1216,7 +1216,34 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser diff --git a/patches/server/0156-handle-PacketPlayInKeepAlive-async.patch b/patches/server/0156-handle-PacketPlayInKeepAlive-async.patch index 94dc5a55ed..2949057c4d 100644 --- a/patches/server/0156-handle-PacketPlayInKeepAlive-async.patch +++ b/patches/server/0156-handle-PacketPlayInKeepAlive-async.patch @@ -15,7 +15,7 @@ also adding some additional logging in order to help work out what is causing random disconnections for clients. diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index 03ddcbaedc8282cc8964014692dd90c87912e46f..8665bbd6e81d55711f82419c3e3edc9357a839f9 100644 +index 0ee7a16e0595118d0135cafbc2c96b17b9cf9c70..8e233f88d5bbd223c8d3dfc88d79eb03c17aa204 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java @@ -2995,14 +2995,18 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser diff --git a/patches/server/0157-Expose-client-protocol-version-and-virtual-host.patch b/patches/server/0157-Expose-client-protocol-version-and-virtual-host.patch index 5fda23d3e2..5e405644f5 100644 --- a/patches/server/0157-Expose-client-protocol-version-and-virtual-host.patch +++ b/patches/server/0157-Expose-client-protocol-version-and-virtual-host.patch @@ -90,7 +90,7 @@ index 9016aced079108aeae09f030a672467a953ef93f..4170bda451df3db43e7d57d87d1abb81 @Override diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -index 2f193f96eb5633fe1d06ec0d76fcbfc5b0ff5c7b..539b04ada489df2150b40f6d1b3c99fbaee32368 100644 +index 0b693866af8e0d8de275e87ca1232a03a6a35abe..7233d075b9c12c4beee872c204a4524c942f183d 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java @@ -218,6 +218,20 @@ public class CraftPlayer extends CraftHumanEntity implements Player { diff --git a/patches/server/0158-revert-serverside-behavior-of-keepalives.patch b/patches/server/0158-revert-serverside-behavior-of-keepalives.patch index 26d8634cb6..42d1452fbb 100644 --- a/patches/server/0158-revert-serverside-behavior-of-keepalives.patch +++ b/patches/server/0158-revert-serverside-behavior-of-keepalives.patch @@ -17,7 +17,7 @@ from networking or during connections flood of chunk packets on slower clients, at the cost of dead connections being kept open for longer. diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index 8665bbd6e81d55711f82419c3e3edc9357a839f9..fb681f9607f2b17a5edafc60c40342532e33021c 100644 +index 8e233f88d5bbd223c8d3dfc88d79eb03c17aa204..35b973dbf30ea14dbb94d10cc16ebb4b86d24a99 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java @@ -239,7 +239,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser diff --git a/patches/server/0159-Send-attack-SoundEffects-only-to-players-who-can-see.patch b/patches/server/0159-Send-attack-SoundEffects-only-to-players-who-can-see.patch index 8f90260342..c8919be744 100644 --- a/patches/server/0159-Send-attack-SoundEffects-only-to-players-who-can-see.patch +++ b/patches/server/0159-Send-attack-SoundEffects-only-to-players-who-can-see.patch @@ -6,7 +6,7 @@ Subject: [PATCH] Send attack SoundEffects only to players who can see the diff --git a/src/main/java/net/minecraft/world/entity/player/Player.java b/src/main/java/net/minecraft/world/entity/player/Player.java -index 6e34a16ab02e733130a897bc9f8f2c1ffb090b46..c3c95d825af9e8f84d62a469189535f015d228a4 100644 +index 794081610e52b7b8e04403510d1ad05f4f11d320..98d776dc6970c5412cfe54538228c6fda2b0d02e 100644 --- a/src/main/java/net/minecraft/world/entity/player/Player.java +++ b/src/main/java/net/minecraft/world/entity/player/Player.java @@ -1245,7 +1245,7 @@ public abstract class Player extends LivingEntity { diff --git a/patches/server/0160-Add-PlayerArmorChangeEvent.patch b/patches/server/0160-Add-PlayerArmorChangeEvent.patch index 0e0a79eff4..0747a7d626 100644 --- a/patches/server/0160-Add-PlayerArmorChangeEvent.patch +++ b/patches/server/0160-Add-PlayerArmorChangeEvent.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Add PlayerArmorChangeEvent diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java -index 2eed84529ad9a34ae88c4f37f2b0c7943f51b0ad..fc63d202e8cc28d5664c0f5749b195e3c1220cc9 100644 +index 7c50e9c28f9f26b42d2baa51d8fa735bb182ffa5..27a2ba075a2f7575b6788c66a121fc906b19a99d 100644 --- a/src/main/java/net/minecraft/world/entity/LivingEntity.java +++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java @@ -1,5 +1,6 @@ diff --git a/patches/server/0161-Prevent-logins-from-being-processed-when-the-player-.patch b/patches/server/0161-Prevent-logins-from-being-processed-when-the-player-.patch index c4b3096471..31dd1f90ec 100644 --- a/patches/server/0161-Prevent-logins-from-being-processed-when-the-player-.patch +++ b/patches/server/0161-Prevent-logins-from-being-processed-when-the-player-.patch @@ -6,7 +6,7 @@ Subject: [PATCH] Prevent logins from being processed when the player has diff --git a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java -index 6d015b226ea32f9d658ca9674b9500494c837949..c927fc378254812ca630b2d1c48d6b378dee5ef0 100644 +index 9fe3ec7e6bd194b825a1b29bcff9fcd5e21f22ad..5bf48f4fb0794a1eaea3783add9e5852997434f6 100644 --- a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java @@ -86,7 +86,11 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener diff --git a/patches/server/0162-Fix-MC-117075-TE-Unload-Lag-Spike.patch b/patches/server/0162-Fix-MC-117075-TE-Unload-Lag-Spike.patch index 3ebc012323..cc8e752db2 100644 --- a/patches/server/0162-Fix-MC-117075-TE-Unload-Lag-Spike.patch +++ b/patches/server/0162-Fix-MC-117075-TE-Unload-Lag-Spike.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Fix MC-117075: TE Unload Lag Spike diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java -index 4aea5e937e2e0e272e5aeb4e6b9ed750064f3828..fc7d5f89b0ad56ab30d32b8ff2a301a55ad768dc 100644 +index 5577a560d41a2467bd713f2fa7511c83a73c2f2d..e6b9b19cde9c3576745a10e0a12317fc99577ae8 100644 --- a/src/main/java/net/minecraft/world/level/Level.java +++ b/src/main/java/net/minecraft/world/level/Level.java -@@ -687,6 +687,8 @@ public abstract class Level implements LevelAccessor, AutoCloseable { +@@ -691,6 +691,8 @@ public abstract class Level implements LevelAccessor, AutoCloseable { // Spigot start // Iterator iterator = this.blockEntityTickers.iterator(); int tilesThisCycle = 0; @@ -17,7 +17,7 @@ index 4aea5e937e2e0e272e5aeb4e6b9ed750064f3828..fc7d5f89b0ad56ab30d32b8ff2a301a5 for (tileTickPosition = 0; tileTickPosition < this.blockEntityTickers.size(); tileTickPosition++) { // Paper - Disable tick limiters this.tileTickPosition = (this.tileTickPosition < this.blockEntityTickers.size()) ? this.tileTickPosition : 0; TickingBlockEntity tickingblockentity = (TickingBlockEntity) this.blockEntityTickers.get(tileTickPosition); -@@ -694,7 +696,6 @@ public abstract class Level implements LevelAccessor, AutoCloseable { +@@ -698,7 +700,6 @@ public abstract class Level implements LevelAccessor, AutoCloseable { if (tickingblockentity == null) { this.getCraftServer().getLogger().severe("Spigot has detected a null entity and has removed it, preventing a crash"); tilesThisCycle--; @@ -25,7 +25,7 @@ index 4aea5e937e2e0e272e5aeb4e6b9ed750064f3828..fc7d5f89b0ad56ab30d32b8ff2a301a5 continue; } // Spigot end -@@ -702,12 +703,13 @@ public abstract class Level implements LevelAccessor, AutoCloseable { +@@ -706,12 +707,13 @@ public abstract class Level implements LevelAccessor, AutoCloseable { if (tickingblockentity.isRemoved()) { // Spigot start tilesThisCycle--; diff --git a/patches/server/0163-use-CB-BlockState-implementations-for-captured-block.patch b/patches/server/0163-use-CB-BlockState-implementations-for-captured-block.patch index 5155fc0f8c..73c67e8c1a 100644 --- a/patches/server/0163-use-CB-BlockState-implementations-for-captured-block.patch +++ b/patches/server/0163-use-CB-BlockState-implementations-for-captured-block.patch @@ -18,7 +18,7 @@ the blockstate that will be valid for restoration, as opposed to dropping information on restoration when the event is cancelled. diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java -index fc7d5f89b0ad56ab30d32b8ff2a301a55ad768dc..1569c9249804de05b2650463f32a94d599ffd427 100644 +index e6b9b19cde9c3576745a10e0a12317fc99577ae8..ad0f91d57b5cbf0c4439993ad99ec7a484729a2e 100644 --- a/src/main/java/net/minecraft/world/level/Level.java +++ b/src/main/java/net/minecraft/world/level/Level.java @@ -148,7 +148,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable { @@ -30,7 +30,7 @@ index fc7d5f89b0ad56ab30d32b8ff2a301a55ad768dc..1569c9249804de05b2650463f32a94d5 public Map capturedTileEntities = new HashMap<>(); public List captureDrops; public final it.unimi.dsi.fastutil.objects.Object2LongOpenHashMap ticksPerSpawnCategory = new it.unimi.dsi.fastutil.objects.Object2LongOpenHashMap<>(); -@@ -372,7 +372,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable { +@@ -376,7 +376,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable { public boolean setBlock(BlockPos pos, BlockState state, int flags, int maxUpdateDepth) { // CraftBukkit start - tree generation if (this.captureTreeGeneration) { @@ -39,7 +39,7 @@ index fc7d5f89b0ad56ab30d32b8ff2a301a55ad768dc..1569c9249804de05b2650463f32a94d5 if (blockstate == null) { blockstate = CapturedBlockState.getTreeBlockState(this, pos, flags); this.capturedBlockStates.put(pos.immutable(), blockstate); -@@ -392,7 +392,8 @@ public abstract class Level implements LevelAccessor, AutoCloseable { +@@ -396,7 +396,8 @@ public abstract class Level implements LevelAccessor, AutoCloseable { // CraftBukkit start - capture blockstates boolean captured = false; if (this.captureBlockStates && !this.capturedBlockStates.containsKey(pos)) { @@ -49,7 +49,7 @@ index fc7d5f89b0ad56ab30d32b8ff2a301a55ad768dc..1569c9249804de05b2650463f32a94d5 this.capturedBlockStates.put(pos.immutable(), blockstate); captured = true; } -@@ -599,7 +600,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable { +@@ -603,7 +604,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable { public BlockState getBlockState(BlockPos pos) { // CraftBukkit start - tree generation if (this.captureTreeGeneration) { diff --git a/patches/server/0165-AsyncTabCompleteEvent.patch b/patches/server/0165-AsyncTabCompleteEvent.patch index f32e64cd5b..ae2024c586 100644 --- a/patches/server/0165-AsyncTabCompleteEvent.patch +++ b/patches/server/0165-AsyncTabCompleteEvent.patch @@ -14,7 +14,7 @@ completion, such as offline players. Also adds isCommand and getLocation to the sync TabCompleteEvent diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index fb681f9607f2b17a5edafc60c40342532e33021c..9e7a3a58bf944e612fa4c3bcb3b87efe5eb21c5b 100644 +index 35b973dbf30ea14dbb94d10cc16ebb4b86d24a99..81ac95b9a174b25d47515fbd84c03d22c905454e 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java @@ -740,10 +740,10 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser @@ -72,10 +72,10 @@ index fb681f9607f2b17a5edafc60c40342532e33021c..9e7a3a58bf944e612fa4c3bcb3b87efe @Override diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -index fbe26f8a592ed0a3b970b6f02126b6e3e454d8af..5d62881b974081d7207773580697c5d6ccdc8880 100644 +index eed64dedb3430bd01c53c230c280a7c475fdbfd5..3f84c3579b1b37f98120d20bae008a1030b93adf 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -@@ -2061,7 +2061,7 @@ public final class CraftServer implements Server { +@@ -2060,7 +2060,7 @@ public final class CraftServer implements Server { offers = this.tabCompleteChat(player, message); } diff --git a/patches/server/0167-Ability-to-apply-mending-to-XP-API.patch b/patches/server/0167-Ability-to-apply-mending-to-XP-API.patch index 55f132e9d7..3e9d938d70 100644 --- a/patches/server/0167-Ability-to-apply-mending-to-XP-API.patch +++ b/patches/server/0167-Ability-to-apply-mending-to-XP-API.patch @@ -10,7 +10,7 @@ of giving the player experience points. Both an API To standalone mend, and apply mending logic to .giveExp has been added. diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -index 539b04ada489df2150b40f6d1b3c99fbaee32368..b87be952c65e92c99bbb4ca961519ba20ebb4155 100644 +index 7233d075b9c12c4beee872c204a4524c942f183d..e6ca45329c5f102ebf4abc729837108cad63a59f 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java @@ -1346,7 +1346,37 @@ public class CraftPlayer extends CraftHumanEntity implements Player { diff --git a/patches/server/0168-PlayerNaturallySpawnCreaturesEvent.patch b/patches/server/0168-PlayerNaturallySpawnCreaturesEvent.patch index 9b6e6139c7..e18da73314 100644 --- a/patches/server/0168-PlayerNaturallySpawnCreaturesEvent.patch +++ b/patches/server/0168-PlayerNaturallySpawnCreaturesEvent.patch @@ -40,7 +40,7 @@ index 943cad9a08d72b90b92f92ef90588501bbf158d5..f9ef45635b731cafc9b6879603cac34c return true; diff --git a/src/main/java/net/minecraft/server/level/ServerChunkCache.java b/src/main/java/net/minecraft/server/level/ServerChunkCache.java -index 63e11397d6efb293b140c4c4bca91e49464e8ea6..f4174e4b7c296407cb1b18af77ae855978ec1b6a 100644 +index 86acdd910eebb8beac4536942119c9e97580ff2e..a81644df294c739b72fc638cd06a3976250caa50 100644 --- a/src/main/java/net/minecraft/server/level/ServerChunkCache.java +++ b/src/main/java/net/minecraft/server/level/ServerChunkCache.java @@ -819,6 +819,15 @@ public class ServerChunkCache extends ChunkSource { @@ -60,7 +60,7 @@ index 63e11397d6efb293b140c4c4bca91e49464e8ea6..f4174e4b7c296407cb1b18af77ae8559 while (iterator1.hasNext()) { diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java -index bd6e22b849d6328b2fcc0244cc83a79d9ffb08c8..23bf128cb5b7598a9d4c145b14f8fe692660be0d 100644 +index 4b65dc12dc97e72b221d9fd15202a1a0622ef806..05b9595d4d308e5b4a551d26f3defbfa1d829ea9 100644 --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java @@ -1,5 +1,6 @@ diff --git a/patches/server/0170-PreCreatureSpawnEvent.patch b/patches/server/0170-PreCreatureSpawnEvent.patch index 48aecbc866..82fc009561 100644 --- a/patches/server/0170-PreCreatureSpawnEvent.patch +++ b/patches/server/0170-PreCreatureSpawnEvent.patch @@ -59,7 +59,7 @@ index f4d1a3e861a8727d7f3efd75c0e83cc9418fa9bd..4f2952cb39be3644e81ae627b748b791 if (t0 != null) { diff --git a/src/main/java/net/minecraft/world/entity/EntityType.java b/src/main/java/net/minecraft/world/entity/EntityType.java -index 0c7c8b8671738d9ec408f5dc7f2950a9991858b8..3ee0d583bb6e07570071562a083462c8d67e8a1d 100644 +index 2db27f5e3e3c1bb0502c055f78c4a81eb00fcf1b..4b8024f8f62caaa417de6798522c2beb98e00fc4 100644 --- a/src/main/java/net/minecraft/world/entity/EntityType.java +++ b/src/main/java/net/minecraft/world/entity/EntityType.java @@ -347,6 +347,20 @@ public class EntityType implements EntityTypeTest { @@ -97,7 +97,7 @@ index 25cd8a4101cf44955d95924c9794c238ddde2901..f957c0aca36b7228ac3a33ca04c948b1 } } diff --git a/src/main/java/net/minecraft/world/level/BaseSpawner.java b/src/main/java/net/minecraft/world/level/BaseSpawner.java -index c104ea31c63fab8f23b4db71ba6e664f710e0bee..031bb42a1921966e8dd45c9e57dcd09f2dece7fb 100644 +index ac767d107ea0d856f3f8caccfe6f79b14e933005..ffb7a0b7c1ae53e1340f2cdb7840ee2c89982dbe 100644 --- a/src/main/java/net/minecraft/world/level/BaseSpawner.java +++ b/src/main/java/net/minecraft/world/level/BaseSpawner.java @@ -124,6 +124,27 @@ public abstract class BaseSpawner { diff --git a/patches/server/0176-Toggleable-player-crits-helps-mitigate-hacked-client.patch b/patches/server/0176-Toggleable-player-crits-helps-mitigate-hacked-client.patch index 6884d18bf8..8ec53f2390 100644 --- a/patches/server/0176-Toggleable-player-crits-helps-mitigate-hacked-client.patch +++ b/patches/server/0176-Toggleable-player-crits-helps-mitigate-hacked-client.patch @@ -4,31 +4,15 @@ Date: Sat, 10 Mar 2018 00:50:24 +0100 Subject: [PATCH] Toggleable player crits, helps mitigate hacked clients. -diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -index 99ce64e4d01b58d887506841451e561c2796c413..665b7f4cddfef1631ba2fad6eebeb19392cf8759 100644 ---- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -@@ -253,6 +253,11 @@ public class PaperWorldConfig { - disableChestCatDetection = getBoolean("game-mechanics.disable-chest-cat-detection", false); - } - -+ public boolean disablePlayerCrits; -+ private void disablePlayerCrits() { -+ disablePlayerCrits = getBoolean("game-mechanics.disable-player-crits", false); -+ } -+ - public boolean allChunksAreSlimeChunks; - private void allChunksAreSlimeChunks() { - allChunksAreSlimeChunks = getBoolean("all-chunks-are-slime-chunks", false); diff --git a/src/main/java/net/minecraft/world/entity/player/Player.java b/src/main/java/net/minecraft/world/entity/player/Player.java -index c3c95d825af9e8f84d62a469189535f015d228a4..863f805dfce2ffcde9d724012895c5f5cda0229f 100644 +index 98d776dc6970c5412cfe54538228c6fda2b0d02e..417a76fed2217d33ed3c0b0febf254b6405404b1 100644 --- a/src/main/java/net/minecraft/world/entity/player/Player.java +++ b/src/main/java/net/minecraft/world/entity/player/Player.java @@ -1252,6 +1252,7 @@ public abstract class Player extends LivingEntity { boolean flag2 = flag && this.fallDistance > 0.0F && !this.onGround && !this.onClimbable() && !this.isInWater() && !this.hasEffect(MobEffects.BLINDNESS) && !this.isPassenger() && target instanceof LivingEntity; -+ flag2 = flag2 && !level.paperConfig.disablePlayerCrits; // Paper ++ flag2 = flag2 && !level.paperConfig().entities.behavior.disablePlayerCrits; // Paper flag2 = flag2 && !this.isSprinting(); if (flag2) { f *= 1.5F; diff --git a/patches/server/0178-Implement-extended-PaperServerListPingEvent.patch b/patches/server/0178-Implement-extended-PaperServerListPingEvent.patch index 83f07f24fa..a6af82c65c 100644 --- a/patches/server/0178-Implement-extended-PaperServerListPingEvent.patch +++ b/patches/server/0178-Implement-extended-PaperServerListPingEvent.patch @@ -190,7 +190,7 @@ index 67455a5ba75c9b816213e44d6872c5ddf8e27e98..23efad80934930beadf15e65781551d4 public ClientboundStatusResponsePacket(ServerStatus metadata) { diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index 64a6f488be70dafc09c8d713aa4d9edd4a70177a..b031d4340dbee22108f8cbc15729337c50160a29 100644 +index 2cdde6eaf2221bb634fd0d34db849c0a6833cfbd..94201e91ee67c00fb9d5af0c6db9d96999164c06 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java @@ -2,6 +2,9 @@ package net.minecraft.server; @@ -236,7 +236,7 @@ index 5d368e34c90fc5191d9ed2352f7aa44c4a299eed..d21549bb272e4848c5ce7c29862f0303 } diff --git a/src/main/java/org/spigotmc/SpigotConfig.java b/src/main/java/org/spigotmc/SpigotConfig.java -index cd5add5a38919dfcf7510758b2d3e2f7c40c18fd..b53e6955f35e1308814cdb31a5fa5f4d0c49493c 100644 +index 2e684d28948d23a310b5d5029903a871e6f9b1ca..f4aa98ed573ffa25659ed19a8a391e04bf2bd8b2 100644 --- a/src/main/java/org/spigotmc/SpigotConfig.java +++ b/src/main/java/org/spigotmc/SpigotConfig.java @@ -289,7 +289,7 @@ public class SpigotConfig diff --git a/patches/server/0179-Ability-to-change-PlayerProfile-in-AsyncPreLoginEven.patch b/patches/server/0179-Ability-to-change-PlayerProfile-in-AsyncPreLoginEven.patch index a0d1b5b3de..0827a42249 100644 --- a/patches/server/0179-Ability-to-change-PlayerProfile-in-AsyncPreLoginEven.patch +++ b/patches/server/0179-Ability-to-change-PlayerProfile-in-AsyncPreLoginEven.patch @@ -6,7 +6,7 @@ Subject: [PATCH] Ability to change PlayerProfile in AsyncPreLoginEvent This will allow you to change the players name or skin on login. diff --git a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java -index c927fc378254812ca630b2d1c48d6b378dee5ef0..5c73ee9b2d3328c9174db067ce674401d7ff5dc9 100644 +index 5bf48f4fb0794a1eaea3783add9e5852997434f6..27a90187a615734fb86d0325dae0c7af2768375a 100644 --- a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java @@ -397,8 +397,16 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener diff --git a/patches/server/0180-Player.setPlayerProfile-API.patch b/patches/server/0180-Player.setPlayerProfile-API.patch index a304d1ecfb..6895da16b4 100644 --- a/patches/server/0180-Player.setPlayerProfile-API.patch +++ b/patches/server/0180-Player.setPlayerProfile-API.patch @@ -6,7 +6,7 @@ Subject: [PATCH] Player.setPlayerProfile API This can be useful for changing name or skins after a player has logged in. diff --git a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java -index 5c73ee9b2d3328c9174db067ce674401d7ff5dc9..136ff7de4ffb91d3fc84a90560a2f5db84703cff 100644 +index 27a90187a615734fb86d0325dae0c7af2768375a..e27ce986dab7b249f8a69e1d94cfbd91bab5c4b9 100644 --- a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java @@ -398,11 +398,11 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener @@ -24,7 +24,7 @@ index 5c73ee9b2d3328c9174db067ce674401d7ff5dc9..136ff7de4ffb91d3fc84a90560a2f5db playerName = gameProfile.getName(); uniqueId = gameProfile.getId(); diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -index b87be952c65e92c99bbb4ca961519ba20ebb4155..09cde5fc320be42f2bd1e9f3aa7c1c70eabf2923 100644 +index e6ca45329c5f102ebf4abc729837108cad63a59f..380bdc7cfa8980d5db29a15b29613fc62d75de2a 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java @@ -75,6 +75,7 @@ import net.minecraft.world.entity.ai.attributes.Attributes; diff --git a/patches/server/0181-getPlayerUniqueId-API.patch b/patches/server/0181-getPlayerUniqueId-API.patch index 97de22fb6d..5d4c1a2f50 100644 --- a/patches/server/0181-getPlayerUniqueId-API.patch +++ b/patches/server/0181-getPlayerUniqueId-API.patch @@ -9,10 +9,10 @@ In Offline Mode, will return an Offline UUID This is a more performant way to obtain a UUID for a name than loading an OfflinePlayer diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -index 2a171e67ce018d44c0739e6ee7ae51709daceb21..6681c07f5f59124299263d990cfe7bdf202aef87 100644 +index 3f84c3579b1b37f98120d20bae008a1030b93adf..8ede5166c3764f75c27e170ef40b89a103389073 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -@@ -1688,6 +1688,25 @@ public final class CraftServer implements Server { +@@ -1687,6 +1687,25 @@ public final class CraftServer implements Server { return recipients.size(); } @@ -25,7 +25,7 @@ index 2a171e67ce018d44c0739e6ee7ae51709daceb21..6681c07f5f59124299263d990cfe7bdf + } + GameProfile profile; + // Only fetch an online UUID in online mode -+ if (com.destroystokyo.paper.PaperConfig.isProxyOnlineMode()) { ++ if (io.papermc.paper.configuration.GlobalConfiguration.get().proxies.isProxyOnlineMode()) { + profile = console.getProfileCache().get(name).orElse(null); + } else { + // Make an OfflinePlayer using an offline mode UUID since the name has no profile diff --git a/patches/server/0184-Make-legacy-ping-handler-more-reliable.patch b/patches/server/0183-Make-legacy-ping-handler-more-reliable.patch similarity index 100% rename from patches/server/0184-Make-legacy-ping-handler-more-reliable.patch rename to patches/server/0183-Make-legacy-ping-handler-more-reliable.patch diff --git a/patches/server/0183-Upstream-config-migrations.patch b/patches/server/0183-Upstream-config-migrations.patch deleted file mode 100644 index 8e2f48f541..0000000000 --- a/patches/server/0183-Upstream-config-migrations.patch +++ /dev/null @@ -1,36 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Mark Vainomaa -Date: Mon, 26 Mar 2018 18:30:53 +0300 -Subject: [PATCH] Upstream config migrations - -This patch contains config migrations for when upstream adds options -which Paper already had. - -diff --git a/src/main/java/com/destroystokyo/paper/PaperConfig.java b/src/main/java/com/destroystokyo/paper/PaperConfig.java -index a8de81b1a153525b2d0d6b01802b7733947527a2..e2fed9b89ec1acb63a140f0f67814587ab6942bc 100644 ---- a/src/main/java/com/destroystokyo/paper/PaperConfig.java -+++ b/src/main/java/com/destroystokyo/paper/PaperConfig.java -@@ -291,4 +291,23 @@ public class PaperConfig { - private static void authenticationServersDownKickMessage() { - authenticationServersDownKickMessage = Strings.emptyToNull(getString("messages.kick.authentication-servers-down", authenticationServersDownKickMessage)); - } -+ -+ private static void savePlayerData() { -+ Object val = config.get("settings.save-player-data"); -+ if (val instanceof Boolean) { -+ SpigotConfig.disablePlayerDataSaving = !(Boolean) val; -+ SpigotConfig.config.set("players.disable-saving", SpigotConfig.disablePlayerDataSaving); -+ SpigotConfig.save(); -+ config.set("settings.save-player-data", null); -+ } -+ } -+ -+ private static void namedEntityDeaths() { -+ Object val = config.get("settings.log-named-entity-deaths"); -+ if (val instanceof Boolean bool && !bool) { -+ SpigotConfig.logNamedDeaths = false; -+ SpigotConfig.config.set("settings.log-named-deaths", false); -+ SpigotConfig.save(); -+ } -+ } - } diff --git a/patches/server/0185-Call-PaperServerListPingEvent-for-legacy-pings.patch b/patches/server/0184-Call-PaperServerListPingEvent-for-legacy-pings.patch similarity index 100% rename from patches/server/0185-Call-PaperServerListPingEvent-for-legacy-pings.patch rename to patches/server/0184-Call-PaperServerListPingEvent-for-legacy-pings.patch diff --git a/patches/server/0186-Flag-to-disable-the-channel-limit.patch b/patches/server/0185-Flag-to-disable-the-channel-limit.patch similarity index 95% rename from patches/server/0186-Flag-to-disable-the-channel-limit.patch rename to patches/server/0185-Flag-to-disable-the-channel-limit.patch index b3ad36eafc..bc569ac1d0 100644 --- a/patches/server/0186-Flag-to-disable-the-channel-limit.patch +++ b/patches/server/0185-Flag-to-disable-the-channel-limit.patch @@ -9,7 +9,7 @@ e.g. servers which allow and support the usage of mod packs. provide an optional flag to disable this check, at your own risk. diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -index 09cde5fc320be42f2bd1e9f3aa7c1c70eabf2923..7a7fe687f4d6d0439024b58651a7815d951625cb 100644 +index 380bdc7cfa8980d5db29a15b29613fc62d75de2a..68a6bb89a5946fba7d4baeb009895d7ca975cbe8 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java @@ -167,6 +167,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player { diff --git a/patches/server/0187-Add-openSign-method-to-HumanEntity.patch b/patches/server/0186-Add-openSign-method-to-HumanEntity.patch similarity index 96% rename from patches/server/0187-Add-openSign-method-to-HumanEntity.patch rename to patches/server/0186-Add-openSign-method-to-HumanEntity.patch index 6da81ac0ec..d842f4f11f 100644 --- a/patches/server/0187-Add-openSign-method-to-HumanEntity.patch +++ b/patches/server/0186-Add-openSign-method-to-HumanEntity.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Add openSign method to HumanEntity diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftSign.java b/src/main/java/org/bukkit/craftbukkit/block/CraftSign.java -index 541f943d307f5307460ea049294fd98d53054d52..c629755ddba58eeff6f38f9396891f98f530e08e 100644 +index 911843bf38ab750edd4a63417ba7a9deb6b64cb1..a0950f5902c3719dc31205ec43dca9482278c744 100644 --- a/src/main/java/org/bukkit/craftbukkit/block/CraftSign.java +++ b/src/main/java/org/bukkit/craftbukkit/block/CraftSign.java @@ -117,15 +117,15 @@ public class CraftSign extends CraftBlockEntityState implements diff --git a/patches/server/0188-Configurable-sprint-interruption-on-attack.patch b/patches/server/0187-Configurable-sprint-interruption-on-attack.patch similarity index 52% rename from patches/server/0188-Configurable-sprint-interruption-on-attack.patch rename to patches/server/0187-Configurable-sprint-interruption-on-attack.patch index ab2469429a..157f5b6c24 100644 --- a/patches/server/0188-Configurable-sprint-interruption-on-attack.patch +++ b/patches/server/0187-Configurable-sprint-interruption-on-attack.patch @@ -5,22 +5,8 @@ Subject: [PATCH] Configurable sprint interruption on attack If the sprint interruption is disabled players continue sprinting when they attack entities. -diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -index 665b7f4cddfef1631ba2fad6eebeb19392cf8759..7dbd03897bf98ef19509972fb8d09aa071d7de3a 100644 ---- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -@@ -414,4 +414,9 @@ public class PaperWorldConfig { - disableCreeperLingeringEffect = getBoolean("disable-creeper-lingering-effect", false); - log("Creeper lingering effect: " + disableCreeperLingeringEffect); - } -+ -+ public boolean disableSprintInterruptionOnAttack; -+ private void disableSprintInterruptionOnAttack() { -+ disableSprintInterruptionOnAttack = getBoolean("game-mechanics.disable-sprint-interruption-on-attack", false); -+ } - } diff --git a/src/main/java/net/minecraft/world/entity/player/Player.java b/src/main/java/net/minecraft/world/entity/player/Player.java -index 863f805dfce2ffcde9d724012895c5f5cda0229f..c92bdcc43c008bd41ef5bea8fbce4ec6720147c6 100644 +index 417a76fed2217d33ed3c0b0febf254b6405404b1..389724f74de627f09c6e2ba8419ef0982aa2961a 100644 --- a/src/main/java/net/minecraft/world/entity/player/Player.java +++ b/src/main/java/net/minecraft/world/entity/player/Player.java @@ -1301,7 +1301,11 @@ public abstract class Player extends LivingEntity { @@ -29,7 +15,7 @@ index 863f805dfce2ffcde9d724012895c5f5cda0229f..c92bdcc43c008bd41ef5bea8fbce4ec6 this.setDeltaMovement(this.getDeltaMovement().multiply(0.6D, 1.0D, 0.6D)); - this.setSprinting(false); + // Paper start - Configuration option to disable automatic sprint interruption -+ if (!level.paperConfig.disableSprintInterruptionOnAttack) { ++ if (!level.paperConfig().misc.disableSprintInterruptionOnAttack) { + this.setSprinting(false); + } + // Paper end diff --git a/patches/server/0189-Fix-exploit-that-allowed-colored-signs-to-be-created.patch b/patches/server/0188-Fix-exploit-that-allowed-colored-signs-to-be-created.patch similarity index 94% rename from patches/server/0189-Fix-exploit-that-allowed-colored-signs-to-be-created.patch rename to patches/server/0188-Fix-exploit-that-allowed-colored-signs-to-be-created.patch index 7b9afaa75f..d78dcd2ac0 100644 --- a/patches/server/0189-Fix-exploit-that-allowed-colored-signs-to-be-created.patch +++ b/patches/server/0188-Fix-exploit-that-allowed-colored-signs-to-be-created.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Fix exploit that allowed colored signs to be created diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index 9e7a3a58bf944e612fa4c3bcb3b87efe5eb21c5b..6b96d3e39fb6de4ce1c82eb36c881331d885fec8 100644 +index 81ac95b9a174b25d47515fbd84c03d22c905454e..18f5bcda3747735d3fadd6186dc3afc4f6097946 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java @@ -3001,9 +3001,9 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser diff --git a/patches/server/0190-EndermanEscapeEvent.patch b/patches/server/0189-EndermanEscapeEvent.patch similarity index 100% rename from patches/server/0190-EndermanEscapeEvent.patch rename to patches/server/0189-EndermanEscapeEvent.patch diff --git a/patches/server/0191-Enderman.teleportRandomly.patch b/patches/server/0190-Enderman.teleportRandomly.patch similarity index 100% rename from patches/server/0191-Enderman.teleportRandomly.patch rename to patches/server/0190-Enderman.teleportRandomly.patch diff --git a/patches/server/0192-Block-Enderpearl-Travel-Exploit.patch b/patches/server/0191-Block-Enderpearl-Travel-Exploit.patch similarity index 56% rename from patches/server/0192-Block-Enderpearl-Travel-Exploit.patch rename to patches/server/0191-Block-Enderpearl-Travel-Exploit.patch index beb94090b3..7cbf7c07a4 100644 --- a/patches/server/0192-Block-Enderpearl-Travel-Exploit.patch +++ b/patches/server/0191-Block-Enderpearl-Travel-Exploit.patch @@ -11,23 +11,8 @@ This disables that by not saving the thrower when the chunk is unloaded. This is mainly useful for survival servers that do not allow freeform teleporting. -diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -index 7dbd03897bf98ef19509972fb8d09aa071d7de3a..0129a469d991225a0cef281e0e0eeb069fe4cfb5 100644 ---- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -@@ -419,4 +419,10 @@ public class PaperWorldConfig { - private void disableSprintInterruptionOnAttack() { - disableSprintInterruptionOnAttack = getBoolean("game-mechanics.disable-sprint-interruption-on-attack", false); - } -+ -+ public boolean disableEnderpearlExploit = true; -+ private void disableEnderpearlExploit() { -+ disableEnderpearlExploit = getBoolean("game-mechanics.disable-unloaded-chunk-enderpearl-exploit", disableEnderpearlExploit); -+ log("Disable Unloaded Chunk Enderpearl Exploit: " + (disableEnderpearlExploit ? "enabled" : "disabled")); -+ } - } diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java -index 5ee25084459f4cfcc8a95001a9d480e4a235f9f0..d2ecaf71e52123d5a015d49049d2a8e5b7332e97 100644 +index 535cb7102ad69c34e3035422429c9874ba434e31..9804934384975c38e1c6986c7fa73d510bb1136b 100644 --- a/src/main/java/net/minecraft/server/level/ServerLevel.java +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java @@ -2069,6 +2069,12 @@ public class ServerLevel extends Level implements WorldGenLevel { @@ -35,7 +20,7 @@ index 5ee25084459f4cfcc8a95001a9d480e4a235f9f0..d2ecaf71e52123d5a015d49049d2a8e5 public void onTickingEnd(Entity entity) { ServerLevel.this.entityTickList.remove(entity); + // Paper start - Reset pearls when they stop being ticked -+ if (paperConfig.disableEnderpearlExploit && entity instanceof net.minecraft.world.entity.projectile.ThrownEnderpearl pearl) { ++ if (paperConfig().fixes.disableUnloadedChunkEnderpearlExploit && entity instanceof net.minecraft.world.entity.projectile.ThrownEnderpearl pearl) { + pearl.cachedOwner = null; + pearl.ownerUUID = null; + } @@ -44,14 +29,14 @@ index 5ee25084459f4cfcc8a95001a9d480e4a235f9f0..d2ecaf71e52123d5a015d49049d2a8e5 public void onTrackingStart(Entity entity) { diff --git a/src/main/java/net/minecraft/world/entity/projectile/Projectile.java b/src/main/java/net/minecraft/world/entity/projectile/Projectile.java -index cf8498165065c7db1be9cf7de492c1a41817cbf1..5cb04230e22e7e9463d4e89792fca569970e10b7 100644 +index cf8498165065c7db1be9cf7de492c1a41817cbf1..f550686d1ae45a9ecb406e999d02dba0cf022c58 100644 --- a/src/main/java/net/minecraft/world/entity/projectile/Projectile.java +++ b/src/main/java/net/minecraft/world/entity/projectile/Projectile.java @@ -88,6 +88,7 @@ public abstract class Projectile extends Entity { protected void readAdditionalSaveData(CompoundTag nbt) { if (nbt.hasUUID("Owner")) { this.ownerUUID = nbt.getUUID("Owner"); -+ if (this instanceof ThrownEnderpearl && this.level != null && this.level.paperConfig.disableEnderpearlExploit) { this.ownerUUID = null; } // Paper - Don't store shooter name for pearls to block enderpearl travel exploit ++ if (this instanceof ThrownEnderpearl && this.level != null && this.level.paperConfig().fixes.disableUnloadedChunkEnderpearlExploit) { this.ownerUUID = null; } // Paper - Don't store shooter name for pearls to block enderpearl travel exploit } this.leftOwner = nbt.getBoolean("LeftOwner"); diff --git a/patches/server/0193-Expand-World.spawnParticle-API-and-add-Builder.patch b/patches/server/0192-Expand-World.spawnParticle-API-and-add-Builder.patch similarity index 97% rename from patches/server/0193-Expand-World.spawnParticle-API-and-add-Builder.patch rename to patches/server/0192-Expand-World.spawnParticle-API-and-add-Builder.patch index f93ab8bbc2..c7f0abe558 100644 --- a/patches/server/0193-Expand-World.spawnParticle-API-and-add-Builder.patch +++ b/patches/server/0192-Expand-World.spawnParticle-API-and-add-Builder.patch @@ -10,7 +10,7 @@ Adds an option to control the force mode of the particle. This adds a new Builder API which is much friendlier to use. diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java -index d2ecaf71e52123d5a015d49049d2a8e5b7332e97..abbb28560e1a4c1175ea431d55f903f2b5241830 100644 +index 9804934384975c38e1c6986c7fa73d510bb1136b..ef9bf1ec96a320ff16385ceb28d77315b56cfef0 100644 --- a/src/main/java/net/minecraft/server/level/ServerLevel.java +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java @@ -1482,12 +1482,17 @@ public class ServerLevel extends Level implements WorldGenLevel { diff --git a/patches/server/0194-Prevent-Frosted-Ice-from-loading-holding-chunks.patch b/patches/server/0193-Prevent-Frosted-Ice-from-loading-holding-chunks.patch similarity index 86% rename from patches/server/0194-Prevent-Frosted-Ice-from-loading-holding-chunks.patch rename to patches/server/0193-Prevent-Frosted-Ice-from-loading-holding-chunks.patch index 9840e3e937..b9c45b572d 100644 --- a/patches/server/0194-Prevent-Frosted-Ice-from-loading-holding-chunks.patch +++ b/patches/server/0193-Prevent-Frosted-Ice-from-loading-holding-chunks.patch @@ -6,7 +6,7 @@ Subject: [PATCH] Prevent Frosted Ice from loading/holding chunks 1.17: Shouldn't be needed as blocks no longer tick without at least 1 radius chunk loaded. diff --git a/src/main/java/net/minecraft/world/level/block/FrostedIceBlock.java b/src/main/java/net/minecraft/world/level/block/FrostedIceBlock.java -index d2de8192cbdae37fc7baaef998254bd82485fc72..3d4658bdc0616e4d8c26e496158063a515181847 100644 +index 331b642c36af97f7f05bd63f96d42d1af443e5a3..a3af96b2518b41f370d09cfda26dc589b9ee977b 100644 --- a/src/main/java/net/minecraft/world/level/block/FrostedIceBlock.java +++ b/src/main/java/net/minecraft/world/level/block/FrostedIceBlock.java @@ -38,7 +38,8 @@ public class FrostedIceBlock extends IceBlock { @@ -17,7 +17,7 @@ index d2de8192cbdae37fc7baaef998254bd82485fc72..3d4658bdc0616e4d8c26e496158063a5 + BlockState blockState = world.getBlockStateIfLoaded(mutableBlockPos); // Paper + if (blockState == null) { continue; } // Paper if (blockState.is(this) && !this.slightlyMelt(blockState, world, mutableBlockPos)) { - world.scheduleTick(mutableBlockPos, this, Mth.nextInt(random, world.paperConfig.frostedIceDelayMin, world.paperConfig.frostedIceDelayMax)); // Paper - use configurable min/max delay + world.scheduleTick(mutableBlockPos, this, Mth.nextInt(random, world.paperConfig().environment.frostedIce.delay.min, world.paperConfig().environment.frostedIce.delay.max)); // Paper - use configurable min/max delay } @@ -75,7 +76,10 @@ public class FrostedIceBlock extends IceBlock { diff --git a/patches/server/0195-EndermanAttackPlayerEvent.patch b/patches/server/0194-EndermanAttackPlayerEvent.patch similarity index 100% rename from patches/server/0195-EndermanAttackPlayerEvent.patch rename to patches/server/0194-EndermanAttackPlayerEvent.patch diff --git a/patches/server/0196-WitchConsumePotionEvent.patch b/patches/server/0195-WitchConsumePotionEvent.patch similarity index 100% rename from patches/server/0196-WitchConsumePotionEvent.patch rename to patches/server/0195-WitchConsumePotionEvent.patch diff --git a/patches/server/0197-WitchThrowPotionEvent.patch b/patches/server/0196-WitchThrowPotionEvent.patch similarity index 100% rename from patches/server/0197-WitchThrowPotionEvent.patch rename to patches/server/0196-WitchThrowPotionEvent.patch diff --git a/patches/server/0198-Allow-spawning-Item-entities-with-World.spawnEntity.patch b/patches/server/0197-Allow-spawning-Item-entities-with-World.spawnEntity.patch similarity index 100% rename from patches/server/0198-Allow-spawning-Item-entities-with-World.spawnEntity.patch rename to patches/server/0197-Allow-spawning-Item-entities-with-World.spawnEntity.patch diff --git a/patches/server/0199-WitchReadyPotionEvent.patch b/patches/server/0198-WitchReadyPotionEvent.patch similarity index 100% rename from patches/server/0199-WitchReadyPotionEvent.patch rename to patches/server/0198-WitchReadyPotionEvent.patch diff --git a/patches/server/0200-ItemStack-getMaxItemUseDuration.patch b/patches/server/0199-ItemStack-getMaxItemUseDuration.patch similarity index 100% rename from patches/server/0200-ItemStack-getMaxItemUseDuration.patch rename to patches/server/0199-ItemStack-getMaxItemUseDuration.patch diff --git a/patches/server/0201-Implement-EntityTeleportEndGatewayEvent.patch b/patches/server/0200-Implement-EntityTeleportEndGatewayEvent.patch similarity index 100% rename from patches/server/0201-Implement-EntityTeleportEndGatewayEvent.patch rename to patches/server/0200-Implement-EntityTeleportEndGatewayEvent.patch diff --git a/patches/server/0202-Unset-Ignited-flag-on-cancel-of-Explosion-Event.patch b/patches/server/0201-Unset-Ignited-flag-on-cancel-of-Explosion-Event.patch similarity index 89% rename from patches/server/0202-Unset-Ignited-flag-on-cancel-of-Explosion-Event.patch rename to patches/server/0201-Unset-Ignited-flag-on-cancel-of-Explosion-Event.patch index 462155cf04..6f7b7cd31b 100644 --- a/patches/server/0202-Unset-Ignited-flag-on-cancel-of-Explosion-Event.patch +++ b/patches/server/0201-Unset-Ignited-flag-on-cancel-of-Explosion-Event.patch @@ -6,7 +6,7 @@ Subject: [PATCH] Unset Ignited flag on cancel of Explosion Event Otherwise the creeper infinite explodes diff --git a/src/main/java/net/minecraft/world/entity/monster/Creeper.java b/src/main/java/net/minecraft/world/entity/monster/Creeper.java -index e74bd467f6b2fe26d7798abbe089a6311c42be64..951654626a9eaa8d8cc4044f98b0931097e848e0 100644 +index 441eee3d3a639b8eccc4369de0d9e3e7d28bac27..bc493838420a6857ebc86f84cabdc1b6e3e637a4 100644 --- a/src/main/java/net/minecraft/world/entity/monster/Creeper.java +++ b/src/main/java/net/minecraft/world/entity/monster/Creeper.java @@ -272,6 +272,7 @@ public class Creeper extends Monster implements PowerableMob { diff --git a/patches/server/0203-Fix-CraftEntity-hashCode.patch b/patches/server/0202-Fix-CraftEntity-hashCode.patch similarity index 100% rename from patches/server/0203-Fix-CraftEntity-hashCode.patch rename to patches/server/0202-Fix-CraftEntity-hashCode.patch diff --git a/patches/server/0204-Configurable-Alternative-LootPool-Luck-Formula.patch b/patches/server/0203-Configurable-Alternative-LootPool-Luck-Formula.patch similarity index 77% rename from patches/server/0204-Configurable-Alternative-LootPool-Luck-Formula.patch rename to patches/server/0203-Configurable-Alternative-LootPool-Luck-Formula.patch index d7284ced98..40dce864c6 100644 --- a/patches/server/0204-Configurable-Alternative-LootPool-Luck-Formula.patch +++ b/patches/server/0203-Configurable-Alternative-LootPool-Luck-Formula.patch @@ -35,25 +35,8 @@ This change will result in some major changes to fishing formulas. I would love to see this change in Vanilla, so Mojang please pull :) -diff --git a/src/main/java/com/destroystokyo/paper/PaperConfig.java b/src/main/java/com/destroystokyo/paper/PaperConfig.java -index e2fed9b89ec1acb63a140f0f67814587ab6942bc..b46b10c726b53b1106cc74ec9a5d6ca6f45c96fe 100644 ---- a/src/main/java/com/destroystokyo/paper/PaperConfig.java -+++ b/src/main/java/com/destroystokyo/paper/PaperConfig.java -@@ -310,4 +310,12 @@ public class PaperConfig { - SpigotConfig.save(); - } - } -+ -+ public static boolean useAlternativeLuckFormula = false; -+ private static void useAlternativeLuckFormula() { -+ useAlternativeLuckFormula = getBoolean("settings.use-alternative-luck-formula", false); -+ if (useAlternativeLuckFormula) { -+ Bukkit.getLogger().log(Level.INFO, "Using Aikar's Alternative Luck Formula to apply Luck attribute to all loot pool calculations. See https://luckformula.emc.gs"); -+ } -+ } - } diff --git a/src/main/java/net/minecraft/world/level/storage/loot/entries/LootPoolSingletonContainer.java b/src/main/java/net/minecraft/world/level/storage/loot/entries/LootPoolSingletonContainer.java -index 710a66e9aafe8bd622f9f37789c281aba98d030e..558f43580d976d7bde32779e47e24c9ad388892d 100644 +index 710a66e9aafe8bd622f9f37789c281aba98d030e..d125b5a470be0f4c56c2c1f229fc5c83fc4d2f3b 100644 --- a/src/main/java/net/minecraft/world/level/storage/loot/entries/LootPoolSingletonContainer.java +++ b/src/main/java/net/minecraft/world/level/storage/loot/entries/LootPoolSingletonContainer.java @@ -113,9 +113,35 @@ public abstract class LootPoolSingletonContainer extends LootPoolEntryContainer @@ -69,7 +52,7 @@ index 710a66e9aafe8bd622f9f37789c281aba98d030e..558f43580d976d7bde32779e47e24c9a + // This is vanilla + float qualityModifer = (float) LootPoolSingletonContainer.this.quality * luck; + double baseWeight = (LootPoolSingletonContainer.this.weight + qualityModifer); -+ if (com.destroystokyo.paper.PaperConfig.useAlternativeLuckFormula) { ++ if (io.papermc.paper.configuration.GlobalConfiguration.get().misc.useAlternativeLuckFormula) { + // Random boost to avoid losing precision in the final int cast on return + final int weightBoost = 100; + baseWeight *= weightBoost; diff --git a/patches/server/0205-Print-Error-details-when-failing-to-save-player-data.patch b/patches/server/0204-Print-Error-details-when-failing-to-save-player-data.patch similarity index 100% rename from patches/server/0205-Print-Error-details-when-failing-to-save-player-data.patch rename to patches/server/0204-Print-Error-details-when-failing-to-save-player-data.patch diff --git a/patches/server/0206-Make-shield-blocking-delay-configurable.patch b/patches/server/0205-Make-shield-blocking-delay-configurable.patch similarity index 69% rename from patches/server/0206-Make-shield-blocking-delay-configurable.patch rename to patches/server/0205-Make-shield-blocking-delay-configurable.patch index 0d0b060b7d..006c2a4b17 100644 --- a/patches/server/0206-Make-shield-blocking-delay-configurable.patch +++ b/patches/server/0205-Make-shield-blocking-delay-configurable.patch @@ -4,22 +4,8 @@ Date: Sat, 16 Jun 2018 01:18:16 -0500 Subject: [PATCH] Make shield blocking delay configurable -diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -index 0129a469d991225a0cef281e0e0eeb069fe4cfb5..ecb00a7fb5146296fe3087b1c7eedc34e7249e2c 100644 ---- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -@@ -425,4 +425,9 @@ public class PaperWorldConfig { - disableEnderpearlExploit = getBoolean("game-mechanics.disable-unloaded-chunk-enderpearl-exploit", disableEnderpearlExploit); - log("Disable Unloaded Chunk Enderpearl Exploit: " + (disableEnderpearlExploit ? "enabled" : "disabled")); - } -+ -+ public int shieldBlockingDelay = 5; -+ private void shieldBlockingDelay() { -+ shieldBlockingDelay = getInt("game-mechanics.shield-blocking-delay", 5); -+ } - } diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java -index fc63d202e8cc28d5664c0f5749b195e3c1220cc9..51f7f1ee4242fc6bd8ff57c76052e1e75232bc34 100644 +index 27a2ba075a2f7575b6788c66a121fc906b19a99d..1d82dab7fad130e6674d7f137ca29258cc7632a4 100644 --- a/src/main/java/net/minecraft/world/entity/LivingEntity.java +++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java @@ -3697,12 +3697,24 @@ public abstract class LivingEntity extends Entity { @@ -34,7 +20,7 @@ index fc63d202e8cc28d5664c0f5749b195e3c1220cc9..51f7f1ee4242fc6bd8ff57c76052e1e7 } + // Paper start -+ public int shieldBlockingDelay = level.paperConfig.shieldBlockingDelay; ++ public int shieldBlockingDelay = level.paperConfig().misc.shieldBlockingDelay; + + public int getShieldBlockingDelay() { + return shieldBlockingDelay; diff --git a/patches/server/0207-Improve-EntityShootBowEvent.patch b/patches/server/0206-Improve-EntityShootBowEvent.patch similarity index 100% rename from patches/server/0207-Improve-EntityShootBowEvent.patch rename to patches/server/0206-Improve-EntityShootBowEvent.patch diff --git a/patches/server/0208-PlayerReadyArrowEvent.patch b/patches/server/0207-PlayerReadyArrowEvent.patch similarity index 95% rename from patches/server/0208-PlayerReadyArrowEvent.patch rename to patches/server/0207-PlayerReadyArrowEvent.patch index f42bbcd999..cb650e6788 100644 --- a/patches/server/0208-PlayerReadyArrowEvent.patch +++ b/patches/server/0207-PlayerReadyArrowEvent.patch @@ -7,7 +7,7 @@ Called when a player is firing a bow and the server is choosing an arrow to use. Plugins can skip selection of certain arrows and control which is used. diff --git a/src/main/java/net/minecraft/world/entity/player/Player.java b/src/main/java/net/minecraft/world/entity/player/Player.java -index c92bdcc43c008bd41ef5bea8fbce4ec6720147c6..e48995a975a8540eb93df76f3e1825cc9762c214 100644 +index 389724f74de627f09c6e2ba8419ef0982aa2961a..5ff66cefb4b5e274e381ed77545b36fb37146fdf 100644 --- a/src/main/java/net/minecraft/world/entity/player/Player.java +++ b/src/main/java/net/minecraft/world/entity/player/Player.java @@ -2244,6 +2244,17 @@ public abstract class Player extends LivingEntity { diff --git a/patches/server/0209-Implement-EntityKnockbackByEntityEvent.patch b/patches/server/0208-Implement-EntityKnockbackByEntityEvent.patch similarity index 96% rename from patches/server/0209-Implement-EntityKnockbackByEntityEvent.patch rename to patches/server/0208-Implement-EntityKnockbackByEntityEvent.patch index 3407e02599..384fd823d4 100644 --- a/patches/server/0209-Implement-EntityKnockbackByEntityEvent.patch +++ b/patches/server/0208-Implement-EntityKnockbackByEntityEvent.patch @@ -6,7 +6,7 @@ Subject: [PATCH] Implement EntityKnockbackByEntityEvent This event is called when an entity receives knockback by another entity. diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java -index 51f7f1ee4242fc6bd8ff57c76052e1e75232bc34..eb9d45fd330ad4ed194ed593ca15ed579ddb2c54 100644 +index 1d82dab7fad130e6674d7f137ca29258cc7632a4..da896f299072360a23cdfd025ed6f151a0441d4e 100644 --- a/src/main/java/net/minecraft/world/entity/LivingEntity.java +++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java @@ -1456,7 +1456,7 @@ public abstract class LivingEntity extends Entity { @@ -56,7 +56,7 @@ index 51f7f1ee4242fc6bd8ff57c76052e1e75232bc34..eb9d45fd330ad4ed194ed593ca15ed57 } diff --git a/src/main/java/net/minecraft/world/entity/Mob.java b/src/main/java/net/minecraft/world/entity/Mob.java -index 932f54d8a6db9455d9fd947baad0de7850ccd563..2bec7466fcd61731d4da1cefdea8c375def0be12 100644 +index 049a9c4547428d7306d82ed35bcd470ae6f3efc3..95b042aed945adc72238ebeb19369d9b9568dc8d 100644 --- a/src/main/java/net/minecraft/world/entity/Mob.java +++ b/src/main/java/net/minecraft/world/entity/Mob.java @@ -1573,7 +1573,7 @@ public abstract class Mob extends LivingEntity { @@ -82,7 +82,7 @@ index 3380b95e0eff5a6b1b683b8233b8991eb817b638..de8485df1c23e903ff0721fdb682b98d serverLevel.playSound((Player)null, goat, this.getImpactSound.apply(goat), SoundSource.HOSTILE, 1.0F, 1.0F); } else if (this.hasRammedHornBreakingBlock(serverLevel, goat)) { diff --git a/src/main/java/net/minecraft/world/entity/player/Player.java b/src/main/java/net/minecraft/world/entity/player/Player.java -index e48995a975a8540eb93df76f3e1825cc9762c214..1b0a86441fcef191a7c3a8eb2def7e09f1b3ce06 100644 +index 5ff66cefb4b5e274e381ed77545b36fb37146fdf..f484bdf2ef045faefad326f8e6d59962b3abb4b3 100644 --- a/src/main/java/net/minecraft/world/entity/player/Player.java +++ b/src/main/java/net/minecraft/world/entity/player/Player.java @@ -1295,7 +1295,7 @@ public abstract class Player extends LivingEntity { diff --git a/patches/server/0210-Expand-Explosions-API.patch b/patches/server/0209-Expand-Explosions-API.patch similarity index 100% rename from patches/server/0210-Expand-Explosions-API.patch rename to patches/server/0209-Expand-Explosions-API.patch diff --git a/patches/server/0211-LivingEntity-Hand-Raised-Item-Use-API.patch b/patches/server/0210-LivingEntity-Hand-Raised-Item-Use-API.patch similarity index 100% rename from patches/server/0211-LivingEntity-Hand-Raised-Item-Use-API.patch rename to patches/server/0210-LivingEntity-Hand-Raised-Item-Use-API.patch diff --git a/patches/server/0212-RangedEntity-API.patch b/patches/server/0211-RangedEntity-API.patch similarity index 100% rename from patches/server/0212-RangedEntity-API.patch rename to patches/server/0211-RangedEntity-API.patch diff --git a/patches/server/0213-Add-config-to-disable-ender-dragon-legacy-check.patch b/patches/server/0212-Add-config-to-disable-ender-dragon-legacy-check.patch similarity index 51% rename from patches/server/0213-Add-config-to-disable-ender-dragon-legacy-check.patch rename to patches/server/0212-Add-config-to-disable-ender-dragon-legacy-check.patch index bccb78045f..e2cb389ce5 100644 --- a/patches/server/0213-Add-config-to-disable-ender-dragon-legacy-check.patch +++ b/patches/server/0212-Add-config-to-disable-ender-dragon-legacy-check.patch @@ -4,22 +4,8 @@ Date: Fri, 22 Jun 2018 10:38:31 -0500 Subject: [PATCH] Add config to disable ender dragon legacy check -diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -index ecb00a7fb5146296fe3087b1c7eedc34e7249e2c..f0b2c5ae854ee7f3321b2b39a3680af5c747732e 100644 ---- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -@@ -430,4 +430,9 @@ public class PaperWorldConfig { - private void shieldBlockingDelay() { - shieldBlockingDelay = getInt("game-mechanics.shield-blocking-delay", 5); - } -+ -+ public boolean scanForLegacyEnderDragon = true; -+ private void scanForLegacyEnderDragon() { -+ scanForLegacyEnderDragon = getBoolean("game-mechanics.scan-for-legacy-ender-dragon", true); -+ } - } diff --git a/src/main/java/net/minecraft/world/level/dimension/end/EndDragonFight.java b/src/main/java/net/minecraft/world/level/dimension/end/EndDragonFight.java -index fd2d78d8794c7f90abfbff4901cbe51513dbef0a..ec51369448a7f84ee65915ca97a0f22093126caa 100644 +index fd2d78d8794c7f90abfbff4901cbe51513dbef0a..908cc3e2fc2cf4894a10081192a8b0d3c7e99932 100644 --- a/src/main/java/net/minecraft/world/level/dimension/end/EndDragonFight.java +++ b/src/main/java/net/minecraft/world/level/dimension/end/EndDragonFight.java @@ -89,6 +89,10 @@ public class EndDragonFight { @@ -27,7 +13,7 @@ index fd2d78d8794c7f90abfbff4901cbe51513dbef0a..ec51369448a7f84ee65915ca97a0f220 public EndDragonFight(ServerLevel world, long gatewaysSeed, CompoundTag nbt) { + // Paper start -+ this.needsStateScanning = world.paperConfig.scanForLegacyEnderDragon; ++ this.needsStateScanning = world.paperConfig().entities.spawning.scanForLegacyEnderDragon; + if (!this.needsStateScanning) this.dragonKilled = true; + // Paper end this.level = world; diff --git a/patches/server/0214-Implement-World.getEntity-UUID-API.patch b/patches/server/0213-Implement-World.getEntity-UUID-API.patch similarity index 100% rename from patches/server/0214-Implement-World.getEntity-UUID-API.patch rename to patches/server/0213-Implement-World.getEntity-UUID-API.patch diff --git a/patches/server/0215-InventoryCloseEvent-Reason-API.patch b/patches/server/0214-InventoryCloseEvent-Reason-API.patch similarity index 93% rename from patches/server/0215-InventoryCloseEvent-Reason-API.patch rename to patches/server/0214-InventoryCloseEvent-Reason-API.patch index b4bae5e9b3..4800c00104 100644 --- a/patches/server/0215-InventoryCloseEvent-Reason-API.patch +++ b/patches/server/0214-InventoryCloseEvent-Reason-API.patch @@ -7,7 +7,7 @@ Allows you to determine why an inventory was closed, enabling plugin developers to "confirm" things based on if it was player triggered close or not. diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java -index abbb28560e1a4c1175ea431d55f903f2b5241830..efd06327b3cbe15d6a4c8b2f1082bc43798de311 100644 +index ef9bf1ec96a320ff16385ceb28d77315b56cfef0..584f93acc8192444e241e71d49f6351f691a019b 100644 --- a/src/main/java/net/minecraft/server/level/ServerLevel.java +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java @@ -1155,7 +1155,7 @@ public class ServerLevel extends Level implements WorldGenLevel { @@ -29,7 +29,7 @@ index abbb28560e1a4c1175ea431d55f903f2b5241830..efd06327b3cbe15d6a4c8b2f1082bc43 } // Spigot End diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java -index 23bf128cb5b7598a9d4c145b14f8fe692660be0d..9e010074c289abd939cd9743307579bee7583b5c 100644 +index 05b9595d4d308e5b4a551d26f3defbfa1d829ea9..0ef0b7fa2af5ac6608f9b8b37317434f15df6bfa 100644 --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java @@ -608,7 +608,7 @@ public class ServerPlayer extends Player { @@ -75,7 +75,7 @@ index 23bf128cb5b7598a9d4c145b14f8fe692660be0d..9e010074c289abd939cd9743307579be this.doCloseContainer(); } diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index 6b96d3e39fb6de4ce1c82eb36c881331d885fec8..c8b729f19ece0eccac953f3344eefb73a04ce06e 100644 +index 18f5bcda3747735d3fadd6186dc3afc4f6097946..96e853da573736f436cc4885acde663e20877714 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java @@ -204,6 +204,7 @@ import org.bukkit.event.inventory.ClickType; @@ -105,7 +105,7 @@ index 6b96d3e39fb6de4ce1c82eb36c881331d885fec8..c8b729f19ece0eccac953f3344eefb73 this.player.doCloseContainer(); } diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java -index fe1636a73f1af09314a200b99c196984d09a4b4a..d35de56c2110c8dcdf6104010f2edb0158b29780 100644 +index 4a94be565a3a7f7b8b330a35d97a14ef52ac4e50..4c9d595234a849d87157678383d220051c556962 100644 --- a/src/main/java/net/minecraft/server/players/PlayerList.java +++ b/src/main/java/net/minecraft/server/players/PlayerList.java @@ -506,7 +506,7 @@ public abstract class PlayerList { @@ -116,9 +116,9 @@ index fe1636a73f1af09314a200b99c196984d09a4b4a..d35de56c2110c8dcdf6104010f2edb01 + entityplayer.closeContainer(org.bukkit.event.inventory.InventoryCloseEvent.Reason.DISCONNECT); // Paper } - PlayerQuitEvent playerQuitEvent = new PlayerQuitEvent(entityplayer.getBukkitEntity(), net.kyori.adventure.text.Component.translatable("multiplayer.player.left", net.kyori.adventure.text.format.NamedTextColor.YELLOW, com.destroystokyo.paper.PaperConfig.useDisplayNameInQuit ? entityplayer.getBukkitEntity().displayName() : net.kyori.adventure.text.Component.text(entityplayer.getScoreboardName()))); + PlayerQuitEvent playerQuitEvent = new PlayerQuitEvent(entityplayer.getBukkitEntity(), net.kyori.adventure.text.Component.translatable("multiplayer.player.left", net.kyori.adventure.text.format.NamedTextColor.YELLOW, io.papermc.paper.configuration.GlobalConfiguration.get().messages.useDisplayNameInQuitMessage ? entityplayer.getBukkitEntity().displayName() : net.kyori.adventure.text.Component.text(entityplayer.getScoreboardName()))); diff --git a/src/main/java/net/minecraft/world/entity/player/Player.java b/src/main/java/net/minecraft/world/entity/player/Player.java -index 1b0a86441fcef191a7c3a8eb2def7e09f1b3ce06..ce34b94fa1d8d33cc0492841e1cbfb59be7600f4 100644 +index f484bdf2ef045faefad326f8e6d59962b3abb4b3..9dad71368225d86598f02962b42659bc601ce144 100644 --- a/src/main/java/net/minecraft/world/entity/player/Player.java +++ b/src/main/java/net/minecraft/world/entity/player/Player.java @@ -270,7 +270,7 @@ public abstract class Player extends LivingEntity { @@ -174,7 +174,7 @@ index 6c708f65b3a3718c7b53e0c2cc12ee8ad62ff2b9..a6ac2fdcda24ec031d5d2ea9e4492614 @Override public boolean isBlocking() { diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -index 0d08b1dee73c59edfa385241e5e0f9407b9b00b6..c99e40cac8f843dcf2804f721edeee0a2708d229 100644 +index 68a6bb89a5946fba7d4baeb009895d7ca975cbe8..61aa7b0299bf29302f0ce2d7a9fe89d25d0a92e6 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java @@ -1060,7 +1060,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player { diff --git a/patches/server/0216-Vex-get-setSummoner-API.patch b/patches/server/0215-Vex-get-setSummoner-API.patch similarity index 100% rename from patches/server/0216-Vex-get-setSummoner-API.patch rename to patches/server/0215-Vex-get-setSummoner-API.patch diff --git a/patches/server/0217-Refresh-player-inventory-when-cancelling-PlayerInter.patch b/patches/server/0216-Refresh-player-inventory-when-cancelling-PlayerInter.patch similarity index 94% rename from patches/server/0217-Refresh-player-inventory-when-cancelling-PlayerInter.patch rename to patches/server/0216-Refresh-player-inventory-when-cancelling-PlayerInter.patch index 69a7f6c2d3..89b2ebc9db 100644 --- a/patches/server/0217-Refresh-player-inventory-when-cancelling-PlayerInter.patch +++ b/patches/server/0216-Refresh-player-inventory-when-cancelling-PlayerInter.patch @@ -16,7 +16,7 @@ Refresh the player inventory when PlayerInteractEntityEvent is cancelled to avoid this problem. diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index c8b729f19ece0eccac953f3344eefb73a04ce06e..79d9af684d331c5e656697353559d4b3ce70a368 100644 +index 96e853da573736f436cc4885acde663e20877714..6dc8b7fe2418ee893b5db5d2116fa8853d92f28b 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java @@ -2425,6 +2425,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser diff --git a/patches/server/0218-Avoid-item-merge-if-stack-size-above-max-stack-size.patch b/patches/server/0217-Avoid-item-merge-if-stack-size-above-max-stack-size.patch similarity index 100% rename from patches/server/0218-Avoid-item-merge-if-stack-size-above-max-stack-size.patch rename to patches/server/0217-Avoid-item-merge-if-stack-size-above-max-stack-size.patch diff --git a/patches/server/0219-Use-AsyncAppender-to-keep-logging-IO-off-main-thread.patch b/patches/server/0218-Use-AsyncAppender-to-keep-logging-IO-off-main-thread.patch similarity index 93% rename from patches/server/0219-Use-AsyncAppender-to-keep-logging-IO-off-main-thread.patch rename to patches/server/0218-Use-AsyncAppender-to-keep-logging-IO-off-main-thread.patch index 960142294d..46f516cc08 100644 --- a/patches/server/0219-Use-AsyncAppender-to-keep-logging-IO-off-main-thread.patch +++ b/patches/server/0218-Use-AsyncAppender-to-keep-logging-IO-off-main-thread.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Use AsyncAppender to keep logging IO off main thread diff --git a/build.gradle.kts b/build.gradle.kts -index 0bff41bce07cb0fed23346704538a0577f2bc88b..87789b8b857ae4e89a158fb356fb5bb1a4ae93b1 100644 +index 2a77dfc3045d7cbf035a4bc0cd25ee95555f83cd..d226f391e596e0303d0f8f29f594e0ddbe47bcd0 100644 --- a/build.gradle.kts +++ b/build.gradle.kts -@@ -25,6 +25,7 @@ dependencies { +@@ -26,6 +26,7 @@ dependencies { implementation("commons-lang:commons-lang:2.6") runtimeOnly("org.xerial:sqlite-jdbc:3.36.0.3") runtimeOnly("mysql:mysql-connector-java:8.0.29") diff --git a/patches/server/0220-add-more-information-to-Entity.toString.patch b/patches/server/0219-add-more-information-to-Entity.toString.patch similarity index 91% rename from patches/server/0220-add-more-information-to-Entity.toString.patch rename to patches/server/0219-add-more-information-to-Entity.toString.patch index bd67c410bb..bcc361ace1 100644 --- a/patches/server/0220-add-more-information-to-Entity.toString.patch +++ b/patches/server/0219-add-more-information-to-Entity.toString.patch @@ -6,10 +6,10 @@ Subject: [PATCH] add more information to Entity.toString() UUID, ticks lived, valid, dead diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java -index 66a5a84098913b9bf6456e52df103332dcb147bb..31decb2c608042d026cb8a996389cf0c11859c13 100644 +index 22c9fcb8b0a75e59fc6838b9f33430b6c476cdc1..57b1d37bfe35215552c138caad8597986f755064 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java -@@ -2900,7 +2900,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource { +@@ -2899,7 +2899,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource { public String toString() { String s = this.level == null ? "~NULL~" : this.level.toString(); diff --git a/patches/server/0221-Add-CraftMagicNumbers.isSupportedApiVersion.patch b/patches/server/0220-Add-CraftMagicNumbers.isSupportedApiVersion.patch similarity index 90% rename from patches/server/0221-Add-CraftMagicNumbers.isSupportedApiVersion.patch rename to patches/server/0220-Add-CraftMagicNumbers.isSupportedApiVersion.patch index 18f8dc3661..ac845dd260 100644 --- a/patches/server/0221-Add-CraftMagicNumbers.isSupportedApiVersion.patch +++ b/patches/server/0220-Add-CraftMagicNumbers.isSupportedApiVersion.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Add CraftMagicNumbers.isSupportedApiVersion() diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java -index 0c040073b004fdbb2daa8e9d2aebdfffad405397..ab1bcb17d88b032c091a2237d0f1559b82bcd43f 100644 +index 8fc00b0ad230d9e7ae8dd73927b61116f73f7b4b..d4e5b0d8fbd885a84ae854f2dcced0423a42b4f9 100644 --- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java +++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java @@ -426,6 +426,11 @@ public final class CraftMagicNumbers implements UnsafeValues { diff --git a/patches/server/0222-EnderDragon-Events.patch b/patches/server/0221-EnderDragon-Events.patch similarity index 100% rename from patches/server/0222-EnderDragon-Events.patch rename to patches/server/0221-EnderDragon-Events.patch diff --git a/patches/server/0223-PlayerElytraBoostEvent.patch b/patches/server/0222-PlayerElytraBoostEvent.patch similarity index 100% rename from patches/server/0223-PlayerElytraBoostEvent.patch rename to patches/server/0222-PlayerElytraBoostEvent.patch diff --git a/patches/server/0224-PlayerLaunchProjectileEvent.patch b/patches/server/0223-PlayerLaunchProjectileEvent.patch similarity index 100% rename from patches/server/0224-PlayerLaunchProjectileEvent.patch rename to patches/server/0223-PlayerLaunchProjectileEvent.patch diff --git a/patches/server/0225-Improve-BlockPosition-inlining.patch b/patches/server/0224-Improve-BlockPosition-inlining.patch similarity index 100% rename from patches/server/0225-Improve-BlockPosition-inlining.patch rename to patches/server/0224-Improve-BlockPosition-inlining.patch diff --git a/patches/server/0226-Option-to-prevent-armor-stands-from-doing-entity-loo.patch b/patches/server/0225-Option-to-prevent-armor-stands-from-doing-entity-loo.patch similarity index 55% rename from patches/server/0226-Option-to-prevent-armor-stands-from-doing-entity-loo.patch rename to patches/server/0225-Option-to-prevent-armor-stands-from-doing-entity-loo.patch index 4fa06cca13..fe04742609 100644 --- a/patches/server/0226-Option-to-prevent-armor-stands-from-doing-entity-loo.patch +++ b/patches/server/0225-Option-to-prevent-armor-stands-from-doing-entity-loo.patch @@ -4,44 +4,30 @@ Date: Mon, 23 Jul 2018 12:57:39 +0200 Subject: [PATCH] Option to prevent armor stands from doing entity lookups -diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -index f0b2c5ae854ee7f3321b2b39a3680af5c747732e..7372f826b346bf684eb5987dedb4b907076ef2c0 100644 ---- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -@@ -435,4 +435,9 @@ public class PaperWorldConfig { - private void scanForLegacyEnderDragon() { - scanForLegacyEnderDragon = getBoolean("game-mechanics.scan-for-legacy-ender-dragon", true); - } -+ -+ public boolean armorStandEntityLookups = true; -+ private void armorStandEntityLookups() { -+ armorStandEntityLookups = getBoolean("armor-stands-do-collision-entity-lookups", true); -+ } - } diff --git a/src/main/java/net/minecraft/world/entity/decoration/ArmorStand.java b/src/main/java/net/minecraft/world/entity/decoration/ArmorStand.java -index ed698f3e3f9ed6003fe621c5f6f7e3a151a1a559..0923867d4730c9a7ed08d52bbc39b09871c8c806 100644 +index ed698f3e3f9ed6003fe621c5f6f7e3a151a1a559..9897dbb03c343e1e1842f7ca6bc9b99b95d0b8be 100644 --- a/src/main/java/net/minecraft/world/entity/decoration/ArmorStand.java +++ b/src/main/java/net/minecraft/world/entity/decoration/ArmorStand.java @@ -336,6 +336,7 @@ public class ArmorStand extends LivingEntity { @Override protected void pushEntities() { -+ if (!level.paperConfig.armorStandEntityLookups) return; // Paper ++ if (!level.paperConfig().entities.armorStands.doCollisionEntityLookups) return; // Paper List list = this.level.getEntities((Entity) this, this.getBoundingBox(), ArmorStand.RIDABLE_MINECARTS); for (int i = 0; i < list.size(); ++i) { diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java -index 1569c9249804de05b2650463f32a94d599ffd427..502734a44ee9f40eae983fed74348f3aa5a8f8b6 100644 +index ad0f91d57b5cbf0c4439993ad99ec7a484729a2e..ed29841c17a4d29ca05cbd307fa474d2208f5b3f 100644 --- a/src/main/java/net/minecraft/world/level/Level.java +++ b/src/main/java/net/minecraft/world/level/Level.java -@@ -731,6 +731,13 @@ public abstract class Level implements LevelAccessor, AutoCloseable { +@@ -735,6 +735,13 @@ public abstract class Level implements LevelAccessor, AutoCloseable { // Paper end } } + // Paper start - Prevent armor stands from doing entity lookups + @Override + public boolean noCollision(@Nullable Entity entity, AABB box) { -+ if (entity instanceof net.minecraft.world.entity.decoration.ArmorStand && !entity.level.paperConfig.armorStandEntityLookups) return false; ++ if (entity instanceof net.minecraft.world.entity.decoration.ArmorStand && !entity.level.paperConfig().entities.armorStands.doCollisionEntityLookups) return false; + return LevelAccessor.super.noCollision(entity, box); + } + // Paper end diff --git a/patches/server/0227-Vanished-players-don-t-have-rights.patch b/patches/server/0226-Vanished-players-don-t-have-rights.patch similarity index 96% rename from patches/server/0227-Vanished-players-don-t-have-rights.patch rename to patches/server/0226-Vanished-players-don-t-have-rights.patch index 9948b35d12..50edb3b520 100644 --- a/patches/server/0227-Vanished-players-don-t-have-rights.patch +++ b/patches/server/0226-Vanished-players-don-t-have-rights.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Vanished players don't have rights diff --git a/src/main/java/net/minecraft/world/entity/projectile/Projectile.java b/src/main/java/net/minecraft/world/entity/projectile/Projectile.java -index 5cb04230e22e7e9463d4e89792fca569970e10b7..cadcd3060e1c0e459ea064d2ac7a3ab5a4214d1d 100644 +index f550686d1ae45a9ecb406e999d02dba0cf022c58..273e1a6f4fd117e98732c66d9b168cab1d588127 100644 --- a/src/main/java/net/minecraft/world/entity/projectile/Projectile.java +++ b/src/main/java/net/minecraft/world/entity/projectile/Projectile.java @@ -211,7 +211,14 @@ public abstract class Projectile extends Entity { @@ -38,7 +38,7 @@ index 0d7c4be0c4abefecab367334408594afa7998b5e..78cac63e5bd7c84f59b8e00ee40899be BlockCanBuildEvent event = new BlockCanBuildEvent(CraftBlock.at(context.getLevel(), context.getClickedPos()), player, CraftBlockData.fromData(state), defaultReturn); diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java -index 502734a44ee9f40eae983fed74348f3aa5a8f8b6..b71dffee6c24c4ec2daf70bcfee21e8c0c532390 100644 +index ed29841c17a4d29ca05cbd307fa474d2208f5b3f..f8058e1f54d0281863cab81e866e0aa5400bb6bd 100644 --- a/src/main/java/net/minecraft/world/level/Level.java +++ b/src/main/java/net/minecraft/world/level/Level.java @@ -74,6 +74,10 @@ import net.minecraft.world.level.saveddata.maps.MapItemSavedData; @@ -52,7 +52,7 @@ index 502734a44ee9f40eae983fed74348f3aa5a8f8b6..b71dffee6c24c4ec2daf70bcfee21e8c import net.minecraft.world.scores.Scoreboard; // CraftBukkit start -@@ -261,6 +265,45 @@ public abstract class Level implements LevelAccessor, AutoCloseable { +@@ -265,6 +269,45 @@ public abstract class Level implements LevelAccessor, AutoCloseable { this.tileLimiter = new org.spigotmc.TickLimiter(spigotConfig.tileMaxTickTime); } diff --git a/patches/server/0228-Allow-disabling-armour-stand-ticking.patch b/patches/server/0227-Allow-disabling-armour-stand-ticking.patch similarity index 84% rename from patches/server/0228-Allow-disabling-armour-stand-ticking.patch rename to patches/server/0227-Allow-disabling-armour-stand-ticking.patch index cd2abdbcea..8c8a8d1532 100644 --- a/patches/server/0228-Allow-disabling-armour-stand-ticking.patch +++ b/patches/server/0227-Allow-disabling-armour-stand-ticking.patch @@ -4,23 +4,8 @@ Date: Wed, 15 Aug 2018 01:26:09 -0700 Subject: [PATCH] Allow disabling armour stand ticking -diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -index 7372f826b346bf684eb5987dedb4b907076ef2c0..6e7eb2134186e530f31eef6f86e30e8dbf523c4d 100644 ---- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -@@ -440,4 +440,10 @@ public class PaperWorldConfig { - private void armorStandEntityLookups() { - armorStandEntityLookups = getBoolean("armor-stands-do-collision-entity-lookups", true); - } -+ -+ public boolean armorStandTick = true; -+ private void armorStandTick() { -+ this.armorStandTick = this.getBoolean("armor-stands-tick", this.armorStandTick); -+ log("ArmorStand ticking is " + (this.armorStandTick ? "enabled" : "disabled") + " by default"); -+ } - } diff --git a/src/main/java/net/minecraft/world/entity/decoration/ArmorStand.java b/src/main/java/net/minecraft/world/entity/decoration/ArmorStand.java -index 0923867d4730c9a7ed08d52bbc39b09871c8c806..b2a64c75a9ef3ad2f1129cd7dc59d713c4768539 100644 +index 9897dbb03c343e1e1842f7ca6bc9b99b95d0b8be..f94a74728bd7c02a7f8245c92e7916f0b669ee0d 100644 --- a/src/main/java/net/minecraft/world/entity/decoration/ArmorStand.java +++ b/src/main/java/net/minecraft/world/entity/decoration/ArmorStand.java @@ -92,9 +92,16 @@ public class ArmorStand extends LivingEntity { @@ -36,7 +21,7 @@ index 0923867d4730c9a7ed08d52bbc39b09871c8c806..b2a64c75a9ef3ad2f1129cd7dc59d713 public ArmorStand(EntityType type, Level world) { super(type, world); -+ if (world != null) this.canTick = world.paperConfig.armorStandTick; // Paper - armour stand ticking ++ if (world != null) this.canTick = world.paperConfig().entities.armorStands.tick; // Paper - armour stand ticking this.handItems = NonNullList.withSize(2, ItemStack.EMPTY); this.armorItems = NonNullList.withSize(4, ItemStack.EMPTY); this.headPose = ArmorStand.DEFAULT_HEAD_POSE; diff --git a/patches/server/0229-SkeletonHorse-Additions.patch b/patches/server/0228-SkeletonHorse-Additions.patch similarity index 100% rename from patches/server/0229-SkeletonHorse-Additions.patch rename to patches/server/0228-SkeletonHorse-Additions.patch diff --git a/patches/server/0230-Don-t-call-getItemMeta-on-hasItemMeta.patch b/patches/server/0229-Don-t-call-getItemMeta-on-hasItemMeta.patch similarity index 100% rename from patches/server/0230-Don-t-call-getItemMeta-on-hasItemMeta.patch rename to patches/server/0229-Don-t-call-getItemMeta-on-hasItemMeta.patch diff --git a/patches/server/0231-Implement-Expanded-ArmorStand-API.patch b/patches/server/0230-Implement-Expanded-ArmorStand-API.patch similarity index 100% rename from patches/server/0231-Implement-Expanded-ArmorStand-API.patch rename to patches/server/0230-Implement-Expanded-ArmorStand-API.patch diff --git a/patches/server/0232-AnvilDamageEvent.patch b/patches/server/0231-AnvilDamageEvent.patch similarity index 100% rename from patches/server/0232-AnvilDamageEvent.patch rename to patches/server/0231-AnvilDamageEvent.patch diff --git a/patches/server/0233-Add-hand-to-bucket-events.patch b/patches/server/0232-Add-hand-to-bucket-events.patch similarity index 100% rename from patches/server/0233-Add-hand-to-bucket-events.patch rename to patches/server/0232-Add-hand-to-bucket-events.patch diff --git a/patches/server/0234-Add-TNTPrimeEvent.patch b/patches/server/0233-Add-TNTPrimeEvent.patch similarity index 100% rename from patches/server/0234-Add-TNTPrimeEvent.patch rename to patches/server/0233-Add-TNTPrimeEvent.patch diff --git a/patches/server/0235-Break-up-and-make-tab-spam-limits-configurable.patch b/patches/server/0234-Break-up-and-make-tab-spam-limits-configurable.patch similarity index 67% rename from patches/server/0235-Break-up-and-make-tab-spam-limits-configurable.patch rename to patches/server/0234-Break-up-and-make-tab-spam-limits-configurable.patch index 47a2a067f6..16956293f9 100644 --- a/patches/server/0235-Break-up-and-make-tab-spam-limits-configurable.patch +++ b/patches/server/0234-Break-up-and-make-tab-spam-limits-configurable.patch @@ -21,31 +21,8 @@ Splitting the field up and making it configurable allows for server owners to take the burden of this into their own hand without having to rely on plugins doing unsafe things. -diff --git a/src/main/java/com/destroystokyo/paper/PaperConfig.java b/src/main/java/com/destroystokyo/paper/PaperConfig.java -index b46b10c726b53b1106cc74ec9a5d6ca6f45c96fe..c3539fabda1887cca6e82abce26dff088cdc4251 100644 ---- a/src/main/java/com/destroystokyo/paper/PaperConfig.java -+++ b/src/main/java/com/destroystokyo/paper/PaperConfig.java -@@ -318,4 +318,18 @@ public class PaperConfig { - Bukkit.getLogger().log(Level.INFO, "Using Aikar's Alternative Luck Formula to apply Luck attribute to all loot pool calculations. See https://luckformula.emc.gs"); - } - } -+ -+ public static int tabSpamIncrement = 1; -+ public static int tabSpamLimit = 500; -+ private static void tabSpamLimiters() { -+ tabSpamIncrement = getInt("settings.spam-limiter.tab-spam-increment", tabSpamIncrement); -+ // Older versions used a smaller limit, which is too low for 1.13, we'll bump this up if default -+ if (version < 14) { -+ if (tabSpamIncrement == 10) { -+ set("settings.spam-limiter.tab-spam-increment", 2); -+ tabSpamIncrement = 2; -+ } -+ } -+ tabSpamLimit = getInt("settings.spam-limiter.tab-spam-limit", tabSpamLimit); -+ } - } diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index 79d9af684d331c5e656697353559d4b3ce70a368..a6add84c2bae068263b0ae9fe4bd66c569884be5 100644 +index 6dc8b7fe2418ee893b5db5d2116fa8853d92f28b..490b5565721e6a95fa58839450337690f9afed6a 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java @@ -245,6 +245,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser @@ -69,7 +46,7 @@ index 79d9af684d331c5e656697353559d4b3ce70a368..a6add84c2bae068263b0ae9fe4bd66c5 // PlayerConnectionUtils.ensureMainThread(packetplayintabcomplete, this, this.player.getWorldServer()); // Paper - run this async // CraftBukkit start - if (this.chatSpamTickCount.addAndGet(1) > 500 && !this.server.getPlayerList().isOp(this.player.getGameProfile())) { -+ if (this.chatSpamTickCount.addAndGet(com.destroystokyo.paper.PaperConfig.tabSpamIncrement) > com.destroystokyo.paper.PaperConfig.tabSpamLimit && !this.server.getPlayerList().isOp(this.player.getGameProfile())) { // Paper start - split and make configurable ++ if (this.chatSpamTickCount.addAndGet(io.papermc.paper.configuration.GlobalConfiguration.get().spamLimiter.tabSpamIncrement) > io.papermc.paper.configuration.GlobalConfiguration.get().spamLimiter.tabSpamLimit && !this.server.getPlayerList().isOp(this.player.getGameProfile())) { // Paper start - split and make configurable server.scheduleOnMain(() -> this.disconnect(Component.translatable("disconnect.spam", new Object[0]))); // Paper return; } diff --git a/patches/server/0236-MC-135506-Experience-should-save-as-Integers.patch b/patches/server/0235-MC-135506-Experience-should-save-as-Integers.patch similarity index 100% rename from patches/server/0236-MC-135506-Experience-should-save-as-Integers.patch rename to patches/server/0235-MC-135506-Experience-should-save-as-Integers.patch diff --git a/patches/server/0237-Fix-client-rendering-skulls-from-same-user.patch b/patches/server/0236-Fix-client-rendering-skulls-from-same-user.patch similarity index 100% rename from patches/server/0237-Fix-client-rendering-skulls-from-same-user.patch rename to patches/server/0236-Fix-client-rendering-skulls-from-same-user.patch diff --git a/patches/server/0238-Add-Debug-Entities-option-to-debug-dupe-uuid-issues.patch b/patches/server/0237-Add-Debug-Entities-option-to-debug-dupe-uuid-issues.patch similarity index 96% rename from patches/server/0238-Add-Debug-Entities-option-to-debug-dupe-uuid-issues.patch rename to patches/server/0237-Add-Debug-Entities-option-to-debug-dupe-uuid-issues.patch index d9b367bd77..44caabe986 100644 --- a/patches/server/0238-Add-Debug-Entities-option-to-debug-dupe-uuid-issues.patch +++ b/patches/server/0237-Add-Debug-Entities-option-to-debug-dupe-uuid-issues.patch @@ -29,7 +29,7 @@ index f9ef45635b731cafc9b6879603cac34c146833b0..29482bebf5b878c698283720d1452ef2 protected void tick() { diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java -index efd06327b3cbe15d6a4c8b2f1082bc43798de311..8c00f5d064106cca5722bdd41287ba4e99afe227 100644 +index 584f93acc8192444e241e71d49f6351f691a019b..ff266253406ae6b5047ce4605755df3c753a56c5 100644 --- a/src/main/java/net/minecraft/server/level/ServerLevel.java +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java @@ -214,6 +214,9 @@ public class ServerLevel extends Level implements WorldGenLevel { @@ -72,7 +72,7 @@ index efd06327b3cbe15d6a4c8b2f1082bc43798de311..8c00f5d064106cca5722bdd41287ba4e return false; } else { diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java -index 31decb2c608042d026cb8a996389cf0c11859c13..bae9afa3f56fed4bd00e1ce5e760935829c1c751 100644 +index 57b1d37bfe35215552c138caad8597986f755064..d020cbe64e13b479e22a8f6c090165390663af63 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java @@ -229,6 +229,8 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource { @@ -85,7 +85,7 @@ index 31decb2c608042d026cb8a996389cf0c11859c13..bae9afa3f56fed4bd00e1ce5e7609358 if (this.bukkitEntity == null) { this.bukkitEntity = CraftEntity.getEntity(this.level.getCraftServer(), this); diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java -index b71dffee6c24c4ec2daf70bcfee21e8c0c532390..36264caae95b4ab69412a60f24e1e926df424fa0 100644 +index f8058e1f54d0281863cab81e866e0aa5400bb6bd..52b954528037e2f43d7cbcf2bcf8198b0c835109 100644 --- a/src/main/java/net/minecraft/world/level/Level.java +++ b/src/main/java/net/minecraft/world/level/Level.java @@ -148,6 +148,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable { diff --git a/patches/server/0239-Add-Early-Warning-Feature-to-WatchDog.patch b/patches/server/0238-Add-Early-Warning-Feature-to-WatchDog.patch similarity index 75% rename from patches/server/0239-Add-Early-Warning-Feature-to-WatchDog.patch rename to patches/server/0238-Add-Early-Warning-Feature-to-WatchDog.patch index a6241d0930..e8b354dec1 100644 --- a/patches/server/0239-Add-Early-Warning-Feature-to-WatchDog.patch +++ b/patches/server/0238-Add-Early-Warning-Feature-to-WatchDog.patch @@ -8,35 +8,8 @@ thread dumps at an interval until the point of crash. This will help diagnose what was going on in that time before the crash. -diff --git a/src/main/java/com/destroystokyo/paper/PaperConfig.java b/src/main/java/com/destroystokyo/paper/PaperConfig.java -index c3539fabda1887cca6e82abce26dff088cdc4251..924b890d34c113ce804244dbb6635ff737f974b5 100644 ---- a/src/main/java/com/destroystokyo/paper/PaperConfig.java -+++ b/src/main/java/com/destroystokyo/paper/PaperConfig.java -@@ -25,6 +25,7 @@ import org.bukkit.configuration.file.YamlConfiguration; - import co.aikar.timings.Timings; - import co.aikar.timings.TimingsManager; - import org.spigotmc.SpigotConfig; -+import org.spigotmc.WatchdogThread; - - public class PaperConfig { - -@@ -319,6 +320,14 @@ public class PaperConfig { - } - } - -+ public static int watchdogPrintEarlyWarningEvery = 5000; -+ public static int watchdogPrintEarlyWarningDelay = 10000; -+ private static void watchdogEarlyWarning() { -+ watchdogPrintEarlyWarningEvery = getInt("settings.watchdog.early-warning-every", 5000); -+ watchdogPrintEarlyWarningDelay = getInt("settings.watchdog.early-warning-delay", 10000); -+ WatchdogThread.doStart(SpigotConfig.timeoutTime, SpigotConfig.restartOnCrash ); -+ } -+ - public static int tabSpamIncrement = 1; - public static int tabSpamLimit = 500; - private static void tabSpamLimiters() { diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index 6d92ab505613fc0ba0c0436c6a6336eb6349a461..40d086016536dd3efa5c861a770853c166974c7c 100644 +index 94201e91ee67c00fb9d5af0c6db9d96999164c06..d4595c3eadce0b09042043bd9d31aa57285e04ce 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java @@ -1057,6 +1057,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop comparator; diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index a6add84c2bae068263b0ae9fe4bd66c569884be5..27725c9c1ad03f8f2263c027ebf6f175efb8b986 100644 +index 490b5565721e6a95fa58839450337690f9afed6a..2d041220607e35b8adf00c6378336db0e137e79a 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java @@ -749,6 +749,13 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser @@ -3369,7 +3328,7 @@ index 2d74ab966a1291895b6248a67a31fe4802b3773f..038e2177182c94baa4af24f9111cf155 } diff --git a/src/main/java/net/minecraft/world/level/chunk/storage/RegionFileStorage.java b/src/main/java/net/minecraft/world/level/chunk/storage/RegionFileStorage.java -index deb852aa0fb2ad55a94d3c7ee542a0cc8013be42..40830a2b231df9bbf676d8325e76c8252a6c1d6c 100644 +index 5a35e5040726a981ae91f018f05b91c178a54ba0..9d7adf17851202adf03bf9feff3577069e324bc6 100644 --- a/src/main/java/net/minecraft/world/level/chunk/storage/RegionFileStorage.java +++ b/src/main/java/net/minecraft/world/level/chunk/storage/RegionFileStorage.java @@ -29,11 +29,32 @@ public class RegionFileStorage implements AutoCloseable { @@ -3405,7 +3364,7 @@ index deb852aa0fb2ad55a94d3c7ee542a0cc8013be42..40830a2b231df9bbf676d8325e76c825 + // Paper end return regionfile; } else { - if (this.regionCache.size() >= com.destroystokyo.paper.PaperConfig.regionFileCacheSize) { // Paper - configurable + if (this.regionCache.size() >= io.papermc.paper.configuration.GlobalConfiguration.get().misc.regionFileCacheSize) { // Paper - configurable @@ -48,6 +69,12 @@ public class RegionFileStorage implements AutoCloseable { RegionFile regionfile1 = new RegionFile(path1, this.folder, this.sync); @@ -3676,10 +3635,10 @@ index 1adc2ad30b174465989c628c4306df011356c93c..c752f70b0c05cb7acd8c7cfce92ab05a public boolean teleport(Location location) { return this.teleport(location, TeleportCause.PLUGIN); diff --git a/src/main/java/org/spigotmc/WatchdogThread.java b/src/main/java/org/spigotmc/WatchdogThread.java -index a01a266a25e3267c94c20f8597b4b596efe20faa..1ffb208094f521883ef0e23baf5fb29380b14273 100644 +index 06efdd7aa6d35a670e81c4f303618a7ba301396a..e62f085de1678568d422ef0eda5b9bfbd8b4d556 100644 --- a/src/main/java/org/spigotmc/WatchdogThread.java +++ b/src/main/java/org/spigotmc/WatchdogThread.java -@@ -117,6 +117,7 @@ public class WatchdogThread extends Thread +@@ -116,6 +116,7 @@ public class WatchdogThread extends Thread // Paper end - Different message for short timeout log.log( Level.SEVERE, "------------------------------" ); log.log( Level.SEVERE, "Server thread dump (Look for plugins here before reporting to Paper!):" ); // Paper diff --git a/patches/server/0254-Add-ray-tracing-methods-to-LivingEntity.patch b/patches/server/0253-Add-ray-tracing-methods-to-LivingEntity.patch similarity index 96% rename from patches/server/0254-Add-ray-tracing-methods-to-LivingEntity.patch rename to patches/server/0253-Add-ray-tracing-methods-to-LivingEntity.patch index 2994f0d956..4f70bb6125 100644 --- a/patches/server/0254-Add-ray-tracing-methods-to-LivingEntity.patch +++ b/patches/server/0253-Add-ray-tracing-methods-to-LivingEntity.patch @@ -28,7 +28,7 @@ index 0cf818fceddd76e7704fdc6625456787856b2815..ccdee183f02ab55723e16f41efce55dc switch (enumDirection) { case DOWN: diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java -index eb9d45fd330ad4ed194ed593ca15ed579ddb2c54..62e8d61f70c315f346f1f365c874c27e0bdd529c 100644 +index da896f299072360a23cdfd025ed6f151a0441d4e..831e8c32c85a45daff36449f2d6ef57a522fa7cf 100644 --- a/src/main/java/net/minecraft/world/entity/LivingEntity.java +++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java @@ -3718,6 +3718,23 @@ public abstract class LivingEntity extends Entity { @@ -52,7 +52,7 @@ index eb9d45fd330ad4ed194ed593ca15ed579ddb2c54..62e8d61f70c315f346f1f365c874c27e + return level.clip(raytrace); + } + - public int shieldBlockingDelay = level.paperConfig.shieldBlockingDelay; + public int shieldBlockingDelay = level.paperConfig().misc.shieldBlockingDelay; public int getShieldBlockingDelay() { diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java diff --git a/patches/server/0255-Expose-attack-cooldown-methods-for-Player.patch b/patches/server/0254-Expose-attack-cooldown-methods-for-Player.patch similarity index 92% rename from patches/server/0255-Expose-attack-cooldown-methods-for-Player.patch rename to patches/server/0254-Expose-attack-cooldown-methods-for-Player.patch index 8f1ba3c31b..5b92204354 100644 --- a/patches/server/0255-Expose-attack-cooldown-methods-for-Player.patch +++ b/patches/server/0254-Expose-attack-cooldown-methods-for-Player.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Expose attack cooldown methods for Player diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -index 47abdbaa2663efb4817396d49389f7f3719c5f74..60b016aed7c70385abb14b2b2266fc70adf788a6 100644 +index 61aa7b0299bf29302f0ce2d7a9fe89d25d0a92e6..7839f3c136cc7e9bdda2f121001acbd6ed2fd6b3 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java @@ -2505,6 +2505,21 @@ public class CraftPlayer extends CraftHumanEntity implements Player { diff --git a/patches/server/0256-Improve-death-events.patch b/patches/server/0255-Improve-death-events.patch similarity index 97% rename from patches/server/0256-Improve-death-events.patch rename to patches/server/0255-Improve-death-events.patch index 93116d75f4..b25cac063f 100644 --- a/patches/server/0256-Improve-death-events.patch +++ b/patches/server/0255-Improve-death-events.patch @@ -19,7 +19,7 @@ maybe more (please check patch overrides for drops for more): - players, armor stands, foxes, chested donkeys/llamas diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java -index 9e010074c289abd939cd9743307579bee7583b5c..db5f63dcb0b44a5ba0a1eae892415af73746d7e1 100644 +index 0ef0b7fa2af5ac6608f9b8b37317434f15df6bfa..67316da1b90024e58b572606798eba0f335db0bb 100644 --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java @@ -228,6 +228,10 @@ public class ServerPlayer extends Player { @@ -70,7 +70,7 @@ index 9e010074c289abd939cd9743307579bee7583b5c..db5f63dcb0b44a5ba0a1eae892415af7 } } diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java -index 62e8d61f70c315f346f1f365c874c27e0bdd529c..260f51f6a3d3a6da4ff9a0a3a67193abccb31e56 100644 +index 831e8c32c85a45daff36449f2d6ef57a522fa7cf..b4906b20b48badd4ebff662cb830b36f346b7977 100644 --- a/src/main/java/net/minecraft/world/entity/LivingEntity.java +++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java @@ -262,6 +262,7 @@ public abstract class LivingEntity extends Entity { @@ -220,7 +220,7 @@ index 62e8d61f70c315f346f1f365c874c27e0bdd529c..260f51f6a3d3a6da4ff9a0a3a67193ab // CraftBukkit start public int getExpReward() { diff --git a/src/main/java/net/minecraft/world/entity/Mob.java b/src/main/java/net/minecraft/world/entity/Mob.java -index 2bec7466fcd61731d4da1cefdea8c375def0be12..dc5cb767c91252b1049c76841cbe14b29287572c 100644 +index 95b042aed945adc72238ebeb19369d9b9568dc8d..2ffc99730c3d5dbdec63881a1eca07d5fbb1754e 100644 --- a/src/main/java/net/minecraft/world/entity/Mob.java +++ b/src/main/java/net/minecraft/world/entity/Mob.java @@ -1012,7 +1012,13 @@ public abstract class Mob extends LivingEntity { @@ -296,7 +296,7 @@ index c47884bab387647d99ed842b46f1c078ef9b6995..a3f3e06679cef10f50346e9cc6672ec9 public void addAdditionalSaveData(CompoundTag nbt) { super.addAdditionalSaveData(nbt); diff --git a/src/main/java/net/minecraft/world/entity/decoration/ArmorStand.java b/src/main/java/net/minecraft/world/entity/decoration/ArmorStand.java -index b2a64c75a9ef3ad2f1129cd7dc59d713c4768539..a885e4a63f9ffb70b305b6d8c0f0dedf5b3cbeef 100644 +index f94a74728bd7c02a7f8245c92e7916f0b669ee0d..cd54fa8f7bbcb6036e90f4ef7cdc01d7af835a13 100644 --- a/src/main/java/net/minecraft/world/entity/decoration/ArmorStand.java +++ b/src/main/java/net/minecraft/world/entity/decoration/ArmorStand.java @@ -752,7 +752,8 @@ public class ArmorStand extends LivingEntity { @@ -310,7 +310,7 @@ index b2a64c75a9ef3ad2f1129cd7dc59d713c4768539..a885e4a63f9ffb70b305b6d8c0f0dedf this.gameEvent(GameEvent.ENTITY_DIE); } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -index 60b016aed7c70385abb14b2b2266fc70adf788a6..6d5b004ffcca0ca76e065d5c5e8c0917154247d4 100644 +index 7839f3c136cc7e9bdda2f121001acbd6ed2fd6b3..c39e13bd897d1178900558d510de7367bd0bb3a2 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java @@ -2055,7 +2055,14 @@ public class CraftPlayer extends CraftHumanEntity implements Player { diff --git a/patches/server/0257-Allow-chests-to-be-placed-with-NBT-data.patch b/patches/server/0256-Allow-chests-to-be-placed-with-NBT-data.patch similarity index 100% rename from patches/server/0257-Allow-chests-to-be-placed-with-NBT-data.patch rename to patches/server/0256-Allow-chests-to-be-placed-with-NBT-data.patch diff --git a/patches/server/0258-Mob-Pathfinding-API.patch b/patches/server/0257-Mob-Pathfinding-API.patch similarity index 100% rename from patches/server/0258-Mob-Pathfinding-API.patch rename to patches/server/0257-Mob-Pathfinding-API.patch diff --git a/patches/server/0259-Implement-an-API-for-CanPlaceOn-and-CanDestroy-NBT-v.patch b/patches/server/0258-Implement-an-API-for-CanPlaceOn-and-CanDestroy-NBT-v.patch similarity index 100% rename from patches/server/0259-Implement-an-API-for-CanPlaceOn-and-CanDestroy-NBT-v.patch rename to patches/server/0258-Implement-an-API-for-CanPlaceOn-and-CanDestroy-NBT-v.patch diff --git a/patches/server/0260-Prevent-chunk-loading-from-Fluid-Flowing.patch b/patches/server/0259-Prevent-chunk-loading-from-Fluid-Flowing.patch similarity index 100% rename from patches/server/0260-Prevent-chunk-loading-from-Fluid-Flowing.patch rename to patches/server/0259-Prevent-chunk-loading-from-Fluid-Flowing.patch diff --git a/patches/server/0261-Prevent-Mob-AI-Rules-from-Loading-Chunks.patch b/patches/server/0260-Prevent-Mob-AI-Rules-from-Loading-Chunks.patch similarity index 100% rename from patches/server/0261-Prevent-Mob-AI-Rules-from-Loading-Chunks.patch rename to patches/server/0260-Prevent-Mob-AI-Rules-from-Loading-Chunks.patch diff --git a/patches/server/0262-Prevent-mob-spawning-from-loading-generating-chunks.patch b/patches/server/0261-Prevent-mob-spawning-from-loading-generating-chunks.patch similarity index 100% rename from patches/server/0262-Prevent-mob-spawning-from-loading-generating-chunks.patch rename to patches/server/0261-Prevent-mob-spawning-from-loading-generating-chunks.patch diff --git a/patches/server/0263-Implement-furnace-cook-speed-multiplier-API.patch b/patches/server/0262-Implement-furnace-cook-speed-multiplier-API.patch similarity index 100% rename from patches/server/0263-Implement-furnace-cook-speed-multiplier-API.patch rename to patches/server/0262-Implement-furnace-cook-speed-multiplier-API.patch diff --git a/patches/server/0264-Catch-JsonParseException-in-Entity-and-TE-names.patch b/patches/server/0263-Catch-JsonParseException-in-Entity-and-TE-names.patch similarity index 100% rename from patches/server/0264-Catch-JsonParseException-in-Entity-and-TE-names.patch rename to patches/server/0263-Catch-JsonParseException-in-Entity-and-TE-names.patch diff --git a/patches/server/0265-Honor-EntityAgeable.ageLock.patch b/patches/server/0264-Honor-EntityAgeable.ageLock.patch similarity index 100% rename from patches/server/0265-Honor-EntityAgeable.ageLock.patch rename to patches/server/0264-Honor-EntityAgeable.ageLock.patch diff --git a/patches/server/0266-Configurable-connection-throttle-kick-message.patch b/patches/server/0265-Configurable-connection-throttle-kick-message.patch similarity index 55% rename from patches/server/0266-Configurable-connection-throttle-kick-message.patch rename to patches/server/0265-Configurable-connection-throttle-kick-message.patch index 5d2614d752..29956aa4b1 100644 --- a/patches/server/0266-Configurable-connection-throttle-kick-message.patch +++ b/patches/server/0265-Configurable-connection-throttle-kick-message.patch @@ -4,24 +4,8 @@ Date: Tue, 2 Oct 2018 09:57:50 +0100 Subject: [PATCH] Configurable connection throttle kick message -diff --git a/src/main/java/com/destroystokyo/paper/PaperConfig.java b/src/main/java/com/destroystokyo/paper/PaperConfig.java -index 5def23f470c9737884bdf7551e426faf887bca9c..51dd358137d37eb078aff036ccf12db7f01c469b 100644 ---- a/src/main/java/com/destroystokyo/paper/PaperConfig.java -+++ b/src/main/java/com/destroystokyo/paper/PaperConfig.java -@@ -294,6 +294,11 @@ public class PaperConfig { - authenticationServersDownKickMessage = Strings.emptyToNull(getString("messages.kick.authentication-servers-down", authenticationServersDownKickMessage)); - } - -+ public static String connectionThrottleKickMessage = "Connection throttled! Please wait before reconnecting."; -+ private static void connectionThrottleKickMessage() { -+ connectionThrottleKickMessage = getString("messages.kick.connection-throttle", connectionThrottleKickMessage); -+ } -+ - private static void savePlayerData() { - Object val = config.get("settings.save-player-data"); - if (val instanceof Boolean) { diff --git a/src/main/java/net/minecraft/server/network/ServerHandshakePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerHandshakePacketListenerImpl.java -index 4170bda451df3db43e7d57d87d1abb81934d7dad..941a9d8addd44e95c467b34f77658592b9f4ef06 100644 +index 4170bda451df3db43e7d57d87d1abb81934d7dad..14fa831c9984e72ae2185c4f9e07f65b0c2ed67c 100644 --- a/src/main/java/net/minecraft/server/network/ServerHandshakePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerHandshakePacketListenerImpl.java @@ -49,7 +49,7 @@ public class ServerHandshakePacketListenerImpl implements ServerHandshakePacketL @@ -29,7 +13,7 @@ index 4170bda451df3db43e7d57d87d1abb81934d7dad..941a9d8addd44e95c467b34f77658592 if (ServerHandshakePacketListenerImpl.throttleTracker.containsKey(address) && !"127.0.0.1".equals(address.getHostAddress()) && currentTime - ServerHandshakePacketListenerImpl.throttleTracker.get(address) < connectionThrottle) { ServerHandshakePacketListenerImpl.throttleTracker.put(address, currentTime); - MutableComponent chatmessage = Component.literal("Connection throttled! Please wait before reconnecting."); -+ MutableComponent chatmessage = Component.literal(com.destroystokyo.paper.PaperConfig.connectionThrottleKickMessage); // Paper - Configurable connection throttle kick message ++ MutableComponent chatmessage = Component.literal(io.papermc.paper.configuration.GlobalConfiguration.get().messages.kick.connectionThrottle); // Paper - Configurable connection throttle kick message this.connection.send(new ClientboundLoginDisconnectPacket(chatmessage)); this.connection.disconnect(chatmessage); return; diff --git a/patches/server/0267-Hook-into-CB-plugin-rewrites.patch b/patches/server/0266-Hook-into-CB-plugin-rewrites.patch similarity index 100% rename from patches/server/0267-Hook-into-CB-plugin-rewrites.patch rename to patches/server/0266-Hook-into-CB-plugin-rewrites.patch diff --git a/patches/server/0268-PreSpawnerSpawnEvent.patch b/patches/server/0267-PreSpawnerSpawnEvent.patch similarity index 94% rename from patches/server/0268-PreSpawnerSpawnEvent.patch rename to patches/server/0267-PreSpawnerSpawnEvent.patch index 1db8901d93..ad93f9fbae 100644 --- a/patches/server/0268-PreSpawnerSpawnEvent.patch +++ b/patches/server/0267-PreSpawnerSpawnEvent.patch @@ -9,7 +9,7 @@ SpawnerSpawnEvent gets called instead of the CreatureSpawnEvent for spawners. diff --git a/src/main/java/net/minecraft/world/level/BaseSpawner.java b/src/main/java/net/minecraft/world/level/BaseSpawner.java -index 031bb42a1921966e8dd45c9e57dcd09f2dece7fb..3e8848cbf22902b1a0e015ecf9e330c9235bc638 100644 +index ffb7a0b7c1ae53e1340f2cdb7840ee2c89982dbe..0be0c7a323277093a6f8e476048eb9ee8712cbc9 100644 --- a/src/main/java/net/minecraft/world/level/BaseSpawner.java +++ b/src/main/java/net/minecraft/world/level/BaseSpawner.java @@ -130,11 +130,11 @@ public abstract class BaseSpawner { diff --git a/patches/server/0269-Add-LivingEntity-getTargetEntity.patch b/patches/server/0268-Add-LivingEntity-getTargetEntity.patch similarity index 96% rename from patches/server/0269-Add-LivingEntity-getTargetEntity.patch rename to patches/server/0268-Add-LivingEntity-getTargetEntity.patch index 2b35aa9de9..e1ca7bb292 100644 --- a/patches/server/0269-Add-LivingEntity-getTargetEntity.patch +++ b/patches/server/0268-Add-LivingEntity-getTargetEntity.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Add LivingEntity#getTargetEntity diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java -index 260f51f6a3d3a6da4ff9a0a3a67193abccb31e56..370ec54f5c6741e7c9f3630e7f42ea7d7a7d1423 100644 +index b4906b20b48badd4ebff662cb830b36f346b7977..9538c026f483cdfe2696e13208914eb25ad090b5 100644 --- a/src/main/java/net/minecraft/world/entity/LivingEntity.java +++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java @@ -116,6 +116,7 @@ import net.minecraft.world.level.storage.loot.LootTable; @@ -52,7 +52,7 @@ index 260f51f6a3d3a6da4ff9a0a3a67193abccb31e56..370ec54f5c6741e7c9f3630e7f42ea7d + return result; + } + - public int shieldBlockingDelay = level.paperConfig.shieldBlockingDelay; + public int shieldBlockingDelay = level.paperConfig().misc.shieldBlockingDelay; public int getShieldBlockingDelay() { diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java diff --git a/patches/server/0270-Add-sun-related-API.patch b/patches/server/0269-Add-sun-related-API.patch similarity index 100% rename from patches/server/0270-Add-sun-related-API.patch rename to patches/server/0269-Add-sun-related-API.patch diff --git a/patches/server/0271-Turtle-API.patch b/patches/server/0270-Turtle-API.patch similarity index 100% rename from patches/server/0271-Turtle-API.patch rename to patches/server/0270-Turtle-API.patch diff --git a/patches/server/0272-Call-player-spectator-target-events-and-improve-impl.patch b/patches/server/0271-Call-player-spectator-target-events-and-improve-impl.patch similarity index 97% rename from patches/server/0272-Call-player-spectator-target-events-and-improve-impl.patch rename to patches/server/0271-Call-player-spectator-target-events-and-improve-impl.patch index 76559491a9..96be182640 100644 --- a/patches/server/0272-Call-player-spectator-target-events-and-improve-impl.patch +++ b/patches/server/0271-Call-player-spectator-target-events-and-improve-impl.patch @@ -19,7 +19,7 @@ spectate the target entity. Co-authored-by: Spottedleaf diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java -index db5f63dcb0b44a5ba0a1eae892415af73746d7e1..46c26fb9919b468409ac71cbde48419fbbe46846 100644 +index 67316da1b90024e58b572606798eba0f335db0bb..541029d263f55588ae0f232e2692c7218e471f6f 100644 --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java @@ -1880,14 +1880,58 @@ public class ServerPlayer extends Player { diff --git a/patches/server/0273-MC-50319-Check-other-worlds-for-shooter-of-projectil.patch b/patches/server/0272-MC-50319-Check-other-worlds-for-shooter-of-projectil.patch similarity index 94% rename from patches/server/0273-MC-50319-Check-other-worlds-for-shooter-of-projectil.patch rename to patches/server/0272-MC-50319-Check-other-worlds-for-shooter-of-projectil.patch index 1250865174..b766300549 100644 --- a/patches/server/0273-MC-50319-Check-other-worlds-for-shooter-of-projectil.patch +++ b/patches/server/0272-MC-50319-Check-other-worlds-for-shooter-of-projectil.patch @@ -11,7 +11,7 @@ If the projectile fails to find the shooter in the current world, check other worlds. diff --git a/src/main/java/net/minecraft/world/entity/projectile/Projectile.java b/src/main/java/net/minecraft/world/entity/projectile/Projectile.java -index cadcd3060e1c0e459ea064d2ac7a3ab5a4214d1d..80fdb953d7a49b05108672e18ea326182fa7cfd6 100644 +index 273e1a6f4fd117e98732c66d9b168cab1d588127..2dfe2e655026e6da1f548779ab3b455a6e42fb0c 100644 --- a/src/main/java/net/minecraft/world/entity/projectile/Projectile.java +++ b/src/main/java/net/minecraft/world/entity/projectile/Projectile.java @@ -57,6 +57,18 @@ public abstract class Projectile extends Entity { diff --git a/patches/server/0274-Add-Velocity-IP-Forwarding-Support.patch b/patches/server/0273-Add-Velocity-IP-Forwarding-Support.patch similarity index 70% rename from patches/server/0274-Add-Velocity-IP-Forwarding-Support.patch rename to patches/server/0273-Add-Velocity-IP-Forwarding-Support.patch index 824e907695..476ebdc265 100644 --- a/patches/server/0274-Add-Velocity-IP-Forwarding-Support.patch +++ b/patches/server/0273-Add-Velocity-IP-Forwarding-Support.patch @@ -13,57 +13,15 @@ of messages, is packed into a binary format that is smaller than BungeeCord's forwarding, and is integrated into the Minecraft login process by using the 1.13 login plugin message packet. -diff --git a/src/main/java/com/destroystokyo/paper/PaperConfig.java b/src/main/java/com/destroystokyo/paper/PaperConfig.java -index 51dd358137d37eb078aff036ccf12db7f01c469b..65df47283afc4aa1453fdd18e65e6f8cb3bd0c3f 100644 ---- a/src/main/java/com/destroystokyo/paper/PaperConfig.java -+++ b/src/main/java/com/destroystokyo/paper/PaperConfig.java -@@ -9,6 +9,7 @@ import java.io.IOException; - import java.lang.reflect.InvocationTargetException; - import java.lang.reflect.Method; - import java.lang.reflect.Modifier; -+import java.nio.charset.StandardCharsets; - import java.util.HashMap; - import java.util.List; - import java.util.Map; -@@ -265,7 +266,7 @@ public class PaperConfig { - } - - public static boolean isProxyOnlineMode() { -- return Bukkit.getOnlineMode() || (SpigotConfig.bungee && bungeeOnlineMode); -+ return Bukkit.getOnlineMode() || (SpigotConfig.bungee && bungeeOnlineMode) || (velocitySupport && velocityOnlineMode); - } - - public static int packetInSpamThreshold = 300; -@@ -348,6 +349,20 @@ public class PaperConfig { - tabSpamLimit = getInt("settings.spam-limiter.tab-spam-limit", tabSpamLimit); - } - -+ public static boolean velocitySupport; -+ public static boolean velocityOnlineMode; -+ public static byte[] velocitySecretKey; -+ private static void velocitySupport() { -+ velocitySupport = getBoolean("settings.velocity-support.enabled", false); -+ velocityOnlineMode = getBoolean("settings.velocity-support.online-mode", false); -+ String secret = getString("settings.velocity-support.secret", ""); -+ if (velocitySupport && secret.isEmpty()) { -+ fatal("Velocity support is enabled, but no secret key was specified. A secret key is required!"); -+ } else { -+ velocitySecretKey = secret.getBytes(StandardCharsets.UTF_8); -+ } -+ } -+ - public static boolean asyncChunks = false; - private static void asyncChunks() { - ConfigurationSection section; diff --git a/src/main/java/com/destroystokyo/paper/proxy/VelocityProxy.java b/src/main/java/com/destroystokyo/paper/proxy/VelocityProxy.java new file mode 100644 -index 0000000000000000000000000000000000000000..41d73aa91fb401612e087aa1b7278ba61d28bf3a +index 0000000000000000000000000000000000000000..74b3265bba78491f462c15709a31bc44b4e4bea8 --- /dev/null +++ b/src/main/java/com/destroystokyo/paper/proxy/VelocityProxy.java @@ -0,0 +1,66 @@ +package com.destroystokyo.paper.proxy; + -+import com.destroystokyo.paper.PaperConfig; ++import io.papermc.paper.configuration.GlobalConfiguration; +import com.google.common.net.InetAddresses; +import com.mojang.authlib.GameProfile; +import com.mojang.authlib.properties.Property; @@ -90,7 +48,7 @@ index 0000000000000000000000000000000000000000..41d73aa91fb401612e087aa1b7278ba6 + + try { + final Mac mac = Mac.getInstance("HmacSHA256"); -+ mac.init(new SecretKeySpec(PaperConfig.velocitySecretKey, "HmacSHA256")); ++ mac.init(new SecretKeySpec(GlobalConfiguration.get().proxies.velocity.secret.getBytes(java.nio.charset.StandardCharsets.UTF_8), "HmacSHA256")); + final byte[] mySignature = mac.doFinal(data); + if (!MessageDigest.isEqual(signature, mySignature)) { + return false; @@ -128,18 +86,10 @@ index 0000000000000000000000000000000000000000..41d73aa91fb401612e087aa1b7278ba6 + } +} diff --git a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java -index 136ff7de4ffb91d3fc84a90560a2f5db84703cff..cbb0865b08185d1c9dc95f6dc5507cc39f92f15e 100644 +index e27ce986dab7b249f8a69e1d94cfbd91bab5c4b9..1e4c306569fa96327dc99bb5dd6b3a749e60813e 100644 --- a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java -@@ -46,6 +46,7 @@ import org.bukkit.craftbukkit.util.Waitable; - import org.bukkit.event.player.AsyncPlayerPreLoginEvent; - import org.bukkit.event.player.PlayerPreLoginEvent; - // CraftBukkit end -+import io.netty.buffer.Unpooled; // Paper - - public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener { - -@@ -69,6 +70,7 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener +@@ -69,6 +69,7 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener @Nullable private ProfilePublicKey playerProfilePublicKey; public String hostname = ""; // CraftBukkit - add field @@ -147,14 +97,14 @@ index 136ff7de4ffb91d3fc84a90560a2f5db84703cff..cbb0865b08185d1c9dc95f6dc5507cc3 public ServerLoginPacketListenerImpl(MinecraftServer server, Connection connection) { this.state = ServerLoginPacketListenerImpl.State.HELLO; -@@ -279,6 +281,14 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener +@@ -279,6 +280,14 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener this.state = ServerLoginPacketListenerImpl.State.KEY; this.connection.send(new ClientboundHelloPacket("", this.server.getKeyPair().getPublic().getEncoded(), this.nonce)); } else { + // Paper start - Velocity support -+ if (com.destroystokyo.paper.PaperConfig.velocitySupport) { ++ if (io.papermc.paper.configuration.GlobalConfiguration.get().proxies.velocity.enabled) { + this.velocityLoginMessageId = java.util.concurrent.ThreadLocalRandom.current().nextInt(); -+ net.minecraft.network.protocol.login.ClientboundCustomQueryPacket packet1 = new net.minecraft.network.protocol.login.ClientboundCustomQueryPacket(this.velocityLoginMessageId, com.destroystokyo.paper.proxy.VelocityProxy.PLAYER_INFO_CHANNEL, new net.minecraft.network.FriendlyByteBuf(Unpooled.EMPTY_BUFFER)); ++ net.minecraft.network.protocol.login.ClientboundCustomQueryPacket packet1 = new net.minecraft.network.protocol.login.ClientboundCustomQueryPacket(this.velocityLoginMessageId, com.destroystokyo.paper.proxy.VelocityProxy.PLAYER_INFO_CHANNEL, new net.minecraft.network.FriendlyByteBuf(io.netty.buffer.Unpooled.EMPTY_BUFFER)); + this.connection.send(packet1); + return; + } @@ -162,12 +112,12 @@ index 136ff7de4ffb91d3fc84a90560a2f5db84703cff..cbb0865b08185d1c9dc95f6dc5507cc3 // Spigot start // Paper start - Cache authenticator threads authenticatorPool.execute(new Runnable() { -@@ -392,6 +402,12 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener +@@ -392,6 +401,12 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener public class LoginHandler { public void fireEvents() throws Exception { + // Paper start - Velocity support -+ if (ServerLoginPacketListenerImpl.this.velocityLoginMessageId == -1 && com.destroystokyo.paper.PaperConfig.velocitySupport) { ++ if (ServerLoginPacketListenerImpl.this.velocityLoginMessageId == -1 && io.papermc.paper.configuration.GlobalConfiguration.get().proxies.velocity.enabled) { + disconnect("This server requires you to connect with Velocity."); + return; + } @@ -175,12 +125,12 @@ index 136ff7de4ffb91d3fc84a90560a2f5db84703cff..cbb0865b08185d1c9dc95f6dc5507cc3 String playerName = ServerLoginPacketListenerImpl.this.gameProfile.getName(); java.net.InetAddress address = ((java.net.InetSocketAddress) ServerLoginPacketListenerImpl.this.connection.getRemoteAddress()).getAddress(); java.util.UUID uniqueId = ServerLoginPacketListenerImpl.this.gameProfile.getId(); -@@ -439,6 +455,40 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener +@@ -439,6 +454,40 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener // Spigot end public void handleCustomQueryPacket(ServerboundCustomQueryPacket packet) { + // Paper start - Velocity support -+ if (com.destroystokyo.paper.PaperConfig.velocitySupport && packet.getTransactionId() == this.velocityLoginMessageId) { ++ if (io.papermc.paper.configuration.GlobalConfiguration.get().proxies.velocity.enabled && packet.getTransactionId() == this.velocityLoginMessageId) { + net.minecraft.network.FriendlyByteBuf buf = packet.getData(); + if (buf == null) { + this.disconnect("This server requires you to connect with Velocity."); @@ -217,7 +167,7 @@ index 136ff7de4ffb91d3fc84a90560a2f5db84703cff..cbb0865b08185d1c9dc95f6dc5507cc3 } diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -index 907de15edda4f9b1165d985ff6b2c2a8317f06b5..ff47276975bac1dfa83c310a8944ec6335247a54 100644 +index ac7a1408efe242d34200d3f27333a1df72b5b7dd..9a9b6ceab49e78a6b5523825e571186f6f610212 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java @@ -755,7 +755,7 @@ public final class CraftServer implements Server { @@ -225,7 +175,7 @@ index 907de15edda4f9b1165d985ff6b2c2a8317f06b5..ff47276975bac1dfa83c310a8944ec63 public long getConnectionThrottle() { // Spigot Start - Automatically set connection throttle for bungee configurations - if (org.spigotmc.SpigotConfig.bungee) { -+ if (org.spigotmc.SpigotConfig.bungee || com.destroystokyo.paper.PaperConfig.velocitySupport) { // Paper - Velocity support ++ if (org.spigotmc.SpigotConfig.bungee || io.papermc.paper.configuration.GlobalConfiguration.get().proxies.velocity.enabled) { // Paper - Velocity support return -1; } else { return this.configuration.getInt("settings.connection-throttle"); diff --git a/patches/server/0275-Add-more-Witch-API.patch b/patches/server/0274-Add-more-Witch-API.patch similarity index 100% rename from patches/server/0275-Add-more-Witch-API.patch rename to patches/server/0274-Add-more-Witch-API.patch diff --git a/patches/server/0276-Check-Drowned-for-Villager-Aggression-Config.patch b/patches/server/0275-Check-Drowned-for-Villager-Aggression-Config.patch similarity index 100% rename from patches/server/0276-Check-Drowned-for-Villager-Aggression-Config.patch rename to patches/server/0275-Check-Drowned-for-Villager-Aggression-Config.patch diff --git a/patches/server/0277-Add-option-to-prevent-players-from-moving-into-unloa.patch b/patches/server/0276-Add-option-to-prevent-players-from-moving-into-unloa.patch similarity index 79% rename from patches/server/0277-Add-option-to-prevent-players-from-moving-into-unloa.patch rename to patches/server/0276-Add-option-to-prevent-players-from-moving-into-unloa.patch index aad338d79c..9dcbbf3e72 100644 --- a/patches/server/0277-Add-option-to-prevent-players-from-moving-into-unloa.patch +++ b/patches/server/0276-Add-option-to-prevent-players-from-moving-into-unloa.patch @@ -5,22 +5,8 @@ Subject: [PATCH] Add option to prevent players from moving into unloaded chunks #1551 -diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -index 85ad9a1a29d0cb11f552d8f34b210f1bf4bdd810..0078fb8df378058a6ddeb5dbea4132c8c9c3fa64 100644 ---- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -@@ -452,4 +452,9 @@ public class PaperWorldConfig { - waterOverLavaFlowSpeed = getInt("water-over-lava-flow-speed", 5); - log("Water over lava flow speed: " + waterOverLavaFlowSpeed); - } -+ -+ public boolean preventMovingIntoUnloadedChunks = false; -+ private void preventMovingIntoUnloadedChunks() { -+ preventMovingIntoUnloadedChunks = getBoolean("prevent-moving-into-unloaded-chunks", false); -+ } - } diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index 27725c9c1ad03f8f2263c027ebf6f175efb8b986..eea6bd6fa0e08c6242d13d2458bdcbdb67bfbb57 100644 +index 2d041220607e35b8adf00c6378336db0e137e79a..3716906566e09617cb12cd4fd0f37cb48a35a7fd 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java @@ -525,9 +525,9 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser @@ -41,7 +27,7 @@ index 27725c9c1ad03f8f2263c027ebf6f175efb8b986..eea6bd6fa0e08c6242d13d2458bdcbdb speed *= 2f; // TODO: Get the speed of the vehicle instead of the player + // Paper start - Prevent moving into unloaded chunks -+ if (player.level.paperConfig.preventMovingIntoUnloadedChunks && ( ++ if (player.level.paperConfig().chunks.preventMovingIntoUnloadedChunks && ( + !worldserver.areChunksLoadedForMove(this.player.getBoundingBox().expandTowards(new Vec3(toX, toY, toZ).subtract(this.player.position()))) || + !worldserver.areChunksLoadedForMove(entity.getBoundingBox().expandTowards(new Vec3(toX, toY, toZ).subtract(entity.position()))) + )) { @@ -71,7 +57,7 @@ index 27725c9c1ad03f8f2263c027ebf6f175efb8b986..eea6bd6fa0e08c6242d13d2458bdcbdb speed = this.player.getAbilities().walkingSpeed * 10f; } + // Paper start - Prevent moving into unloaded chunks -+ if (player.level.paperConfig.preventMovingIntoUnloadedChunks && (this.player.getX() != toX || this.player.getZ() != toZ) && !worldserver.areChunksLoadedForMove(this.player.getBoundingBox().expandTowards(new Vec3(toX, toY, toZ).subtract(this.player.position())))) { ++ if (player.level.paperConfig().chunks.preventMovingIntoUnloadedChunks && (this.player.getX() != toX || this.player.getZ() != toZ) && !worldserver.areChunksLoadedForMove(this.player.getBoundingBox().expandTowards(new Vec3(toX, toY, toZ).subtract(this.player.position())))) { + this.internalTeleport(this.player.getX(), this.player.getY(), this.player.getZ(), this.player.getYRot(), this.player.getXRot(), Collections.emptySet(), true); + return; + } diff --git a/patches/server/0278-Reset-players-airTicks-on-respawn.patch b/patches/server/0277-Reset-players-airTicks-on-respawn.patch similarity index 89% rename from patches/server/0278-Reset-players-airTicks-on-respawn.patch rename to patches/server/0277-Reset-players-airTicks-on-respawn.patch index cd26f2bf42..46454f5c7c 100644 --- a/patches/server/0278-Reset-players-airTicks-on-respawn.patch +++ b/patches/server/0277-Reset-players-airTicks-on-respawn.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Reset players airTicks on respawn diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java -index 46c26fb9919b468409ac71cbde48419fbbe46846..222452a5549e29ef43d183390cc41783aeb8f3e9 100644 +index 541029d263f55588ae0f232e2692c7218e471f6f..15b9186ad0e52a55a3f523e4f1d96ef34ca99145 100644 --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java @@ -2293,6 +2293,7 @@ public class ServerPlayer extends Player { diff --git a/patches/server/0279-Don-t-sleep-after-profile-lookups-if-not-needed.patch b/patches/server/0278-Don-t-sleep-after-profile-lookups-if-not-needed.patch similarity index 100% rename from patches/server/0279-Don-t-sleep-after-profile-lookups-if-not-needed.patch rename to patches/server/0278-Don-t-sleep-after-profile-lookups-if-not-needed.patch diff --git a/patches/server/0280-Improve-Server-Thread-Pool-and-Thread-Priorities.patch b/patches/server/0279-Improve-Server-Thread-Pool-and-Thread-Priorities.patch similarity index 98% rename from patches/server/0280-Improve-Server-Thread-Pool-and-Thread-Priorities.patch rename to patches/server/0279-Improve-Server-Thread-Pool-and-Thread-Priorities.patch index b92d03b4e2..d1c15a3368 100644 --- a/patches/server/0280-Improve-Server-Thread-Pool-and-Thread-Priorities.patch +++ b/patches/server/0279-Improve-Server-Thread-Pool-and-Thread-Priorities.patch @@ -58,7 +58,7 @@ index d7e22ddf89619b58516ccef1d75a4c33df61b73c..70b8b86ed827217e536e35a690160adf return executorService; } diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index 2ad76722a54d4cc1a4f4799d14d0148c86e93198..7af89d152b13870a8495f94dffd34c948a9148fa 100644 +index ae210087f3f0af1f98064b39e817d4f8584a1b7c..f8b2bd7937aab3d70492a61918f7564b56639a3e 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java @@ -303,6 +303,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop +Date: Sun, 18 Nov 2018 19:49:56 +0000 +Subject: [PATCH] Make the default permission message configurable + + +diff --git a/src/main/java/com/destroystokyo/paper/PaperCommand.java b/src/main/java/com/destroystokyo/paper/PaperCommand.java +index e75134a6aa92c86aa86430c7603e111280077d16..c5b005e7a803c848dca31dc76d1ec83ffca42950 100644 +--- a/src/main/java/com/destroystokyo/paper/PaperCommand.java ++++ b/src/main/java/com/destroystokyo/paper/PaperCommand.java +@@ -56,7 +56,7 @@ public class PaperCommand extends Command { + + private static boolean testPermission(CommandSender commandSender, String permission) { + if (commandSender.hasPermission(BASE_PERM + permission) || commandSender.hasPermission("bukkit.command.paper")) return true; +- commandSender.sendMessage(text("I'm sorry, but you do not have permission to perform this command. Please contact the server administrators if you believe that this is in error.", RED)); ++ commandSender.sendMessage(Bukkit.getPermissionMessage()); // Sorry, kashike + return false; + } + +diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java +index 9a9b6ceab49e78a6b5523825e571186f6f610212..fe5a676abb5c47045f6ca1a6dde78d9859b43abe 100644 +--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java ++++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java +@@ -2586,6 +2586,11 @@ public final class CraftServer implements Server { + return io.papermc.paper.configuration.GlobalConfiguration.get().commands.suggestPlayerNamesWhenNullTabCompletions; + } + ++ @Override ++ public String getPermissionMessage() { ++ return io.papermc.paper.configuration.GlobalConfiguration.get().messages.noPermission; ++ } ++ + @Override + public com.destroystokyo.paper.profile.PlayerProfile createProfile(@Nonnull UUID uuid) { + return createProfile(uuid, null); diff --git a/patches/server/0286-Make-the-default-permission-message-configurable.patch b/patches/server/0286-Make-the-default-permission-message-configurable.patch deleted file mode 100644 index 328e4626b3..0000000000 --- a/patches/server/0286-Make-the-default-permission-message-configurable.patch +++ /dev/null @@ -1,59 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Shane Freeder -Date: Sun, 18 Nov 2018 19:49:56 +0000 -Subject: [PATCH] Make the default permission message configurable - - -diff --git a/src/main/java/com/destroystokyo/paper/PaperCommand.java b/src/main/java/com/destroystokyo/paper/PaperCommand.java -index 0c7738412ce5c9b8c66e3f1c1e13fcd2a2154195..d20fd81524518459635c1b78770de087ad178743 100644 ---- a/src/main/java/com/destroystokyo/paper/PaperCommand.java -+++ b/src/main/java/com/destroystokyo/paper/PaperCommand.java -@@ -56,7 +56,7 @@ public class PaperCommand extends Command { - - private static boolean testPermission(CommandSender commandSender, String permission) { - if (commandSender.hasPermission(BASE_PERM + permission) || commandSender.hasPermission("bukkit.command.paper")) return true; -- commandSender.sendMessage(text("I'm sorry, but you do not have permission to perform this command. Please contact the server administrators if you believe that this is in error.", RED)); -+ commandSender.sendMessage(Bukkit.getPermissionMessage()); // Sorry, kashike - return false; - } - -diff --git a/src/main/java/com/destroystokyo/paper/PaperConfig.java b/src/main/java/com/destroystokyo/paper/PaperConfig.java -index 65df47283afc4aa1453fdd18e65e6f8cb3bd0c3f..80306b595b555d4057975a07872084a83abe78ae 100644 ---- a/src/main/java/com/destroystokyo/paper/PaperConfig.java -+++ b/src/main/java/com/destroystokyo/paper/PaperConfig.java -@@ -20,6 +20,7 @@ import java.util.regex.Pattern; - import com.google.common.collect.Lists; - import net.minecraft.server.MinecraftServer; - import org.bukkit.Bukkit; -+import org.bukkit.ChatColor; - import org.bukkit.command.Command; - import org.bukkit.configuration.ConfigurationSection; - import org.bukkit.configuration.InvalidConfigurationException; -@@ -300,6 +301,11 @@ public class PaperConfig { - connectionThrottleKickMessage = getString("messages.kick.connection-throttle", connectionThrottleKickMessage); - } - -+ public static String noPermissionMessage = "&cI'm sorry, but you do not have permission to perform this command. Please contact the server administrators if you believe that this is in error."; -+ private static void noPermissionMessage() { -+ noPermissionMessage = ChatColor.translateAlternateColorCodes('&', getString("messages.no-permission", noPermissionMessage)); -+ } -+ - private static void savePlayerData() { - Object val = config.get("settings.save-player-data"); - if (val instanceof Boolean) { -diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -index ff47276975bac1dfa83c310a8944ec6335247a54..35a652b6a2c569787ecb32029de05ef1c6c9de6f 100644 ---- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java -+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -@@ -2589,6 +2589,11 @@ public final class CraftServer implements Server { - return com.destroystokyo.paper.PaperConfig.suggestPlayersWhenNullTabCompletions; - } - -+ @Override -+ public String getPermissionMessage() { -+ return com.destroystokyo.paper.PaperConfig.noPermissionMessage; -+ } -+ - @Override - public com.destroystokyo.paper.profile.PlayerProfile createProfile(@Nonnull UUID uuid) { - return createProfile(uuid, null); diff --git a/patches/server/0287-Prevent-rayTrace-from-loading-chunks.patch b/patches/server/0286-Prevent-rayTrace-from-loading-chunks.patch similarity index 100% rename from patches/server/0287-Prevent-rayTrace-from-loading-chunks.patch rename to patches/server/0286-Prevent-rayTrace-from-loading-chunks.patch diff --git a/patches/server/0288-Handle-Large-Packets-disconnecting-client.patch b/patches/server/0287-Handle-Large-Packets-disconnecting-client.patch similarity index 100% rename from patches/server/0288-Handle-Large-Packets-disconnecting-client.patch rename to patches/server/0287-Handle-Large-Packets-disconnecting-client.patch diff --git a/patches/server/0289-force-entity-dismount-during-teleportation.patch b/patches/server/0288-force-entity-dismount-during-teleportation.patch similarity index 90% rename from patches/server/0289-force-entity-dismount-during-teleportation.patch rename to patches/server/0288-force-entity-dismount-during-teleportation.patch index 20d16505d4..7fb448da6d 100644 --- a/patches/server/0289-force-entity-dismount-during-teleportation.patch +++ b/patches/server/0288-force-entity-dismount-during-teleportation.patch @@ -20,7 +20,7 @@ this is going to be the best soultion all around. Improvements/suggestions welcome! diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java -index 222452a5549e29ef43d183390cc41783aeb8f3e9..3e50915041041486dc6dd939609bcd2673cd2ad2 100644 +index 15b9186ad0e52a55a3f523e4f1d96ef34ca99145..2e42a61e315a6857ca8b2ef4a63c974057a254cb 100644 --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java @@ -1336,11 +1336,13 @@ public class ServerPlayer extends Player { @@ -41,10 +41,10 @@ index 222452a5549e29ef43d183390cc41783aeb8f3e9..3e50915041041486dc6dd939609bcd26 if (entity1 != entity && this.connection != null) { diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java -index bae9afa3f56fed4bd00e1ce5e760935829c1c751..df59b8252e8182519c587ed27feca4963a4d57e9 100644 +index d020cbe64e13b479e22a8f6c090165390663af63..a5e9b15d52a0134060b9f815560fa20ee610d506 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java -@@ -2313,11 +2313,16 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource { +@@ -2312,11 +2312,16 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource { } public void removeVehicle() { @@ -62,7 +62,7 @@ index bae9afa3f56fed4bd00e1ce5e760935829c1c751..df59b8252e8182519c587ed27feca496 } } -@@ -2380,7 +2385,10 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource { +@@ -2379,7 +2384,10 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource { return true; // CraftBukkit } @@ -74,7 +74,7 @@ index bae9afa3f56fed4bd00e1ce5e760935829c1c751..df59b8252e8182519c587ed27feca496 if (entity.getVehicle() == this) { throw new IllegalStateException("Use x.stopRiding(y), not y.removePassenger(x)"); } else { -@@ -2390,7 +2398,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource { +@@ -2389,7 +2397,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource { if (this.getBukkitEntity() instanceof Vehicle && entity.getBukkitEntity() instanceof LivingEntity) { VehicleExitEvent event = new VehicleExitEvent( (Vehicle) this.getBukkitEntity(), @@ -83,7 +83,7 @@ index bae9afa3f56fed4bd00e1ce5e760935829c1c751..df59b8252e8182519c587ed27feca496 ); // Suppress during worldgen if (this.valid) { -@@ -2404,7 +2412,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource { +@@ -2403,7 +2411,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource { } // CraftBukkit end // Spigot start @@ -93,7 +93,7 @@ index bae9afa3f56fed4bd00e1ce5e760935829c1c751..df59b8252e8182519c587ed27feca496 if (this.valid) { Bukkit.getPluginManager().callEvent(event); diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java -index 370ec54f5c6741e7c9f3630e7f42ea7d7a7d1423..3ea28ff50d409d1d234d17f62207b0585386a607 100644 +index 9538c026f483cdfe2696e13208914eb25ad090b5..7446b9d43647faa042fccb912833c2ef0d0261c4 100644 --- a/src/main/java/net/minecraft/world/entity/LivingEntity.java +++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java @@ -3379,9 +3379,15 @@ public abstract class LivingEntity extends Entity { @@ -114,7 +114,7 @@ index 370ec54f5c6741e7c9f3630e7f42ea7d7a7d1423..3ea28ff50d409d1d234d17f62207b058 this.dismountVehicle(entity); } diff --git a/src/main/java/net/minecraft/world/entity/player/Player.java b/src/main/java/net/minecraft/world/entity/player/Player.java -index ce34b94fa1d8d33cc0492841e1cbfb59be7600f4..bac822f72cf8b2c6858343cf80a59284b9118ab6 100644 +index 9dad71368225d86598f02962b42659bc601ce144..6b7aea148b7a979201dd51bf842a552644fd0a63 100644 --- a/src/main/java/net/minecraft/world/entity/player/Player.java +++ b/src/main/java/net/minecraft/world/entity/player/Player.java @@ -1159,7 +1159,13 @@ public abstract class Player extends LivingEntity { diff --git a/patches/server/0290-Add-more-Zombie-API.patch b/patches/server/0289-Add-more-Zombie-API.patch similarity index 90% rename from patches/server/0290-Add-more-Zombie-API.patch rename to patches/server/0289-Add-more-Zombie-API.patch index 3228db1ee2..d744393591 100644 --- a/patches/server/0290-Add-more-Zombie-API.patch +++ b/patches/server/0289-Add-more-Zombie-API.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Add more Zombie API diff --git a/src/main/java/net/minecraft/world/entity/monster/Zombie.java b/src/main/java/net/minecraft/world/entity/monster/Zombie.java -index cf80a2592e923967fa440f8c383a9dc977177638..aa78c218d0709eff043fb7e7f5e9a3f8fa918982 100644 +index 1b48576beca178af14bfab297bd427b5f5bdaf42..1ff02c66fcc291b6ccc456673ad4c6c09d47d69e 100644 --- a/src/main/java/net/minecraft/world/entity/monster/Zombie.java +++ b/src/main/java/net/minecraft/world/entity/monster/Zombie.java -@@ -93,6 +93,7 @@ public class Zombie extends Monster { +@@ -94,6 +94,7 @@ public class Zombie extends Monster { private int inWaterTime; public int conversionTime; private int lastTick = MinecraftServer.currentTick; // CraftBukkit - add field @@ -16,7 +16,7 @@ index cf80a2592e923967fa440f8c383a9dc977177638..aa78c218d0709eff043fb7e7f5e9a3f8 public Zombie(EntityType type, Level world) { super(type, world); -@@ -261,6 +262,12 @@ public class Zombie extends Monster { +@@ -262,6 +263,12 @@ public class Zombie extends Monster { super.aiStep(); } @@ -29,7 +29,7 @@ index cf80a2592e923967fa440f8c383a9dc977177638..aa78c218d0709eff043fb7e7f5e9a3f8 public void startUnderWaterConversion(int ticksUntilWaterConversion) { this.lastTick = MinecraftServer.currentTick; // CraftBukkit this.conversionTime = ticksUntilWaterConversion; -@@ -290,9 +297,15 @@ public class Zombie extends Monster { +@@ -291,9 +298,15 @@ public class Zombie extends Monster { } public boolean isSunSensitive() { @@ -46,7 +46,7 @@ index cf80a2592e923967fa440f8c383a9dc977177638..aa78c218d0709eff043fb7e7f5e9a3f8 @Override public boolean hurt(DamageSource source, float amount) { if (!super.hurt(source, amount)) { -@@ -412,6 +425,7 @@ public class Zombie extends Monster { +@@ -413,6 +426,7 @@ public class Zombie extends Monster { nbt.putBoolean("CanBreakDoors", this.canBreakDoors()); nbt.putInt("InWaterTime", this.isInWater() ? this.inWaterTime : -1); nbt.putInt("DrownedConversionTime", this.isUnderWaterConverting() ? this.conversionTime : -1); @@ -54,7 +54,7 @@ index cf80a2592e923967fa440f8c383a9dc977177638..aa78c218d0709eff043fb7e7f5e9a3f8 } @Override -@@ -423,6 +437,11 @@ public class Zombie extends Monster { +@@ -424,6 +438,11 @@ public class Zombie extends Monster { if (nbt.contains("DrownedConversionTime", 99) && nbt.getInt("DrownedConversionTime") > -1) { this.startUnderWaterConversion(nbt.getInt("DrownedConversionTime")); } diff --git a/patches/server/0291-Book-Size-Limits.patch b/patches/server/0290-Book-Size-Limits.patch similarity index 68% rename from patches/server/0291-Book-Size-Limits.patch rename to patches/server/0290-Book-Size-Limits.patch index 1ee2a3619e..93ac90404e 100644 --- a/patches/server/0291-Book-Size-Limits.patch +++ b/patches/server/0290-Book-Size-Limits.patch @@ -5,26 +5,8 @@ Subject: [PATCH] Book Size Limits Puts some limits on the size of books. -diff --git a/src/main/java/com/destroystokyo/paper/PaperConfig.java b/src/main/java/com/destroystokyo/paper/PaperConfig.java -index 80306b595b555d4057975a07872084a83abe78ae..0be8f68c3e61f132ada9381e36b743dd7477eece 100644 ---- a/src/main/java/com/destroystokyo/paper/PaperConfig.java -+++ b/src/main/java/com/destroystokyo/paper/PaperConfig.java -@@ -369,6 +369,13 @@ public class PaperConfig { - } - } - -+ public static int maxBookPageSize = 2560; -+ public static double maxBookTotalSizeMultiplier = 0.98D; -+ private static void maxBookSize() { -+ maxBookPageSize = Math.min(8192, getInt("settings.book-size.page-max", maxBookPageSize)); -+ maxBookTotalSizeMultiplier = getDouble("settings.book-size.total-multiplier", maxBookTotalSizeMultiplier); -+ } -+ - public static boolean asyncChunks = false; - private static void asyncChunks() { - ConfigurationSection section; diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index 414d7f007487ee53dfeec8321b414017e0cd1dbd..2d74384ed9ba6d55f88dbf9d82f3a0b4117f49a3 100644 +index 56ae4b92aaca4ddaa6659a2b65ad69a1f532b0f1..307c68c756cc46867605f83d7dd3b1ead79db32f 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java @@ -1048,6 +1048,45 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser @@ -35,8 +17,8 @@ index 414d7f007487ee53dfeec8321b414017e0cd1dbd..2d74384ed9ba6d55f88dbf9d82f3a0b4 + if (!this.cserver.isPrimaryThread()) { + List pageList = packet.getPages(); + long byteTotal = 0; -+ int maxBookPageSize = com.destroystokyo.paper.PaperConfig.maxBookPageSize; -+ double multiplier = Math.max(0.3D, Math.min(1D, com.destroystokyo.paper.PaperConfig.maxBookTotalSizeMultiplier)); ++ int maxBookPageSize = io.papermc.paper.configuration.GlobalConfiguration.get().itemValidation.bookSize.pageMax; ++ double multiplier = Math.max(0.3D, Math.min(1D, io.papermc.paper.configuration.GlobalConfiguration.get().itemValidation.bookSize.totalMultiplier)); + long byteAllowed = maxBookPageSize; + for (String testString : pageList) { + int byteLength = testString.getBytes(java.nio.charset.StandardCharsets.UTF_8).length; diff --git a/patches/server/0292-Add-PlayerConnectionCloseEvent.patch b/patches/server/0291-Add-PlayerConnectionCloseEvent.patch similarity index 100% rename from patches/server/0292-Add-PlayerConnectionCloseEvent.patch rename to patches/server/0291-Add-PlayerConnectionCloseEvent.patch diff --git a/patches/server/0293-Prevent-Enderman-from-loading-chunks.patch b/patches/server/0292-Prevent-Enderman-from-loading-chunks.patch similarity index 100% rename from patches/server/0293-Prevent-Enderman-from-loading-chunks.patch rename to patches/server/0292-Prevent-Enderman-from-loading-chunks.patch diff --git a/patches/server/0294-Add-APIs-to-replace-OfflinePlayer-getLastPlayed.patch b/patches/server/0293-Add-APIs-to-replace-OfflinePlayer-getLastPlayed.patch similarity index 95% rename from patches/server/0294-Add-APIs-to-replace-OfflinePlayer-getLastPlayed.patch rename to patches/server/0293-Add-APIs-to-replace-OfflinePlayer-getLastPlayed.patch index df11167926..aa8cee6ac6 100644 --- a/patches/server/0294-Add-APIs-to-replace-OfflinePlayer-getLastPlayed.patch +++ b/patches/server/0293-Add-APIs-to-replace-OfflinePlayer-getLastPlayed.patch @@ -16,7 +16,7 @@ intent to remove) and replace it with two new methods, clearly named and documented as to their purpose. diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java -index 3e50915041041486dc6dd939609bcd2673cd2ad2..8f9218c552a1a4bc56e5396a85b50ff7ad830090 100644 +index 2e42a61e315a6857ca8b2ef4a63c974057a254cb..6a16654e0d44f166d5fa38246d825c5482a2d47e 100644 --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java @@ -228,6 +228,7 @@ public class ServerPlayer extends Player { @@ -28,7 +28,7 @@ index 3e50915041041486dc6dd939609bcd2673cd2ad2..8f9218c552a1a4bc56e5396a85b50ff7 public boolean queueHealthUpdatePacket = false; public net.minecraft.network.protocol.game.ClientboundSetHealthPacket queuedHealthUpdatePacket; diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java -index cf3cca43a2eb2a3731112fef37b0ac4a0676ecf5..8ff7ae4af69cd62419b6c51c7a7d957a6550c7b9 100644 +index 5285cd8f395871c8bb55e0dc143216ae3acc0310..fee344bc4457fb4cd21d2e7ed9845f0bd3ce84da 100644 --- a/src/main/java/net/minecraft/server/players/PlayerList.java +++ b/src/main/java/net/minecraft/server/players/PlayerList.java @@ -177,6 +177,7 @@ public abstract class PlayerList { @@ -106,7 +106,7 @@ index f6665825e62a0cd912e6b06df6d68795596486f0..1f2bc88d4570c6ef00e67a772b745e0b public Location getBedSpawnLocation() { CompoundTag data = this.getData(); diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -index 6d5b004ffcca0ca76e065d5c5e8c0917154247d4..d1a5c35e66f451a593066fc4b1e86f9344c71fbb 100644 +index c39e13bd897d1178900558d510de7367bd0bb3a2..26f7393e912722150f91e9c2891afb2c4942d3de 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java @@ -168,6 +168,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player { diff --git a/patches/server/0295-Workaround-for-vehicle-tracking-issue-on-disconnect.patch b/patches/server/0294-Workaround-for-vehicle-tracking-issue-on-disconnect.patch similarity index 91% rename from patches/server/0295-Workaround-for-vehicle-tracking-issue-on-disconnect.patch rename to patches/server/0294-Workaround-for-vehicle-tracking-issue-on-disconnect.patch index 05deb8d113..6b33fd6ffa 100644 --- a/patches/server/0295-Workaround-for-vehicle-tracking-issue-on-disconnect.patch +++ b/patches/server/0294-Workaround-for-vehicle-tracking-issue-on-disconnect.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Workaround for vehicle tracking issue on disconnect diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java -index 8f9218c552a1a4bc56e5396a85b50ff7ad830090..67b4e7c887e012f32ea2a269717373568efed212 100644 +index 6a16654e0d44f166d5fa38246d825c5482a2d47e..51f9287472fd1897958edf7d014939d0ab0b24ac 100644 --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java @@ -1578,6 +1578,13 @@ public class ServerPlayer extends Player { diff --git a/patches/server/0296-Block-Entity-remove-from-being-called-on-Players.patch b/patches/server/0295-Block-Entity-remove-from-being-called-on-Players.patch similarity index 94% rename from patches/server/0296-Block-Entity-remove-from-being-called-on-Players.patch rename to patches/server/0295-Block-Entity-remove-from-being-called-on-Players.patch index 69aa0370f5..915e294c2a 100644 --- a/patches/server/0296-Block-Entity-remove-from-being-called-on-Players.patch +++ b/patches/server/0295-Block-Entity-remove-from-being-called-on-Players.patch @@ -12,7 +12,7 @@ Player we will look at limiting the scope of this change. It appears to be unintentional in the few cases we've seen so far. diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -index d1a5c35e66f451a593066fc4b1e86f9344c71fbb..9bce12ed1842934fb05233337d2571ad44f7fe07 100644 +index 26f7393e912722150f91e9c2891afb2c4942d3de..40e6f19449f5d87616097bb3e83fbf1ce796685c 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java @@ -2552,6 +2552,15 @@ public class CraftPlayer extends CraftHumanEntity implements Player { diff --git a/patches/server/0297-BlockDestroyEvent.patch b/patches/server/0296-BlockDestroyEvent.patch similarity index 93% rename from patches/server/0297-BlockDestroyEvent.patch rename to patches/server/0296-BlockDestroyEvent.patch index 58e3790201..677462113a 100644 --- a/patches/server/0297-BlockDestroyEvent.patch +++ b/patches/server/0296-BlockDestroyEvent.patch @@ -11,7 +11,7 @@ floating in the air. This can replace many uses of BlockPhysicsEvent diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java -index 36264caae95b4ab69412a60f24e1e926df424fa0..3b2357eb2844d9e8cf00a43884759da60b9327eb 100644 +index 52b954528037e2f43d7cbcf2bcf8198b0c835109..d412429adffa5cfc68ad9c8937fdceee51660328 100644 --- a/src/main/java/net/minecraft/world/level/Level.java +++ b/src/main/java/net/minecraft/world/level/Level.java @@ -28,6 +28,7 @@ import net.minecraft.nbt.CompoundTag; @@ -22,7 +22,7 @@ index 36264caae95b4ab69412a60f24e1e926df424fa0..3b2357eb2844d9e8cf00a43884759da6 import net.minecraft.server.MinecraftServer; import net.minecraft.server.level.ChunkHolder; import net.minecraft.server.level.ServerLevel; -@@ -574,8 +575,20 @@ public abstract class Level implements LevelAccessor, AutoCloseable { +@@ -578,8 +579,20 @@ public abstract class Level implements LevelAccessor, AutoCloseable { return false; } else { FluidState fluid = this.getFluidState(pos); diff --git a/patches/server/0298-Async-command-map-building.patch b/patches/server/0297-Async-command-map-building.patch similarity index 100% rename from patches/server/0298-Async-command-map-building.patch rename to patches/server/0297-Async-command-map-building.patch diff --git a/patches/server/0299-Implement-Brigadier-Mojang-API.patch b/patches/server/0298-Implement-Brigadier-Mojang-API.patch similarity index 98% rename from patches/server/0299-Implement-Brigadier-Mojang-API.patch rename to patches/server/0298-Implement-Brigadier-Mojang-API.patch index 4f57c9f3fb..27c3ba5c75 100644 --- a/patches/server/0299-Implement-Brigadier-Mojang-API.patch +++ b/patches/server/0298-Implement-Brigadier-Mojang-API.patch @@ -10,7 +10,7 @@ Adds CommandRegisteredEvent - Allows manipulating the CommandNode to add more children/metadata for the client diff --git a/build.gradle.kts b/build.gradle.kts -index 344787b84f91627e4f33288c75eacd2bca7bcc3f..7dd1c9449a1e6a9197e2915399feabf63f490b0a 100644 +index 078026236de2e0c8094a63bb261060e9f576bd06..55355f4efce9b3f50eae1f403d6e95dff48e4c54 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -8,6 +8,7 @@ plugins { @@ -81,7 +81,7 @@ index 4c9773997c63f7b2c8465b19810068f11367466b..a8f3a84615a640d2949d268ef1ac81a0 event.getPlayer().getServer().getPluginManager().callEvent(event); diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index 2d74384ed9ba6d55f88dbf9d82f3a0b4117f49a3..90da4b1e636419aa8c35ab1a06b037f5c7b328f7 100644 +index 307c68c756cc46867605f83d7dd3b1ead79db32f..80e3023545af22725c2d74124db5dabd8b7111d9 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java @@ -789,8 +789,12 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser diff --git a/patches/server/0300-Fix-Custom-Shapeless-Custom-Crafting-Recipes.patch b/patches/server/0299-Fix-Custom-Shapeless-Custom-Crafting-Recipes.patch similarity index 100% rename from patches/server/0300-Fix-Custom-Shapeless-Custom-Crafting-Recipes.patch rename to patches/server/0299-Fix-Custom-Shapeless-Custom-Crafting-Recipes.patch diff --git a/patches/server/0301-Limit-Client-Sign-length-more.patch b/patches/server/0300-Limit-Client-Sign-length-more.patch similarity index 97% rename from patches/server/0301-Limit-Client-Sign-length-more.patch rename to patches/server/0300-Limit-Client-Sign-length-more.patch index fc385cd5e4..ac6373c1c8 100644 --- a/patches/server/0301-Limit-Client-Sign-length-more.patch +++ b/patches/server/0300-Limit-Client-Sign-length-more.patch @@ -22,7 +22,7 @@ it only impacts data sent from the client. Set -DPaper.maxSignLength=XX to change limit or -1 to disable diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index 90da4b1e636419aa8c35ab1a06b037f5c7b328f7..ea764d2b935c42f88e8dcaff6ba85e5122dbbcc6 100644 +index 80e3023545af22725c2d74124db5dabd8b7111d9..15498edc2b51777cb47941efea7e1a48f63b026c 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java @@ -275,6 +275,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser diff --git a/patches/server/0302-Don-t-check-ConvertSigns-boolean-every-sign-save.patch b/patches/server/0301-Don-t-check-ConvertSigns-boolean-every-sign-save.patch similarity index 100% rename from patches/server/0302-Don-t-check-ConvertSigns-boolean-every-sign-save.patch rename to patches/server/0301-Don-t-check-ConvertSigns-boolean-every-sign-save.patch diff --git a/patches/server/0303-Optimize-Network-Manager-and-add-advanced-packet-sup.patch b/patches/server/0302-Optimize-Network-Manager-and-add-advanced-packet-sup.patch similarity index 100% rename from patches/server/0303-Optimize-Network-Manager-and-add-advanced-packet-sup.patch rename to patches/server/0302-Optimize-Network-Manager-and-add-advanced-packet-sup.patch diff --git a/patches/server/0304-Handle-Oversized-Tile-Entities-in-chunks.patch b/patches/server/0303-Handle-Oversized-Tile-Entities-in-chunks.patch similarity index 100% rename from patches/server/0304-Handle-Oversized-Tile-Entities-in-chunks.patch rename to patches/server/0303-Handle-Oversized-Tile-Entities-in-chunks.patch diff --git a/patches/server/0305-Set-Zombie-last-tick-at-start-of-drowning-process.patch b/patches/server/0304-Set-Zombie-last-tick-at-start-of-drowning-process.patch similarity index 85% rename from patches/server/0305-Set-Zombie-last-tick-at-start-of-drowning-process.patch rename to patches/server/0304-Set-Zombie-last-tick-at-start-of-drowning-process.patch index 24c7e26760..6c82126b25 100644 --- a/patches/server/0305-Set-Zombie-last-tick-at-start-of-drowning-process.patch +++ b/patches/server/0304-Set-Zombie-last-tick-at-start-of-drowning-process.patch @@ -6,10 +6,10 @@ Subject: [PATCH] Set Zombie last tick at start of drowning process Fixes GH-1887 diff --git a/src/main/java/net/minecraft/world/entity/monster/Zombie.java b/src/main/java/net/minecraft/world/entity/monster/Zombie.java -index aa78c218d0709eff043fb7e7f5e9a3f8fa918982..374fccfec47769d2df51056fb6d1948f472a6802 100644 +index 1ff02c66fcc291b6ccc456673ad4c6c09d47d69e..bf5f4fe68a942dff8c2e2ad4735a529b5a6353e8 100644 --- a/src/main/java/net/minecraft/world/entity/monster/Zombie.java +++ b/src/main/java/net/minecraft/world/entity/monster/Zombie.java -@@ -222,6 +222,7 @@ public class Zombie extends Monster { +@@ -223,6 +223,7 @@ public class Zombie extends Monster { ++this.inWaterTime; if (this.inWaterTime >= 600) { this.startUnderWaterConversion(300); diff --git a/patches/server/0306-Call-WhitelistToggleEvent-when-whitelist-is-toggled.patch b/patches/server/0305-Call-WhitelistToggleEvent-when-whitelist-is-toggled.patch similarity index 88% rename from patches/server/0306-Call-WhitelistToggleEvent-when-whitelist-is-toggled.patch rename to patches/server/0305-Call-WhitelistToggleEvent-when-whitelist-is-toggled.patch index 7844d9824e..7455c723b4 100644 --- a/patches/server/0306-Call-WhitelistToggleEvent-when-whitelist-is-toggled.patch +++ b/patches/server/0305-Call-WhitelistToggleEvent-when-whitelist-is-toggled.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Call WhitelistToggleEvent when whitelist is toggled diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java -index 8ff7ae4af69cd62419b6c51c7a7d957a6550c7b9..056d89f0a8f94e2be94a773068cf2cf52556ce5a 100644 +index fee344bc4457fb4cd21d2e7ed9845f0bd3ce84da..c2370cb1128b55dd9d40a72a01296f40e01630b9 100644 --- a/src/main/java/net/minecraft/server/players/PlayerList.java +++ b/src/main/java/net/minecraft/server/players/PlayerList.java @@ -1127,6 +1127,7 @@ public abstract class PlayerList { diff --git a/patches/server/0307-Entity-getEntitySpawnReason.patch b/patches/server/0306-Entity-getEntitySpawnReason.patch similarity index 92% rename from patches/server/0307-Entity-getEntitySpawnReason.patch rename to patches/server/0306-Entity-getEntitySpawnReason.patch index 24ef23ad78..3a6f105886 100644 --- a/patches/server/0307-Entity-getEntitySpawnReason.patch +++ b/patches/server/0306-Entity-getEntitySpawnReason.patch @@ -10,7 +10,7 @@ persistenting Living Entity, SPAWNER for spawners, or DEFAULT since data was not stored. diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java -index a37991c960df688f4890fd1a9d88b2e637f26101..1a5ebca952422de8caded739e1816deb4b1a4d72 100644 +index b749315bf8ae2cc4a6b98e0c0d8ca43bb4ed2fe3..fdd4b2d399db5e7071b6ac3a767e4135476ac64b 100644 --- a/src/main/java/net/minecraft/server/level/ServerLevel.java +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java @@ -1209,6 +1209,7 @@ public class ServerLevel extends Level implements WorldGenLevel { @@ -22,7 +22,7 @@ index a37991c960df688f4890fd1a9d88b2e637f26101..1a5ebca952422de8caded739e1816deb // Paper start if (DEBUG_ENTITIES) { diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java -index 056d89f0a8f94e2be94a773068cf2cf52556ce5a..604ce3bcec48f63292020220e463659554ada7e0 100644 +index c2370cb1128b55dd9d40a72a01296f40e01630b9..7fc211e97da0f3e00abc9e0098df137bcfda3c80 100644 --- a/src/main/java/net/minecraft/server/players/PlayerList.java +++ b/src/main/java/net/minecraft/server/players/PlayerList.java @@ -346,7 +346,7 @@ public abstract class PlayerList { @@ -35,7 +35,7 @@ index 056d89f0a8f94e2be94a773068cf2cf52556ce5a..604ce3bcec48f63292020220e4636595 }); diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java -index df59b8252e8182519c587ed27feca4963a4d57e9..f075e2663260759c457bce48d2ce0773709fc9e7 100644 +index a5e9b15d52a0134060b9f815560fa20ee610d506..94966ce5d0af77f3ae2e43e84f12470e6fee094b 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java @@ -73,6 +73,8 @@ import net.minecraft.world.InteractionHand; @@ -55,7 +55,7 @@ index df59b8252e8182519c587ed27feca4963a4d57e9..f075e2663260759c457bce48d2ce0773 public com.destroystokyo.paper.loottable.PaperLootableInventoryData lootableData; // Paper private CraftEntity bukkitEntity; -@@ -1957,6 +1960,9 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource { +@@ -1956,6 +1959,9 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource { } nbt.put("Paper.Origin", this.newDoubleList(origin.getX(), origin.getY(), origin.getZ())); } @@ -65,7 +65,7 @@ index df59b8252e8182519c587ed27feca4963a4d57e9..f075e2663260759c457bce48d2ce0773 // Save entity's from mob spawner status if (spawnedViaMobSpawner) { nbt.putBoolean("Paper.FromMobSpawner", true); -@@ -2100,6 +2106,26 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource { +@@ -2099,6 +2105,26 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource { } spawnedViaMobSpawner = nbt.getBoolean("Paper.FromMobSpawner"); // Restore entity's from mob spawner status @@ -93,7 +93,7 @@ index df59b8252e8182519c587ed27feca4963a4d57e9..f075e2663260759c457bce48d2ce0773 } catch (Throwable throwable) { diff --git a/src/main/java/net/minecraft/world/level/BaseSpawner.java b/src/main/java/net/minecraft/world/level/BaseSpawner.java -index 3e8848cbf22902b1a0e015ecf9e330c9235bc638..01269e52855f88f5cfd7b57b2dc12f5d3e3c1583 100644 +index 0be0c7a323277093a6f8e476048eb9ee8712cbc9..c7e97263eee005fd673882e11c436542cb0ca62a 100644 --- a/src/main/java/net/minecraft/world/level/BaseSpawner.java +++ b/src/main/java/net/minecraft/world/level/BaseSpawner.java @@ -181,6 +181,7 @@ public abstract class BaseSpawner { diff --git a/patches/server/0308-Update-entity-Metadata-for-all-tracked-players.patch b/patches/server/0307-Update-entity-Metadata-for-all-tracked-players.patch similarity index 96% rename from patches/server/0308-Update-entity-Metadata-for-all-tracked-players.patch rename to patches/server/0307-Update-entity-Metadata-for-all-tracked-players.patch index 0623ebdcc9..4cf5937abf 100644 --- a/patches/server/0308-Update-entity-Metadata-for-all-tracked-players.patch +++ b/patches/server/0307-Update-entity-Metadata-for-all-tracked-players.patch @@ -22,7 +22,7 @@ index 232341fa41b1962d329cc17f3146e41c51d22164..2c43304fd7a189f399f0e7757dbd593f this.broadcast.accept(packet); if (this.entity instanceof ServerPlayer) { diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index ea764d2b935c42f88e8dcaff6ba85e5122dbbcc6..a2947ec5dd0df55e1edc9e2f016a4b618b8c5349 100644 +index 15498edc2b51777cb47941efea7e1a48f63b026c..d91d66084e97675a5fdc3069487e50e7e78d1c1b 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java @@ -2500,7 +2500,14 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser diff --git a/patches/server/0309-Fire-event-on-GS4-query.patch b/patches/server/0308-Fire-event-on-GS4-query.patch similarity index 100% rename from patches/server/0309-Fire-event-on-GS4-query.patch rename to patches/server/0308-Fire-event-on-GS4-query.patch diff --git a/patches/server/0310-Implement-PlayerPostRespawnEvent.patch b/patches/server/0309-Implement-PlayerPostRespawnEvent.patch similarity index 95% rename from patches/server/0310-Implement-PlayerPostRespawnEvent.patch rename to patches/server/0309-Implement-PlayerPostRespawnEvent.patch index 41153d8c35..623ee5e32e 100644 --- a/patches/server/0310-Implement-PlayerPostRespawnEvent.patch +++ b/patches/server/0309-Implement-PlayerPostRespawnEvent.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Implement PlayerPostRespawnEvent diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java -index 604ce3bcec48f63292020220e463659554ada7e0..6ef66a4c040ad9ad33d363f212c70621b260b6c7 100644 +index 7fc211e97da0f3e00abc9e0098df137bcfda3c80..eeb014dfd4376090eb95bbf372a6b2c1f660593c 100644 --- a/src/main/java/net/minecraft/server/players/PlayerList.java +++ b/src/main/java/net/minecraft/server/players/PlayerList.java @@ -726,9 +726,14 @@ public abstract class PlayerList { diff --git a/patches/server/0311-don-t-go-below-0-for-pickupDelay-breaks-picking-up-i.patch b/patches/server/0310-don-t-go-below-0-for-pickupDelay-breaks-picking-up-i.patch similarity index 100% rename from patches/server/0311-don-t-go-below-0-for-pickupDelay-breaks-picking-up-i.patch rename to patches/server/0310-don-t-go-below-0-for-pickupDelay-breaks-picking-up-i.patch diff --git a/patches/server/0312-Server-Tick-Events.patch b/patches/server/0311-Server-Tick-Events.patch similarity index 93% rename from patches/server/0312-Server-Tick-Events.patch rename to patches/server/0311-Server-Tick-Events.patch index b363681d5f..e0eecb9429 100644 --- a/patches/server/0312-Server-Tick-Events.patch +++ b/patches/server/0311-Server-Tick-Events.patch @@ -6,7 +6,7 @@ Subject: [PATCH] Server Tick Events Fires event at start and end of a server tick diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index 5407fea80a66c43550b0b557174d710676b5f118..95034c3486ccd7179c4b41c270a252b26ce77a9c 100644 +index 24ac6bdf8af8ef62e700ab416f649fe03d07f335..3d59157b1b5a7bfcfd53142f64f2e6b0093637ff 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java @@ -1306,6 +1306,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop - License: LGPLv2.1 */ diff --git a/src/main/java/net/minecraft/server/MCUtil.java b/src/main/java/net/minecraft/server/MCUtil.java -index 162aa7718488a74980843944e0d026ccfd5a65a5..defeba92b2a7a5d9d5031f2adc0581d87070bb47 100644 +index 162aa7718488a74980843944e0d026ccfd5a65a5..aebfcd07170109b9cf058df0d4e285b0d95fedb5 100644 --- a/src/main/java/net/minecraft/server/MCUtil.java +++ b/src/main/java/net/minecraft/server/MCUtil.java @@ -9,13 +9,27 @@ import net.minecraft.core.BlockPos; @@ -366,7 +366,7 @@ index 162aa7718488a74980843944e0d026ccfd5a65a5..defeba92b2a7a5d9d5031f2adc0581d8 + worldData.addProperty("name", world.getWorld().getName()); + worldData.addProperty("view-distance", world.spigotConfig.viewDistance); + worldData.addProperty("keep-spawn-loaded", world.keepSpawnInMemory); -+ worldData.addProperty("keep-spawn-loaded-range", world.paperConfig.keepLoadedRange); ++ worldData.addProperty("keep-spawn-loaded-range", world.paperConfig().spawn.keepSpawnLoadedRange); + worldData.addProperty("visible-chunk-count", visibleChunks.size()); + worldData.addProperty("loaded-chunk-count", chunkMap.entitiesInLevel.size()); + worldData.addProperty("verified-fully-loaded-chunks", fullLoadedChunks); diff --git a/patches/server/0324-Allow-Saving-of-Oversized-Chunks.patch b/patches/server/0323-Allow-Saving-of-Oversized-Chunks.patch similarity index 99% rename from patches/server/0324-Allow-Saving-of-Oversized-Chunks.patch rename to patches/server/0323-Allow-Saving-of-Oversized-Chunks.patch index 7a71ae6af9..0f82b9f323 100644 --- a/patches/server/0324-Allow-Saving-of-Oversized-Chunks.patch +++ b/patches/server/0323-Allow-Saving-of-Oversized-Chunks.patch @@ -142,7 +142,7 @@ index 038e2177182c94baa4af24f9111cf155ec342dfe..330fb8e6565a5c0490af0c5ca0e7355d private final ChunkPos pos; diff --git a/src/main/java/net/minecraft/world/level/chunk/storage/RegionFileStorage.java b/src/main/java/net/minecraft/world/level/chunk/storage/RegionFileStorage.java -index 40830a2b231df9bbf676d8325e76c8252a6c1d6c..a1bfcdd713c47d8613eb4af7625a64d51161690b 100644 +index 9d7adf17851202adf03bf9feff3577069e324bc6..e734d82c2863caca8abc6bb8bb82882e971c36a8 100644 --- a/src/main/java/net/minecraft/world/level/chunk/storage/RegionFileStorage.java +++ b/src/main/java/net/minecraft/world/level/chunk/storage/RegionFileStorage.java @@ -11,8 +11,10 @@ import java.nio.file.Files; diff --git a/patches/server/0325-Expose-the-internal-current-tick.patch b/patches/server/0324-Expose-the-internal-current-tick.patch similarity index 83% rename from patches/server/0325-Expose-the-internal-current-tick.patch rename to patches/server/0324-Expose-the-internal-current-tick.patch index 8ab9641f58..60ebe8afda 100644 --- a/patches/server/0325-Expose-the-internal-current-tick.patch +++ b/patches/server/0324-Expose-the-internal-current-tick.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Expose the internal current tick diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -index db3e7d6d21cc2780221d5f9a82cfd8010bbdad99..ab13a26a1391ad7403dca09a366fc11163849632 100644 +index 403f4166b9e27a9037920195996e7f13c2fb31a2..4c8ca8625860c7a19c73da633b236e2b255bd6de 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -@@ -2625,5 +2625,10 @@ public final class CraftServer implements Server { +@@ -2622,5 +2622,10 @@ public final class CraftServer implements Server { profile.getProperties().putAll(((CraftPlayer)player).getHandle().getGameProfile().getProperties()); return new com.destroystokyo.paper.profile.CraftPlayerProfile(profile); } diff --git a/patches/server/0326-Fix-World-isChunkGenerated-calls.patch b/patches/server/0325-Fix-World-isChunkGenerated-calls.patch similarity index 98% rename from patches/server/0326-Fix-World-isChunkGenerated-calls.patch rename to patches/server/0325-Fix-World-isChunkGenerated-calls.patch index 75e9dbbca5..7674691f23 100644 --- a/patches/server/0326-Fix-World-isChunkGenerated-calls.patch +++ b/patches/server/0325-Fix-World-isChunkGenerated-calls.patch @@ -188,7 +188,7 @@ index 330fb8e6565a5c0490af0c5ca0e7355d81a82e58..861a25a15f1aab20e3245b6d5cdad5d2 this.padToFullSector(); } finally { diff --git a/src/main/java/net/minecraft/world/level/chunk/storage/RegionFileStorage.java b/src/main/java/net/minecraft/world/level/chunk/storage/RegionFileStorage.java -index a1bfcdd713c47d8613eb4af7625a64d51161690b..4bc33c31d497aa7d69226ab870fd78902bedfd5b 100644 +index e734d82c2863caca8abc6bb8bb82882e971c36a8..a96a6af2bcec3134b7caa32299bd07af50e83b89 100644 --- a/src/main/java/net/minecraft/world/level/chunk/storage/RegionFileStorage.java +++ b/src/main/java/net/minecraft/world/level/chunk/storage/RegionFileStorage.java @@ -245,6 +245,7 @@ public class RegionFileStorage implements AutoCloseable { @@ -200,7 +200,7 @@ index a1bfcdd713c47d8613eb4af7625a64d51161690b..4bc33c31d497aa7d69226ab870fd7890 } catch (Throwable throwable) { if (dataoutputstream != null) { diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java -index 1ca7903bd14d85e8ee95389250fa3228406c2ca9..2fd677796c6393d6997dca455a7daeef191e51b7 100644 +index d795014028cfa9ebd6f986b8ddd3d6477f189fa7..65edea6420256384a108663761ac9619ba110a8e 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java @@ -294,9 +294,23 @@ public class CraftWorld extends CraftRegionAccessor implements World { diff --git a/patches/server/0327-Show-blockstate-location-if-we-failed-to-read-it.patch b/patches/server/0326-Show-blockstate-location-if-we-failed-to-read-it.patch similarity index 100% rename from patches/server/0327-Show-blockstate-location-if-we-failed-to-read-it.patch rename to patches/server/0326-Show-blockstate-location-if-we-failed-to-read-it.patch diff --git a/patches/server/0328-Only-count-Natural-Spawned-mobs-towards-natural-spaw.patch b/patches/server/0327-Only-count-Natural-Spawned-mobs-towards-natural-spaw.patch similarity index 57% rename from patches/server/0328-Only-count-Natural-Spawned-mobs-towards-natural-spaw.patch rename to patches/server/0327-Only-count-Natural-Spawned-mobs-towards-natural-spaw.patch index 2bd9674551..a181d9b9ad 100644 --- a/patches/server/0328-Only-count-Natural-Spawned-mobs-towards-natural-spaw.patch +++ b/patches/server/0327-Only-count-Natural-Spawned-mobs-towards-natural-spaw.patch @@ -16,28 +16,8 @@ worse than vanilla. This should fully solve all of the issues around it so that only natural influences natural spawns. -diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -index 321dedb7bea65c85aaeac338b88e85c6d453325d..98f81bc3277096493ff0a942361bf79525000431 100644 ---- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -@@ -463,4 +463,15 @@ public class PaperWorldConfig { - private void preventMovingIntoUnloadedChunks() { - preventMovingIntoUnloadedChunks = getBoolean("prevent-moving-into-unloaded-chunks", false); - } -+ -+ public boolean countAllMobsForSpawning = false; -+ private void countAllMobsForSpawning() { -+ countAllMobsForSpawning = getBoolean("count-all-mobs-for-spawning", false); -+ if (countAllMobsForSpawning) { -+ log("Counting all mobs for spawning. Mob farms may reduce natural spawns elsewhere in world."); -+ } else { -+ log("Using improved mob spawn limits (Only Natural Spawns impact spawn limits for more natural spawns)"); -+ } -+ } - } -+ diff --git a/src/main/java/net/minecraft/world/level/NaturalSpawner.java b/src/main/java/net/minecraft/world/level/NaturalSpawner.java -index 31b330e140d71d9b017e68eab531a59d4f2ed9a2..fedc36ceebaf3e1d267431bdf7db81e25f4d6fd7 100644 +index 31b330e140d71d9b017e68eab531a59d4f2ed9a2..b4098068e674b639e82c07e5d60e4e2120b4305b 100644 --- a/src/main/java/net/minecraft/world/level/NaturalSpawner.java +++ b/src/main/java/net/minecraft/world/level/NaturalSpawner.java @@ -87,6 +87,13 @@ public final class NaturalSpawner { @@ -45,7 +25,7 @@ index 31b330e140d71d9b017e68eab531a59d4f2ed9a2..fedc36ceebaf3e1d267431bdf7db81e2 if (enumcreaturetype != MobCategory.MISC) { + // Paper start - Only count natural spawns -+ if (!entity.level.paperConfig.countAllMobsForSpawning && ++ if (!entity.level.paperConfig().entities.spawning.countAllMobsForSpawning && + !(entity.spawnReason == org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.NATURAL || + entity.spawnReason == org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.CHUNK_GEN)) { + continue; diff --git a/patches/server/0329-Configurable-projectile-relative-velocity.patch b/patches/server/0328-Configurable-projectile-relative-velocity.patch similarity index 65% rename from patches/server/0329-Configurable-projectile-relative-velocity.patch rename to patches/server/0328-Configurable-projectile-relative-velocity.patch index 1507176747..024876f999 100644 --- a/patches/server/0329-Configurable-projectile-relative-velocity.patch +++ b/patches/server/0328-Configurable-projectile-relative-velocity.patch @@ -24,23 +24,8 @@ efficient as just not applying the velocity in the first place. P3) Solutions for 1) and especially 2) might not be future-proof, while this server-internal fix makes this change future-proof. -diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -index 98f81bc3277096493ff0a942361bf79525000431..b230c79a830375a1d3b9262620f51039c30102ce 100644 ---- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -@@ -473,5 +473,10 @@ public class PaperWorldConfig { - log("Using improved mob spawn limits (Only Natural Spawns impact spawn limits for more natural spawns)"); - } - } -+ -+ public boolean disableRelativeProjectileVelocity; -+ private void disableRelativeProjectileVelocity() { -+ disableRelativeProjectileVelocity = getBoolean("game-mechanics.disable-relative-projectile-velocity", false); -+ } - } - diff --git a/src/main/java/net/minecraft/world/entity/projectile/Projectile.java b/src/main/java/net/minecraft/world/entity/projectile/Projectile.java -index 80fdb953d7a49b05108672e18ea326182fa7cfd6..fcbc5a3aee2e23a0b30b1f774d608f85b85f7d71 100644 +index 2dfe2e655026e6da1f548779ab3b455a6e42fb0c..66c3f374a779cd3a4548393ba23e9219f1caf6d3 100644 --- a/src/main/java/net/minecraft/world/entity/projectile/Projectile.java +++ b/src/main/java/net/minecraft/world/entity/projectile/Projectile.java @@ -161,7 +161,7 @@ public abstract class Projectile extends Entity { @@ -48,7 +33,7 @@ index 80fdb953d7a49b05108672e18ea326182fa7cfd6..fcbc5a3aee2e23a0b30b1f774d608f85 Vec3 vec3d = shooter.getDeltaMovement(); - this.setDeltaMovement(this.getDeltaMovement().add(vec3d.x, shooter.isOnGround() ? 0.0D : vec3d.y, vec3d.z)); -+ if (!shooter.level.paperConfig.disableRelativeProjectileVelocity) this.setDeltaMovement(this.getDeltaMovement().add(vec3d.x, shooter.isOnGround() ? 0.0D : vec3d.y, vec3d.z)); // Paper - allow disabling relative velocity ++ if (!shooter.level.paperConfig().misc.disableRelativeProjectileVelocity) this.setDeltaMovement(this.getDeltaMovement().add(vec3d.x, shooter.isOnGround() ? 0.0D : vec3d.y, vec3d.z)); // Paper - allow disabling relative velocity } // CraftBukkit start - call projectile hit event diff --git a/patches/server/0330-offset-item-frame-ticking.patch b/patches/server/0329-offset-item-frame-ticking.patch similarity index 100% rename from patches/server/0330-offset-item-frame-ticking.patch rename to patches/server/0329-offset-item-frame-ticking.patch diff --git a/patches/server/0331-Fix-MC-158900.patch b/patches/server/0330-Fix-MC-158900.patch similarity index 94% rename from patches/server/0331-Fix-MC-158900.patch rename to patches/server/0330-Fix-MC-158900.patch index c65a127da8..1491c9e335 100644 --- a/patches/server/0331-Fix-MC-158900.patch +++ b/patches/server/0330-Fix-MC-158900.patch @@ -7,7 +7,7 @@ The problem was we were checking isExpired() on the entry, but if it was expired at that point, then it would be null. diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java -index 6ef66a4c040ad9ad33d363f212c70621b260b6c7..a2071ea91515c5ddd2318cc4918328d20dec224e 100644 +index eeb014dfd4376090eb95bbf372a6b2c1f660593c..f14d4bfd5ac03eeffefcf98e1077d915fd3fa2cb 100644 --- a/src/main/java/net/minecraft/server/players/PlayerList.java +++ b/src/main/java/net/minecraft/server/players/PlayerList.java @@ -610,8 +610,10 @@ public abstract class PlayerList { diff --git a/patches/server/0332-Prevent-consuming-the-wrong-itemstack.patch b/patches/server/0331-Prevent-consuming-the-wrong-itemstack.patch similarity index 95% rename from patches/server/0332-Prevent-consuming-the-wrong-itemstack.patch rename to patches/server/0331-Prevent-consuming-the-wrong-itemstack.patch index 333813b1c4..cf43c51668 100644 --- a/patches/server/0332-Prevent-consuming-the-wrong-itemstack.patch +++ b/patches/server/0331-Prevent-consuming-the-wrong-itemstack.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Prevent consuming the wrong itemstack diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java -index 3ea28ff50d409d1d234d17f62207b0585386a607..0da23722a326aa190dca7d610bf3cb5c42dbb7f8 100644 +index 7446b9d43647faa042fccb912833c2ef0d0261c4..b521be6552d4fbf115a2f829b68fc7c5fff72a9a 100644 --- a/src/main/java/net/minecraft/world/entity/LivingEntity.java +++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java @@ -3596,9 +3596,14 @@ public abstract class LivingEntity extends Entity { diff --git a/patches/server/0333-Dont-send-unnecessary-sign-update.patch b/patches/server/0332-Dont-send-unnecessary-sign-update.patch similarity index 92% rename from patches/server/0333-Dont-send-unnecessary-sign-update.patch rename to patches/server/0332-Dont-send-unnecessary-sign-update.patch index e89dd00d79..124a3c3e90 100644 --- a/patches/server/0333-Dont-send-unnecessary-sign-update.patch +++ b/patches/server/0332-Dont-send-unnecessary-sign-update.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Dont send unnecessary sign update diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index c7d85b95c57cd049f5a0c0fbaf06df8183c40684..6c773657094f31d52ed5e5f13726d847786d4d7b 100644 +index 8e8b68c67cb2d428c3c83cc4830c52041d75c350..a78989388f60effa7b0c498807ca648de21afa9d 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java @@ -3091,6 +3091,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser diff --git a/patches/server/0333-Add-option-to-disable-pillager-patrols.patch b/patches/server/0333-Add-option-to-disable-pillager-patrols.patch new file mode 100644 index 0000000000..65d645b929 --- /dev/null +++ b/patches/server/0333-Add-option-to-disable-pillager-patrols.patch @@ -0,0 +1,18 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: William Blake Galbreath +Date: Wed, 9 Oct 2019 21:46:15 -0500 +Subject: [PATCH] Add option to disable pillager patrols + + +diff --git a/src/main/java/net/minecraft/world/level/levelgen/PatrolSpawner.java b/src/main/java/net/minecraft/world/level/levelgen/PatrolSpawner.java +index 65d9211b812995869e58900a2873583658122312..e5918fa3be107ac3a2fc8831fd78733a7506730a 100644 +--- a/src/main/java/net/minecraft/world/level/levelgen/PatrolSpawner.java ++++ b/src/main/java/net/minecraft/world/level/levelgen/PatrolSpawner.java +@@ -25,6 +25,7 @@ public class PatrolSpawner implements CustomSpawner { + + @Override + public int tick(ServerLevel world, boolean spawnMonsters, boolean spawnAnimals) { ++ if (world.paperConfig().entities.behavior.pillagerPatrols.disable) return 0; // Paper + if (!spawnMonsters) { + return 0; + } else if (!world.getGameRules().getBoolean(GameRules.RULE_DO_PATROL_SPAWNING)) { diff --git a/patches/server/0334-Add-option-to-disable-pillager-patrols.patch b/patches/server/0334-Add-option-to-disable-pillager-patrols.patch deleted file mode 100644 index b5becb8cf5..0000000000 --- a/patches/server/0334-Add-option-to-disable-pillager-patrols.patch +++ /dev/null @@ -1,33 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: William Blake Galbreath -Date: Wed, 9 Oct 2019 21:46:15 -0500 -Subject: [PATCH] Add option to disable pillager patrols - - -diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -index b230c79a830375a1d3b9262620f51039c30102ce..50f6eb50a20773bab78e96e9c4cbac79a5893310 100644 ---- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -@@ -478,5 +478,10 @@ public class PaperWorldConfig { - private void disableRelativeProjectileVelocity() { - disableRelativeProjectileVelocity = getBoolean("game-mechanics.disable-relative-projectile-velocity", false); - } -+ -+ public boolean disablePillagerPatrols = false; -+ private void pillagerSettings() { -+ disablePillagerPatrols = getBoolean("game-mechanics.disable-pillager-patrols", disablePillagerPatrols); -+ } - } - -diff --git a/src/main/java/net/minecraft/world/level/levelgen/PatrolSpawner.java b/src/main/java/net/minecraft/world/level/levelgen/PatrolSpawner.java -index 65d9211b812995869e58900a2873583658122312..96765f740eb5704c977be7c037ecf81fbc1c7a92 100644 ---- a/src/main/java/net/minecraft/world/level/levelgen/PatrolSpawner.java -+++ b/src/main/java/net/minecraft/world/level/levelgen/PatrolSpawner.java -@@ -25,6 +25,7 @@ public class PatrolSpawner implements CustomSpawner { - - @Override - public int tick(ServerLevel world, boolean spawnMonsters, boolean spawnAnimals) { -+ if (world.paperConfig.disablePillagerPatrols) return 0; // Paper - if (!spawnMonsters) { - return 0; - } else if (!world.getGameRules().getBoolean(GameRules.RULE_DO_PATROL_SPAWNING)) { diff --git a/patches/server/0335-Fix-AssertionError-when-player-hand-set-to-empty-typ.patch b/patches/server/0334-Fix-AssertionError-when-player-hand-set-to-empty-typ.patch similarity index 92% rename from patches/server/0335-Fix-AssertionError-when-player-hand-set-to-empty-typ.patch rename to patches/server/0334-Fix-AssertionError-when-player-hand-set-to-empty-typ.patch index 239eac2f01..91eb8eff12 100644 --- a/patches/server/0335-Fix-AssertionError-when-player-hand-set-to-empty-typ.patch +++ b/patches/server/0334-Fix-AssertionError-when-player-hand-set-to-empty-typ.patch @@ -7,7 +7,7 @@ Fixes an AssertionError when setting the player's item in hand to null or a new Fixes GH-2718 diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index 6c773657094f31d52ed5e5f13726d847786d4d7b..1f90edd5eba696303962523439133d19514ebc32 100644 +index a78989388f60effa7b0c498807ca648de21afa9d..da564c365a597d0cd92efdef7a4af99f4b9d2e97 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java @@ -1790,6 +1790,10 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser diff --git a/patches/server/0336-Flat-bedrock-generator-settings.patch b/patches/server/0335-Flat-bedrock-generator-settings.patch similarity index 95% rename from patches/server/0336-Flat-bedrock-generator-settings.patch rename to patches/server/0335-Flat-bedrock-generator-settings.patch index f7e50ecbc6..566ecb8d42 100644 --- a/patches/server/0336-Flat-bedrock-generator-settings.patch +++ b/patches/server/0335-Flat-bedrock-generator-settings.patch @@ -5,23 +5,8 @@ Subject: [PATCH] Flat bedrock generator settings Co-authored-by: Noah van der Aa -diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -index 50f6eb50a20773bab78e96e9c4cbac79a5893310..68448d9ae6650beabcc62128772c6a18754788c4 100644 ---- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -@@ -483,5 +483,10 @@ public class PaperWorldConfig { - private void pillagerSettings() { - disablePillagerPatrols = getBoolean("game-mechanics.disable-pillager-patrols", disablePillagerPatrols); - } -+ -+ public boolean generateFlatBedrock = false; -+ private void generatorSettings() { -+ generateFlatBedrock = getBoolean("generator-settings.flat-bedrock", this.generateFlatBedrock); -+ } - } - diff --git a/src/main/java/net/minecraft/data/worldgen/SurfaceRuleData.java b/src/main/java/net/minecraft/data/worldgen/SurfaceRuleData.java -index 06e1774dfbb667aca69bc30c9675ed472cb5728c..e380a62e44d93c434128a656d509c8892289c66d 100644 +index 06e1774dfbb667aca69bc30c9675ed472cb5728c..2f9ba60c0196c3722fbf5a44fbbcf22a85d438db 100644 --- a/src/main/java/net/minecraft/data/worldgen/SurfaceRuleData.java +++ b/src/main/java/net/minecraft/data/worldgen/SurfaceRuleData.java @@ -53,6 +53,66 @@ public class SurfaceRuleData { @@ -53,7 +38,7 @@ index 06e1774dfbb667aca69bc30c9675ed472cb5728c..e380a62e44d93c434128a656d509c889 + + @Override + public SurfaceRules.Condition apply(SurfaceRules.Context context) { -+ boolean hasFlatBedrock = context.context.getWorld().paperConfig.generateFlatBedrock; ++ boolean hasFlatBedrock = context.context.getWorld().paperConfig().environment.generateFlatBedrock; + int trueAtY = this.trueAtAndBelow().resolveY(context.context); + int falseAtY = this.falseAtAndAbove().resolveY(context.context); + diff --git a/patches/server/0337-Prevent-sync-chunk-loads-when-villagers-try-to-find-.patch b/patches/server/0336-Prevent-sync-chunk-loads-when-villagers-try-to-find-.patch similarity index 100% rename from patches/server/0337-Prevent-sync-chunk-loads-when-villagers-try-to-find-.patch rename to patches/server/0336-Prevent-sync-chunk-loads-when-villagers-try-to-find-.patch diff --git a/patches/server/0338-MC-145656-Fix-Follow-Range-Initial-Target.patch b/patches/server/0337-MC-145656-Fix-Follow-Range-Initial-Target.patch similarity index 72% rename from patches/server/0338-MC-145656-Fix-Follow-Range-Initial-Target.patch rename to patches/server/0337-MC-145656-Fix-Follow-Range-Initial-Target.patch index 8c11c29d52..44844fef0d 100644 --- a/patches/server/0338-MC-145656-Fix-Follow-Range-Initial-Target.patch +++ b/patches/server/0337-MC-145656-Fix-Follow-Range-Initial-Target.patch @@ -4,30 +4,15 @@ Date: Wed, 18 Dec 2019 22:21:35 -0600 Subject: [PATCH] MC-145656 Fix Follow Range Initial Target -diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -index 68448d9ae6650beabcc62128772c6a18754788c4..297adb65c486abccd42cdb3b042e651a767c69cf 100644 ---- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -@@ -488,5 +488,10 @@ public class PaperWorldConfig { - private void generatorSettings() { - generateFlatBedrock = getBoolean("generator-settings.flat-bedrock", this.generateFlatBedrock); - } -+ -+ public boolean entitiesTargetWithFollowRange = false; -+ private void entitiesTargetWithFollowRange() { -+ entitiesTargetWithFollowRange = getBoolean("entities-target-with-follow-range", entitiesTargetWithFollowRange); -+ } - } - diff --git a/src/main/java/net/minecraft/world/entity/ai/goal/target/NearestAttackableTargetGoal.java b/src/main/java/net/minecraft/world/entity/ai/goal/target/NearestAttackableTargetGoal.java -index 638942d54c6ea2d305350a330ac9fb8b82294f53..c6fc08d13b4cf3141ff31bed99294bdbace1c5e2 100644 +index 638942d54c6ea2d305350a330ac9fb8b82294f53..7f4fb6ad4b3b3da52a111b0c58499f27d8443124 100644 --- a/src/main/java/net/minecraft/world/entity/ai/goal/target/NearestAttackableTargetGoal.java +++ b/src/main/java/net/minecraft/world/entity/ai/goal/target/NearestAttackableTargetGoal.java @@ -38,6 +38,7 @@ public class NearestAttackableTargetGoal extends TargetG this.randomInterval = reducedTickDelay(reciprocalChance); this.setFlags(EnumSet.of(Goal.Flag.TARGET)); this.targetConditions = TargetingConditions.forCombat().range(this.getFollowDistance()).selector(targetPredicate); -+ if (mob.level.paperConfig.entitiesTargetWithFollowRange) this.targetConditions.useFollowRange(); // Paper ++ if (mob.level.paperConfig().entities.entitiesTargetWithFollowRange) this.targetConditions.useFollowRange(); // Paper } @Override diff --git a/patches/server/0339-Duplicate-UUID-Resolve-Option.patch b/patches/server/0338-Duplicate-UUID-Resolve-Option.patch similarity index 61% rename from patches/server/0339-Duplicate-UUID-Resolve-Option.patch rename to patches/server/0338-Duplicate-UUID-Resolve-Option.patch index be8f44e81a..3a06b76507 100644 --- a/patches/server/0339-Duplicate-UUID-Resolve-Option.patch +++ b/patches/server/0338-Duplicate-UUID-Resolve-Option.patch @@ -32,69 +32,11 @@ But for those who are ok with leaving this inconsistent behavior, you may use WA It is recommended you regenerate the entities, as these were legit entities, and deserve your love. -diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -index 297adb65c486abccd42cdb3b042e651a767c69cf..ce892ab0a2f5c648c1e6f4b3d4332102ae7b8be2 100644 ---- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -@@ -464,6 +464,45 @@ public class PaperWorldConfig { - preventMovingIntoUnloadedChunks = getBoolean("prevent-moving-into-unloaded-chunks", false); - } - -+ public enum DuplicateUUIDMode { -+ SAFE_REGEN, DELETE, NOTHING, WARN -+ } -+ public DuplicateUUIDMode duplicateUUIDMode = DuplicateUUIDMode.SAFE_REGEN; -+ public int duplicateUUIDDeleteRange = 32; -+ private void repairDuplicateUUID() { -+ String desiredMode = getString("duplicate-uuid-resolver", "saferegen").toLowerCase().trim(); -+ duplicateUUIDDeleteRange = getInt("duplicate-uuid-saferegen-delete-range", duplicateUUIDDeleteRange); -+ switch (desiredMode.toLowerCase()) { -+ case "regen": -+ case "regenerate": -+ case "saferegen": -+ case "saferegenerate": -+ duplicateUUIDMode = DuplicateUUIDMode.SAFE_REGEN; -+ log("Duplicate UUID Resolve: Regenerate New UUID if distant (Delete likely duplicates within " + duplicateUUIDDeleteRange + " blocks)"); -+ break; -+ case "remove": -+ case "delete": -+ duplicateUUIDMode = DuplicateUUIDMode.DELETE; -+ log("Duplicate UUID Resolve: Delete Entity"); -+ break; -+ case "silent": -+ case "nothing": -+ duplicateUUIDMode = DuplicateUUIDMode.NOTHING; -+ logError("Duplicate UUID Resolve: Do Nothing (no logs) - Warning, may lose indication of bad things happening"); -+ break; -+ case "log": -+ case "warn": -+ duplicateUUIDMode = DuplicateUUIDMode.WARN; -+ log("Duplicate UUID Resolve: Warn (do nothing but log it happened, may be spammy)"); -+ break; -+ default: -+ duplicateUUIDMode = DuplicateUUIDMode.WARN; -+ logError("Warning: Invalid duplicate-uuid-resolver config " + desiredMode + " - must be one of: regen, delete, nothing, warn"); -+ log("Duplicate UUID Resolve: Warn (do nothing but log it happened, may be spammy)"); -+ break; -+ } -+ } -+ - public boolean countAllMobsForSpawning = false; - private void countAllMobsForSpawning() { - countAllMobsForSpawning = getBoolean("count-all-mobs-for-spawning", false); diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java -index ef7ef7fa4116e0def1d73e604ee706deb4c94330..e08245037aeb6fd8a24ae7402b5853933e5eed34 100644 +index ef7ef7fa4116e0def1d73e604ee706deb4c94330..ac57c9f6ac5c0bf816a9adaee8ecbb5d291926d9 100644 --- a/src/main/java/net/minecraft/server/level/ChunkMap.java +++ b/src/main/java/net/minecraft/server/level/ChunkMap.java -@@ -1,6 +1,7 @@ - package net.minecraft.server.level; - - import co.aikar.timings.Timing; // Paper -+import com.destroystokyo.paper.PaperWorldConfig; // Paper - import com.google.common.collect.ImmutableList; - import com.google.common.collect.ImmutableList.Builder; - import com.google.common.collect.Iterables; -@@ -32,13 +33,17 @@ import java.io.Writer; +@@ -32,13 +32,17 @@ import java.io.Writer; import java.nio.file.Path; import java.util.ArrayList; import java.util.BitSet; @@ -112,7 +54,7 @@ index ef7ef7fa4116e0def1d73e604ee706deb4c94330..e08245037aeb6fd8a24ae7402b585393 import java.util.concurrent.CompletableFuture; import java.util.concurrent.CompletionException; import java.util.concurrent.CompletionStage; -@@ -871,6 +876,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider +@@ -871,6 +875,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider entity.discard(); needsRemoval = true; } @@ -120,23 +62,23 @@ index ef7ef7fa4116e0def1d73e604ee706deb4c94330..e08245037aeb6fd8a24ae7402b585393 return !needsRemoval; })); // CraftBukkit end -@@ -921,6 +927,43 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider +@@ -921,6 +926,43 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider }); } + // Paper start + private static void checkDupeUUID(ServerLevel level, Entity entity) { -+ PaperWorldConfig.DuplicateUUIDMode mode = level.paperConfig.duplicateUUIDMode; -+ if (mode != PaperWorldConfig.DuplicateUUIDMode.WARN -+ && mode != PaperWorldConfig.DuplicateUUIDMode.DELETE -+ && mode != PaperWorldConfig.DuplicateUUIDMode.SAFE_REGEN) { ++ io.papermc.paper.configuration.WorldConfiguration.Entities.Spawning.DuplicateUUID.DuplicateUUIDMode mode = level.paperConfig().entities.spawning.duplicateUuid.mode; ++ if (mode != io.papermc.paper.configuration.WorldConfiguration.Entities.Spawning.DuplicateUUID.DuplicateUUIDMode.WARN ++ && mode != io.papermc.paper.configuration.WorldConfiguration.Entities.Spawning.DuplicateUUID.DuplicateUUIDMode.DELETE ++ && mode != io.papermc.paper.configuration.WorldConfiguration.Entities.Spawning.DuplicateUUID.DuplicateUUIDMode.SAFE_REGEN) { + return; + } + Entity other = level.getEntity(entity.getUUID()); + -+ if (mode == PaperWorldConfig.DuplicateUUIDMode.SAFE_REGEN && other != null && !other.isRemoved() ++ if (mode == io.papermc.paper.configuration.WorldConfiguration.Entities.Spawning.DuplicateUUID.DuplicateUUIDMode.SAFE_REGEN && other != null && !other.isRemoved() + && Objects.equals(other.getEncodeId(), entity.getEncodeId()) -+ && entity.getBukkitEntity().getLocation().distance(other.getBukkitEntity().getLocation()) < level.paperConfig.duplicateUUIDDeleteRange ++ && entity.getBukkitEntity().getLocation().distance(other.getBukkitEntity().getLocation()) < level.paperConfig().entities.spawning.duplicateUuid.safeRegenDeleteRange + ) { + if (ServerLevel.DEBUG_ENTITIES) LOGGER.warn("[DUPE-UUID] Duplicate UUID found used by " + other + ", deleted entity " + entity + " because it was near the duplicate and likely an actual duplicate. See https://github.com/PaperMC/Paper/issues/1223 for discussion on what this is about."); + entity.discard(); @@ -165,7 +107,7 @@ index ef7ef7fa4116e0def1d73e604ee706deb4c94330..e08245037aeb6fd8a24ae7402b585393 ChunkPos chunkcoordintpair = holder.getPos(); CompletableFuture, ChunkHolder.ChunkLoadingFailure>> completablefuture = this.getChunkRangeFuture(chunkcoordintpair, 1, (i) -> { diff --git a/src/main/java/net/minecraft/world/level/entity/PersistentEntitySectionManager.java b/src/main/java/net/minecraft/world/level/entity/PersistentEntitySectionManager.java -index dfd1afc57664dd18c11f8a2547616074ccc55690..e55ec74ac0363def04c2d7bf1b2a9d873388ea70 100644 +index dfd1afc57664dd18c11f8a2547616074ccc55690..6e3d02fb68741fc3cf7d74ec659a37e5a1ecac5c 100644 --- a/src/main/java/net/minecraft/world/level/entity/PersistentEntitySectionManager.java +++ b/src/main/java/net/minecraft/world/level/entity/PersistentEntitySectionManager.java @@ -78,7 +78,22 @@ public class PersistentEntitySectionManager implements A @@ -181,11 +123,11 @@ index dfd1afc57664dd18c11f8a2547616074ccc55690..e55ec74ac0363def04c2d7bf1b2a9d87 + // Paper end PersistentEntitySectionManager.LOGGER.warn("UUID of added entity already exists: {}", entity); + // Paper start -+ if (net.minecraft.world.level.Level.DEBUG_ENTITIES && ((Entity) entity).level.paperConfig.duplicateUUIDMode != com.destroystokyo.paper.PaperWorldConfig.DuplicateUUIDMode.NOTHING) { ++ if (net.minecraft.world.level.Level.DEBUG_ENTITIES && ((Entity) entity).level.paperConfig().entities.spawning.duplicateUuid.mode != io.papermc.paper.configuration.WorldConfiguration.Entities.Spawning.DuplicateUUID.DuplicateUUIDMode.NOTHING) { + if (((Entity) entity).addedToWorldStack != null) { + ((Entity) entity).addedToWorldStack.printStackTrace(); + } -+ net.minecraft.server.level.ServerLevel.getAddToWorldStackTrace((net.minecraft.world.entity.Entity) entity).printStackTrace(); ++ net.minecraft.server.level.ServerLevel.getAddToWorldStackTrace((Entity) entity).printStackTrace(); + } + // Paper end return false; diff --git a/patches/server/0340-Optimize-Hoppers.patch b/patches/server/0339-Optimize-Hoppers.patch similarity index 91% rename from patches/server/0340-Optimize-Hoppers.patch rename to patches/server/0339-Optimize-Hoppers.patch index 21d90dc661..4a7cb45658 100644 --- a/patches/server/0340-Optimize-Hoppers.patch +++ b/patches/server/0339-Optimize-Hoppers.patch @@ -12,37 +12,15 @@ Subject: [PATCH] Optimize Hoppers * Don't check for Entities with Inventories if the block above us is also occluding (not just Inventoried) * Remove Streams from Item Suck In and restore restore 1.12 AABB checks which is simpler and no voxel allocations (was doing TWO Item Suck ins) -diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -index ce892ab0a2f5c648c1e6f4b3d4332102ae7b8be2..4e90cc3970c77d8a488ac8bbcbaacf78b147f8b2 100644 ---- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -@@ -532,5 +532,17 @@ public class PaperWorldConfig { - private void entitiesTargetWithFollowRange() { - entitiesTargetWithFollowRange = getBoolean("entities-target-with-follow-range", entitiesTargetWithFollowRange); - } -+ -+ public boolean cooldownHopperWhenFull = true; -+ public boolean disableHopperMoveEvents = false; -+ public boolean hoppersIgnoreOccludingBlocks = false; -+ private void hopperOptimizations() { -+ cooldownHopperWhenFull = getBoolean("hopper.cooldown-when-full", cooldownHopperWhenFull); -+ log("Cooldown Hoppers when Full: " + (cooldownHopperWhenFull ? "enabled" : "disabled")); -+ disableHopperMoveEvents = getBoolean("hopper.disable-move-event", disableHopperMoveEvents); -+ log("Hopper Move Item Events: " + (disableHopperMoveEvents ? "disabled" : "enabled")); -+ hoppersIgnoreOccludingBlocks = getBoolean("hopper.ignore-occluding-blocks", hoppersIgnoreOccludingBlocks); -+ log("Hopper Ignore Container Entities inside Occluding Blocks: " + (hoppersIgnoreOccludingBlocks ? "enabled" : "disabled")); -+ } - } - diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index ed8d4ee72f179a55c12e83dfc691a57984d1c592..8bb4657523acef60df297cc4ebae292eb6a79591 100644 +index 6ceed3a97a7fc351052b2020572d65801542f593..6f7ff5486d7f7661c352a54b38598b15adebe26a 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java @@ -1409,6 +1409,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop 0; // Paper -+ net.minecraft.world.level.block.entity.HopperBlockEntity.skipHopperEvents = worldserver.paperConfig.disableHopperMoveEvents || org.bukkit.event.inventory.InventoryMoveItemEvent.getHandlerList().getRegisteredListeners().length == 0; // Paper ++ net.minecraft.world.level.block.entity.HopperBlockEntity.skipHopperEvents = worldserver.paperConfig().hopper.disableMoveEvent || org.bukkit.event.inventory.InventoryMoveItemEvent.getHandlerList().getRegisteredListeners().length == 0; // Paper this.profiler.push(() -> { return worldserver + " " + worldserver.dimension().location(); @@ -100,7 +78,7 @@ index a05acf709735b40ca86f978508c63a86065fd405..6a1405a8630e90db3b5a3c9152259ba6 double getLevelY(); diff --git a/src/main/java/net/minecraft/world/level/block/entity/HopperBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/HopperBlockEntity.java -index d732d00af7870b4b9d7eefe0fc97041b09c12a64..80ca90806bc1e52b6995ba287bc4195617aa9e67 100644 +index d732d00af7870b4b9d7eefe0fc97041b09c12a64..9cb783a3001291ddba44776c6bff0c6369684399 100644 --- a/src/main/java/net/minecraft/world/level/block/entity/HopperBlockEntity.java +++ b/src/main/java/net/minecraft/world/level/block/entity/HopperBlockEntity.java @@ -3,7 +3,6 @@ package net.minecraft.world.level.block.entity; @@ -166,7 +144,7 @@ index d732d00af7870b4b9d7eefe0fc97041b09c12a64..80ca90806bc1e52b6995ba287bc41956 + origItemStack.setCount(origCount); + } + } -+ if (foundItem && level.paperConfig.cooldownHopperWhenFull) { // Inventory was full - cooldown ++ if (foundItem && level.paperConfig().hopper.cooldownWhenFull) { // Inventory was full - cooldown + hopper.setCooldown(level.spigotConfig.hopperTransfer); + } + return false; @@ -205,7 +183,7 @@ index d732d00af7870b4b9d7eefe0fc97041b09c12a64..80ca90806bc1e52b6995ba287bc41956 + } + origItemStack.setCount(origCount); + -+ if (level.paperConfig.cooldownHopperWhenFull) { ++ if (level.paperConfig().hopper.cooldownWhenFull) { + cooldownHopper(ihopper); + } + @@ -450,7 +428,7 @@ index d732d00af7870b4b9d7eefe0fc97041b09c12a64..80ca90806bc1e52b6995ba287bc41956 } - if (object == null) { -+ if (object == null && (!optimizeEntities || !world.paperConfig.hoppersIgnoreOccludingBlocks || !org.bukkit.craftbukkit.util.CraftMagicNumbers.getMaterial(block).isOccluding())) { // Paper ++ if (object == null && (!optimizeEntities || !world.paperConfig().hopper.ignoreOccludingBlocks || !org.bukkit.craftbukkit.util.CraftMagicNumbers.getMaterial(block).isOccluding())) { // Paper List list = world.getEntities((Entity) null, new AABB(x - 0.5D, y - 0.5D, z - 0.5D, x + 0.5D, y + 0.5D, z + 0.5D), EntitySelector.CONTAINER_ENTITY_SELECTOR); if (!list.isEmpty()) { diff --git a/patches/server/0341-PlayerDeathEvent-shouldDropExperience.patch b/patches/server/0340-PlayerDeathEvent-shouldDropExperience.patch similarity index 91% rename from patches/server/0341-PlayerDeathEvent-shouldDropExperience.patch rename to patches/server/0340-PlayerDeathEvent-shouldDropExperience.patch index 6135fb25b6..d55bc99c58 100644 --- a/patches/server/0341-PlayerDeathEvent-shouldDropExperience.patch +++ b/patches/server/0340-PlayerDeathEvent-shouldDropExperience.patch @@ -5,7 +5,7 @@ Subject: [PATCH] PlayerDeathEvent#shouldDropExperience diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java -index 321b6a74fadd0aa8b5b956743bde289e69b65578..b19ca7f62e78035ed5f52e1eb1a76066af97de80 100644 +index d28f8f527048f8ec2b3acaa499fee92faeaac3aa..255c679b6859d95e47d9106697bfc2f0f066334e 100644 --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java @@ -896,7 +896,7 @@ public class ServerPlayer extends Player { diff --git a/patches/server/0342-Prevent-bees-loading-chunks-checking-hive-position.patch b/patches/server/0341-Prevent-bees-loading-chunks-checking-hive-position.patch similarity index 100% rename from patches/server/0342-Prevent-bees-loading-chunks-checking-hive-position.patch rename to patches/server/0341-Prevent-bees-loading-chunks-checking-hive-position.patch diff --git a/patches/server/0343-Don-t-load-Chunks-from-Hoppers-and-other-things.patch b/patches/server/0342-Don-t-load-Chunks-from-Hoppers-and-other-things.patch similarity index 100% rename from patches/server/0343-Don-t-load-Chunks-from-Hoppers-and-other-things.patch rename to patches/server/0342-Don-t-load-Chunks-from-Hoppers-and-other-things.patch diff --git a/patches/server/0344-Guard-against-serializing-mismatching-chunk-coordina.patch b/patches/server/0343-Guard-against-serializing-mismatching-chunk-coordina.patch similarity index 100% rename from patches/server/0344-Guard-against-serializing-mismatching-chunk-coordina.patch rename to patches/server/0343-Guard-against-serializing-mismatching-chunk-coordina.patch diff --git a/patches/server/0345-Optimise-IEntityAccess-getPlayerByUUID.patch b/patches/server/0344-Optimise-IEntityAccess-getPlayerByUUID.patch similarity index 94% rename from patches/server/0345-Optimise-IEntityAccess-getPlayerByUUID.patch rename to patches/server/0344-Optimise-IEntityAccess-getPlayerByUUID.patch index b8246b54d7..ff1f389619 100644 --- a/patches/server/0345-Optimise-IEntityAccess-getPlayerByUUID.patch +++ b/patches/server/0344-Optimise-IEntityAccess-getPlayerByUUID.patch @@ -6,7 +6,7 @@ Subject: [PATCH] Optimise IEntityAccess#getPlayerByUUID Use the world entity map instead of iterating over all players diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java -index 97f1679c2a549b27fd70b6773819feae26fc54bb..06d4c948241f121f4ccafe869b3e37c8a6279622 100644 +index f1d2801bc46888f9f7e8b3458e47bb0677947272..ed0676cdb55232944e3e4d87108fe98159515d2e 100644 --- a/src/main/java/net/minecraft/server/level/ServerLevel.java +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java @@ -390,6 +390,14 @@ public class ServerLevel extends Level implements WorldGenLevel { diff --git a/patches/server/0346-Fix-items-not-falling-correctly.patch b/patches/server/0345-Fix-items-not-falling-correctly.patch similarity index 100% rename from patches/server/0346-Fix-items-not-falling-correctly.patch rename to patches/server/0345-Fix-items-not-falling-correctly.patch diff --git a/patches/server/0347-Lag-compensate-eating.patch b/patches/server/0346-Lag-compensate-eating.patch similarity index 97% rename from patches/server/0347-Lag-compensate-eating.patch rename to patches/server/0346-Lag-compensate-eating.patch index 8a2af0f730..5fc3b96330 100644 --- a/patches/server/0347-Lag-compensate-eating.patch +++ b/patches/server/0346-Lag-compensate-eating.patch @@ -7,7 +7,7 @@ When the server is lagging, players will wait longer when eating. Change to also use a time check instead if it passes. diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java -index 0da23722a326aa190dca7d610bf3cb5c42dbb7f8..5330ce940918cc858cbce74665f1c928249bb957 100644 +index b521be6552d4fbf115a2f829b68fc7c5fff72a9a..26f59e695ef68d1cf33e649ca370f8320d515201 100644 --- a/src/main/java/net/minecraft/world/entity/LivingEntity.java +++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java @@ -3539,6 +3539,11 @@ public abstract class LivingEntity extends Entity { diff --git a/patches/server/0348-Optimize-call-to-getFluid-for-explosions.patch b/patches/server/0347-Optimize-call-to-getFluid-for-explosions.patch similarity index 91% rename from patches/server/0348-Optimize-call-to-getFluid-for-explosions.patch rename to patches/server/0347-Optimize-call-to-getFluid-for-explosions.patch index 2c306ee70e..952f1fc45d 100644 --- a/patches/server/0348-Optimize-call-to-getFluid-for-explosions.patch +++ b/patches/server/0347-Optimize-call-to-getFluid-for-explosions.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Optimize call to getFluid for explosions diff --git a/src/main/java/net/minecraft/world/level/Explosion.java b/src/main/java/net/minecraft/world/level/Explosion.java -index 2a10a50381b6d6229b7c6e1d32f0d8f96db70bd5..85e9c23b8dde4266696c6c62fc124b7508a0bb4f 100644 +index af9645a3ef9dab1134977b30937f15fa3fa27a95..38bb502e9f1272020a23a3ef8ebb0cb1a5a251ef 100644 --- a/src/main/java/net/minecraft/world/level/Explosion.java +++ b/src/main/java/net/minecraft/world/level/Explosion.java @@ -172,7 +172,7 @@ public class Explosion { diff --git a/patches/server/0349-Fix-last-firework-in-stack-not-having-effects-when-d.patch b/patches/server/0348-Fix-last-firework-in-stack-not-having-effects-when-d.patch similarity index 100% rename from patches/server/0349-Fix-last-firework-in-stack-not-having-effects-when-d.patch rename to patches/server/0348-Fix-last-firework-in-stack-not-having-effects-when-d.patch diff --git a/patches/server/0350-Add-effect-to-block-break-naturally.patch b/patches/server/0349-Add-effect-to-block-break-naturally.patch similarity index 100% rename from patches/server/0350-Add-effect-to-block-break-naturally.patch rename to patches/server/0349-Add-effect-to-block-break-naturally.patch diff --git a/patches/server/0351-Entity-Activation-Range-2.0.patch b/patches/server/0350-Entity-Activation-Range-2.0.patch similarity index 99% rename from patches/server/0351-Entity-Activation-Range-2.0.patch rename to patches/server/0350-Entity-Activation-Range-2.0.patch index c1f4cca723..c17d361f00 100644 --- a/patches/server/0351-Entity-Activation-Range-2.0.patch +++ b/patches/server/0350-Entity-Activation-Range-2.0.patch @@ -14,7 +14,7 @@ Adds flying monsters to control ghast and phantoms Adds villagers as separate config diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java -index 06d4c948241f121f4ccafe869b3e37c8a6279622..1d036031889a41134b5c475c18a85c5b678fa1f7 100644 +index ed0676cdb55232944e3e4d87108fe98159515d2e..34c9354e1bdf08ac5203e550a542548ceb9dd105 100644 --- a/src/main/java/net/minecraft/server/level/ServerLevel.java +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java @@ -2,7 +2,6 @@ package net.minecraft.server.level; @@ -108,7 +108,7 @@ index 06d4c948241f121f4ccafe869b3e37c8a6279622..1d036031889a41134b5c475c18a85c5b } else { passenger.stopRiding(); diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java -index f075e2663260759c457bce48d2ce0773709fc9e7..f5f40e97fa07cd84de0c759a6dffd638f752d466 100644 +index 94966ce5d0af77f3ae2e43e84f12470e6fee094b..b3d252b822b39c3fbbfbaf5c98284fb4281ab635 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java @@ -378,6 +378,8 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource { @@ -144,7 +144,7 @@ index f075e2663260759c457bce48d2ce0773709fc9e7..f5f40e97fa07cd84de0c759a6dffd638 movement = this.maybeBackOffFromEdge(movement, movementType); Vec3 vec3d1 = this.collide(movement); diff --git a/src/main/java/net/minecraft/world/entity/Mob.java b/src/main/java/net/minecraft/world/entity/Mob.java -index dc5cb767c91252b1049c76841cbe14b29287572c..9e0f1938f534a61abc00ed80c8effd7d15056195 100644 +index 2ffc99730c3d5dbdec63881a1eca07d5fbb1754e..1a2e5e8c32a2fabe3b92ded6c630b8258b57bc0f 100644 --- a/src/main/java/net/minecraft/world/entity/Mob.java +++ b/src/main/java/net/minecraft/world/entity/Mob.java @@ -210,6 +210,19 @@ public abstract class Mob extends LivingEntity { @@ -303,7 +303,7 @@ index f957c0aca36b7228ac3a33ca04c948b1d10642d1..39fc94b1e1555fd6706391223dd27831 super.customServerAiStep(); } diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java -index 6d5d67aec4be3205032ce3b97e12356b89a0f5fe..dca25847a2d8cf2ae74121c9e8840dfab38e43e8 100644 +index c30b310f949400f1eb2329f5f1c726635d9efe4d..4130eeaf6fbba28602fc5ee064ec4e3936a88b4e 100644 --- a/src/main/java/net/minecraft/world/level/Level.java +++ b/src/main/java/net/minecraft/world/level/Level.java @@ -158,6 +158,12 @@ public abstract class Level implements LevelAccessor, AutoCloseable { @@ -318,7 +318,7 @@ index 6d5d67aec4be3205032ce3b97e12356b89a0f5fe..dca25847a2d8cf2ae74121c9e8840dfa + // Paper end public boolean populating; public final org.spigotmc.SpigotWorldConfig spigotConfig; // Spigot - + // Paper start diff --git a/src/main/java/net/minecraft/world/level/block/piston/PistonMovingBlockEntity.java b/src/main/java/net/minecraft/world/level/block/piston/PistonMovingBlockEntity.java index 4b55b667eebfe50dfeda89015112e275e71b9777..dda0b32a4989bbead35a2219a969a30ba0e975b0 100644 --- a/src/main/java/net/minecraft/world/level/block/piston/PistonMovingBlockEntity.java diff --git a/patches/server/0352-Increase-Light-Queue-Size.patch b/patches/server/0351-Increase-Light-Queue-Size.patch similarity index 58% rename from patches/server/0352-Increase-Light-Queue-Size.patch rename to patches/server/0351-Increase-Light-Queue-Size.patch index eaba454d22..46095208e3 100644 --- a/patches/server/0352-Increase-Light-Queue-Size.patch +++ b/patches/server/0351-Increase-Light-Queue-Size.patch @@ -13,23 +13,8 @@ light engine on shutdown... The queue size only puts a cap on max loss, doesn't solve that problem. -diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -index 4e90cc3970c77d8a488ac8bbcbaacf78b147f8b2..60d76eb048186d2f1bc0f1ed02741f8a2fd763b0 100644 ---- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -@@ -544,5 +544,10 @@ public class PaperWorldConfig { - hoppersIgnoreOccludingBlocks = getBoolean("hopper.ignore-occluding-blocks", hoppersIgnoreOccludingBlocks); - log("Hopper Ignore Container Entities inside Occluding Blocks: " + (hoppersIgnoreOccludingBlocks ? "enabled" : "disabled")); - } -+ -+ public int lightQueueSize = 20; -+ private void lightQueueSize() { -+ lightQueueSize = getInt("light-queue-size", lightQueueSize); -+ } - } - diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index 71bed00743ec7ef026a59fc84f8e9153a32e269a..5b9cd88e77a492bbd9c52d5c245b35bb53cf024e 100644 +index 6f7ff5486d7f7661c352a54b38598b15adebe26a..bf97a9be49a8a187004ceb302db59c31f12e3e1b 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java @@ -777,7 +777,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop (max 5) to automatically fix all light data in the chunks. diff --git a/src/main/java/com/destroystokyo/paper/PaperCommand.java b/src/main/java/com/destroystokyo/paper/PaperCommand.java -index 68f3f5ebd2188bf8280fc028f98ef8bb51622c26..b5756d067b013ee78a55b97ad00375d15ecd483c 100644 +index 7f0b9f12eae3d05a21118806dfc291c7d02996d4..c3ee820fa69a75bee8d2c3a61e1015b22214bc53 100644 --- a/src/main/java/com/destroystokyo/paper/PaperCommand.java +++ b/src/main/java/com/destroystokyo/paper/PaperCommand.java @@ -10,7 +10,8 @@ import net.minecraft.server.MinecraftServer; @@ -58,7 +58,7 @@ index 68f3f5ebd2188bf8280fc028f98ef8bb51622c26..b5756d067b013ee78a55b97ad00375d1 case "ver": if (!testPermission(sender, "version")) break; // "ver" needs a special check because it's an alias. All other commands are checked up before the switch statement (because they are present in the SUBCOMMANDS set) case "version": -@@ -427,4 +434,74 @@ public class PaperCommand extends Command { +@@ -424,4 +431,74 @@ public class PaperCommand extends Command { Command.broadcastCommandMessage(sender, text("Paper config reload complete.", GREEN)); } @@ -105,7 +105,7 @@ index 68f3f5ebd2188bf8280fc028f98ef8bb51622c26..b5756d067b013ee78a55b97ad00375d1 + updateLight(sender, world, lightengine, queue); + return; + } -+ lightengine.setTaskPerBatch(world.paperConfig.lightQueueSize + 16 * 256); // ensure full chunk can fit into queue ++ lightengine.setTaskPerBatch(world.paperConfig().misc.lightQueueSize + 16 * 256); // ensure full chunk can fit into queue + sender.sendMessage("Updating Light " + coord); + int cx = chunk.getPos().x << 4; + int cz = chunk.getPos().z << 4; @@ -129,15 +129,15 @@ index 68f3f5ebd2188bf8280fc028f98ef8bb51622c26..b5756d067b013ee78a55b97ad00375d1 + } else { + updateLight(sender, world, lightengine, queue); + } -+ lightengine.setTaskPerBatch(world.paperConfig.lightQueueSize); ++ lightengine.setTaskPerBatch(world.paperConfig().misc.lightQueueSize); + }, MinecraftServer.getServer()); + } } diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java -index e08245037aeb6fd8a24ae7402b5853933e5eed34..77ecefbdda8ed2d52085eb31f857012f6bc905fc 100644 +index ac57c9f6ac5c0bf816a9adaee8ecbb5d291926d9..c4af6e0f38ac9271247ed657b8ee6b48822417b5 100644 --- a/src/main/java/net/minecraft/server/level/ChunkMap.java +++ b/src/main/java/net/minecraft/server/level/ChunkMap.java -@@ -141,6 +141,12 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider +@@ -140,6 +140,12 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider private final ChunkTaskPriorityQueueSorter queueSorter; private final ProcessorHandle> worldgenMailbox; public final ProcessorHandle> mainThreadMailbox; @@ -150,7 +150,7 @@ index e08245037aeb6fd8a24ae7402b5853933e5eed34..77ecefbdda8ed2d52085eb31f857012f public final ChunkProgressListener progressListener; private final ChunkStatusUpdateListener chunkStatusListener; public final ChunkMap.ChunkDistanceManager distanceManager; -@@ -259,11 +265,12 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider +@@ -258,11 +264,12 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider this.progressListener = worldGenerationProgressListener; this.chunkStatusListener = chunkStatusChangeListener; diff --git a/patches/server/0354-Anti-Xray.patch b/patches/server/0353-Anti-Xray.patch similarity index 94% rename from patches/server/0354-Anti-Xray.patch rename to patches/server/0353-Anti-Xray.patch index 5bdcca5298..9d7c7c60f5 100644 --- a/patches/server/0354-Anti-Xray.patch +++ b/patches/server/0353-Anti-Xray.patch @@ -4,65 +4,6 @@ Date: Thu, 25 Nov 2021 13:27:51 +0100 Subject: [PATCH] Anti-Xray -diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -index 60d76eb048186d2f1bc0f1ed02741f8a2fd763b0..9e1db210ded0830d0dcfaa34936e66bbf51fc1fc 100644 ---- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -@@ -1,11 +1,13 @@ - package com.destroystokyo.paper; - -+import java.util.Arrays; - import java.util.List; - - import java.util.stream.Collectors; - import it.unimi.dsi.fastutil.objects.Reference2IntMap; - import it.unimi.dsi.fastutil.objects.Reference2IntOpenHashMap; - import net.minecraft.world.entity.MobCategory; -+import com.destroystokyo.paper.antixray.ChunkPacketBlockControllerAntiXray.EngineMode; - import org.bukkit.Bukkit; - import org.bukkit.configuration.file.YamlConfiguration; - import org.spigotmc.SpigotWorldConfig; -@@ -549,5 +551,40 @@ public class PaperWorldConfig { - private void lightQueueSize() { - lightQueueSize = getInt("light-queue-size", lightQueueSize); - } -+ -+ public boolean antiXray; -+ public EngineMode engineMode; -+ public int maxBlockHeight; -+ public int updateRadius; -+ public boolean lavaObscures; -+ public boolean usePermission; -+ public List hiddenBlocks; -+ public List replacementBlocks; -+ private void antiXray() { -+ antiXray = getBoolean("anti-xray.enabled", false); -+ engineMode = EngineMode.getById(getInt("anti-xray.engine-mode", EngineMode.HIDE.getId())); -+ engineMode = engineMode == null ? EngineMode.HIDE : engineMode; -+ maxBlockHeight = getInt("anti-xray.max-block-height", 64); -+ updateRadius = getInt("anti-xray.update-radius", 2); -+ lavaObscures = getBoolean("anti-xray.lava-obscures", false); -+ usePermission = getBoolean("anti-xray.use-permission", false); -+ hiddenBlocks = getList("anti-xray.hidden-blocks", Arrays.asList("copper_ore", "deepslate_copper_ore", "gold_ore", "deepslate_gold_ore", "iron_ore", "deepslate_iron_ore", -+ "coal_ore", "deepslate_coal_ore", "lapis_ore", "deepslate_lapis_ore", "mossy_cobblestone", "obsidian", "chest", "diamond_ore", "deepslate_diamond_ore", -+ "redstone_ore", "deepslate_redstone_ore", "clay", "emerald_ore", "deepslate_emerald_ore", "ender_chest")); -+ replacementBlocks = getList("anti-xray.replacement-blocks", Arrays.asList("stone", "oak_planks", "deepslate")); -+ if (PaperConfig.version < 19) { -+ hiddenBlocks.remove("lit_redstone_ore"); -+ int index = replacementBlocks.indexOf("planks"); -+ if (index != -1) { -+ replacementBlocks.set(index, "oak_planks"); -+ } -+ set("anti-xray.hidden-blocks", hiddenBlocks); -+ set("anti-xray.replacement-blocks", replacementBlocks); -+ } -+ log("Anti-Xray: " + (antiXray ? "enabled" : "disabled") + " / Engine Mode: " + engineMode.getDescription() + " / Up to " + ((maxBlockHeight >> 4) << 4) + " blocks / Update Radius: " + updateRadius); -+ if (antiXray && usePermission) { -+ Bukkit.getLogger().warning("You have enabled permission-based Anti-Xray checking - depending on your permission plugin, this may cause performance issues"); -+ } -+ } - } - diff --git a/src/main/java/com/destroystokyo/paper/antixray/BitStorageReader.java b/src/main/java/com/destroystokyo/paper/antixray/BitStorageReader.java new file mode 100644 index 0000000000000000000000000000000000000000..e448c26327b5f6189c3c52e698cff66c8f9ad81a @@ -258,13 +199,13 @@ index 0000000000000000000000000000000000000000..aabad39d13ead83042ec2e4dd7f4ed49 +} diff --git a/src/main/java/com/destroystokyo/paper/antixray/ChunkPacketBlockControllerAntiXray.java b/src/main/java/com/destroystokyo/paper/antixray/ChunkPacketBlockControllerAntiXray.java new file mode 100644 -index 0000000000000000000000000000000000000000..8e2baa21f71e7105a8e72cba4ded6aa99370fca0 +index 0000000000000000000000000000000000000000..a5d43901595f864c8a5dd5d013aa42d7f294e489 --- /dev/null +++ b/src/main/java/com/destroystokyo/paper/antixray/ChunkPacketBlockControllerAntiXray.java -@@ -0,0 +1,666 @@ +@@ -0,0 +1,692 @@ +package com.destroystokyo.paper.antixray; + -+import com.destroystokyo.paper.PaperWorldConfig; ++import io.papermc.paper.configuration.WorldConfiguration; +import net.minecraft.core.BlockPos; +import net.minecraft.core.Direction; +import net.minecraft.core.Registry; @@ -284,11 +225,15 @@ index 0000000000000000000000000000000000000000..8e2baa21f71e7105a8e72cba4ded6aa9 +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.level.chunk.*; +import org.bukkit.Bukkit; ++import org.spongepowered.configurate.serialize.ScalarSerializer; ++import org.spongepowered.configurate.serialize.SerializationException; + ++import java.lang.reflect.Type; +import java.util.*; +import java.util.concurrent.Executor; +import java.util.concurrent.ThreadLocalRandom; +import java.util.function.IntSupplier; ++import java.util.function.Predicate; + +public final class ChunkPacketBlockControllerAntiXray extends ChunkPacketBlockController { + @@ -317,7 +262,7 @@ index 0000000000000000000000000000000000000000..8e2baa21f71e7105a8e72cba4ded6aa9 + + public ChunkPacketBlockControllerAntiXray(Level level, Executor executor) { + this.executor = executor; -+ PaperWorldConfig paperWorldConfig = level.paperConfig; ++ WorldConfiguration.AntiCheat.AntiXRay paperWorldConfig = level.paperConfig().anticheat.antiXray; + engineMode = paperWorldConfig.engineMode; + maxBlockHeight = paperWorldConfig.maxBlockHeight >> 4 << 4; + updateRadius = paperWorldConfig.updateRadius; @@ -901,6 +846,8 @@ index 0000000000000000000000000000000000000000..8e2baa21f71e7105a8e72cba4ded6aa9 + HIDE(1, "hide ores"), + OBFUSCATE(2, "obfuscate"); + ++ public static final ScalarSerializer SERIALIZER = new Serializer(); ++ + private final int id; + private final String description; + @@ -926,6 +873,26 @@ index 0000000000000000000000000000000000000000..8e2baa21f71e7105a8e72cba4ded6aa9 + public String getDescription() { + return description; + } ++ ++ static class Serializer extends ScalarSerializer { ++ ++ Serializer() { ++ super(EngineMode.class); ++ } ++ ++ @Override ++ public EngineMode deserialize(Type type, Object obj) throws SerializationException { ++ if (obj instanceof Integer num) { ++ return Objects.requireNonNullElse(EngineMode.getById(num), HIDE); ++ } ++ throw new SerializationException(obj + " is not of a valid type (" + type + ") for this node"); ++ } ++ ++ @Override ++ protected Object serialize(EngineMode item, Predicate> typeSupported) { ++ return item.getId(); ++ } ++ } + } +} diff --git a/src/main/java/com/destroystokyo/paper/antixray/ChunkPacketInfo.java b/src/main/java/com/destroystokyo/paper/antixray/ChunkPacketInfo.java @@ -1049,6 +1016,26 @@ index 0000000000000000000000000000000000000000..80a2dfb266ae1221680a7b24fee2f7e2 + chunkPacketBlockControllerAntiXray.obfuscate(this); + } +} +diff --git a/src/main/java/io/papermc/paper/configuration/PaperConfigurations.java b/src/main/java/io/papermc/paper/configuration/PaperConfigurations.java +index ef407d6a961c327631656cfd4cc610a22a9e53ac..0f185ff1af93d40519e8f093b1e63b530656d616 100644 +--- a/src/main/java/io/papermc/paper/configuration/PaperConfigurations.java ++++ b/src/main/java/io/papermc/paper/configuration/PaperConfigurations.java +@@ -2,6 +2,7 @@ package io.papermc.paper.configuration; + + import com.destroystokyo.paper.Metrics; + import com.destroystokyo.paper.PaperCommand; ++import com.destroystokyo.paper.antixray.ChunkPacketBlockControllerAntiXray; + import com.google.common.collect.Table; + import com.mojang.logging.LogUtils; + import io.leangen.geantyref.TypeToken; +@@ -171,6 +172,7 @@ public class PaperConfigurations extends Configurations(new TypeToken>() {}, Registry.ENTITY_TYPE, true)) + .register(new RegistryValueSerializer<>(Item.class, Registry.ITEM, true)) diff --git a/src/main/java/net/minecraft/network/protocol/game/ClientboundLevelChunkPacketData.java b/src/main/java/net/minecraft/network/protocol/game/ClientboundLevelChunkPacketData.java index 7cf356a700e47686e093e2f2f880af919dc0414a..e902b437ee089907b34ae30c0a6bdf1d42e1e674 100644 --- a/src/main/java/net/minecraft/network/protocol/game/ClientboundLevelChunkPacketData.java @@ -1133,10 +1120,10 @@ index 7825d6f0fdcfda6212cff8033ec55fb7db236154..2072aa8710f6e285f7c8f76c63b7bcf8 public ClientboundLevelChunkWithLightPacket(FriendlyByteBuf buf) { diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java -index 77ecefbdda8ed2d52085eb31f857012f6bc905fc..4ff1c09b4db2edbcf39c13a1942dd95bd566173d 100644 +index c4af6e0f38ac9271247ed657b8ee6b48822417b5..7996247c00bf6ea4399322d089821432333ca6c4 100644 --- a/src/main/java/net/minecraft/server/level/ChunkMap.java +++ b/src/main/java/net/minecraft/server/level/ChunkMap.java -@@ -992,7 +992,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider +@@ -991,7 +991,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider completablefuture1.thenAcceptAsync((either) -> { either.ifLeft((chunk) -> { this.tickingGenerated.getAndIncrement(); @@ -1145,7 +1132,7 @@ index 77ecefbdda8ed2d52085eb31f857012f6bc905fc..4ff1c09b4db2edbcf39c13a1942dd95b this.getPlayers(chunkcoordintpair, false).forEach((entityplayer) -> { this.playerLoadedChunk(entityplayer, mutableobject, chunk); -@@ -1171,7 +1171,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider +@@ -1170,7 +1170,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider while (objectiterator.hasNext()) { ChunkHolder playerchunk = (ChunkHolder) objectiterator.next(); ChunkPos chunkcoordintpair = playerchunk.getPos(); @@ -1154,7 +1141,7 @@ index 77ecefbdda8ed2d52085eb31f857012f6bc905fc..4ff1c09b4db2edbcf39c13a1942dd95b this.getPlayers(chunkcoordintpair, false).forEach((entityplayer) -> { SectionPos sectionposition = entityplayer.getLastSectionPos(); -@@ -1185,7 +1185,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider +@@ -1184,7 +1184,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider } @@ -1163,7 +1150,7 @@ index 77ecefbdda8ed2d52085eb31f857012f6bc905fc..4ff1c09b4db2edbcf39c13a1942dd95b if (player.level == this.level) { if (newWithinViewDistance && !oldWithinViewDistance) { ChunkHolder playerchunk = this.getVisibleChunkIfPresent(pos.toLong()); -@@ -1722,12 +1722,17 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider +@@ -1721,12 +1721,17 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider } @@ -1186,15 +1173,15 @@ index 77ecefbdda8ed2d52085eb31f857012f6bc905fc..4ff1c09b4db2edbcf39c13a1942dd95b List list = Lists.newArrayList(); List list1 = Lists.newArrayList(); diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java -index 1d036031889a41134b5c475c18a85c5b678fa1f7..989f0da37f20c7989183986ffa14e9fe12c7af7f 100644 +index 25df2a2a14aeae69b0156d041159c75f3e8e6eb7..7e08260e9cdb88ff122eaf9b494f908296d99fbb 100644 --- a/src/main/java/net/minecraft/server/level/ServerLevel.java +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java @@ -401,7 +401,7 @@ public class ServerLevel extends Level implements WorldGenLevel { public ServerLevel(MinecraftServer minecraftserver, Executor executor, LevelStorageSource.LevelStorageAccess convertable_conversionsession, PrimaryLevelData iworlddataserver, ResourceKey resourcekey, LevelStem worlddimension, ChunkProgressListener worldloadlistener, boolean flag, long i, List list, boolean flag1, org.bukkit.World.Environment env, org.bukkit.generator.ChunkGenerator gen, org.bukkit.generator.BiomeProvider biomeProvider) { // Holder holder = worlddimension.typeHolder(); // CraftBukkit - decompile error // Objects.requireNonNull(minecraftserver); // CraftBukkit - decompile error -- super(iworlddataserver, resourcekey, worlddimension.typeHolder(), minecraftserver::getProfiler, false, flag, i, minecraftserver.getMaxChainedNeighborUpdates(), gen, biomeProvider, env); -+ super(iworlddataserver, resourcekey, worlddimension.typeHolder(), minecraftserver::getProfiler, false, flag, i, minecraftserver.getMaxChainedNeighborUpdates(), gen, biomeProvider, env, executor); // Paper - Async-Anti-Xray - Pass executor +- super(iworlddataserver, resourcekey, worlddimension.typeHolder(), minecraftserver::getProfiler, false, flag, i, minecraftserver.getMaxChainedNeighborUpdates(), gen, biomeProvider, env, spigotConfig -> minecraftserver.paperConfigurations.createWorldConfig(convertable_conversionsession.levelDirectory.path(), iworlddataserver.getLevelName(), spigotConfig)); // Paper ++ super(iworlddataserver, resourcekey, worlddimension.typeHolder(), minecraftserver::getProfiler, false, flag, i, minecraftserver.getMaxChainedNeighborUpdates(), gen, biomeProvider, env, spigotConfig -> minecraftserver.paperConfigurations.createWorldConfig(convertable_conversionsession.levelDirectory.path(), iworlddataserver.getLevelName(), spigotConfig), executor); // Paper - Async-Anti-Xray - Pass executor this.pvpMode = minecraftserver.isPvpAllowed(); this.convertable = convertable_conversionsession; this.uuid = WorldUUID.getUUID(convertable_conversionsession.levelDirectory.path().toFile()); @@ -1221,35 +1208,36 @@ index 3fadf6b46cc722ad81cf810c0761cf717e9f9b78..312768054e02847bbc7d2ec7fa6198da public void destroyAndAck(BlockPos pos, int sequence, String reason) { diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java -index dca25847a2d8cf2ae74121c9e8840dfab38e43e8..b56fe14e7b7de95876ba2b1d084856d6935e591c 100644 +index 4c1d34bd274d8e2a4003a286536652367da9488a..c57f400bf1fcfa1a24259ced1821aa43c428d90b 100644 --- a/src/main/java/net/minecraft/world/level/Level.java +++ b/src/main/java/net/minecraft/world/level/Level.java -@@ -168,6 +168,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable { - public final org.spigotmc.SpigotWorldConfig spigotConfig; // Spigot +@@ -173,6 +173,8 @@ public abstract class Level implements LevelAccessor, AutoCloseable { + } + // Paper end - public final com.destroystokyo.paper.PaperWorldConfig paperConfig; // Paper + public final com.destroystokyo.paper.antixray.ChunkPacketBlockController chunkPacketBlockController; // Paper - Anti-Xray - ++ public final co.aikar.timings.WorldTimingsHandler timings; // Paper public static BlockPos lastPhysicsProblem; // Spigot -@@ -187,7 +188,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable { + private org.spigotmc.TickLimiter entityLimiter; +@@ -191,7 +193,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable { public abstract ResourceKey getTypeKey(); -- protected Level(WritableLevelData worlddatamutable, ResourceKey resourcekey, 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) { -+ protected Level(WritableLevelData worlddatamutable, ResourceKey resourcekey, 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.concurrent.Executor executor) { // Paper - Async-Anti-Xray - Pass executor +- protected Level(WritableLevelData worlddatamutable, ResourceKey resourcekey, 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) { // Paper ++ protected Level(WritableLevelData worlddatamutable, ResourceKey resourcekey, Holder holder, Supplier supplier, boolean flag, boolean flag1, long i, int j, org.bukkit.generator.ChunkGenerator gen, org.bukkit.generator.BiomeProvider biomeProvider, org.bukkit.World.Environment env, java.util.function.Function paperWorldConfigCreator, java.util.concurrent.Executor executor) { // Paper - Async-Anti-Xray - Pass executor this.spigotConfig = new org.spigotmc.SpigotWorldConfig(((net.minecraft.world.level.storage.PrimaryLevelData) worlddatamutable).getLevelName()); // Spigot - this.paperConfig = new com.destroystokyo.paper.PaperWorldConfig(((net.minecraft.world.level.storage.PrimaryLevelData) worlddatamutable).getLevelName(), this.spigotConfig); // Paper + this.paperConfig = paperWorldConfigCreator.apply(this.spigotConfig); // Paper this.generator = gen; -@@ -271,6 +272,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable { - this.keepSpawnInMemory = this.paperConfig.keepSpawnInMemory; // Paper +@@ -275,6 +277,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable { + this.keepSpawnInMemory = this.paperConfig().spawn.keepSpawnLoaded; // Paper this.entityLimiter = new org.spigotmc.TickLimiter(spigotConfig.entityMaxTickTime); this.tileLimiter = new org.spigotmc.TickLimiter(spigotConfig.tileMaxTickTime); -+ this.chunkPacketBlockController = this.paperConfig.antiXray ? new com.destroystokyo.paper.antixray.ChunkPacketBlockControllerAntiXray(this, executor) : com.destroystokyo.paper.antixray.ChunkPacketBlockController.NO_OPERATION_INSTANCE; // Paper - Anti-Xray ++ this.chunkPacketBlockController = this.paperConfig().anticheat.antiXray.enabled ? new com.destroystokyo.paper.antixray.ChunkPacketBlockControllerAntiXray(this, executor) : com.destroystokyo.paper.antixray.ChunkPacketBlockController.NO_OPERATION_INSTANCE; // Paper - Anti-Xray } // Paper start -@@ -451,6 +453,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable { +@@ -455,6 +458,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable { // CraftBukkit end BlockState iblockdata1 = chunk.setBlockState(pos, state, (flags & 64) != 0, (flags & 1024) == 0); // CraftBukkit custom NO_PLACE flag @@ -1271,7 +1259,7 @@ index 0d815a39d50bb8c06f81e3386764db6a00d84985..a5160f0336f1ab50e415bddaa958616e } diff --git a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java -index 605ec3ac08845178795721977b685dfbaab33156..74952112182ac94942474f1c7cf21a6301abbcc7 100644 +index e9fae214f60fe682087d41cfaa55a1b25e5f4331..1a28b3a60bd568cba7c96152fa8dd2a64dd56801 100644 --- a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java +++ b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java @@ -93,7 +93,7 @@ public class LevelChunk extends ChunkAccess { @@ -1597,7 +1585,7 @@ index 864e591b10360b0f12fe5c5a650da372555ebd10..f26a08f81495dde6205b34254d159b04 // CraftBukkit end diff --git a/src/main/java/org/bukkit/craftbukkit/CraftChunk.java b/src/main/java/org/bukkit/craftbukkit/CraftChunk.java -index 63d4277d9d62cc26cf96af21f11015e003f9eb26..e28efd61e5b773064af077be6497caec63df1140 100644 +index cf48c93d89da53e0ec771e5c2c8582e30b35e3f5..518dfbb7dbd4221937636cf46d27109de6f431a4 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftChunk.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftChunk.java @@ -54,7 +54,7 @@ public class CraftChunk implements Chunk { @@ -1619,10 +1607,10 @@ index 63d4277d9d62cc26cf96af21f11015e003f9eb26..e28efd61e5b773064af077be6497caec } diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -index ab13a26a1391ad7403dca09a366fc11163849632..abab21e657dc13d48006bf87e434e3343a00f1ca 100644 +index 4c8ca8625860c7a19c73da633b236e2b255bd6de..cf7b6b0c4b682baefcb080b4a971c388667533e5 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -@@ -2205,7 +2205,7 @@ public final class CraftServer implements Server { +@@ -2204,7 +2204,7 @@ public final class CraftServer implements Server { public ChunkGenerator.ChunkData createChunkData(World world) { Validate.notNull(world, "World cannot be null"); ServerLevel handle = ((CraftWorld) world).getHandle(); @@ -1632,7 +1620,7 @@ index ab13a26a1391ad7403dca09a366fc11163849632..abab21e657dc13d48006bf87e434e334 @Override diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java -index 2fd677796c6393d6997dca455a7daeef191e51b7..4685879eadff725311d648d165e2aa9ad851f6fc 100644 +index 65edea6420256384a108663761ac9619ba110a8e..759370eff9dd53f41d7b00b8372154acf43908e6 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java @@ -401,11 +401,16 @@ public class CraftWorld extends CraftRegionAccessor implements World { diff --git a/patches/server/0354-Implement-alternative-item-despawn-rate.patch b/patches/server/0354-Implement-alternative-item-despawn-rate.patch new file mode 100644 index 0000000000..d1e6ea3d3e --- /dev/null +++ b/patches/server/0354-Implement-alternative-item-despawn-rate.patch @@ -0,0 +1,63 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: kickash32 +Date: Mon, 3 Jun 2019 02:02:39 -0400 +Subject: [PATCH] Implement alternative item-despawn-rate + +Co-authored-by: Noah van der Aa + +diff --git a/src/main/java/net/minecraft/world/entity/item/ItemEntity.java b/src/main/java/net/minecraft/world/entity/item/ItemEntity.java +index 85fc33183ff01611bfa90ddd33a9c885d1dd7172..22437b835c309956f263278db37737251e1503d5 100644 +--- a/src/main/java/net/minecraft/world/entity/item/ItemEntity.java ++++ b/src/main/java/net/minecraft/world/entity/item/ItemEntity.java +@@ -54,6 +54,7 @@ public class ItemEntity extends Entity { + public final float bobOffs; + private int lastTick = MinecraftServer.currentTick - 1; // CraftBukkit + public boolean canMobPickup = true; // Paper ++ private int despawnRate = -1; // Paper + + public ItemEntity(EntityType type, Level world) { + super(type, world); +@@ -184,7 +185,7 @@ public class ItemEntity extends Entity { + } + } + +- if (!this.level.isClientSide && this.age >= level.spigotConfig.itemDespawnRate) { // Spigot ++ if (!this.level.isClientSide && this.age >= this.despawnRate) { // Spigot // Paper + // CraftBukkit start - fire ItemDespawnEvent + if (org.bukkit.craftbukkit.event.CraftEventFactory.callItemDespawnEvent(this).isCancelled()) { + this.age = 0; +@@ -208,7 +209,7 @@ public class ItemEntity extends Entity { + this.lastTick = MinecraftServer.currentTick; + // CraftBukkit end + +- if (!this.level.isClientSide && this.age >= level.spigotConfig.itemDespawnRate) { // Spigot ++ if (!this.level.isClientSide && this.age >= this.despawnRate) { // Spigot // Paper + // CraftBukkit start - fire ItemDespawnEvent + if (org.bukkit.craftbukkit.event.CraftEventFactory.callItemDespawnEvent(this).isCancelled()) { + this.age = 0; +@@ -263,7 +264,7 @@ public class ItemEntity extends Entity { + private boolean isMergable() { + ItemStack itemstack = this.getItem(); + +- return this.isAlive() && this.pickupDelay != 32767 && this.age != -32768 && this.age < 6000 && itemstack.getCount() < itemstack.getMaxStackSize(); ++ return this.isAlive() && this.pickupDelay != 32767 && this.age != -32768 && this.age < this.despawnRate && itemstack.getCount() < itemstack.getMaxStackSize(); // Paper - respect despawn rate in pickup check. + } + + private void tryToMerge(ItemEntity other) { +@@ -507,6 +508,7 @@ public class ItemEntity extends Entity { + com.google.common.base.Preconditions.checkArgument(!stack.isEmpty(), "Cannot drop air"); // CraftBukkit + this.getEntityData().set(ItemEntity.DATA_ITEM, stack); + this.getEntityData().markDirty(ItemEntity.DATA_ITEM); // CraftBukkit - SPIGOT-4591, must mark dirty ++ this.despawnRate = level.paperConfig().entities.spawning.altItemDespawnRate.enabled ? level.paperConfig().entities.spawning.altItemDespawnRate.items.getOrDefault(stack.getItem(), level.spigotConfig.itemDespawnRate) : level.spigotConfig.itemDespawnRate; // Paper + } + + @Override +@@ -570,7 +572,7 @@ public class ItemEntity extends Entity { + + public void makeFakeItem() { + this.setNeverPickUp(); +- this.age = level.spigotConfig.itemDespawnRate - 1; // Spigot ++ this.age = this.despawnRate - 1; // Spigot + } + + public float getSpin(float tickDelta) { diff --git a/patches/server/0355-Implement-alternative-item-despawn-rate.patch b/patches/server/0355-Implement-alternative-item-despawn-rate.patch deleted file mode 100644 index 6482488f1b..0000000000 --- a/patches/server/0355-Implement-alternative-item-despawn-rate.patch +++ /dev/null @@ -1,144 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: kickash32 -Date: Mon, 3 Jun 2019 02:02:39 -0400 -Subject: [PATCH] Implement alternative item-despawn-rate - -Co-authored-by: Noah van der Aa - -diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -index 9e1db210ded0830d0dcfaa34936e66bbf51fc1fc..1563d22762458b9ced45be29d60eef07bfc45bb3 100644 ---- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -@@ -586,5 +586,74 @@ public class PaperWorldConfig { - Bukkit.getLogger().warning("You have enabled permission-based Anti-Xray checking - depending on your permission plugin, this may cause performance issues"); - } - } --} - -+ public boolean altItemDespawnRateEnabled; -+ public java.util.Map altItemDespawnRateMap = new java.util.HashMap<>(); -+ private void altItemDespawnRate() { -+ String path = "alt-item-despawn-rate"; -+ // Migrate from bukkit material to Mojang item ids -+ if (PaperConfig.version < 26) { -+ String world = worldName; -+ try { -+ org.bukkit.configuration.ConfigurationSection mapSection = config.getConfigurationSection("world-settings." + world + "." + path + ".items"); -+ if (mapSection == null) { -+ world = "default"; -+ mapSection = config.getConfigurationSection("world-settings." + world + "." + path + ".items"); -+ } -+ if (mapSection != null) { -+ for (String key : mapSection.getKeys(false)) { -+ int val = mapSection.getInt(key); -+ try { -+ // Ignore options that are already valid mojang wise, otherwise we might try to migrate the same config twice and fail. -+ boolean isMojangMaterial = net.minecraft.core.Registry.ITEM.getOptional(new net.minecraft.resources.ResourceLocation(key.toLowerCase())).isPresent(); -+ mapSection.set(key, null); -+ String newKey = isMojangMaterial ? key.toLowerCase() : org.bukkit.Material.valueOf(key).getKey().getKey().toLowerCase(); -+ mapSection.set(newKey, val); -+ } catch (Exception e) { -+ logError("Could not add item " + key + " to altItemDespawnRateMap: " + e.getMessage()); -+ } -+ } -+ config.set("world-settings." + world + "." + path + ".items", mapSection); -+ } -+ } catch (Exception e) { -+ logError("alt-item-despawn-rate was malformatted"); -+ return; -+ } -+ } -+ -+ altItemDespawnRateEnabled = getBoolean(path + ".enabled", false); -+ -+ if (config.getConfigurationSection("world-settings.default." + path + ".items") == null) { -+ // Initialize default -+ config.addDefault("world-settings.default." + path + ".items.cobblestone", 300); -+ } -+ -+ if (!altItemDespawnRateEnabled) { -+ return; -+ } -+ -+ org.bukkit.configuration.ConfigurationSection mapSection = config.getConfigurationSection("world-settings." + worldName + "." + path + ".items"); -+ if (mapSection == null) { -+ mapSection = config.getConfigurationSection("world-settings.default." + path + ".items"); -+ } -+ if (mapSection != null) { -+ for (String key : mapSection.getKeys(false)) { -+ try { -+ int val = mapSection.getInt(key); -+ net.minecraft.resources.ResourceLocation keyLocation = new net.minecraft.resources.ResourceLocation(key); -+ if (net.minecraft.core.Registry.ITEM.getOptional(keyLocation).isPresent()) { -+ altItemDespawnRateMap.put(keyLocation, val); -+ } else { -+ logError("Could not add item " + key + " to altItemDespawnRateMap: not a valid item"); -+ } -+ } catch (Exception e) { -+ logError("Could not add item " + key + " to altItemDespawnRateMap: " + e.getMessage()); -+ } -+ } -+ } -+ -+ for (net.minecraft.resources.ResourceLocation key : altItemDespawnRateMap.keySet()) { -+ log("Alternative item despawn rate of " + key.getPath() + ": " + altItemDespawnRateMap.get(key)); -+ } -+ } -+} -diff --git a/src/main/java/net/minecraft/world/entity/item/ItemEntity.java b/src/main/java/net/minecraft/world/entity/item/ItemEntity.java -index 85fc33183ff01611bfa90ddd33a9c885d1dd7172..3364316079dba81778869380b70e621cb9ac6269 100644 ---- a/src/main/java/net/minecraft/world/entity/item/ItemEntity.java -+++ b/src/main/java/net/minecraft/world/entity/item/ItemEntity.java -@@ -54,6 +54,7 @@ public class ItemEntity extends Entity { - public final float bobOffs; - private int lastTick = MinecraftServer.currentTick - 1; // CraftBukkit - public boolean canMobPickup = true; // Paper -+ private int despawnRate = -1; // Paper - - public ItemEntity(EntityType type, Level world) { - super(type, world); -@@ -184,7 +185,7 @@ public class ItemEntity extends Entity { - } - } - -- if (!this.level.isClientSide && this.age >= level.spigotConfig.itemDespawnRate) { // Spigot -+ if (!this.level.isClientSide && this.age >= this.despawnRate) { // Spigot // Paper - // CraftBukkit start - fire ItemDespawnEvent - if (org.bukkit.craftbukkit.event.CraftEventFactory.callItemDespawnEvent(this).isCancelled()) { - this.age = 0; -@@ -208,7 +209,7 @@ public class ItemEntity extends Entity { - this.lastTick = MinecraftServer.currentTick; - // CraftBukkit end - -- if (!this.level.isClientSide && this.age >= level.spigotConfig.itemDespawnRate) { // Spigot -+ if (!this.level.isClientSide && this.age >= this.despawnRate) { // Spigot // Paper - // CraftBukkit start - fire ItemDespawnEvent - if (org.bukkit.craftbukkit.event.CraftEventFactory.callItemDespawnEvent(this).isCancelled()) { - this.age = 0; -@@ -263,7 +264,7 @@ public class ItemEntity extends Entity { - private boolean isMergable() { - ItemStack itemstack = this.getItem(); - -- return this.isAlive() && this.pickupDelay != 32767 && this.age != -32768 && this.age < 6000 && itemstack.getCount() < itemstack.getMaxStackSize(); -+ return this.isAlive() && this.pickupDelay != 32767 && this.age != -32768 && this.age < this.despawnRate && itemstack.getCount() < itemstack.getMaxStackSize(); // Paper - respect despawn rate in pickup check. - } - - private void tryToMerge(ItemEntity other) { -@@ -507,6 +508,8 @@ public class ItemEntity extends Entity { - com.google.common.base.Preconditions.checkArgument(!stack.isEmpty(), "Cannot drop air"); // CraftBukkit - this.getEntityData().set(ItemEntity.DATA_ITEM, stack); - this.getEntityData().markDirty(ItemEntity.DATA_ITEM); // CraftBukkit - SPIGOT-4591, must mark dirty -+ net.minecraft.resources.ResourceLocation location = net.minecraft.core.Registry.ITEM.getKey(stack.getItem()); // Paper -+ this.despawnRate = level.paperConfig.altItemDespawnRateMap.getOrDefault(location, level.spigotConfig.itemDespawnRate); // Paper - } - - @Override -@@ -570,7 +573,7 @@ public class ItemEntity extends Entity { - - public void makeFakeItem() { - this.setNeverPickUp(); -- this.age = level.spigotConfig.itemDespawnRate - 1; // Spigot -+ this.age = this.despawnRate - 1; // Spigot - } - - public float getSpin(float tickDelta) { diff --git a/patches/server/0356-Tracking-Range-Improvements.patch b/patches/server/0355-Tracking-Range-Improvements.patch similarity index 95% rename from patches/server/0356-Tracking-Range-Improvements.patch rename to patches/server/0355-Tracking-Range-Improvements.patch index 2d0327a85d..4e56aae62c 100644 --- a/patches/server/0356-Tracking-Range-Improvements.patch +++ b/patches/server/0355-Tracking-Range-Improvements.patch @@ -8,10 +8,10 @@ Sets tracking range of watermobs to animals instead of misc and simplifies code Also ignores Enderdragon, defaulting it to Mojang's setting diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java -index 4ff1c09b4db2edbcf39c13a1942dd95bd566173d..6d5bb19888a2a0dc130eff3d7bc09811351dd75e 100644 +index 7996247c00bf6ea4399322d089821432333ca6c4..7983fbc003ca0904dc1a0a9c45d43502a44131a7 100644 --- a/src/main/java/net/minecraft/server/level/ChunkMap.java +++ b/src/main/java/net/minecraft/server/level/ChunkMap.java -@@ -1910,6 +1910,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider +@@ -1909,6 +1909,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider while (iterator.hasNext()) { Entity entity = (Entity) iterator.next(); int j = entity.getType().clientTrackingRange() * 16; diff --git a/patches/server/0357-Fix-items-vanishing-through-end-portal.patch b/patches/server/0356-Fix-items-vanishing-through-end-portal.patch similarity index 89% rename from patches/server/0357-Fix-items-vanishing-through-end-portal.patch rename to patches/server/0356-Fix-items-vanishing-through-end-portal.patch index 37a0ba015a..e86035b6ae 100644 --- a/patches/server/0357-Fix-items-vanishing-through-end-portal.patch +++ b/patches/server/0356-Fix-items-vanishing-through-end-portal.patch @@ -13,10 +13,10 @@ Quickly loading the exact world spawn chunk before searching the heightmap resolves the issue without having to load all spawn chunks. diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java -index f5f40e97fa07cd84de0c759a6dffd638f752d466..22e4ca3ae5136f7df92981272c30f7f53d47e5cc 100644 +index b3d252b822b39c3fbbfbaf5c98284fb4281ab635..23e83d6d78d875d38e8ec109ff0effa1ed9634bd 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java -@@ -3107,6 +3107,9 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource { +@@ -3106,6 +3106,9 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource { if (flag1) { blockposition1 = ServerLevel.END_SPAWN_POINT; } else { diff --git a/patches/server/0358-implement-optional-per-player-mob-spawns.patch b/patches/server/0357-implement-optional-per-player-mob-spawns.patch similarity index 93% rename from patches/server/0358-implement-optional-per-player-mob-spawns.patch rename to patches/server/0357-implement-optional-per-player-mob-spawns.patch index 152146bff1..e3c728a104 100644 --- a/patches/server/0358-implement-optional-per-player-mob-spawns.patch +++ b/patches/server/0357-implement-optional-per-player-mob-spawns.patch @@ -4,23 +4,6 @@ Date: Mon, 19 Aug 2019 01:27:58 +0500 Subject: [PATCH] implement optional per player mob spawns -diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -index 5918a319d34f8f30cce2f458dd061d83cd838ad0..a9b3442a49dc359959496d1f6adadefa76bfc863 100644 ---- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -@@ -656,4 +656,12 @@ public class PaperWorldConfig { - log("Alternative item despawn rate of " + key.getPath() + ": " + altItemDespawnRateMap.get(key)); - } - } -+ -+ public boolean perPlayerMobSpawns = false; -+ private void perPlayerMobSpawns() { -+ if (PaperConfig.version < 22) { -+ set("per-player-mob-spawns", Boolean.TRUE); -+ } -+ perPlayerMobSpawns = getBoolean("per-player-mob-spawns", true); -+ } - } diff --git a/src/main/java/com/destroystokyo/paper/util/PooledHashSets.java b/src/main/java/com/destroystokyo/paper/util/PooledHashSets.java new file mode 100644 index 0000000000000000000000000000000000000000..11de56afaf059b00fa5bec293516bcdce7c4b2b9 @@ -269,10 +252,10 @@ index 0000000000000000000000000000000000000000..11de56afaf059b00fa5bec293516bcdc + } +} diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java -index 6d5bb19888a2a0dc130eff3d7bc09811351dd75e..5cf6f6f67520af8d94456a028828e49446e82be9 100644 +index 7983fbc003ca0904dc1a0a9c45d43502a44131a7..492e073cfc2a43951e20fd2d15a576601e84a364 100644 --- a/src/main/java/net/minecraft/server/level/ChunkMap.java +++ b/src/main/java/net/minecraft/server/level/ChunkMap.java -@@ -159,6 +159,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider +@@ -158,6 +158,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider private final Long2LongMap chunkSaveCooldowns; private final Queue unloadQueue; int viewDistance; @@ -280,7 +263,7 @@ index 6d5bb19888a2a0dc130eff3d7bc09811351dd75e..5cf6f6f67520af8d94456a028828e494 // CraftBukkit start - recursion-safe executor for Chunk loadCallback() and unloadCallback() public final CallbackExecutor callbackExecutor = new CallbackExecutor(); -@@ -188,16 +189,31 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider +@@ -187,16 +188,31 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider int chunkX = MCUtil.getChunkCoordinate(player.getX()); int chunkZ = MCUtil.getChunkCoordinate(player.getZ()); // Note: players need to be explicitly added to distance maps before they can be updated @@ -312,21 +295,21 @@ index 6d5bb19888a2a0dc130eff3d7bc09811351dd75e..5cf6f6f67520af8d94456a028828e494 } // Paper end // Paper start -@@ -280,6 +296,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider +@@ -279,6 +295,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider this.dataRegionManager = new io.papermc.paper.chunk.SingleThreadChunkRegionManager(this.level, 2, (1.0 / 3.0), 1, 6, "Data", DataRegionData::new, DataRegionSectionData::new); this.regionManagers.add(this.dataRegionManager); // Paper end -+ this.playerMobDistanceMap = this.level.paperConfig.perPlayerMobSpawns ? new com.destroystokyo.paper.util.misc.PlayerAreaMap(this.pooledLinkedPlayerHashSets) : null; // Paper ++ this.playerMobDistanceMap = this.level.paperConfig().entities.spawning.perPlayerMobSpawns ? new com.destroystokyo.paper.util.misc.PlayerAreaMap(this.pooledLinkedPlayerHashSets) : null; // Paper } protected ChunkGenerator generator() { -@@ -301,6 +318,31 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider +@@ -300,6 +317,31 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider }); } + // Paper start + public void updatePlayerMobTypeMap(Entity entity) { -+ if (!this.level.paperConfig.perPlayerMobSpawns) { ++ if (!this.level.paperConfig().entities.spawning.perPlayerMobSpawns) { + return; + } + int index = entity.getType().getCategory().ordinal(); @@ -370,7 +353,7 @@ index 1e066a35b53b1f71a0e6376a22d51fc4c0a412dc..6228f2f67541da62b0ae093de987662d this.naturalSpawnChunkCounter.runAllUpdates(); return this.naturalSpawnChunkCounter.chunks.size(); diff --git a/src/main/java/net/minecraft/server/level/ServerChunkCache.java b/src/main/java/net/minecraft/server/level/ServerChunkCache.java -index 7784dae8016d6ca5fbbf887316100d270710294b..75381eceabd706b5343884dd168dc14801923685 100644 +index d66ec02b09bb7ae46aae8e55f00626139f074ae3..de5b80fce9757517e51f2ef55340e884f2d7e3d4 100644 --- a/src/main/java/net/minecraft/server/level/ServerChunkCache.java +++ b/src/main/java/net/minecraft/server/level/ServerChunkCache.java @@ -908,7 +908,18 @@ public class ServerChunkCache extends ChunkSource { @@ -394,7 +377,7 @@ index 7784dae8016d6ca5fbbf887316100d270710294b..75381eceabd706b5343884dd168dc148 this.lastSpawnState = spawnercreature_d; diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java -index b19ca7f62e78035ed5f52e1eb1a76066af97de80..5c5a42f59908b1f7a737d97c2470037a3d4361a8 100644 +index 255c679b6859d95e47d9106697bfc2f0f066334e..1cb3b8639a8ce367040b8a55da8db66c800769e4 100644 --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java @@ -233,6 +233,11 @@ public class ServerPlayer extends Player { @@ -418,7 +401,7 @@ index b19ca7f62e78035ed5f52e1eb1a76066af97de80..5c5a42f59908b1f7a737d97c2470037a // Yes, this doesn't match Vanilla, but it's the best we can do for now. diff --git a/src/main/java/net/minecraft/world/level/NaturalSpawner.java b/src/main/java/net/minecraft/world/level/NaturalSpawner.java -index fedc36ceebaf3e1d267431bdf7db81e25f4d6fd7..611dbcebd54604da5bd3e6ed510032db2a70401d 100644 +index b4098068e674b639e82c07e5d60e4e2120b4305b..fa23e9c476d4edc6176d8b8a6cb13c52d2f66a87 100644 --- a/src/main/java/net/minecraft/world/level/NaturalSpawner.java +++ b/src/main/java/net/minecraft/world/level/NaturalSpawner.java @@ -69,6 +69,12 @@ public final class NaturalSpawner { @@ -462,7 +445,7 @@ index fedc36ceebaf3e1d267431bdf7db81e25f4d6fd7..611dbcebd54604da5bd3e6ed510032db + int k1 = limit * info.getSpawnableChunkCount() / NaturalSpawner.MAGIC_NUMBER; + int difference = k1 - currEntityCount; + -+ if (world.paperConfig.perPlayerMobSpawns) { ++ if (world.paperConfig().entities.spawning.perPlayerMobSpawns) { + int minDiff = Integer.MAX_VALUE; + final com.destroystokyo.paper.util.misc.PooledLinkedHashSets.PooledObjectLinkedOpenHashSet inRange = world.getChunkSource().chunkMap.playerMobDistanceMap.getObjectsInRange(chunk.getPos()); + if (inRange != null) { @@ -486,7 +469,7 @@ index fedc36ceebaf3e1d267431bdf7db81e25f4d6fd7..611dbcebd54604da5bd3e6ed510032db - NaturalSpawner.spawnCategoryForChunk(enumcreaturetype, world, chunk, spawnercreature_c, info::afterSpawn); + // Paper start + int spawnCount = NaturalSpawner.spawnCategoryForChunk(enumcreaturetype, world, chunk, spawnercreature_c, info::afterSpawn, -+ difference, world.paperConfig.perPlayerMobSpawns ? world.getChunkSource().chunkMap::updatePlayerMobTypeMap : null); ++ difference, world.paperConfig().entities.spawning.perPlayerMobSpawns ? world.getChunkSource().chunkMap::updatePlayerMobTypeMap : null); + info.mobCategoryCounts.mergeInt(enumcreaturetype, spawnCount, Integer::sum); + // Paper end } diff --git a/patches/server/0359-Avoid-hopper-searches-if-there-are-no-items.patch b/patches/server/0358-Avoid-hopper-searches-if-there-are-no-items.patch similarity index 97% rename from patches/server/0359-Avoid-hopper-searches-if-there-are-no-items.patch rename to patches/server/0358-Avoid-hopper-searches-if-there-are-no-items.patch index 37aea10691..891b4e3822 100644 --- a/patches/server/0359-Avoid-hopper-searches-if-there-are-no-items.patch +++ b/patches/server/0358-Avoid-hopper-searches-if-there-are-no-items.patch @@ -14,10 +14,10 @@ And since minecart hoppers are used _very_ rarely near we can avoid alot of sear Combined, this adds up a lot. diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java -index b56fe14e7b7de95876ba2b1d084856d6935e591c..4c3efab510e0041b00af9967226c711304862248 100644 +index 0dd5b81da733aa585a78043cea7b4533e4abff72..672e8eff9b9b635106deb32952b6d2dc4323a564 100644 --- a/src/main/java/net/minecraft/world/level/Level.java +++ b/src/main/java/net/minecraft/world/level/Level.java -@@ -961,7 +961,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable { +@@ -966,7 +966,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable { } } diff --git a/patches/server/0360-Bees-get-gravity-in-void.-Fixes-MC-167279.patch b/patches/server/0359-Bees-get-gravity-in-void.-Fixes-MC-167279.patch similarity index 100% rename from patches/server/0360-Bees-get-gravity-in-void.-Fixes-MC-167279.patch rename to patches/server/0359-Bees-get-gravity-in-void.-Fixes-MC-167279.patch diff --git a/patches/server/0361-Optimise-getChunkAt-calls-for-loaded-chunks.patch b/patches/server/0360-Optimise-getChunkAt-calls-for-loaded-chunks.patch similarity index 96% rename from patches/server/0361-Optimise-getChunkAt-calls-for-loaded-chunks.patch rename to patches/server/0360-Optimise-getChunkAt-calls-for-loaded-chunks.patch index db61fd4a4e..3831aba372 100644 --- a/patches/server/0361-Optimise-getChunkAt-calls-for-loaded-chunks.patch +++ b/patches/server/0360-Optimise-getChunkAt-calls-for-loaded-chunks.patch @@ -7,7 +7,7 @@ bypass the need to get a player chunk, then get the either, then unwrap it... diff --git a/src/main/java/net/minecraft/server/level/ServerChunkCache.java b/src/main/java/net/minecraft/server/level/ServerChunkCache.java -index 75381eceabd706b5343884dd168dc14801923685..0344d10a7e70109c6d5162c3ddab6dfd6d0b4571 100644 +index de5b80fce9757517e51f2ef55340e884f2d7e3d4..c12c03b9e79f264ee593373f8a72ed37c0ae8514 100644 --- a/src/main/java/net/minecraft/server/level/ServerChunkCache.java +++ b/src/main/java/net/minecraft/server/level/ServerChunkCache.java @@ -601,6 +601,12 @@ public class ServerChunkCache extends ChunkSource { diff --git a/patches/server/0362-Add-debug-for-sync-chunk-loads.patch b/patches/server/0361-Add-debug-for-sync-chunk-loads.patch similarity index 97% rename from patches/server/0362-Add-debug-for-sync-chunk-loads.patch rename to patches/server/0361-Add-debug-for-sync-chunk-loads.patch index 32d2a5005e..5d5530ddf9 100644 --- a/patches/server/0362-Add-debug-for-sync-chunk-loads.patch +++ b/patches/server/0361-Add-debug-for-sync-chunk-loads.patch @@ -13,7 +13,7 @@ chunks, however it must be enabled by setting the startup flag /paper syncloadinfo clear diff --git a/src/main/java/com/destroystokyo/paper/PaperCommand.java b/src/main/java/com/destroystokyo/paper/PaperCommand.java -index b5756d067b013ee78a55b97ad00375d15ecd483c..64c8ba212855dbdd7d2025126474644bd68c3ec0 100644 +index c3ee820fa69a75bee8d2c3a61e1015b22214bc53..d2ecbcf966cb7e0b27e65fa12806d2181ecf2d39 100644 --- a/src/main/java/com/destroystokyo/paper/PaperCommand.java +++ b/src/main/java/com/destroystokyo/paper/PaperCommand.java @@ -1,11 +1,17 @@ @@ -312,7 +312,7 @@ index 0000000000000000000000000000000000000000..0bb4aaa546939b67a5d22865190f3047 + } +} diff --git a/src/main/java/net/minecraft/server/level/ServerChunkCache.java b/src/main/java/net/minecraft/server/level/ServerChunkCache.java -index 0344d10a7e70109c6d5162c3ddab6dfd6d0b4571..4581a95a792e8eb157c8577547cb6f76a8e8f883 100644 +index c12c03b9e79f264ee593373f8a72ed37c0ae8514..509b2ee115584ce80717cc12a7ab548d103b4b92 100644 --- a/src/main/java/net/minecraft/server/level/ServerChunkCache.java +++ b/src/main/java/net/minecraft/server/level/ServerChunkCache.java @@ -633,6 +633,7 @@ public class ServerChunkCache extends ChunkSource { @@ -324,7 +324,7 @@ index 0344d10a7e70109c6d5162c3ddab6dfd6d0b4571..4581a95a792e8eb157c8577547cb6f76 chunkproviderserver_b.managedBlock(completablefuture::isDone); com.destroystokyo.paper.io.chunk.ChunkTaskManager.popChunkWait(); // Paper - async chunk debug diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java -index 989f0da37f20c7989183986ffa14e9fe12c7af7f..6bded610f82189a5549e656881dbce0d34f285b2 100644 +index 73c1e9cf05ff72b77887b262b7ac7101bb785405..d4e054a6ed2626845373f4b0fa8463682322cf12 100644 --- a/src/main/java/net/minecraft/server/level/ServerLevel.java +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java @@ -388,6 +388,12 @@ public class ServerLevel extends Level implements WorldGenLevel { diff --git a/patches/server/0363-Remove-garbage-Java-version-check.patch b/patches/server/0362-Remove-garbage-Java-version-check.patch similarity index 100% rename from patches/server/0363-Remove-garbage-Java-version-check.patch rename to patches/server/0362-Remove-garbage-Java-version-check.patch diff --git a/patches/server/0364-Add-ThrownEggHatchEvent.patch b/patches/server/0363-Add-ThrownEggHatchEvent.patch similarity index 100% rename from patches/server/0364-Add-ThrownEggHatchEvent.patch rename to patches/server/0363-Add-ThrownEggHatchEvent.patch diff --git a/patches/server/0365-Entity-Jump-API.patch b/patches/server/0364-Entity-Jump-API.patch similarity index 97% rename from patches/server/0365-Entity-Jump-API.patch rename to patches/server/0364-Entity-Jump-API.patch index 003c53b24d..d818cc844c 100644 --- a/patches/server/0365-Entity-Jump-API.patch +++ b/patches/server/0364-Entity-Jump-API.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Entity Jump API diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java -index 5330ce940918cc858cbce74665f1c928249bb957..70670065642766501918dfca21fdb3ea78a90a31 100644 +index 26f59e695ef68d1cf33e649ca370f8320d515201..12d90147d5d10f074380c0faeff2ceb399c7bda2 100644 --- a/src/main/java/net/minecraft/world/entity/LivingEntity.java +++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java @@ -3215,8 +3215,10 @@ public abstract class LivingEntity extends Entity { diff --git a/patches/server/0366-Add-option-to-nerf-pigmen-from-nether-portals.patch b/patches/server/0365-Add-option-to-nerf-pigmen-from-nether-portals.patch similarity index 62% rename from patches/server/0366-Add-option-to-nerf-pigmen-from-nether-portals.patch rename to patches/server/0365-Add-option-to-nerf-pigmen-from-nether-portals.patch index 7e52130174..859d9a4132 100644 --- a/patches/server/0366-Add-option-to-nerf-pigmen-from-nether-portals.patch +++ b/patches/server/0365-Add-option-to-nerf-pigmen-from-nether-portals.patch @@ -4,24 +4,8 @@ Date: Fri, 7 Feb 2020 14:36:56 -0600 Subject: [PATCH] Add option to nerf pigmen from nether portals -diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -index a9b3442a49dc359959496d1f6adadefa76bfc863..62dfb6afe204c078f579a3dae944d9350aaf72d0 100644 ---- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -@@ -547,6 +547,11 @@ public class PaperWorldConfig { - log("Hopper Ignore Container Entities inside Occluding Blocks: " + (hoppersIgnoreOccludingBlocks ? "enabled" : "disabled")); - } - -+ public boolean nerfNetherPortalPigmen = false; -+ private void nerfNetherPortalPigmen() { -+ nerfNetherPortalPigmen = getBoolean("game-mechanics.nerf-pigmen-from-nether-portals", nerfNetherPortalPigmen); -+ } -+ - public int lightQueueSize = 20; - private void lightQueueSize() { - lightQueueSize = getInt("light-queue-size", lightQueueSize); diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java -index 22e4ca3ae5136f7df92981272c30f7f53d47e5cc..6be19303b491c42d86c617166427f44f75bdaff4 100644 +index 23e83d6d78d875d38e8ec109ff0effa1ed9634bd..97d316a4e14e109e91fba41303b83098895f405c 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java @@ -380,6 +380,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource { @@ -32,7 +16,7 @@ index 22e4ca3ae5136f7df92981272c30f7f53d47e5cc..6be19303b491c42d86c617166427f44f protected int numCollisions = 0; // Paper public boolean spawnedViaMobSpawner; // Paper - Yes this name is similar to above, upstream took the better one @javax.annotation.Nullable -@@ -1978,6 +1979,9 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource { +@@ -1977,6 +1978,9 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource { if (spawnedViaMobSpawner) { nbt.putBoolean("Paper.FromMobSpawner", true); } @@ -42,7 +26,7 @@ index 22e4ca3ae5136f7df92981272c30f7f53d47e5cc..6be19303b491c42d86c617166427f44f // Paper end return nbt; } catch (Throwable throwable) { -@@ -2117,6 +2121,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource { +@@ -2116,6 +2120,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource { } spawnedViaMobSpawner = nbt.getBoolean("Paper.FromMobSpawner"); // Restore entity's from mob spawner status @@ -51,7 +35,7 @@ index 22e4ca3ae5136f7df92981272c30f7f53d47e5cc..6be19303b491c42d86c617166427f44f String spawnReasonName = nbt.getString("Paper.SpawnReason"); try { diff --git a/src/main/java/net/minecraft/world/level/block/NetherPortalBlock.java b/src/main/java/net/minecraft/world/level/block/NetherPortalBlock.java -index 33078e2199c8eb0ce012a72eeb4421df12817b84..fe073237dbec6e9890395575206bbc893bef6d9b 100644 +index 33078e2199c8eb0ce012a72eeb4421df12817b84..8c97cae63b4b373f1d67e797b9fe1064b5205da5 100644 --- a/src/main/java/net/minecraft/world/level/block/NetherPortalBlock.java +++ b/src/main/java/net/minecraft/world/level/block/NetherPortalBlock.java @@ -66,6 +66,8 @@ public class NetherPortalBlock extends Block { @@ -59,7 +43,7 @@ index 33078e2199c8eb0ce012a72eeb4421df12817b84..fe073237dbec6e9890395575206bbc89 if (entity != null) { entity.setPortalCooldown(); + entity.fromNetherPortal = true; // Paper -+ if (world.paperConfig.nerfNetherPortalPigmen) ((net.minecraft.world.entity.Mob) entity).aware = false; // Paper ++ if (world.paperConfig().entities.behavior.nerfPigmenFromNetherPortals) ((net.minecraft.world.entity.Mob) entity).aware = false; // Paper } } } diff --git a/patches/server/0367-Make-the-GUI-graph-fancier.patch b/patches/server/0366-Make-the-GUI-graph-fancier.patch similarity index 100% rename from patches/server/0367-Make-the-GUI-graph-fancier.patch rename to patches/server/0366-Make-the-GUI-graph-fancier.patch diff --git a/patches/server/0368-add-hand-to-BlockMultiPlaceEvent.patch b/patches/server/0367-add-hand-to-BlockMultiPlaceEvent.patch similarity index 100% rename from patches/server/0368-add-hand-to-BlockMultiPlaceEvent.patch rename to patches/server/0367-add-hand-to-BlockMultiPlaceEvent.patch diff --git a/patches/server/0369-Validate-tripwire-hook-placement-before-update.patch b/patches/server/0368-Validate-tripwire-hook-placement-before-update.patch similarity index 100% rename from patches/server/0369-Validate-tripwire-hook-placement-before-update.patch rename to patches/server/0368-Validate-tripwire-hook-placement-before-update.patch diff --git a/patches/server/0369-Add-option-to-allow-iron-golems-to-spawn-in-air.patch b/patches/server/0369-Add-option-to-allow-iron-golems-to-spawn-in-air.patch new file mode 100644 index 0000000000..f058d157d0 --- /dev/null +++ b/patches/server/0369-Add-option-to-allow-iron-golems-to-spawn-in-air.patch @@ -0,0 +1,19 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: William Blake Galbreath +Date: Sat, 13 Apr 2019 16:50:58 -0500 +Subject: [PATCH] Add option to allow iron golems to spawn in air + + +diff --git a/src/main/java/net/minecraft/world/entity/animal/IronGolem.java b/src/main/java/net/minecraft/world/entity/animal/IronGolem.java +index d2864615588aadf81ac9763ba402ede0c1eebb23..e73acfa2f5a4066fa1beee1758082a2fe97a43b3 100644 +--- a/src/main/java/net/minecraft/world/entity/animal/IronGolem.java ++++ b/src/main/java/net/minecraft/world/entity/animal/IronGolem.java +@@ -334,7 +334,7 @@ public class IronGolem extends AbstractGolem implements NeutralMob { + BlockPos blockposition1 = blockposition.below(); + BlockState iblockdata = world.getBlockState(blockposition1); + +- if (!iblockdata.entityCanStandOn(world, blockposition1, this)) { ++ if (!iblockdata.entityCanStandOn(world, blockposition1, this) && !level.paperConfig().entities.spawning.ironGolemsCanSpawnInAir) { // Paper + return false; + } else { + for (int i = 1; i < 3; ++i) { diff --git a/patches/server/0370-Add-option-to-allow-iron-golems-to-spawn-in-air.patch b/patches/server/0370-Add-option-to-allow-iron-golems-to-spawn-in-air.patch deleted file mode 100644 index 48ef19cb78..0000000000 --- a/patches/server/0370-Add-option-to-allow-iron-golems-to-spawn-in-air.patch +++ /dev/null @@ -1,35 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: William Blake Galbreath -Date: Sat, 13 Apr 2019 16:50:58 -0500 -Subject: [PATCH] Add option to allow iron golems to spawn in air - - -diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -index 62dfb6afe204c078f579a3dae944d9350aaf72d0..82d8299d949ee26eefba2952b625650c1aca0e6a 100644 ---- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -@@ -444,6 +444,11 @@ public class PaperWorldConfig { - scanForLegacyEnderDragon = getBoolean("game-mechanics.scan-for-legacy-ender-dragon", true); - } - -+ public boolean ironGolemsCanSpawnInAir = false; -+ private void ironGolemsCanSpawnInAir() { -+ ironGolemsCanSpawnInAir = getBoolean("iron-golems-can-spawn-in-air", ironGolemsCanSpawnInAir); -+ } -+ - public boolean armorStandEntityLookups = true; - private void armorStandEntityLookups() { - armorStandEntityLookups = getBoolean("armor-stands-do-collision-entity-lookups", true); -diff --git a/src/main/java/net/minecraft/world/entity/animal/IronGolem.java b/src/main/java/net/minecraft/world/entity/animal/IronGolem.java -index d2864615588aadf81ac9763ba402ede0c1eebb23..0a239df9a43669047be3d6006597128860862060 100644 ---- a/src/main/java/net/minecraft/world/entity/animal/IronGolem.java -+++ b/src/main/java/net/minecraft/world/entity/animal/IronGolem.java -@@ -334,7 +334,7 @@ public class IronGolem extends AbstractGolem implements NeutralMob { - BlockPos blockposition1 = blockposition.below(); - BlockState iblockdata = world.getBlockState(blockposition1); - -- if (!iblockdata.entityCanStandOn(world, blockposition1, this)) { -+ if (!iblockdata.entityCanStandOn(world, blockposition1, this) && !level.paperConfig.ironGolemsCanSpawnInAir) { // Paper - return false; - } else { - for (int i = 1; i < 3; ++i) { diff --git a/patches/server/0370-Configurable-chance-of-villager-zombie-infection.patch b/patches/server/0370-Configurable-chance-of-villager-zombie-infection.patch new file mode 100644 index 0000000000..ce51b7964c --- /dev/null +++ b/patches/server/0370-Configurable-chance-of-villager-zombie-infection.patch @@ -0,0 +1,30 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Zero +Date: Sat, 22 Feb 2020 16:10:31 -0500 +Subject: [PATCH] Configurable chance of villager zombie infection + +This allows you to solve an issue in vanilla behavior where: +* On easy difficulty your villagers will NEVER get infected, meaning they will always die. +* On normal difficulty they will have a 50% of getting infected or dying. + +diff --git a/src/main/java/net/minecraft/world/entity/monster/Zombie.java b/src/main/java/net/minecraft/world/entity/monster/Zombie.java +index bf5f4fe68a942dff8c2e2ad4735a529b5a6353e8..3c3095e7e684079bcba0ea5a6b44c8fe2a3f47c4 100644 +--- a/src/main/java/net/minecraft/world/entity/monster/Zombie.java ++++ b/src/main/java/net/minecraft/world/entity/monster/Zombie.java +@@ -451,10 +451,14 @@ public class Zombie extends Monster { + public boolean wasKilled(ServerLevel world, LivingEntity other) { + boolean flag = super.wasKilled(world, other); + +- if ((world.getDifficulty() == Difficulty.NORMAL || world.getDifficulty() == Difficulty.HARD) && other instanceof Villager) { +- if (world.getDifficulty() != Difficulty.HARD && this.random.nextBoolean()) { ++ // Paper start ++ if (level.paperConfig().entities.behavior.zombieVillagerInfectionChance != 0.0 && (level.paperConfig().entities.behavior.zombieVillagerInfectionChance != -1.0 || world.getDifficulty() == Difficulty.NORMAL || world.getDifficulty() == Difficulty.HARD) && other instanceof Villager) { ++ if (level.paperConfig().entities.behavior.zombieVillagerInfectionChance == -1.0 && world.getDifficulty() != Difficulty.HARD && this.random.nextBoolean()) { + return flag; + } ++ if (level.paperConfig().entities.behavior.zombieVillagerInfectionChance != -1.0 && (this.random.nextDouble() * 100.0) > level.paperConfig().entities.behavior.zombieVillagerInfectionChance) { ++ return flag; ++ } // Paper end + + Villager entityvillager = (Villager) other; + // CraftBukkit start diff --git a/patches/server/0371-Configurable-chance-of-villager-zombie-infection.patch b/patches/server/0371-Configurable-chance-of-villager-zombie-infection.patch deleted file mode 100644 index ac5f85134a..0000000000 --- a/patches/server/0371-Configurable-chance-of-villager-zombie-infection.patch +++ /dev/null @@ -1,46 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Zero -Date: Sat, 22 Feb 2020 16:10:31 -0500 -Subject: [PATCH] Configurable chance of villager zombie infection - -This allows you to solve an issue in vanilla behavior where: -* On easy difficulty your villagers will NEVER get infected, meaning they will always die. -* On normal difficulty they will have a 50% of getting infected or dying. - -diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -index 82d8299d949ee26eefba2952b625650c1aca0e6a..6e7699e5a725eac05de3e809ae9a45a45891892b 100644 ---- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -@@ -557,6 +557,11 @@ public class PaperWorldConfig { - nerfNetherPortalPigmen = getBoolean("game-mechanics.nerf-pigmen-from-nether-portals", nerfNetherPortalPigmen); - } - -+ public double zombieVillagerInfectionChance = -1.0; -+ private void zombieVillagerInfectionChance() { -+ zombieVillagerInfectionChance = getDouble("zombie-villager-infection-chance", zombieVillagerInfectionChance); -+ } -+ - public int lightQueueSize = 20; - private void lightQueueSize() { - lightQueueSize = getInt("light-queue-size", lightQueueSize); -diff --git a/src/main/java/net/minecraft/world/entity/monster/Zombie.java b/src/main/java/net/minecraft/world/entity/monster/Zombie.java -index 374fccfec47769d2df51056fb6d1948f472a6802..6efce73f5233927104ec772e16a370926317d80d 100644 ---- a/src/main/java/net/minecraft/world/entity/monster/Zombie.java -+++ b/src/main/java/net/minecraft/world/entity/monster/Zombie.java -@@ -450,10 +450,14 @@ public class Zombie extends Monster { - public boolean wasKilled(ServerLevel world, LivingEntity other) { - boolean flag = super.wasKilled(world, other); - -- if ((world.getDifficulty() == Difficulty.NORMAL || world.getDifficulty() == Difficulty.HARD) && other instanceof Villager) { -- if (world.getDifficulty() != Difficulty.HARD && this.random.nextBoolean()) { -+ // Paper start -+ if (level.paperConfig.zombieVillagerInfectionChance != 0.0 && (level.paperConfig.zombieVillagerInfectionChance != -1.0 || world.getDifficulty() == Difficulty.NORMAL || world.getDifficulty() == Difficulty.HARD) && other instanceof Villager) { -+ if (level.paperConfig.zombieVillagerInfectionChance == -1.0 && world.getDifficulty() != Difficulty.HARD && this.random.nextBoolean()) { - return flag; - } -+ if (level.paperConfig.zombieVillagerInfectionChance != -1.0 && (this.random.nextDouble() * 100.0) > level.paperConfig.zombieVillagerInfectionChance) { -+ return flag; -+ } // Paper end - - Villager entityvillager = (Villager) other; - // CraftBukkit start diff --git a/patches/server/0372-Optimise-Chunk-getFluid.patch b/patches/server/0371-Optimise-Chunk-getFluid.patch similarity index 96% rename from patches/server/0372-Optimise-Chunk-getFluid.patch rename to patches/server/0371-Optimise-Chunk-getFluid.patch index a88f9d0fc9..2cc6713999 100644 --- a/patches/server/0372-Optimise-Chunk-getFluid.patch +++ b/patches/server/0371-Optimise-Chunk-getFluid.patch @@ -8,7 +8,7 @@ faster on its own, however removing the try catch makes it easier to inline due to code size diff --git a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java -index 74952112182ac94942474f1c7cf21a6301abbcc7..930fa1703727249585b4ac045db15d55736c58fd 100644 +index 1a28b3a60bd568cba7c96152fa8dd2a64dd56801..89f4ea65b20e773bd3782c41db3a2af7b5b405f3 100644 --- a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java +++ b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java @@ -381,18 +381,20 @@ public class LevelChunk extends ChunkAccess { diff --git a/patches/server/0373-Set-spigots-verbose-world-setting-to-false-by-def.patch b/patches/server/0372-Set-spigots-verbose-world-setting-to-false-by-def.patch similarity index 100% rename from patches/server/0373-Set-spigots-verbose-world-setting-to-false-by-def.patch rename to patches/server/0372-Set-spigots-verbose-world-setting-to-false-by-def.patch diff --git a/patches/server/0374-Add-tick-times-API-and-mspt-command.patch b/patches/server/0373-Add-tick-times-API-and-mspt-command.patch similarity index 83% rename from patches/server/0374-Add-tick-times-API-and-mspt-command.patch rename to patches/server/0373-Add-tick-times-API-and-mspt-command.patch index 1000f4afd2..46554cc230 100644 --- a/patches/server/0374-Add-tick-times-API-and-mspt-command.patch +++ b/patches/server/0373-Add-tick-times-API-and-mspt-command.patch @@ -109,23 +109,30 @@ index 0000000000000000000000000000000000000000..874f0c2a071994c2145848886caa385e + return text(DF.format(avg), avg >= 50 ? RED : avg >= 40 ? YELLOW : GREEN); + } +} -diff --git a/src/main/java/com/destroystokyo/paper/PaperConfig.java b/src/main/java/com/destroystokyo/paper/PaperConfig.java -index 0be8f68c3e61f132ada9381e36b743dd7477eece..8158a00821727104a23958a76e19cd8b01cb4e5a 100644 ---- a/src/main/java/com/destroystokyo/paper/PaperConfig.java -+++ b/src/main/java/com/destroystokyo/paper/PaperConfig.java -@@ -69,6 +69,7 @@ public class PaperConfig { +diff --git a/src/main/java/io/papermc/paper/configuration/PaperConfigurations.java b/src/main/java/io/papermc/paper/configuration/PaperConfigurations.java +index 0f185ff1af93d40519e8f093b1e63b530656d616..1ba72bf064dda8c0e9b8ff4e51a713951e4db46c 100644 +--- a/src/main/java/io/papermc/paper/configuration/PaperConfigurations.java ++++ b/src/main/java/io/papermc/paper/configuration/PaperConfigurations.java +@@ -1,5 +1,6 @@ + package io.papermc.paper.configuration; - commands = new HashMap(); - commands.put("paper", new PaperCommand("paper")); -+ commands.put("mspt", new MSPTCommand("mspt")); ++import com.destroystokyo.paper.MSPTCommand; + import com.destroystokyo.paper.Metrics; + import com.destroystokyo.paper.PaperCommand; + import com.destroystokyo.paper.antixray.ChunkPacketBlockControllerAntiXray; +@@ -289,6 +290,7 @@ public class PaperConfigurations extends Configurations= 5L && world.isDay()) { - if (randomsource.nextInt(5) != 0) { -+ if (days >= world.paperConfig.patrolStartDay && world.isDay()) { -+ if (randomsource.nextDouble() >= world.paperConfig.patrolSpawnChance) { ++ if (days >= world.paperConfig().entities.behavior.pillagerPatrols.start.day && world.isDay()) { ++ if (randomsource.nextDouble() >= world.paperConfig().entities.behavior.pillagerPatrols.spawnChance) { + // Paper end return 0; } else { diff --git a/patches/server/0378-Remote-Connections-shouldn-t-hold-up-shutdown.patch b/patches/server/0377-Remote-Connections-shouldn-t-hold-up-shutdown.patch similarity index 86% rename from patches/server/0378-Remote-Connections-shouldn-t-hold-up-shutdown.patch rename to patches/server/0377-Remote-Connections-shouldn-t-hold-up-shutdown.patch index b798d6cc26..5c3d973204 100644 --- a/patches/server/0378-Remote-Connections-shouldn-t-hold-up-shutdown.patch +++ b/patches/server/0377-Remote-Connections-shouldn-t-hold-up-shutdown.patch @@ -6,10 +6,10 @@ Subject: [PATCH] Remote Connections shouldn't hold up shutdown Bugs in the connection logic appears to leave stale connections even, preventing shutdown diff --git a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java -index 0cd6e4fbcc97ab6b64333860d56946268c1f5064..8f5910ee6469af62bab9c26c2e1985784ae73900 100644 +index 698205c4cd00cc76c3cc83f1dcadd7a4d6734744..0a73727d8fff18c09597fb117463c7cf810470bb 100644 --- a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java +++ b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java -@@ -399,11 +399,11 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface +@@ -396,11 +396,11 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface } if (this.rconThread != null) { diff --git a/patches/server/0379-Do-not-allow-bees-to-load-chunks-for-beehives.patch b/patches/server/0378-Do-not-allow-bees-to-load-chunks-for-beehives.patch similarity index 100% rename from patches/server/0379-Do-not-allow-bees-to-load-chunks-for-beehives.patch rename to patches/server/0378-Do-not-allow-bees-to-load-chunks-for-beehives.patch diff --git a/patches/server/0380-Prevent-Double-PlayerChunkMap-adds-crashing-server.patch b/patches/server/0379-Prevent-Double-PlayerChunkMap-adds-crashing-server.patch similarity index 91% rename from patches/server/0380-Prevent-Double-PlayerChunkMap-adds-crashing-server.patch rename to patches/server/0379-Prevent-Double-PlayerChunkMap-adds-crashing-server.patch index a67b478152..5def4c4fa1 100644 --- a/patches/server/0380-Prevent-Double-PlayerChunkMap-adds-crashing-server.patch +++ b/patches/server/0379-Prevent-Double-PlayerChunkMap-adds-crashing-server.patch @@ -7,10 +7,10 @@ Suspected case would be around the technique used in .stopRiding Stack will identify any causer of this and warn instead of crashing. diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java -index 5cf6f6f67520af8d94456a028828e49446e82be9..496f9580fe0f28381f863cd505779e6b9c103bc9 100644 +index 492e073cfc2a43951e20fd2d15a576601e84a364..1290f55259a5ba0b855323ba59a1d9b8d5de0f57 100644 --- a/src/main/java/net/minecraft/server/level/ChunkMap.java +++ b/src/main/java/net/minecraft/server/level/ChunkMap.java -@@ -1643,6 +1643,14 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider +@@ -1642,6 +1642,14 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider public void addEntity(Entity entity) { org.spigotmc.AsyncCatcher.catchOp("entity track"); // Spigot @@ -26,7 +26,7 @@ index 5cf6f6f67520af8d94456a028828e49446e82be9..496f9580fe0f28381f863cd505779e6b EntityType entitytypes = entity.getType(); int i = entitytypes.clientTrackingRange() * 16; diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java -index 6bded610f82189a5549e656881dbce0d34f285b2..8808b8b5b3fa03a1a0c4d843867f1e26d966ab85 100644 +index d4e054a6ed2626845373f4b0fa8463682322cf12..59d0e9f9cf90bde3d56d69c87e2fe4b9e1903ff7 100644 --- a/src/main/java/net/minecraft/server/level/ServerLevel.java +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java @@ -2288,7 +2288,7 @@ public class ServerLevel extends Level implements WorldGenLevel { diff --git a/patches/server/0381-Don-t-tick-dead-players.patch b/patches/server/0380-Don-t-tick-dead-players.patch similarity index 91% rename from patches/server/0381-Don-t-tick-dead-players.patch rename to patches/server/0380-Don-t-tick-dead-players.patch index df707c1662..2f15e506dc 100644 --- a/patches/server/0381-Don-t-tick-dead-players.patch +++ b/patches/server/0380-Don-t-tick-dead-players.patch @@ -7,7 +7,7 @@ Causes sync chunk loads and who knows what all else. This is safe because Spectators are skipped in unloaded chunks too in vanilla. diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java -index 4c0ab7705824a02bb7e9906fbd3a5c4792bc7dd7..25cbb75767331682276f3c1abd6a08bbc81b4e13 100644 +index 1c7ee53d9f5744ad93f829f12b87aa779db005d4..2527615fa33b45f38b3a5cfdb458dcb92c6d514f 100644 --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java @@ -650,7 +650,7 @@ public class ServerPlayer extends Player { diff --git a/patches/server/0382-Dead-Player-s-shouldn-t-be-able-to-move.patch b/patches/server/0381-Dead-Player-s-shouldn-t-be-able-to-move.patch similarity index 90% rename from patches/server/0382-Dead-Player-s-shouldn-t-be-able-to-move.patch rename to patches/server/0381-Dead-Player-s-shouldn-t-be-able-to-move.patch index 03b64e4d5b..3f94fb7fbe 100644 --- a/patches/server/0382-Dead-Player-s-shouldn-t-be-able-to-move.patch +++ b/patches/server/0381-Dead-Player-s-shouldn-t-be-able-to-move.patch @@ -7,7 +7,7 @@ This fixes a lot of game state issues where packets were delayed for processing due to 1.15's new queue but processed while dead. diff --git a/src/main/java/net/minecraft/world/entity/player/Player.java b/src/main/java/net/minecraft/world/entity/player/Player.java -index bac822f72cf8b2c6858343cf80a59284b9118ab6..a8b122503a5e46242706b6f654b8fc259bf7321c 100644 +index 6b7aea148b7a979201dd51bf842a552644fd0a63..f1a1a251256646d0d3a457f1fc8af20ae085f5ef 100644 --- a/src/main/java/net/minecraft/world/entity/player/Player.java +++ b/src/main/java/net/minecraft/world/entity/player/Player.java @@ -1171,7 +1171,7 @@ public abstract class Player extends LivingEntity { diff --git a/patches/server/0383-Optimize-Collision-to-not-load-chunks.patch b/patches/server/0382-Optimize-Collision-to-not-load-chunks.patch similarity index 94% rename from patches/server/0383-Optimize-Collision-to-not-load-chunks.patch rename to patches/server/0382-Optimize-Collision-to-not-load-chunks.patch index d114e1fb16..8059ead180 100644 --- a/patches/server/0383-Optimize-Collision-to-not-load-chunks.patch +++ b/patches/server/0382-Optimize-Collision-to-not-load-chunks.patch @@ -14,7 +14,7 @@ movement will load only the chunk the player enters anyways and avoids loading massive amounts of surrounding chunks due to large AABB lookups. diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java -index a2071ea91515c5ddd2318cc4918328d20dec224e..dcdf25a8111410d54adc2e758775efcce0165b73 100644 +index f14d4bfd5ac03eeffefcf98e1077d915fd3fa2cb..d8b34055aff358cb2c236199da1e22d84213ea1e 100644 --- a/src/main/java/net/minecraft/server/players/PlayerList.java +++ b/src/main/java/net/minecraft/server/players/PlayerList.java @@ -795,6 +795,7 @@ public abstract class PlayerList { @@ -26,7 +26,7 @@ index a2071ea91515c5ddd2318cc4918328d20dec224e..dcdf25a8111410d54adc2e758775efcc entityplayer1.setPos(entityplayer1.getX(), entityplayer1.getY() + 1.0D, entityplayer1.getZ()); } diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java -index 6be19303b491c42d86c617166427f44f75bdaff4..94ff77c8ea011d74367589ee3121484066314018 100644 +index 97d316a4e14e109e91fba41303b83098895f405c..a9f02cdf5f9d2767fc4a5422d084008f70e6a8e2 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java @@ -230,6 +230,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource { @@ -38,7 +38,7 @@ index 6be19303b491c42d86c617166427f44f75bdaff4..94ff77c8ea011d74367589ee31214840 public @org.jetbrains.annotations.Nullable net.minecraft.server.level.ChunkMap.TrackedEntity tracker; // Paper diff --git a/src/main/java/net/minecraft/world/level/BlockCollisions.java b/src/main/java/net/minecraft/world/level/BlockCollisions.java -index 8390ce194ccc692139c0e870c16a7fb76ac8ba68..a733c91700a38634806e9155c693b227e6aa16b6 100644 +index 8390ce194ccc692139c0e870c16a7fb76ac8ba68..95e22c91bc701785f4804e5d4e0a6b420b9830fd 100644 --- a/src/main/java/net/minecraft/world/level/BlockCollisions.java +++ b/src/main/java/net/minecraft/world/level/BlockCollisions.java @@ -66,22 +66,41 @@ public class BlockCollisions extends AbstractIterator { @@ -76,7 +76,7 @@ index 8390ce194ccc692139c0e870c16a7fb76ac8ba68..a733c91700a38634806e9155c693b227 + } + + if (blockState == null) { -+ if (!(source instanceof net.minecraft.server.level.ServerPlayer) || source.level.paperConfig.preventMovingIntoUnloadedChunks) { ++ if (!(source instanceof net.minecraft.server.level.ServerPlayer) || source.level.paperConfig().chunks.preventMovingIntoUnloadedChunks) { + return Shapes.create(far ? source.getBoundingBox() : new AABB(new BlockPos(x, y, z))); + } + // Paper end diff --git a/patches/server/0384-Don-t-move-existing-players-to-world-spawn.patch b/patches/server/0383-Don-t-move-existing-players-to-world-spawn.patch similarity index 92% rename from patches/server/0384-Don-t-move-existing-players-to-world-spawn.patch rename to patches/server/0383-Don-t-move-existing-players-to-world-spawn.patch index 31d5133613..b4703e6068 100644 --- a/patches/server/0384-Don-t-move-existing-players-to-world-spawn.patch +++ b/patches/server/0383-Don-t-move-existing-players-to-world-spawn.patch @@ -10,7 +10,7 @@ larger than the keep loaded range. By skipping this, we avoid potential for a large spike on server start. diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java -index 25cbb75767331682276f3c1abd6a08bbc81b4e13..3603e169f9195b86553867ddabca2e3ad90a494f 100644 +index 2527615fa33b45f38b3a5cfdb458dcb92c6d514f..3933387e180acc0fcbff1c1147fcf73eeaa8b0d7 100644 --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java @@ -320,7 +320,7 @@ public class ServerPlayer extends Player { @@ -32,7 +32,7 @@ index 25cbb75767331682276f3c1abd6a08bbc81b4e13..3603e169f9195b86553867ddabca2e3a this.gameMode.setLevel((ServerLevel) world); } diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java -index dcdf25a8111410d54adc2e758775efcce0165b73..3290a2e4689c9e34c3260db4de8ac7f6dc74f8ea 100644 +index d8b34055aff358cb2c236199da1e22d84213ea1e..d6b8796ed7eca4ba2af979fb5c2cbff4b92ae329 100644 --- a/src/main/java/net/minecraft/server/players/PlayerList.java +++ b/src/main/java/net/minecraft/server/players/PlayerList.java @@ -214,6 +214,8 @@ public abstract class PlayerList { diff --git a/patches/server/0385-Optimize-GoalSelector-Goal.Flag-Set-operations.patch b/patches/server/0384-Optimize-GoalSelector-Goal.Flag-Set-operations.patch similarity index 100% rename from patches/server/0385-Optimize-GoalSelector-Goal.Flag-Set-operations.patch rename to patches/server/0384-Optimize-GoalSelector-Goal.Flag-Set-operations.patch diff --git a/patches/server/0386-Improved-Watchdog-Support.patch b/patches/server/0385-Improved-Watchdog-Support.patch similarity index 94% rename from patches/server/0386-Improved-Watchdog-Support.patch rename to patches/server/0385-Improved-Watchdog-Support.patch index 4a6bebbbce..55f2c8225b 100644 --- a/patches/server/0386-Improved-Watchdog-Support.patch +++ b/patches/server/0385-Improved-Watchdog-Support.patch @@ -41,7 +41,7 @@ This also moves all plugins who register "delayed init" tasks to occur just befo are properly accounted for and wont trip watchdog on init. diff --git a/src/main/java/com/destroystokyo/paper/Metrics.java b/src/main/java/com/destroystokyo/paper/Metrics.java -index e3b74dbdf8e14219a56fab939f3174e0c2f66de6..218f5bafeed8551b55b91c7fccaf6935c8b631ca 100644 +index 5a19e30a9b7e65a70f68a429b8ca741f788a303b..7b1843e16745ca8db2244e17490d291401f22679 100644 --- a/src/main/java/com/destroystokyo/paper/Metrics.java +++ b/src/main/java/com/destroystokyo/paper/Metrics.java @@ -92,7 +92,12 @@ public class Metrics { @@ -71,10 +71,10 @@ index 8cc4cb2163a93b9491550fe6d0f5d980fb216920..4dd14d73a37b32288a64fbd67ee22c43 cause = cause.getCause(); } diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index 6d71dd7021afa2cb3c1200c64de08e3658e0a998..08ada4f1818f3dc8aeee417df11948a48b66bcfd 100644 +index 7de1368bcde500ba133282537270fbdfd9c9d54b..60648e7c3c86176631d9a3ffdf21f6d236eabd79 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java -@@ -282,7 +282,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop processQueue = new java.util.concurrent.ConcurrentLinkedQueue(); public int autosavePeriod; public Commands vanillaCommandDispatcher; @@ -84,7 +84,7 @@ index 6d71dd7021afa2cb3c1200c64de08e3658e0a998..08ada4f1818f3dc8aeee417df11948a4 // Spigot start public static final int TPS = 20; @@ -292,6 +292,9 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop { CompletableFuture completablefuture; diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java -index 3290a2e4689c9e34c3260db4de8ac7f6dc74f8ea..8fa76c3184d7e25339c2de27332ff4d523a4b85e 100644 +index d6b8796ed7eca4ba2af979fb5c2cbff4b92ae329..3459a7b74be03de8cf29ea1f54b7d54de2838911 100644 --- a/src/main/java/net/minecraft/server/players/PlayerList.java +++ b/src/main/java/net/minecraft/server/players/PlayerList.java @@ -516,7 +516,7 @@ public abstract class PlayerList { @@ -299,10 +299,10 @@ index 6fefa619299d3202158490630d62c16aef71e831..7a4ade1a4190bf4fbb048919ae2be230 } diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java -index c4e679eca56ca756d2d7a9d2ffa2a56e5ab3f721..6f04f79832b52fc898ec2b13af03bc28d4e0bbc1 100644 +index 672e8eff9b9b635106deb32952b6d2dc4323a564..f47812b84b003ac486a2c100d82368e3242014bc 100644 --- a/src/main/java/net/minecraft/world/level/Level.java +++ b/src/main/java/net/minecraft/world/level/Level.java -@@ -789,6 +789,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable { +@@ -794,6 +794,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable { try { tickConsumer.accept(entity); } catch (Throwable throwable) { @@ -311,7 +311,7 @@ index c4e679eca56ca756d2d7a9d2ffa2a56e5ab3f721..6f04f79832b52fc898ec2b13af03bc28 final String msg = String.format("Entity threw exception at %s:%s,%s,%s", entity.level.getWorld().getName(), entity.getX(), entity.getY(), entity.getZ()); MinecraftServer.LOGGER.error(msg, throwable); diff --git a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java -index 930fa1703727249585b4ac045db15d55736c58fd..f362f0edf7ee81d2e21d86d57b86420f9619f32e 100644 +index 89f4ea65b20e773bd3782c41db3a2af7b5b405f3..3fe94e580d2aaae9616ba83c0d3a44687505b249 100644 --- a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java +++ b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java @@ -1083,6 +1083,7 @@ public class LevelChunk extends ChunkAccess { @@ -323,10 +323,10 @@ index 930fa1703727249585b4ac045db15d55736c58fd..f362f0edf7ee81d2e21d86d57b86420f final String msg = String.format("BlockEntity threw exception at %s:%s,%s,%s", LevelChunk.this.getLevel().getWorld().getName(), this.getPos().getX(), this.getPos().getY(), this.getPos().getZ()); net.minecraft.server.MinecraftServer.LOGGER.error(msg, throwable); diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -index 8a36ed778814dfd74ab190fa25cc6dbb54275ac0..14baaf2d679ccceeecb32958cd2ad0ef54beaf4b 100644 +index a67e99a53f35c2d0142193ac75f47ba8bd7d9784..d6b9fb609a3ebd4afb561a829c14e077004e2bc4 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -@@ -2050,7 +2050,7 @@ public final class CraftServer implements Server { +@@ -2049,7 +2049,7 @@ public final class CraftServer implements Server { @Override public boolean isPrimaryThread() { @@ -497,10 +497,10 @@ index a142a56a920e153ed84c08cece993f10d76f7793..92d97a5810a379b427a99b4c63fb9844 String[] split = restartScript.split( " " ); if ( split.length > 0 && new File( split[0] ).isFile() ) diff --git a/src/main/java/org/spigotmc/WatchdogThread.java b/src/main/java/org/spigotmc/WatchdogThread.java -index 1ffb208094f521883ef0e23baf5fb29380b14273..4d271cae88c16ed2419f896c728fdff612540500 100644 +index e62f085de1678568d422ef0eda5b9bfbd8b4d556..f3d60841f7b2e29e667291092b97ec909ba03ab6 100644 --- a/src/main/java/org/spigotmc/WatchdogThread.java +++ b/src/main/java/org/spigotmc/WatchdogThread.java -@@ -12,6 +12,7 @@ import org.bukkit.Bukkit; +@@ -11,6 +11,7 @@ import org.bukkit.Bukkit; public class WatchdogThread extends Thread { @@ -508,7 +508,7 @@ index 1ffb208094f521883ef0e23baf5fb29380b14273..4d271cae88c16ed2419f896c728fdff6 private static WatchdogThread instance; private long timeoutTime; private boolean restart; -@@ -40,6 +41,7 @@ public class WatchdogThread extends Thread +@@ -39,6 +40,7 @@ public class WatchdogThread extends Thread { if ( WatchdogThread.instance == null ) { @@ -516,7 +516,7 @@ index 1ffb208094f521883ef0e23baf5fb29380b14273..4d271cae88c16ed2419f896c728fdff6 WatchdogThread.instance = new WatchdogThread( timeoutTime * 1000L, restart ); WatchdogThread.instance.start(); } else -@@ -71,12 +73,13 @@ public class WatchdogThread extends Thread +@@ -70,12 +72,13 @@ public class WatchdogThread extends Thread // Paper start Logger log = Bukkit.getServer().getLogger(); long currentTime = WatchdogThread.monotonicMillis(); @@ -533,7 +533,7 @@ index 1ffb208094f521883ef0e23baf5fb29380b14273..4d271cae88c16ed2419f896c728fdff6 lastEarlyWarning = currentTime; if (isLongTimeout) { // Paper end -@@ -118,7 +121,7 @@ public class WatchdogThread extends Thread +@@ -117,7 +120,7 @@ public class WatchdogThread extends Thread log.log( Level.SEVERE, "------------------------------" ); log.log( Level.SEVERE, "Server thread dump (Look for plugins here before reporting to Paper!):" ); // Paper com.destroystokyo.paper.io.chunk.ChunkTaskManager.dumpAllChunkLoadInfo(); // Paper @@ -542,7 +542,7 @@ index 1ffb208094f521883ef0e23baf5fb29380b14273..4d271cae88c16ed2419f896c728fdff6 log.log( Level.SEVERE, "------------------------------" ); // // Paper start - Only print full dump on long timeouts -@@ -138,9 +141,25 @@ public class WatchdogThread extends Thread +@@ -137,9 +140,25 @@ public class WatchdogThread extends Thread if ( isLongTimeout ) { diff --git a/patches/server/0387-Optimize-Pathfinding.patch b/patches/server/0386-Optimize-Pathfinding.patch similarity index 100% rename from patches/server/0387-Optimize-Pathfinding.patch rename to patches/server/0386-Optimize-Pathfinding.patch diff --git a/patches/server/0388-Reduce-Either-Optional-allocation.patch b/patches/server/0387-Reduce-Either-Optional-allocation.patch similarity index 100% rename from patches/server/0388-Reduce-Either-Optional-allocation.patch rename to patches/server/0387-Reduce-Either-Optional-allocation.patch diff --git a/patches/server/0389-Reduce-memory-footprint-of-NBTTagCompound.patch b/patches/server/0388-Reduce-memory-footprint-of-NBTTagCompound.patch similarity index 100% rename from patches/server/0389-Reduce-memory-footprint-of-NBTTagCompound.patch rename to patches/server/0388-Reduce-memory-footprint-of-NBTTagCompound.patch diff --git a/patches/server/0390-Prevent-opening-inventories-when-frozen.patch b/patches/server/0389-Prevent-opening-inventories-when-frozen.patch similarity index 95% rename from patches/server/0390-Prevent-opening-inventories-when-frozen.patch rename to patches/server/0389-Prevent-opening-inventories-when-frozen.patch index 605c010fe7..b9cf114eb1 100644 --- a/patches/server/0390-Prevent-opening-inventories-when-frozen.patch +++ b/patches/server/0389-Prevent-opening-inventories-when-frozen.patch @@ -5,11 +5,11 @@ Subject: [PATCH] Prevent opening inventories when frozen diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java -index 3603e169f9195b86553867ddabca2e3ad90a494f..b4d5817998d8aa0c6e6eb3c01af0bc1d804e794b 100644 +index 3933387e180acc0fcbff1c1147fcf73eeaa8b0d7..02a84c3f3ca6b591a1c475b5cf3357cebd41eff6 100644 --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java @@ -619,7 +619,7 @@ public class ServerPlayer extends Player { - containerUpdateDelay = level.paperConfig.containerUpdateTickRate; + containerUpdateDelay = level.paperConfig().tickRates.containerUpdate; } // Paper end - if (!this.level.isClientSide && !this.containerMenu.stillValid(this)) { diff --git a/patches/server/0391-Optimise-ArraySetSorted-removeIf.patch b/patches/server/0390-Optimise-ArraySetSorted-removeIf.patch similarity index 100% rename from patches/server/0391-Optimise-ArraySetSorted-removeIf.patch rename to patches/server/0390-Optimise-ArraySetSorted-removeIf.patch diff --git a/patches/server/0392-Don-t-run-entity-collision-code-if-not-needed.patch b/patches/server/0391-Don-t-run-entity-collision-code-if-not-needed.patch similarity index 88% rename from patches/server/0392-Don-t-run-entity-collision-code-if-not-needed.patch rename to patches/server/0391-Don-t-run-entity-collision-code-if-not-needed.patch index e807aebe4f..ae418d0c67 100644 --- a/patches/server/0392-Don-t-run-entity-collision-code-if-not-needed.patch +++ b/patches/server/0391-Don-t-run-entity-collision-code-if-not-needed.patch @@ -7,7 +7,7 @@ Will not run if max entity craming is disabled and the max collisions per entity is less than or equal to 0 diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java -index 70670065642766501918dfca21fdb3ea78a90a31..44b753d0ea66b9099c575e479ade4080efa3b287 100644 +index 12d90147d5d10f074380c0faeff2ceb399c7bda2..62be04836b57063b4c3dc3dfb05f2e556b062702 100644 --- a/src/main/java/net/minecraft/world/entity/LivingEntity.java +++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java @@ -3312,10 +3312,16 @@ public abstract class LivingEntity extends Entity { @@ -16,7 +16,7 @@ index 70670065642766501918dfca21fdb3ea78a90a31..44b753d0ea66b9099c575e479ade4080 protected void pushEntities() { + // Paper start - don't run getEntities if we're not going to use its result + int i = this.level.getGameRules().getInt(GameRules.RULE_MAX_ENTITY_CRAMMING); -+ if (i <= 0 && level.paperConfig.maxCollisionsPerEntity <= 0) { ++ if (i <= 0 && level.paperConfig().collisions.maxEntityCollisions <= 0) { + return; + } + // Paper end - don't run getEntities if we're not going to use its result diff --git a/patches/server/0393-Implement-Player-Client-Options-API.patch b/patches/server/0392-Implement-Player-Client-Options-API.patch similarity index 97% rename from patches/server/0393-Implement-Player-Client-Options-API.patch rename to patches/server/0392-Implement-Player-Client-Options-API.patch index 0563e24793..4341240c53 100644 --- a/patches/server/0393-Implement-Player-Client-Options-API.patch +++ b/patches/server/0392-Implement-Player-Client-Options-API.patch @@ -85,7 +85,7 @@ index 0000000000000000000000000000000000000000..b6f4400df3d8ec7e06a996de54f8cabb + } +} diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java -index b4d5817998d8aa0c6e6eb3c01af0bc1d804e794b..108561244fa1062cd98be76fdff471fd8fa170cd 100644 +index 02a84c3f3ca6b591a1c475b5cf3357cebd41eff6..8ef5f67c0b51bb5d527b36c667a5c23594da7d03 100644 --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java @@ -1856,6 +1856,7 @@ public class ServerPlayer extends Player { @@ -97,7 +97,7 @@ index b4d5817998d8aa0c6e6eb3c01af0bc1d804e794b..108561244fa1062cd98be76fdff471fd if (getMainArm() != packet.mainHand()) { PlayerChangedMainHandEvent event = new PlayerChangedMainHandEvent(this.getBukkitEntity(), getMainArm() == HumanoidArm.LEFT ? MainHand.LEFT : MainHand.RIGHT); diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -index b627746a04994dc5b6ddb7508ac9442a04aa2d5f..ccdbeadcb232832b12c3249a24966136b7ac54fd 100644 +index 40e6f19449f5d87616097bb3e83fbf1ce796685c..7a64562326cc462c448245a28fdbcce08fe30310 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java @@ -574,6 +574,24 @@ public class CraftPlayer extends CraftHumanEntity implements Player { diff --git a/patches/server/0394-Don-t-crash-if-player-is-attempted-to-be-removed-fro.patch b/patches/server/0393-Don-t-crash-if-player-is-attempted-to-be-removed-fro.patch similarity index 100% rename from patches/server/0394-Don-t-crash-if-player-is-attempted-to-be-removed-fro.patch rename to patches/server/0393-Don-t-crash-if-player-is-attempted-to-be-removed-fro.patch diff --git a/patches/server/0395-Fix-Chunk-Post-Processing-deadlock-risk.patch b/patches/server/0394-Fix-Chunk-Post-Processing-deadlock-risk.patch similarity index 92% rename from patches/server/0395-Fix-Chunk-Post-Processing-deadlock-risk.patch rename to patches/server/0394-Fix-Chunk-Post-Processing-deadlock-risk.patch index 988c4897ca..84afcc16fc 100644 --- a/patches/server/0395-Fix-Chunk-Post-Processing-deadlock-risk.patch +++ b/patches/server/0394-Fix-Chunk-Post-Processing-deadlock-risk.patch @@ -25,10 +25,10 @@ This successfully fixed a reoccurring and highly reproducible crash for heightmaps. diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java -index eb0fbf2126e7c9978f46c92b6999f00c5aea9a58..bfd0398e4bca5458d2913715b742b3c5a0b076f8 100644 +index 1bdfac38a40e5406d8c3f3b4ddd018031bee7ef4..474d08e649dcdf7b9cab34e44c3e976dfba8f14b 100644 --- a/src/main/java/net/minecraft/server/level/ChunkMap.java +++ b/src/main/java/net/minecraft/server/level/ChunkMap.java -@@ -182,6 +182,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider +@@ -181,6 +181,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider }; // CraftBukkit end @@ -36,7 +36,7 @@ index eb0fbf2126e7c9978f46c92b6999f00c5aea9a58..bfd0398e4bca5458d2913715b742b3c5 // Paper start - distance maps private final com.destroystokyo.paper.util.misc.PooledLinkedHashSets pooledLinkedPlayerHashSets = new com.destroystokyo.paper.util.misc.PooledLinkedHashSets<>(); -@@ -1021,16 +1022,15 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider +@@ -1020,16 +1021,15 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider }); CompletableFuture> completablefuture1 = completablefuture.thenApplyAsync((either) -> { return either.mapLeft((list) -> { @@ -60,7 +60,7 @@ index eb0fbf2126e7c9978f46c92b6999f00c5aea9a58..bfd0398e4bca5458d2913715b742b3c5 completablefuture1.thenAcceptAsync((either) -> { either.ifLeft((chunk) -> { diff --git a/src/main/java/net/minecraft/server/level/ServerChunkCache.java b/src/main/java/net/minecraft/server/level/ServerChunkCache.java -index 4581a95a792e8eb157c8577547cb6f76a8e8f883..55b8f9dc3ad2b282e83c912ad8bf46b31cbd3765 100644 +index 509b2ee115584ce80717cc12a7ab548d103b4b92..42b4214a1319691e9a6cb0c5fafaeeff821f3f99 100644 --- a/src/main/java/net/minecraft/server/level/ServerChunkCache.java +++ b/src/main/java/net/minecraft/server/level/ServerChunkCache.java @@ -1138,6 +1138,7 @@ public class ServerChunkCache extends ChunkSource { diff --git a/patches/server/0396-Fix-Longstanding-Broken-behavior-of-PlayerJoinEvent.patch b/patches/server/0395-Fix-Longstanding-Broken-behavior-of-PlayerJoinEvent.patch similarity index 94% rename from patches/server/0396-Fix-Longstanding-Broken-behavior-of-PlayerJoinEvent.patch rename to patches/server/0395-Fix-Longstanding-Broken-behavior-of-PlayerJoinEvent.patch index bfc17bbab6..382eae426d 100644 --- a/patches/server/0396-Fix-Longstanding-Broken-behavior-of-PlayerJoinEvent.patch +++ b/patches/server/0395-Fix-Longstanding-Broken-behavior-of-PlayerJoinEvent.patch @@ -28,10 +28,10 @@ receives a deterministic result, and should no longer require 1 tick delays anymore. diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java -index bfd0398e4bca5458d2913715b742b3c5a0b076f8..16cce0feeca7d6f9f67100a07b824930adabcc72 100644 +index 474d08e649dcdf7b9cab34e44c3e976dfba8f14b..ac846039c98ed297dcb913ef4a02d4ab259debd2 100644 --- a/src/main/java/net/minecraft/server/level/ChunkMap.java +++ b/src/main/java/net/minecraft/server/level/ChunkMap.java -@@ -1651,6 +1651,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider +@@ -1650,6 +1650,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider .printStackTrace(); return; } @@ -40,7 +40,7 @@ index bfd0398e4bca5458d2913715b742b3c5a0b076f8..16cce0feeca7d6f9f67100a07b824930 if (!(entity instanceof EnderDragonPart)) { EntityType entitytypes = entity.getType(); diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java -index 108561244fa1062cd98be76fdff471fd8fa170cd..8aed9224deff11aa2717b929f40b2da1dc1de521 100644 +index 8ef5f67c0b51bb5d527b36c667a5c23594da7d03..55aae33d3b296ff8e02b1c36c55678979d48ac3d 100644 --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java @@ -252,6 +252,7 @@ public class ServerPlayer extends Player { @@ -52,7 +52,7 @@ index 108561244fa1062cd98be76fdff471fd8fa170cd..8aed9224deff11aa2717b929f40b2da1 public String kickLeaveMessage = null; // SPIGOT-3034: Forward leave message to PlayerQuitEvent // CraftBukkit end diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java -index 8fa76c3184d7e25339c2de27332ff4d523a4b85e..730a3d84219f374d0a5f978e152b87e30474dec9 100644 +index 3459a7b74be03de8cf29ea1f54b7d54de2838911..ac0bae0f7ce766a67cf2dc2c5c35f244e5a08837 100644 --- a/src/main/java/net/minecraft/server/players/PlayerList.java +++ b/src/main/java/net/minecraft/server/players/PlayerList.java @@ -280,6 +280,12 @@ public abstract class PlayerList { diff --git a/patches/server/0397-Load-Chunks-for-Login-Asynchronously.patch b/patches/server/0396-Load-Chunks-for-Login-Asynchronously.patch similarity index 94% rename from patches/server/0397-Load-Chunks-for-Login-Asynchronously.patch rename to patches/server/0396-Load-Chunks-for-Login-Asynchronously.patch index dfb59b494f..9d8086c674 100644 --- a/patches/server/0397-Load-Chunks-for-Login-Asynchronously.patch +++ b/patches/server/0396-Load-Chunks-for-Login-Asynchronously.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Load Chunks for Login Asynchronously diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java -index 8aed9224deff11aa2717b929f40b2da1dc1de521..1e32ac21998cf7b7987815850fd022a5f282c5e0 100644 +index 55aae33d3b296ff8e02b1c36c55678979d48ac3d..c1d9c365edc8b6d2c5b94926faaa00180ca3885b 100644 --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java @@ -180,6 +180,7 @@ public class ServerPlayer extends Player { @@ -37,7 +37,7 @@ index be677d437d17b74c6188ce1bd5fc6fdc228fd92f..78fbb4c3e52e900956ae0811aaf934c8 public static final TicketType UNKNOWN = TicketType.create("unknown", Comparator.comparingLong(ChunkPos::toLong), 1); public static final TicketType PLUGIN = TicketType.create("plugin", (a, b) -> 0); // CraftBukkit diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index 1f90edd5eba696303962523439133d19514ebc32..fbcb22036600c7440e66f30afbdf15ee8683ff6d 100644 +index da564c365a597d0cd92efdef7a4af99f4b9d2e97..65fcd9555c70337f65535d6742582ceed5dd4eb6 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java @@ -237,6 +237,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser @@ -74,10 +74,10 @@ index 1f90edd5eba696303962523439133d19514ebc32..fbcb22036600c7440e66f30afbdf15ee this.server.getProfiler().push("keepAlive"); // Paper Start - give clients a longer time to respond to pings as per pre 1.12.2 timings diff --git a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java -index cbb0865b08185d1c9dc95f6dc5507cc39f92f15e..35197aebcc7f00577dc506d022026f1d41168b73 100644 +index 1e4c306569fa96327dc99bb5dd6b3a749e60813e..a5c933260099a3c28d7655b4fb1ec2917f2fc21c 100644 --- a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java -@@ -94,7 +94,7 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener +@@ -93,7 +93,7 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener } // Paper end } else if (this.state == ServerLoginPacketListenerImpl.State.DELAY_ACCEPT) { @@ -86,7 +86,7 @@ index cbb0865b08185d1c9dc95f6dc5507cc39f92f15e..35197aebcc7f00577dc506d022026f1d if (entityplayer == null) { this.state = ServerLoginPacketListenerImpl.State.READY_TO_ACCEPT; -@@ -193,7 +193,7 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener +@@ -192,7 +192,7 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener } this.connection.send(new ClientboundGameProfilePacket(this.gameProfile)); @@ -96,7 +96,7 @@ index cbb0865b08185d1c9dc95f6dc5507cc39f92f15e..35197aebcc7f00577dc506d022026f1d try { ServerPlayer entityplayer1 = this.server.getPlayerList().getPlayerForLogin(this.gameProfile, s); // CraftBukkit - add player reference diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java -index 730a3d84219f374d0a5f978e152b87e30474dec9..1b955c9a6f5532d30d58b8a852d7583d3effd53a 100644 +index ac0bae0f7ce766a67cf2dc2c5c35f244e5a08837..4b9e030016bef762c01ace5181ade7d1480b8702 100644 --- a/src/main/java/net/minecraft/server/players/PlayerList.java +++ b/src/main/java/net/minecraft/server/players/PlayerList.java @@ -138,6 +138,7 @@ public abstract class PlayerList { @@ -209,7 +209,7 @@ index 730a3d84219f374d0a5f978e152b87e30474dec9..1b955c9a6f5532d30d58b8a852d7583d @@ -531,7 +588,7 @@ public abstract class PlayerList { } - PlayerQuitEvent playerQuitEvent = new PlayerQuitEvent(entityplayer.getBukkitEntity(), net.kyori.adventure.text.Component.translatable("multiplayer.player.left", net.kyori.adventure.text.format.NamedTextColor.YELLOW, com.destroystokyo.paper.PaperConfig.useDisplayNameInQuit ? entityplayer.getBukkitEntity().displayName() : net.kyori.adventure.text.Component.text(entityplayer.getScoreboardName()))); + PlayerQuitEvent playerQuitEvent = new PlayerQuitEvent(entityplayer.getBukkitEntity(), net.kyori.adventure.text.Component.translatable("multiplayer.player.left", net.kyori.adventure.text.format.NamedTextColor.YELLOW, io.papermc.paper.configuration.GlobalConfiguration.get().messages.useDisplayNameInQuitMessage ? entityplayer.getBukkitEntity().displayName() : net.kyori.adventure.text.Component.text(entityplayer.getScoreboardName()))); - this.cserver.getPluginManager().callEvent(playerQuitEvent); + if (entityplayer.didPlayerJoinEvent) this.cserver.getPluginManager().callEvent(playerQuitEvent); // Paper - if we disconnected before join ever fired, don't fire quit entityplayer.getBukkitEntity().disconnect(playerQuitEvent.getQuitMessage()); diff --git a/patches/server/0398-Move-player-to-spawn-point-if-spawn-in-unloaded-worl.patch b/patches/server/0397-Move-player-to-spawn-point-if-spawn-in-unloaded-worl.patch similarity index 89% rename from patches/server/0398-Move-player-to-spawn-point-if-spawn-in-unloaded-worl.patch rename to patches/server/0397-Move-player-to-spawn-point-if-spawn-in-unloaded-worl.patch index cae4a2ad41..20bfac32bd 100644 --- a/patches/server/0398-Move-player-to-spawn-point-if-spawn-in-unloaded-worl.patch +++ b/patches/server/0397-Move-player-to-spawn-point-if-spawn-in-unloaded-worl.patch @@ -7,10 +7,10 @@ The code following this has better support for null worlds to move them back to the world spawn. diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java -index 94ff77c8ea011d74367589ee3121484066314018..3905bbb797f0f4f1d6e5822fc7b52f66f9979421 100644 +index a9f02cdf5f9d2767fc4a5422d084008f70e6a8e2..3ae5ac2a50930d89daa460855e7bc7fc3143f979 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java -@@ -2094,9 +2094,11 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource { +@@ -2093,9 +2093,11 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource { bworld = server.getWorld(worldName); } diff --git a/patches/server/0399-Add-PlayerAttackEntityCooldownResetEvent.patch b/patches/server/0398-Add-PlayerAttackEntityCooldownResetEvent.patch similarity index 95% rename from patches/server/0399-Add-PlayerAttackEntityCooldownResetEvent.patch rename to patches/server/0398-Add-PlayerAttackEntityCooldownResetEvent.patch index 80ed154de2..e1c100d038 100644 --- a/patches/server/0399-Add-PlayerAttackEntityCooldownResetEvent.patch +++ b/patches/server/0398-Add-PlayerAttackEntityCooldownResetEvent.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Add PlayerAttackEntityCooldownResetEvent diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java -index 44b753d0ea66b9099c575e479ade4080efa3b287..efb5cc1705bd0ff50360203d68a564875662299c 100644 +index 62be04836b57063b4c3dc3dfb05f2e556b062702..2021b9592a1a32981075d169a61aef2e7f827192 100644 --- a/src/main/java/net/minecraft/world/entity/LivingEntity.java +++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java @@ -2090,7 +2090,16 @@ public abstract class LivingEntity extends Entity { diff --git a/patches/server/0400-Don-t-fire-BlockFade-on-worldgen-threads.patch b/patches/server/0399-Don-t-fire-BlockFade-on-worldgen-threads.patch similarity index 100% rename from patches/server/0400-Don-t-fire-BlockFade-on-worldgen-threads.patch rename to patches/server/0399-Don-t-fire-BlockFade-on-worldgen-threads.patch diff --git a/patches/server/0401-Add-phantom-creative-and-insomniac-controls.patch b/patches/server/0400-Add-phantom-creative-and-insomniac-controls.patch similarity index 68% rename from patches/server/0401-Add-phantom-creative-and-insomniac-controls.patch rename to patches/server/0400-Add-phantom-creative-and-insomniac-controls.patch index 3923ab7187..3b9eaafdbf 100644 --- a/patches/server/0401-Add-phantom-creative-and-insomniac-controls.patch +++ b/patches/server/0400-Add-phantom-creative-and-insomniac-controls.patch @@ -4,22 +4,6 @@ Date: Sat, 25 Apr 2020 15:13:41 -0500 Subject: [PATCH] Add phantom creative and insomniac controls -diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -index 07a912cd9f7af3464ecd0de1d789fdcd8c56f86d..a8dd2a9beb48f464033c812d99c197332175fc09 100644 ---- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -@@ -689,4 +689,11 @@ public class PaperWorldConfig { - } - perPlayerMobSpawns = getBoolean("per-player-mob-spawns", true); - } -+ -+ public boolean phantomIgnoreCreative = true; -+ public boolean phantomOnlyAttackInsomniacs = true; -+ private void phantomSettings() { -+ phantomIgnoreCreative = getBoolean("phantoms-do-not-spawn-on-creative-players", phantomIgnoreCreative); -+ phantomOnlyAttackInsomniacs = getBoolean("phantoms-only-attack-insomniacs", phantomOnlyAttackInsomniacs); -+ } - } diff --git a/src/main/java/net/minecraft/world/entity/EntitySelector.java b/src/main/java/net/minecraft/world/entity/EntitySelector.java index b91a61be7c4829fce0ff8da290eab580e20bb78d..22f36cd3df49160f1b6668befdd05c2268edaa49 100644 --- a/src/main/java/net/minecraft/world/entity/EntitySelector.java @@ -33,19 +17,19 @@ index b91a61be7c4829fce0ff8da290eab580e20bb78d..22f36cd3df49160f1b6668befdd05c22 private EntitySelector() {} // Paper start diff --git a/src/main/java/net/minecraft/world/entity/monster/Phantom.java b/src/main/java/net/minecraft/world/entity/monster/Phantom.java -index 84400bb44d5deb7c79295a83c4c3c6aac88f3175..ca9324381a60fc3072719c39918a1c16ac88799b 100644 +index 84400bb44d5deb7c79295a83c4c3c6aac88f3175..180bcdeb262d61c56193dbf99f1c11f3a6889145 100644 --- a/src/main/java/net/minecraft/world/entity/monster/Phantom.java +++ b/src/main/java/net/minecraft/world/entity/monster/Phantom.java @@ -558,6 +558,7 @@ public class Phantom extends FlyingMob implements Enemy { Player entityhuman = (Player) iterator.next(); if (Phantom.this.canAttack(entityhuman, TargetingConditions.DEFAULT)) { -+ if (!level.paperConfig.phantomOnlyAttackInsomniacs || EntitySelector.isInsomniac.test(entityhuman)) // Paper ++ if (!level.paperConfig().entities.behavior.phantomsOnlyAttackInsomniacs || EntitySelector.isInsomniac.test(entityhuman)) // Paper Phantom.this.setTarget(entityhuman, org.bukkit.event.entity.EntityTargetEvent.TargetReason.CLOSEST_PLAYER, true); // CraftBukkit - reason return true; } diff --git a/src/main/java/net/minecraft/world/level/levelgen/PhantomSpawner.java b/src/main/java/net/minecraft/world/level/levelgen/PhantomSpawner.java -index e9d25aef08103ccdbc6a35c3ab67c1d921e9f45d..9d96235c4697d9a0f045c692a742cdabbd6f8b8a 100644 +index e9d25aef08103ccdbc6a35c3ab67c1d921e9f45d..6b5c31470499e25d01936106839c2fff21b113c8 100644 --- a/src/main/java/net/minecraft/world/level/levelgen/PhantomSpawner.java +++ b/src/main/java/net/minecraft/world/level/levelgen/PhantomSpawner.java @@ -51,7 +51,7 @@ public class PhantomSpawner implements CustomSpawner { @@ -53,7 +37,7 @@ index e9d25aef08103ccdbc6a35c3ab67c1d921e9f45d..9d96235c4697d9a0f045c692a742cdab Player entityhuman = (Player) iterator.next(); - if (!entityhuman.isSpectator()) { -+ if (!entityhuman.isSpectator() && (!world.paperConfig.phantomIgnoreCreative || !entityhuman.isCreative())) { // Paper ++ if (!entityhuman.isSpectator() && (!world.paperConfig().entities.behavior.phantomsDoNotSpawnOnCreativePlayers || !entityhuman.isCreative())) { // Paper BlockPos blockposition = entityhuman.blockPosition(); if (!world.dimensionType().hasSkyLight() || blockposition.getY() >= world.getSeaLevel() && world.canSeeSky(blockposition)) { diff --git a/patches/server/0402-Fix-numerous-item-duplication-issues-and-teleport-is.patch b/patches/server/0401-Fix-numerous-item-duplication-issues-and-teleport-is.patch similarity index 94% rename from patches/server/0402-Fix-numerous-item-duplication-issues-and-teleport-is.patch rename to patches/server/0401-Fix-numerous-item-duplication-issues-and-teleport-is.patch index e5015acb80..5e4dcd6728 100644 --- a/patches/server/0402-Fix-numerous-item-duplication-issues-and-teleport-is.patch +++ b/patches/server/0401-Fix-numerous-item-duplication-issues-and-teleport-is.patch @@ -16,10 +16,10 @@ So even if something NEW comes up, it would be impossible to drop the same item twice because the source was destroyed. diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java -index 3905bbb797f0f4f1d6e5822fc7b52f66f9979421..9cb122ff9347eb8da347de98f362cca2709f60ce 100644 +index 3ae5ac2a50930d89daa460855e7bc7fc3143f979..782bced79dacc90e1d1914a2025e77b4fff06221 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java -@@ -2224,11 +2224,12 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource { +@@ -2223,11 +2223,12 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource { } else { // CraftBukkit start - Capture drops for death event if (this instanceof net.minecraft.world.entity.LivingEntity && !((net.minecraft.world.entity.LivingEntity) this).forceDrops) { @@ -34,7 +34,7 @@ index 3905bbb797f0f4f1d6e5822fc7b52f66f9979421..9cb122ff9347eb8da347de98f362cca2 entityitem.setDefaultPickUpDelay(); // CraftBukkit start -@@ -2992,6 +2993,12 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource { +@@ -2991,6 +2992,12 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource { @Nullable public Entity teleportTo(ServerLevel worldserver, BlockPos location) { // CraftBukkit end @@ -47,7 +47,7 @@ index 3905bbb797f0f4f1d6e5822fc7b52f66f9979421..9cb122ff9347eb8da347de98f362cca2 if (this.level instanceof ServerLevel && !this.isRemoved()) { this.level.getProfiler().push("changeDimension"); // CraftBukkit start -@@ -3018,6 +3025,11 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource { +@@ -3017,6 +3024,11 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource { // CraftBukkit end this.level.getProfiler().popPush("reloading"); @@ -59,7 +59,7 @@ index 3905bbb797f0f4f1d6e5822fc7b52f66f9979421..9cb122ff9347eb8da347de98f362cca2 Entity entity = this.getType().create(worldserver); if (entity != null) { -@@ -3031,10 +3043,6 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource { +@@ -3030,10 +3042,6 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource { // CraftBukkit start - Forward the CraftEntity to the new entity this.getBukkitEntity().setHandle(entity); entity.bukkitEntity = this.getBukkitEntity(); @@ -70,7 +70,7 @@ index 3905bbb797f0f4f1d6e5822fc7b52f66f9979421..9cb122ff9347eb8da347de98f362cca2 // CraftBukkit end } -@@ -3156,7 +3164,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource { +@@ -3155,7 +3163,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource { } public boolean canChangeDimensions() { @@ -80,7 +80,7 @@ index 3905bbb797f0f4f1d6e5822fc7b52f66f9979421..9cb122ff9347eb8da347de98f362cca2 public float getBlockExplosionResistance(Explosion explosion, BlockGetter world, BlockPos pos, BlockState blockState, FluidState fluidState, float max) { diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java -index efb5cc1705bd0ff50360203d68a564875662299c..4cfb5c89538c8d0ce20883bc6d2a5f7dc4967acd 100644 +index 2021b9592a1a32981075d169a61aef2e7f827192..cf04841c7e30b9f45c4922977c12e0fed6049450 100644 --- a/src/main/java/net/minecraft/world/entity/LivingEntity.java +++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java @@ -1643,9 +1643,9 @@ public abstract class LivingEntity extends Entity { @@ -113,7 +113,7 @@ index efb5cc1705bd0ff50360203d68a564875662299c..4cfb5c89538c8d0ce20883bc6d2a5f7d this.drops = new ArrayList<>(); // CraftBukkit end diff --git a/src/main/java/net/minecraft/world/entity/decoration/ArmorStand.java b/src/main/java/net/minecraft/world/entity/decoration/ArmorStand.java -index a885e4a63f9ffb70b305b6d8c0f0dedf5b3cbeef..b8c0a1b5703460d4c4d8923e18b56ab937b8226c 100644 +index cd54fa8f7bbcb6036e90f4ef7cdc01d7af835a13..808e564789d826c1778c053ab91038e3d4d81b7f 100644 --- a/src/main/java/net/minecraft/world/entity/decoration/ArmorStand.java +++ b/src/main/java/net/minecraft/world/entity/decoration/ArmorStand.java @@ -608,7 +608,7 @@ public class ArmorStand extends LivingEntity { diff --git a/patches/server/0403-Villager-Restocks-API.patch b/patches/server/0402-Villager-Restocks-API.patch similarity index 100% rename from patches/server/0403-Villager-Restocks-API.patch rename to patches/server/0402-Villager-Restocks-API.patch diff --git a/patches/server/0404-Validate-PickItem-Packet-and-kick-for-invalid.patch b/patches/server/0403-Validate-PickItem-Packet-and-kick-for-invalid.patch similarity index 95% rename from patches/server/0404-Validate-PickItem-Packet-and-kick-for-invalid.patch rename to patches/server/0403-Validate-PickItem-Packet-and-kick-for-invalid.patch index 667ffaf373..4985968d1c 100644 --- a/patches/server/0404-Validate-PickItem-Packet-and-kick-for-invalid.patch +++ b/patches/server/0403-Validate-PickItem-Packet-and-kick-for-invalid.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Validate PickItem Packet and kick for invalid diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index fbcb22036600c7440e66f30afbdf15ee8683ff6d..59d80414bf8fbf490d9e174a33860f035df3a8ac 100644 +index 65fcd9555c70337f65535d6742582ceed5dd4eb6..f2d465cb9061ba9a9c23752fcad043a0bfac0370 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java @@ -917,7 +917,14 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser diff --git a/patches/server/0405-Expose-game-version.patch b/patches/server/0404-Expose-game-version.patch similarity index 89% rename from patches/server/0405-Expose-game-version.patch rename to patches/server/0404-Expose-game-version.patch index 61ac895328..206df83fe9 100644 --- a/patches/server/0405-Expose-game-version.patch +++ b/patches/server/0404-Expose-game-version.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Expose game version diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -index 14baaf2d679ccceeecb32958cd2ad0ef54beaf4b..d0c73d201d4bc5052efea6049988798a0c52f07e 100644 +index d6b9fb609a3ebd4afb561a829c14e077004e2bc4..62014dffdfda6a72ea9c6ba57bc7f9ce380f45a9 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java @@ -568,6 +568,13 @@ public final class CraftServer implements Server { diff --git a/patches/server/0406-Optimize-Voxel-Shape-Merging.patch b/patches/server/0405-Optimize-Voxel-Shape-Merging.patch similarity index 100% rename from patches/server/0406-Optimize-Voxel-Shape-Merging.patch rename to patches/server/0405-Optimize-Voxel-Shape-Merging.patch diff --git a/patches/server/0407-Set-cap-on-JDK-per-thread-native-byte-buffer-cache.patch b/patches/server/0406-Set-cap-on-JDK-per-thread-native-byte-buffer-cache.patch similarity index 100% rename from patches/server/0407-Set-cap-on-JDK-per-thread-native-byte-buffer-cache.patch rename to patches/server/0406-Set-cap-on-JDK-per-thread-native-byte-buffer-cache.patch diff --git a/patches/server/0408-misc-debugging-dumps.patch b/patches/server/0407-misc-debugging-dumps.patch similarity index 91% rename from patches/server/0408-misc-debugging-dumps.patch rename to patches/server/0407-misc-debugging-dumps.patch index 9cc0be25ef..a2d2ed3bde 100644 --- a/patches/server/0408-misc-debugging-dumps.patch +++ b/patches/server/0407-misc-debugging-dumps.patch @@ -29,7 +29,7 @@ index 0000000000000000000000000000000000000000..2d5494d2813b773e60ddba6790b750a9 + } +} diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index 08ada4f1818f3dc8aeee417df11948a48b66bcfd..096cbbeb42ea195f51e0d430aab2e989ea1aa065 100644 +index 60648e7c3c86176631d9a3ffdf21f6d236eabd79..7e59359423c1a1970c25246f50ace91f04c70aeb 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java @@ -868,6 +868,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop 0) { + // Paper start - Maximum exp value when merging - Whole section has been tweaked, see comments for specifics -+ final int maxValue = world.paperConfig.expMergeMaxValue; -+ final boolean mergeUnconditionally = world.paperConfig.expMergeMaxValue <= 0; ++ final int maxValue = world.paperConfig().entities.behavior.experienceMergeMaxValue; ++ final boolean mergeUnconditionally = world.paperConfig().entities.behavior.experienceMergeMaxValue <= 0; + if (mergeUnconditionally || xp.value < maxValue) { // Paper - Skip iteration if unnecessary + List entities = world.getEntities(entity, entity.getBoundingBox().inflate(radius, radius, radius)); diff --git a/patches/server/0414-ExperienceOrbMergeEvent.patch b/patches/server/0413-ExperienceOrbMergeEvent.patch similarity index 94% rename from patches/server/0414-ExperienceOrbMergeEvent.patch rename to patches/server/0413-ExperienceOrbMergeEvent.patch index b5b175e632..c094c51b50 100644 --- a/patches/server/0414-ExperienceOrbMergeEvent.patch +++ b/patches/server/0413-ExperienceOrbMergeEvent.patch @@ -9,7 +9,7 @@ Plugins can cancel this if they want to ensure experience orbs do not lose impor metadata such as spawn reason, or conditionally move data from source to target. diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java -index fb490fa7d59b1099e34a5adc7993d6dad2f10932..113e4db1d66b7af5b2ba976d094b4bf548b5800e 100644 +index 80c77b047472b5a6aea1ff22c6a4d550877bff73..02d89f77d643bcfa52981cb9a8e93688e089dd83 100644 --- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java +++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java @@ -650,7 +650,7 @@ public class CraftEventFactory { diff --git a/patches/server/0415-Fix-PotionEffect-ignores-icon-flag.patch b/patches/server/0414-Fix-PotionEffect-ignores-icon-flag.patch similarity index 100% rename from patches/server/0415-Fix-PotionEffect-ignores-icon-flag.patch rename to patches/server/0414-Fix-PotionEffect-ignores-icon-flag.patch diff --git a/patches/server/0416-Optimize-brigadier-child-sorting-performance.patch b/patches/server/0415-Optimize-brigadier-child-sorting-performance.patch similarity index 100% rename from patches/server/0416-Optimize-brigadier-child-sorting-performance.patch rename to patches/server/0415-Optimize-brigadier-child-sorting-performance.patch diff --git a/patches/server/0417-Potential-bed-API.patch b/patches/server/0416-Potential-bed-API.patch similarity index 100% rename from patches/server/0417-Potential-bed-API.patch rename to patches/server/0416-Potential-bed-API.patch diff --git a/patches/server/0418-Wait-for-Async-Tasks-during-shutdown.patch b/patches/server/0417-Wait-for-Async-Tasks-during-shutdown.patch similarity index 91% rename from patches/server/0418-Wait-for-Async-Tasks-during-shutdown.patch rename to patches/server/0417-Wait-for-Async-Tasks-during-shutdown.patch index fa0397c9b0..b498ffd614 100644 --- a/patches/server/0418-Wait-for-Async-Tasks-during-shutdown.patch +++ b/patches/server/0417-Wait-for-Async-Tasks-during-shutdown.patch @@ -10,7 +10,7 @@ Adds a 5 second grace period for any async tasks to finish and warns if any are still running after that delay just as reload does. diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index 096cbbeb42ea195f51e0d430aab2e989ea1aa065..9905dba12c6b3f584a6fab94517592b6d2c042f0 100644 +index 7e59359423c1a1970c25246f50ace91f04c70aeb..17f1fe888c08b53abc667ab9bffb4ae05f370ea8 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java @@ -907,6 +907,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop pooledLinkedPlayerHashSets = new com.destroystokyo.paper.util.misc.PooledLinkedHashSets<>(); @@ -69,7 +69,7 @@ index 926e4a8ea6e5afc6ad683761a5d8c4006cdec5ee..464a00542756437d8c3dccc1a85ae51c // Paper start - per player mob spawning if (this.playerMobDistanceMap != null) { this.playerMobDistanceMap.add(player, chunkX, chunkZ, this.distanceManager.getSimulationDistance()); -@@ -199,6 +211,10 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider +@@ -198,6 +210,10 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider void removePlayerFromDistanceMaps(ServerPlayer player) { @@ -80,7 +80,7 @@ index 926e4a8ea6e5afc6ad683761a5d8c4006cdec5ee..464a00542756437d8c3dccc1a85ae51c // Paper start - per player mob spawning if (this.playerMobDistanceMap != null) { this.playerMobDistanceMap.remove(player); -@@ -210,6 +226,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider +@@ -209,6 +225,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider int chunkX = MCUtil.getChunkCoordinate(player.getX()); int chunkZ = MCUtil.getChunkCoordinate(player.getZ()); // Note: players need to be explicitly added to distance maps before they can be updated @@ -88,10 +88,10 @@ index 926e4a8ea6e5afc6ad683761a5d8c4006cdec5ee..464a00542756437d8c3dccc1a85ae51c // Paper start - per player mob spawning if (this.playerMobDistanceMap != null) { this.playerMobDistanceMap.update(player, chunkX, chunkZ, this.distanceManager.getSimulationDistance()); -@@ -298,6 +315,38 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider +@@ -297,6 +314,38 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider this.regionManagers.add(this.dataRegionManager); // Paper end - this.playerMobDistanceMap = this.level.paperConfig.perPlayerMobSpawns ? new com.destroystokyo.paper.util.misc.PlayerAreaMap(this.pooledLinkedPlayerHashSets) : null; // Paper + this.playerMobDistanceMap = this.level.paperConfig().entities.spawning.perPlayerMobSpawns ? new com.destroystokyo.paper.util.misc.PlayerAreaMap(this.pooledLinkedPlayerHashSets) : null; // Paper + // Paper start - optimise ChunkMap#anyPlayerCloseEnoughForSpawning + this.playerChunkTickRangeMap = new com.destroystokyo.paper.util.misc.PlayerAreaMap(this.pooledLinkedPlayerHashSets, + (ServerPlayer player, int rangeX, int rangeZ, int currPosX, int currPosZ, int prevPosX, int prevPosZ, @@ -127,7 +127,7 @@ index 926e4a8ea6e5afc6ad683761a5d8c4006cdec5ee..464a00542756437d8c3dccc1a85ae51c } protected ChunkGenerator generator() { -@@ -553,6 +602,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider +@@ -552,6 +601,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider holder = (ChunkHolder) this.pendingUnloads.remove(pos); if (holder != null) { holder.setTicketLevel(level); @@ -135,7 +135,7 @@ index 926e4a8ea6e5afc6ad683761a5d8c4006cdec5ee..464a00542756437d8c3dccc1a85ae51c } else { holder = new ChunkHolder(new ChunkPos(pos), level, this.level, this.lightEngine, this.queueSorter, this); // Paper start -@@ -648,6 +698,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider +@@ -647,6 +697,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider ChunkHolder playerchunk = (ChunkHolder) this.updatingChunkMap.remove(j); if (playerchunk != null) { @@ -143,7 +143,7 @@ index 926e4a8ea6e5afc6ad683761a5d8c4006cdec5ee..464a00542756437d8c3dccc1a85ae51c this.pendingUnloads.put(j, playerchunk); this.modified = true; ++i; -@@ -1413,43 +1464,48 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider +@@ -1412,43 +1463,48 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider return this.anyPlayerCloseEnoughForSpawning(pos, false); } @@ -286,7 +286,7 @@ index 4a9d0fca55b71f817defcb4286154c0a47bede03..62118348d6fb00f063507debb488e1ff public String getDebugStatus() { diff --git a/src/main/java/net/minecraft/server/level/ServerChunkCache.java b/src/main/java/net/minecraft/server/level/ServerChunkCache.java -index 55b8f9dc3ad2b282e83c912ad8bf46b31cbd3765..d247f8997e5afc4c6449495da0b302a4814df495 100644 +index 42b4214a1319691e9a6cb0c5fafaeeff821f3f99..1d9a0f6effa1654609f4d0752ec69eed6ab7134b 100644 --- a/src/main/java/net/minecraft/server/level/ServerChunkCache.java +++ b/src/main/java/net/minecraft/server/level/ServerChunkCache.java @@ -873,6 +873,37 @@ public class ServerChunkCache extends ChunkSource { @@ -357,7 +357,7 @@ index 55b8f9dc3ad2b282e83c912ad8bf46b31cbd3765..d247f8997e5afc4c6449495da0b302a4 } diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java -index 1e32ac21998cf7b7987815850fd022a5f282c5e0..c62db939791f6c80f612b14db0f8b98f334a96b6 100644 +index c1d9c365edc8b6d2c5b94926faaa00180ca3885b..9075ff5455422feacb6edb6f4fe424a2becf94ed 100644 --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java @@ -260,6 +260,7 @@ public class ServerPlayer extends Player { diff --git a/patches/server/0426-Use-distance-map-to-optimise-entity-tracker.patch b/patches/server/0425-Use-distance-map-to-optimise-entity-tracker.patch similarity index 94% rename from patches/server/0426-Use-distance-map-to-optimise-entity-tracker.patch rename to patches/server/0425-Use-distance-map-to-optimise-entity-tracker.patch index a8f0364b9c..35ae41bd65 100644 --- a/patches/server/0426-Use-distance-map-to-optimise-entity-tracker.patch +++ b/patches/server/0425-Use-distance-map-to-optimise-entity-tracker.patch @@ -6,10 +6,10 @@ Subject: [PATCH] Use distance map to optimise entity tracker Use the distance map to find candidate players for tracking. diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java -index 464a00542756437d8c3dccc1a85ae51cfdb588d2..95dbf60604d86666a359c0d861ef3eb8313e6184 100644 +index 11c0e832c6f81b8f82795913393d2018afaa37e1..5e387419d0163333f2370b5708fbd3641449adeb 100644 --- a/src/main/java/net/minecraft/server/level/ChunkMap.java +++ b/src/main/java/net/minecraft/server/level/ChunkMap.java -@@ -70,6 +70,7 @@ import net.minecraft.network.protocol.game.ClientboundSetEntityLinkPacket; +@@ -69,6 +69,7 @@ import net.minecraft.network.protocol.game.ClientboundSetEntityLinkPacket; import net.minecraft.network.protocol.game.ClientboundSetPassengersPacket; import net.minecraft.network.protocol.game.DebugPackets; import net.minecraft.server.MCUtil; @@ -17,7 +17,7 @@ index 464a00542756437d8c3dccc1a85ae51cfdb588d2..95dbf60604d86666a359c0d861ef3eb8 import net.minecraft.server.level.progress.ChunkProgressListener; import net.minecraft.server.network.ServerPlayerConnection; import net.minecraft.util.CsvOutput; -@@ -196,10 +197,35 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider +@@ -195,10 +196,35 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider public final com.destroystokyo.paper.util.misc.PlayerAreaMap playerMobSpawnMap; // this map is absent from updateMaps since it's controlled at the start of the chunkproviderserver tick public final com.destroystokyo.paper.util.misc.PlayerAreaMap playerChunkTickRangeMap; // Paper end - optimise ChunkMap#anyPlayerCloseEnoughForSpawning @@ -53,7 +53,7 @@ index 464a00542756437d8c3dccc1a85ae51cfdb588d2..95dbf60604d86666a359c0d861ef3eb8 // Note: players need to be explicitly added to distance maps before they can be updated this.playerChunkTickRangeMap.add(player, chunkX, chunkZ, DistanceManager.MOB_SPAWN_RANGE); // Paper - optimise ChunkMap#anyPlayerCloseEnoughForSpawning // Paper start - per player mob spawning -@@ -211,6 +237,11 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider +@@ -210,6 +236,11 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider void removePlayerFromDistanceMaps(ServerPlayer player) { @@ -65,7 +65,7 @@ index 464a00542756437d8c3dccc1a85ae51cfdb588d2..95dbf60604d86666a359c0d861ef3eb8 // Paper start - optimise ChunkMap#anyPlayerCloseEnoughForSpawning this.playerMobSpawnMap.remove(player); this.playerChunkTickRangeMap.remove(player); -@@ -226,6 +257,14 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider +@@ -225,6 +256,14 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider int chunkX = MCUtil.getChunkCoordinate(player.getX()); int chunkZ = MCUtil.getChunkCoordinate(player.getZ()); // Note: players need to be explicitly added to distance maps before they can be updated @@ -80,10 +80,10 @@ index 464a00542756437d8c3dccc1a85ae51cfdb588d2..95dbf60604d86666a359c0d861ef3eb8 this.playerChunkTickRangeMap.update(player, chunkX, chunkZ, DistanceManager.MOB_SPAWN_RANGE); // Paper - optimise ChunkMap#anyPlayerCloseEnoughForSpawning // Paper start - per player mob spawning if (this.playerMobDistanceMap != null) { -@@ -315,6 +354,45 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider +@@ -314,6 +353,45 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider this.regionManagers.add(this.dataRegionManager); // Paper end - this.playerMobDistanceMap = this.level.paperConfig.perPlayerMobSpawns ? new com.destroystokyo.paper.util.misc.PlayerAreaMap(this.pooledLinkedPlayerHashSets) : null; // Paper + this.playerMobDistanceMap = this.level.paperConfig().entities.spawning.perPlayerMobSpawns ? new com.destroystokyo.paper.util.misc.PlayerAreaMap(this.pooledLinkedPlayerHashSets) : null; // Paper + // Paper start - use distance map to optimise entity tracker + this.playerEntityTrackerTrackMaps = new com.destroystokyo.paper.util.misc.PlayerAreaMap[TRACKING_RANGE_TYPES.length]; + this.entityTrackerTrackRanges = new int[TRACKING_RANGE_TYPES.length]; @@ -126,7 +126,7 @@ index 464a00542756437d8c3dccc1a85ae51cfdb588d2..95dbf60604d86666a359c0d861ef3eb8 // Paper start - optimise ChunkMap#anyPlayerCloseEnoughForSpawning this.playerChunkTickRangeMap = new com.destroystokyo.paper.util.misc.PlayerAreaMap(this.pooledLinkedPlayerHashSets, (ServerPlayer player, int rangeX, int rangeZ, int currPosX, int currPosZ, int prevPosX, int prevPosZ, -@@ -1587,17 +1665,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider +@@ -1586,17 +1664,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider } public void move(ServerPlayer player) { @@ -145,7 +145,7 @@ index 464a00542756437d8c3dccc1a85ae51cfdb588d2..95dbf60604d86666a359c0d861ef3eb8 int i = SectionPos.blockToSectionCoord(player.getBlockX()); int j = SectionPos.blockToSectionCoord(player.getBlockZ()); -@@ -1724,7 +1792,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider +@@ -1723,7 +1791,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider entity.tracker = playerchunkmap_entitytracker; // Paper - Fast access to tracker this.entityMap.put(entity.getId(), playerchunkmap_entitytracker); @@ -154,7 +154,7 @@ index 464a00542756437d8c3dccc1a85ae51cfdb588d2..95dbf60604d86666a359c0d861ef3eb8 if (entity instanceof ServerPlayer) { ServerPlayer entityplayer = (ServerPlayer) entity; -@@ -1768,7 +1836,37 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider +@@ -1767,7 +1835,37 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider entity.tracker = null; // Paper - We're no longer tracked } @@ -192,7 +192,7 @@ index 464a00542756437d8c3dccc1a85ae51cfdb588d2..95dbf60604d86666a359c0d861ef3eb8 List list = Lists.newArrayList(); List list1 = this.level.players(); ObjectIterator objectiterator = this.entityMap.values().iterator(); -@@ -1844,23 +1942,31 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider +@@ -1843,23 +1941,31 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider DebugPackets.sendPoiPacketsForChunk(this.level, chunk.getPos()); List list = Lists.newArrayList(); List list1 = Lists.newArrayList(); @@ -236,7 +236,7 @@ index 464a00542756437d8c3dccc1a85ae51cfdb588d2..95dbf60604d86666a359c0d861ef3eb8 Iterator iterator; Entity entity1; -@@ -1936,6 +2042,42 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider +@@ -1935,6 +2041,42 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider this.lastSectionPos = SectionPos.of((EntityAccess) entity); } @@ -280,7 +280,7 @@ index 464a00542756437d8c3dccc1a85ae51cfdb588d2..95dbf60604d86666a359c0d861ef3eb8 return object instanceof ChunkMap.TrackedEntity ? ((ChunkMap.TrackedEntity) object).entity.getId() == this.entity.getId() : false; } diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java -index 9cb122ff9347eb8da347de98f362cca2709f60ce..5a1dff0c0806ac7ca3d7db531f2a84be8ddc7ca4 100644 +index 782bced79dacc90e1d1914a2025e77b4fff06221..f0415a2eeec073943d00c39b12b5edcf751c28ee 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java @@ -56,6 +56,7 @@ import net.minecraft.network.syncher.EntityDataSerializers; diff --git a/patches/server/0427-Optimize-ServerLevels-chunk-level-checking-methods.patch b/patches/server/0426-Optimize-ServerLevels-chunk-level-checking-methods.patch similarity index 95% rename from patches/server/0427-Optimize-ServerLevels-chunk-level-checking-methods.patch rename to patches/server/0426-Optimize-ServerLevels-chunk-level-checking-methods.patch index cbfb61cb15..106b5f1f0c 100644 --- a/patches/server/0427-Optimize-ServerLevels-chunk-level-checking-methods.patch +++ b/patches/server/0426-Optimize-ServerLevels-chunk-level-checking-methods.patch @@ -8,7 +8,7 @@ so inline where possible, and avoid the abstraction of the Either class. diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java -index 8808b8b5b3fa03a1a0c4d843867f1e26d966ab85..e5f7ed6e70231c447f3983ae181e23acc6f69de6 100644 +index 59d0e9f9cf90bde3d56d69c87e2fe4b9e1903ff7..d8694d9c766bc8f85d828da4dabf53215f01e54e 100644 --- a/src/main/java/net/minecraft/server/level/ServerLevel.java +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java @@ -2247,19 +2247,22 @@ public class ServerLevel extends Level implements WorldGenLevel { @@ -52,7 +52,7 @@ index 2d41f619577b41d6420159668bbab70fb6c762eb..ed0b136e99def41d4377f2004477826b public static int getX(long pos) { diff --git a/src/main/java/net/minecraft/world/level/entity/PersistentEntitySectionManager.java b/src/main/java/net/minecraft/world/level/entity/PersistentEntitySectionManager.java -index e55ec74ac0363def04c2d7bf1b2a9d873388ea70..823489437dad68f52213f25d84d84ac64f7cc208 100644 +index 6e3d02fb68741fc3cf7d74ec659a37e5a1ecac5c..e53e912351a0753c429512f018281a656837bde2 100644 --- a/src/main/java/net/minecraft/world/level/entity/PersistentEntitySectionManager.java +++ b/src/main/java/net/minecraft/world/level/entity/PersistentEntitySectionManager.java @@ -383,6 +383,11 @@ public class PersistentEntitySectionManager implements A diff --git a/patches/server/0428-Delay-Chunk-Unloads-based-on-Player-Movement.patch b/patches/server/0427-Delay-Chunk-Unloads-based-on-Player-Movement.patch similarity index 81% rename from patches/server/0428-Delay-Chunk-Unloads-based-on-Player-Movement.patch rename to patches/server/0427-Delay-Chunk-Unloads-based-on-Player-Movement.patch index a7f930d5fe..21c409adc6 100644 --- a/patches/server/0428-Delay-Chunk-Unloads-based-on-Player-Movement.patch +++ b/patches/server/0427-Delay-Chunk-Unloads-based-on-Player-Movement.patch @@ -16,26 +16,8 @@ before it actually unloads, which will be handled by the ticket expiry process. This allows servers with smaller worlds who do less long distance exploring to stop wasting cpu cycles on saving/unloading/reloading chunks repeatedly. -diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -index ffe0ee1bd44d47abbe6b94aadab9ee7eca7c7612..7839ee18955725463fa420a19927019f9814ee24 100644 ---- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -@@ -702,4 +702,13 @@ public class PaperWorldConfig { - expMergeMaxValue = getInt("experience-merge-max-value", -1); - log("Experience Merge Max Value: " + expMergeMaxValue); - } -+ -+ public long delayChunkUnloadsBy; -+ private void delayChunkUnloadsBy() { -+ delayChunkUnloadsBy = PaperConfig.getSeconds(getString("delay-chunk-unloads-by", "10s")); -+ if (delayChunkUnloadsBy > 0) { -+ log("Delaying chunk unloads by " + delayChunkUnloadsBy + " seconds"); -+ delayChunkUnloadsBy *= 20; -+ } -+ } - } diff --git a/src/main/java/net/minecraft/server/level/DistanceManager.java b/src/main/java/net/minecraft/server/level/DistanceManager.java -index 62118348d6fb00f063507debb488e1ff431d139c..211566dada0f820af331695b4c62035b89f25a53 100644 +index 62118348d6fb00f063507debb488e1ff431d139c..9bc956068df3baabb9f8e02ee74a6397de2bf587 100644 --- a/src/main/java/net/minecraft/server/level/DistanceManager.java +++ b/src/main/java/net/minecraft/server/level/DistanceManager.java @@ -212,6 +212,27 @@ public abstract class DistanceManager { @@ -43,7 +25,7 @@ index 62118348d6fb00f063507debb488e1ff431d139c..211566dada0f820af331695b4c62035b if (arraysetsorted.remove(ticket)) { removed = true; // CraftBukkit + // Paper start - delay chunk unloads for player tickets -+ long delayChunkUnloadsBy = chunkMap.level.paperConfig.delayChunkUnloadsBy; ++ long delayChunkUnloadsBy = chunkMap.level.paperConfig().chunks.delayChunkUnloadsBy.ticks(); + if (ticket.getType() == TicketType.PLAYER && delayChunkUnloadsBy > 0) { + boolean hasPlayer = false; + for (Ticket ticket1 : arraysetsorted) { diff --git a/patches/server/0429-Fix-villager-trading-demand-MC-163962.patch b/patches/server/0428-Fix-villager-trading-demand-MC-163962.patch similarity index 100% rename from patches/server/0429-Fix-villager-trading-demand-MC-163962.patch rename to patches/server/0428-Fix-villager-trading-demand-MC-163962.patch diff --git a/patches/server/0430-Maps-shouldn-t-load-chunks.patch b/patches/server/0429-Maps-shouldn-t-load-chunks.patch similarity index 100% rename from patches/server/0430-Maps-shouldn-t-load-chunks.patch rename to patches/server/0429-Maps-shouldn-t-load-chunks.patch diff --git a/patches/server/0431-Use-seed-based-lookup-for-Treasure-Maps-Fixes-lag-fr.patch b/patches/server/0430-Use-seed-based-lookup-for-Treasure-Maps-Fixes-lag-fr.patch similarity index 100% rename from patches/server/0431-Use-seed-based-lookup-for-Treasure-Maps-Fixes-lag-fr.patch rename to patches/server/0430-Use-seed-based-lookup-for-Treasure-Maps-Fixes-lag-fr.patch diff --git a/patches/server/0432-Fix-CraftScheduler-runTaskTimerAsynchronously-Plugin.patch b/patches/server/0431-Fix-CraftScheduler-runTaskTimerAsynchronously-Plugin.patch similarity index 100% rename from patches/server/0432-Fix-CraftScheduler-runTaskTimerAsynchronously-Plugin.patch rename to patches/server/0431-Fix-CraftScheduler-runTaskTimerAsynchronously-Plugin.patch diff --git a/patches/server/0433-Fix-piston-physics-inconsistency-MC-188840.patch b/patches/server/0432-Fix-piston-physics-inconsistency-MC-188840.patch similarity index 73% rename from patches/server/0433-Fix-piston-physics-inconsistency-MC-188840.patch rename to patches/server/0432-Fix-piston-physics-inconsistency-MC-188840.patch index b67d05ab08..dcc303244a 100644 --- a/patches/server/0433-Fix-piston-physics-inconsistency-MC-188840.patch +++ b/patches/server/0432-Fix-piston-physics-inconsistency-MC-188840.patch @@ -31,25 +31,8 @@ This patch fixes https://bugs.mojang.com/browse/MC-188840 This patch also fixes rail duping and carpet duping. -diff --git a/src/main/java/com/destroystokyo/paper/PaperConfig.java b/src/main/java/com/destroystokyo/paper/PaperConfig.java -index 62a0f6772bacfb8ad90c15493e0d48e29b70fac1..c639557108ad9c59ccdd0b543b5507fbab1e0fa4 100644 ---- a/src/main/java/com/destroystokyo/paper/PaperConfig.java -+++ b/src/main/java/com/destroystokyo/paper/PaperConfig.java -@@ -451,4 +451,12 @@ public class PaperConfig { - private static void consoleHasAllPermissions() { - consoleHasAllPermissions = getBoolean("settings.console-has-all-permissions", consoleHasAllPermissions); - } -+ -+ public static boolean allowPistonDuplication; -+ private static void allowPistonDuplication() { -+ config.set("settings.unsupported-settings.allow-piston-duplication-readme", "This setting controls if player should be able to use TNT duplication, but this also allows duplicating carpet, rails and potentially other items"); -+ allowPistonDuplication = getBoolean("settings.unsupported-settings.allow-piston-duplication", config.getBoolean("settings.unsupported-settings.allow-tnt-duplication", false)); -+ set("settings.unsupported-settings.allow-tnt-duplication", null); -+ } -+ - } diff --git a/src/main/java/net/minecraft/world/level/block/piston/PistonBaseBlock.java b/src/main/java/net/minecraft/world/level/block/piston/PistonBaseBlock.java -index 272279244f558c8ea298b35605c0421c037aad48..053bb85355c1b0fd93477187f4cedc582c6a480b 100644 +index 29755807fdb6c30e31c0ec2bbf33bed9afd5d478..8d73893100884c08aa552ff41c2a07a3e714df47 100644 --- a/src/main/java/net/minecraft/world/level/block/piston/PistonBaseBlock.java +++ b/src/main/java/net/minecraft/world/level/block/piston/PistonBaseBlock.java @@ -411,14 +411,26 @@ public class PistonBaseBlock extends DirectionalBlock { @@ -59,7 +42,7 @@ index 272279244f558c8ea298b35605c0421c037aad48..053bb85355c1b0fd93477187f4cedc58 - blockposition3 = (BlockPos) list.get(k); - iblockdata1 = world.getBlockState(blockposition3); + // Paper start - fix a variety of piston desync dupes -+ boolean allowDesync = com.destroystokyo.paper.PaperConfig.allowPistonDuplication; ++ boolean allowDesync = io.papermc.paper.configuration.GlobalConfiguration.get().unsupportedSettings.allowPistonDuplication; + BlockPos oldPos = blockposition3 = (BlockPos) list.get(k); + iblockdata1 = allowDesync ? world.getBlockState(oldPos) : null; + // Paper end - fix a variety of piston desync dupes @@ -83,7 +66,7 @@ index 272279244f558c8ea298b35605c0421c037aad48..053bb85355c1b0fd93477187f4cedc58 } diff --git a/src/main/java/net/minecraft/world/level/block/piston/PistonMovingBlockEntity.java b/src/main/java/net/minecraft/world/level/block/piston/PistonMovingBlockEntity.java -index dda0b32a4989bbead35a2219a969a30ba0e975b0..94bd47212b05f66ebc81966eec3bc0abda76252c 100644 +index dda0b32a4989bbead35a2219a969a30ba0e975b0..7c59d44a3bafdc65f453d77ff3e25cffb742ad6c 100644 --- a/src/main/java/net/minecraft/world/level/block/piston/PistonMovingBlockEntity.java +++ b/src/main/java/net/minecraft/world/level/block/piston/PistonMovingBlockEntity.java @@ -285,7 +285,7 @@ public class PistonMovingBlockEntity extends BlockEntity { @@ -91,7 +74,7 @@ index dda0b32a4989bbead35a2219a969a30ba0e975b0..94bd47212b05f66ebc81966eec3bc0ab BlockState blockState = Block.updateFromNeighbourShapes(blockEntity.movedState, world, pos); if (blockState.isAir()) { - world.setBlock(pos, blockEntity.movedState, 84); -+ world.setBlock(pos, blockEntity.movedState, com.destroystokyo.paper.PaperConfig.allowPistonDuplication ? 84 : (84 | 2)); // Paper - force notify (flag 2), it's possible the set type by the piston block (which doesn't notify) set this block to air ++ world.setBlock(pos, blockEntity.movedState, io.papermc.paper.configuration.GlobalConfiguration.get().unsupportedSettings.allowPistonDuplication ? 84 : (84 | 2)); // Paper - force notify (flag 2), it's possible the set type by the piston block (which doesn't notify) set this block to air Block.updateOrDestroy(blockEntity.movedState, blockState, world, pos, 3); } else { if (blockState.hasProperty(BlockStateProperties.WATERLOGGED) && blockState.getValue(BlockStateProperties.WATERLOGGED)) { diff --git a/patches/server/0434-Fix-sand-duping.patch b/patches/server/0433-Fix-sand-duping.patch similarity index 85% rename from patches/server/0434-Fix-sand-duping.patch rename to patches/server/0433-Fix-sand-duping.patch index b1e79fd86e..5780d77de8 100644 --- a/patches/server/0434-Fix-sand-duping.patch +++ b/patches/server/0433-Fix-sand-duping.patch @@ -7,7 +7,7 @@ If the falling block dies during teleportation (entity#move), then we need to detect that by placing a check after the move. diff --git a/src/main/java/net/minecraft/world/entity/item/FallingBlockEntity.java b/src/main/java/net/minecraft/world/entity/item/FallingBlockEntity.java -index 08defb76e73a5f9121bf405c86a3c4c750ab1933..46102c28d10b11ecbafd3dda2de66982eaed8a00 100644 +index 18d81e8e8f387a7fb531652cb78c61a9bd5ae600..f6405e862b15b71dbb96215e604610fe5ff59bfc 100644 --- a/src/main/java/net/minecraft/world/entity/item/FallingBlockEntity.java +++ b/src/main/java/net/minecraft/world/entity/item/FallingBlockEntity.java @@ -126,6 +126,11 @@ public class FallingBlockEntity extends Entity { @@ -33,5 +33,5 @@ index 08defb76e73a5f9121bf405c86a3c4c750ab1933..46102c28d10b11ecbafd3dda2de66982 + // Paper end - fix sand duping + // Paper start - Configurable EntityFallingBlock height nerf - if (this.level.paperConfig.fallingBlockHeightNerf != 0 && this.getY() > this.level.paperConfig.fallingBlockHeightNerf) { + if (this.level.paperConfig().fixes.fallingBlockHeightNerf != 0 && this.getY() > this.level.paperConfig().fixes.fallingBlockHeightNerf) { if (this.dropItem && this.level.getGameRules().getBoolean(GameRules.RULE_DOENTITYDROPS)) { diff --git a/patches/server/0435-Fix-missing-chunks-due-to-integer-overflow.patch b/patches/server/0434-Fix-missing-chunks-due-to-integer-overflow.patch similarity index 100% rename from patches/server/0435-Fix-missing-chunks-due-to-integer-overflow.patch rename to patches/server/0434-Fix-missing-chunks-due-to-integer-overflow.patch diff --git a/patches/server/0436-Prevent-position-desync-in-playerconnection-causing-.patch b/patches/server/0435-Prevent-position-desync-in-playerconnection-causing-.patch similarity index 94% rename from patches/server/0436-Prevent-position-desync-in-playerconnection-causing-.patch rename to patches/server/0435-Prevent-position-desync-in-playerconnection-causing-.patch index c336093677..43b5b31657 100644 --- a/patches/server/0436-Prevent-position-desync-in-playerconnection-causing-.patch +++ b/patches/server/0435-Prevent-position-desync-in-playerconnection-causing-.patch @@ -14,7 +14,7 @@ behaviour, we need to move all of this dangerous logic outside of the move call and into an appropriate place in the tick method. diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index d5b7a909a26135abce682c062cedd9b2de0239d0..0693356f47cfbc4c3ff2573bf2ce4f28d41f5fd7 100644 +index 47666c0cf18a6d3bdde2c7ecc74b17bf225a3826..7a9eba48e261b36c1ea0def38bda02fbb46dcdf7 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java @@ -1372,6 +1372,11 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser diff --git a/patches/server/0437-Inventory-getHolder-method-without-block-snapshot.patch b/patches/server/0436-Inventory-getHolder-method-without-block-snapshot.patch similarity index 100% rename from patches/server/0437-Inventory-getHolder-method-without-block-snapshot.patch rename to patches/server/0436-Inventory-getHolder-method-without-block-snapshot.patch diff --git a/patches/server/0438-Improve-Arrow-API.patch b/patches/server/0437-Improve-Arrow-API.patch similarity index 100% rename from patches/server/0438-Improve-Arrow-API.patch rename to patches/server/0437-Improve-Arrow-API.patch diff --git a/patches/server/0439-Add-and-implement-PlayerRecipeBookClickEvent.patch b/patches/server/0438-Add-and-implement-PlayerRecipeBookClickEvent.patch similarity index 95% rename from patches/server/0439-Add-and-implement-PlayerRecipeBookClickEvent.patch rename to patches/server/0438-Add-and-implement-PlayerRecipeBookClickEvent.patch index 5a0b2ceec4..c43ec9185e 100644 --- a/patches/server/0439-Add-and-implement-PlayerRecipeBookClickEvent.patch +++ b/patches/server/0438-Add-and-implement-PlayerRecipeBookClickEvent.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Add and implement PlayerRecipeBookClickEvent diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index 0693356f47cfbc4c3ff2573bf2ce4f28d41f5fd7..90ce47c8ac50da05b3082402d56b295fc3293532 100644 +index 7a9eba48e261b36c1ea0def38bda02fbb46dcdf7..cebd8d590fa8ba823a3df9a5780a4398bab8ed38 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java @@ -2996,9 +2996,14 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser diff --git a/patches/server/0440-Hide-sync-chunk-writes-behind-flag.patch b/patches/server/0439-Hide-sync-chunk-writes-behind-flag.patch similarity index 100% rename from patches/server/0440-Hide-sync-chunk-writes-behind-flag.patch rename to patches/server/0439-Hide-sync-chunk-writes-behind-flag.patch diff --git a/patches/server/0441-Add-permission-for-command-blocks.patch b/patches/server/0440-Add-permission-for-command-blocks.patch similarity index 98% rename from patches/server/0441-Add-permission-for-command-blocks.patch rename to patches/server/0440-Add-permission-for-command-blocks.patch index c31d0ab3bd..46a2bc099a 100644 --- a/patches/server/0441-Add-permission-for-command-blocks.patch +++ b/patches/server/0440-Add-permission-for-command-blocks.patch @@ -18,7 +18,7 @@ index 312768054e02847bbc7d2ec7fa6198dad52b86d2..32a6b4d8e6c8f9c05cc7ca811c2188aa return false; } else if (this.player.blockActionRestricted(this.level, pos, this.gameModeForPlayer)) { diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index 90ce47c8ac50da05b3082402d56b295fc3293532..44b44548c33f5128fbf09ac36c6bab428b8a8c97 100644 +index cebd8d590fa8ba823a3df9a5780a4398bab8ed38..6486be14c84660652b2ac8fd0b19b2e6e9220b28 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java @@ -828,7 +828,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser diff --git a/patches/server/0442-Ensure-Entity-AABB-s-are-never-invalid.patch b/patches/server/0441-Ensure-Entity-AABB-s-are-never-invalid.patch similarity index 89% rename from patches/server/0442-Ensure-Entity-AABB-s-are-never-invalid.patch rename to patches/server/0441-Ensure-Entity-AABB-s-are-never-invalid.patch index 58f45bb280..aab2a111d3 100644 --- a/patches/server/0442-Ensure-Entity-AABB-s-are-never-invalid.patch +++ b/patches/server/0441-Ensure-Entity-AABB-s-are-never-invalid.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Ensure Entity AABB's are never invalid diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java -index 5a1dff0c0806ac7ca3d7db531f2a84be8ddc7ca4..a34797b5afd6460a5f98e9485c53d6963c6ee462 100644 +index f0415a2eeec073943d00c39b12b5edcf751c28ee..39c34df3b23eed1ca97234e8df64e9ac0a53ff46 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java @@ -656,8 +656,8 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource { @@ -19,7 +19,7 @@ index 5a1dff0c0806ac7ca3d7db531f2a84be8ddc7ca4..a34797b5afd6460a5f98e9485c53d696 } protected AABB makeBoundingBox() { -@@ -3869,6 +3869,11 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource { +@@ -3868,6 +3868,11 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource { } public final void setPosRaw(double x, double y, double z) { @@ -31,7 +31,7 @@ index 5a1dff0c0806ac7ca3d7db531f2a84be8ddc7ca4..a34797b5afd6460a5f98e9485c53d696 if (this.position.x != x || this.position.y != y || this.position.z != z) { this.position = new Vec3(x, y, z); int i = Mth.floor(x); -@@ -3886,6 +3891,12 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource { +@@ -3885,6 +3890,12 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource { this.levelCallback.onMove(); } diff --git a/patches/server/0443-Fix-Per-World-Difficulty-Remembering-Difficulty.patch b/patches/server/0442-Fix-Per-World-Difficulty-Remembering-Difficulty.patch similarity index 91% rename from patches/server/0443-Fix-Per-World-Difficulty-Remembering-Difficulty.patch rename to patches/server/0442-Fix-Per-World-Difficulty-Remembering-Difficulty.patch index feaae18304..60b7eeefba 100644 --- a/patches/server/0443-Fix-Per-World-Difficulty-Remembering-Difficulty.patch +++ b/patches/server/0442-Fix-Per-World-Difficulty-Remembering-Difficulty.patch @@ -8,11 +8,11 @@ makes it so that the server keeps the last difficulty used instead of restoring the server.properties every single load. diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index 9905dba12c6b3f584a6fab94517592b6d2c042f0..06e7ca13f24838bdb2305e1c12b1aeac9152612f 100644 +index 17f1fe888c08b53abc667ab9bffb4ae05f370ea8..5ff10579b1ae3a7070c0548d3e5e2fae886ca6f7 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java @@ -788,7 +788,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop 100) ? 10 : 20; -+ } -+ } - } -diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -index ac7f270f8726bf770f90d9242132ef1d90f3c390..72f622f79d8cc16c4abce1730811770cb793d9b2 100644 ---- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -@@ -74,6 +74,21 @@ public class PaperWorldConfig { - log( "Keep Spawn Loaded Range: " + (keepLoadedRange/16)); - } - -+ public int autoSavePeriod = -1; -+ private void autoSavePeriod() { -+ autoSavePeriod = getInt("auto-save-interval", -1); -+ if (autoSavePeriod > 0) { -+ log("Auto Save Interval: " +autoSavePeriod + " (" + (autoSavePeriod / 20) + "s)"); -+ } else if (autoSavePeriod < 0) { -+ autoSavePeriod = net.minecraft.server.MinecraftServer.getServer().autosavePeriod; -+ } -+ } -+ -+ public int maxAutoSaveChunksPerTick = 24; -+ private void maxAutoSaveChunksPerTick() { -+ maxAutoSaveChunksPerTick = getInt("max-auto-save-chunks-per-tick", 24); -+ } -+ - private boolean getBoolean(String path, boolean def) { - return this.getBoolean(path, def, true); - } diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index 06e7ca13f24838bdb2305e1c12b1aeac9152612f..817459063cbe37422d2d1b560f4751857139c6f6 100644 +index 5ff10579b1ae3a7070c0548d3e5e2fae886ca6f7..67ba7274461ed438014cc208326a2c3fe7a2e43e 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java @@ -851,7 +851,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop 0) { ++ if (level.paperConfig().chunks.autoSaveInterval.value() > 0) { + level.saveIncrementally(fullSave); + } + } @@ -98,7 +53,7 @@ index 06e7ca13f24838bdb2305e1c12b1aeac9152612f..817459063cbe37422d2d1b560f475185 // Paper start - move executeAll() into full server tick timing try (co.aikar.timings.Timing ignored = MinecraftTimings.processTasksTimer.startTiming()) { diff --git a/src/main/java/net/minecraft/server/level/ChunkHolder.java b/src/main/java/net/minecraft/server/level/ChunkHolder.java -index 4e8a79f2d3b6f52c6284bc9b0ce2423dc43a154f..c21fd8a27be72056122643c9f3dda352d55bd0ce 100644 +index 4e8a79f2d3b6f52c6284bc9b0ce2423dc43a154f..36a9d52d9af3bc398010c52dc16ab23e53f2702a 100644 --- a/src/main/java/net/minecraft/server/level/ChunkHolder.java +++ b/src/main/java/net/minecraft/server/level/ChunkHolder.java @@ -92,6 +92,8 @@ public class ChunkHolder { @@ -121,7 +76,7 @@ index 4e8a79f2d3b6f52c6284bc9b0ce2423dc43a154f..c21fd8a27be72056122643c9f3dda352 + long timeSinceAutoSave = this.inactiveTimeStart - this.lastAutoSaveTime; + if (timeSinceAutoSave < 0) { + // safest bet is to assume autosave is needed here -+ timeSinceAutoSave = this.chunkMap.level.paperConfig.autoSavePeriod; ++ timeSinceAutoSave = this.chunkMap.level.paperConfig().chunks.autoSaveInterval.value(); + } + this.lastAutoSaveTime = this.chunkMap.level.getGameTime() - timeSinceAutoSave; + this.chunkMap.autoSaveQueue.add(this); @@ -142,7 +97,7 @@ index 4e8a79f2d3b6f52c6284bc9b0ce2423dc43a154f..c21fd8a27be72056122643c9f3dda352 + long timeSinceAutoSave = this.inactiveTimeStart - this.lastAutoSaveTime; + if (timeSinceAutoSave < 0) { + // safest bet is to assume autosave is needed here -+ timeSinceAutoSave = this.chunkMap.level.paperConfig.autoSavePeriod; ++ timeSinceAutoSave = this.chunkMap.level.paperConfig().chunks.autoSaveInterval.value(); + } + this.lastAutoSaveTime = this.chunkMap.level.getGameTime() - timeSinceAutoSave; + this.chunkMap.autoSaveQueue.add(this); @@ -165,10 +120,10 @@ index 4e8a79f2d3b6f52c6284bc9b0ce2423dc43a154f..c21fd8a27be72056122643c9f3dda352 for (int i = 0; i < this.futures.length(); ++i) { CompletableFuture> completablefuture = (CompletableFuture) this.futures.get(i); diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java -index 95dbf60604d86666a359c0d861ef3eb8313e6184..73990ab5095253ae76d36968abf4d10f50af4d1b 100644 +index 5e387419d0163333f2370b5708fbd3641449adeb..3022b04038821d471503297628a897114ee273c1 100644 --- a/src/main/java/net/minecraft/server/level/ChunkMap.java +++ b/src/main/java/net/minecraft/server/level/ChunkMap.java -@@ -107,6 +107,7 @@ import net.minecraft.world.level.levelgen.structure.templatesystem.StructureTemp +@@ -106,6 +106,7 @@ import net.minecraft.world.level.levelgen.structure.templatesystem.StructureTemp import net.minecraft.world.level.storage.DimensionDataStorage; import net.minecraft.world.level.storage.LevelStorageSource; import net.minecraft.world.phys.Vec3; @@ -176,7 +131,7 @@ index 95dbf60604d86666a359c0d861ef3eb8313e6184..73990ab5095253ae76d36968abf4d10f import org.apache.commons.lang3.mutable.MutableBoolean; import org.apache.commons.lang3.mutable.MutableObject; import org.slf4j.Logger; -@@ -710,6 +711,64 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider +@@ -709,6 +710,64 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider } @@ -193,9 +148,9 @@ index 95dbf60604d86666a359c0d861ef3eb8313e6184..73990ab5095253ae76d36968abf4d10f + protected void saveIncrementally() { + int savedThisTick = 0; + // optimized since we search far less chunks to hit ones that need to be saved -+ List reschedule = new java.util.ArrayList<>(this.level.paperConfig.maxAutoSaveChunksPerTick); ++ List reschedule = new java.util.ArrayList<>(this.level.paperConfig().chunks.maxAutoSaveChunksPerTick); + long currentTick = this.level.getGameTime(); -+ long maxSaveTime = currentTick - this.level.paperConfig.autoSavePeriod; ++ long maxSaveTime = currentTick - this.level.paperConfig().chunks.autoSaveInterval.value(); + + for (Iterator iterator = this.autoSaveQueue.iterator(); iterator.hasNext();) { + ChunkHolder playerchunk = iterator.next(); @@ -215,7 +170,7 @@ index 95dbf60604d86666a359c0d861ef3eb8313e6184..73990ab5095253ae76d36968abf4d10f + if (!playerchunk.setHasBeenLoaded()) { + // do not fall through to reschedule logic + playerchunk.inactiveTimeStart = currentTick; -+ if (savedThisTick >= this.level.paperConfig.maxAutoSaveChunksPerTick) { ++ if (savedThisTick >= this.level.paperConfig().chunks.maxAutoSaveChunksPerTick) { + break; + } + continue; @@ -225,7 +180,7 @@ index 95dbf60604d86666a359c0d861ef3eb8313e6184..73990ab5095253ae76d36968abf4d10f + + reschedule.add(playerchunk); + -+ if (savedThisTick >= this.level.paperConfig.maxAutoSaveChunksPerTick) { ++ if (savedThisTick >= this.level.paperConfig().chunks.maxAutoSaveChunksPerTick) { + break; + } + } @@ -241,7 +196,7 @@ index 95dbf60604d86666a359c0d861ef3eb8313e6184..73990ab5095253ae76d36968abf4d10f protected void saveAllChunks(boolean flush) { if (flush) { List list = (List) this.visibleChunkMap.values().stream().filter(ChunkHolder::wasAccessibleSinceLastSave).peek(ChunkHolder::refreshAccessibility).collect(Collectors.toList()); -@@ -794,13 +853,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider +@@ -793,13 +852,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider } int l = 0; @@ -256,7 +211,7 @@ index 95dbf60604d86666a359c0d861ef3eb8313e6184..73990ab5095253ae76d36968abf4d10f } -@@ -838,6 +891,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider +@@ -837,6 +890,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider this.level.unload(chunk); } @@ -264,7 +219,7 @@ index 95dbf60604d86666a359c0d861ef3eb8313e6184..73990ab5095253ae76d36968abf4d10f this.lightEngine.updateChunkStatus(ichunkaccess.getPos()); this.lightEngine.tryScheduleUpdate(); -@@ -1258,6 +1312,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider +@@ -1257,6 +1311,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider asyncSaveData, chunk); chunk.setUnsaved(false); @@ -272,7 +227,7 @@ index 95dbf60604d86666a359c0d861ef3eb8313e6184..73990ab5095253ae76d36968abf4d10f } // Paper end -@@ -1267,6 +1322,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider +@@ -1266,6 +1321,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider if (!chunk.isUnsaved()) { return false; } else { @@ -281,7 +236,7 @@ index 95dbf60604d86666a359c0d861ef3eb8313e6184..73990ab5095253ae76d36968abf4d10f ChunkPos chunkcoordintpair = chunk.getPos(); diff --git a/src/main/java/net/minecraft/server/level/ServerChunkCache.java b/src/main/java/net/minecraft/server/level/ServerChunkCache.java -index d247f8997e5afc4c6449495da0b302a4814df495..92ef60cb5ec230ac359b321249cacca18fd4d2da 100644 +index 1d9a0f6effa1654609f4d0752ec69eed6ab7134b..585892f19bc0aea89889a358c0407f2975b9efe5 100644 --- a/src/main/java/net/minecraft/server/level/ServerChunkCache.java +++ b/src/main/java/net/minecraft/server/level/ServerChunkCache.java @@ -814,6 +814,15 @@ public class ServerChunkCache extends ChunkSource { @@ -301,7 +256,7 @@ index d247f8997e5afc4c6449495da0b302a4814df495..92ef60cb5ec230ac359b321249cacca1 public void close() throws IOException { // CraftBukkit start diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java -index e5f7ed6e70231c447f3983ae181e23acc6f69de6..c79dd3cdb5d3d1e8cb79a7efdf48f513679c5f51 100644 +index d8694d9c766bc8f85d828da4dabf53215f01e54e..59421d2d766d4c52e93b0849bce316dcfc1b76c4 100644 --- a/src/main/java/net/minecraft/server/level/ServerLevel.java +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java @@ -1079,6 +1079,37 @@ public class ServerLevel extends Level implements WorldGenLevel { @@ -343,7 +298,7 @@ index e5f7ed6e70231c447f3983ae181e23acc6f69de6..c79dd3cdb5d3d1e8cb79a7efdf48f513 ServerChunkCache chunkproviderserver = this.getChunkSource(); diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java -index 896fe621d47ff3fef40e109d63251480fea082a9..b4d6f2bc63bb7ad2e08897b73392df5ab1c77910 100644 +index ea1f0477f416f9e852ea92083781d7eb6ab24861..58c67cc9a4c9c238fae89e165dc6ad01e569476f 100644 --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java @@ -177,6 +177,7 @@ import org.bukkit.inventory.MainHand; @@ -355,7 +310,7 @@ index 896fe621d47ff3fef40e109d63251480fea082a9..b4d6f2bc63bb7ad2e08897b73392df5a private static final int NEUTRAL_MOB_DEATH_NOTIFICATION_RADII_Y = 10; public ServerGamePacketListenerImpl connection; diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java -index 1b955c9a6f5532d30d58b8a852d7583d3effd53a..8f33d924236811c5636469ad218096d18ec67643 100644 +index 4b9e030016bef762c01ace5181ade7d1480b8702..c1e62a0d1655993430da7e4cbd8075cd4239adb4 100644 --- a/src/main/java/net/minecraft/server/players/PlayerList.java +++ b/src/main/java/net/minecraft/server/players/PlayerList.java @@ -561,6 +561,7 @@ public abstract class PlayerList { @@ -384,7 +339,7 @@ index 1b955c9a6f5532d30d58b8a852d7583d3effd53a..8f33d924236811c5636469ad218096d1 + ServerPlayer entityplayer = this.players.get(i); + if (interval == -1 || now - entityplayer.lastSave >= interval) { + this.save(entityplayer); -+ if (interval != -1 && ++numSaved <= com.destroystokyo.paper.PaperConfig.maxPlayerAutoSavePerTick) { break; } ++ if (interval != -1 && ++numSaved <= io.papermc.paper.configuration.GlobalConfiguration.get().playerAutoSave.maxPerTick()) { break; } + } + // Paper end } @@ -403,7 +358,7 @@ index a5160f0336f1ab50e415bddaa958616e8a08dfee..bef890d2e8d883165a48a7f5b39a8651 public static record TicksToSave(SerializableTickContainer blocks, SerializableTickContainer fluids) { diff --git a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java -index f362f0edf7ee81d2e21d86d57b86420f9619f32e..2e84b4e52055ec373e8d59c4bea8afefae1ba8e1 100644 +index 3fe94e580d2aaae9616ba83c0d3a44687505b249..797ff36295412ac8429d573e039d870fd85eb569 100644 --- a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java +++ b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java @@ -87,6 +87,12 @@ public class LevelChunk extends ChunkAccess { diff --git a/patches/server/0450-Stop-copy-on-write-operations-for-updating-light-dat.patch b/patches/server/0449-Stop-copy-on-write-operations-for-updating-light-dat.patch similarity index 100% rename from patches/server/0450-Stop-copy-on-write-operations-for-updating-light-dat.patch rename to patches/server/0449-Stop-copy-on-write-operations-for-updating-light-dat.patch diff --git a/patches/server/0451-Support-old-UUID-format-for-NBT.patch b/patches/server/0450-Support-old-UUID-format-for-NBT.patch similarity index 100% rename from patches/server/0451-Support-old-UUID-format-for-NBT.patch rename to patches/server/0450-Support-old-UUID-format-for-NBT.patch diff --git a/patches/server/0452-Clean-up-duplicated-GameProfile-Properties.patch b/patches/server/0451-Clean-up-duplicated-GameProfile-Properties.patch similarity index 100% rename from patches/server/0452-Clean-up-duplicated-GameProfile-Properties.patch rename to patches/server/0451-Clean-up-duplicated-GameProfile-Properties.patch diff --git a/patches/server/0453-Convert-legacy-attributes-in-Item-Meta.patch b/patches/server/0452-Convert-legacy-attributes-in-Item-Meta.patch similarity index 100% rename from patches/server/0453-Convert-legacy-attributes-in-Item-Meta.patch rename to patches/server/0452-Convert-legacy-attributes-in-Item-Meta.patch diff --git a/patches/server/0454-Remove-some-streams-from-structures.patch b/patches/server/0453-Remove-some-streams-from-structures.patch similarity index 100% rename from patches/server/0454-Remove-some-streams-from-structures.patch rename to patches/server/0453-Remove-some-streams-from-structures.patch diff --git a/patches/server/0455-Remove-streams-from-classes-related-villager-gossip.patch b/patches/server/0454-Remove-streams-from-classes-related-villager-gossip.patch similarity index 100% rename from patches/server/0455-Remove-streams-from-classes-related-villager-gossip.patch rename to patches/server/0454-Remove-streams-from-classes-related-villager-gossip.patch diff --git a/patches/server/0456-Support-components-in-ItemMeta.patch b/patches/server/0455-Support-components-in-ItemMeta.patch similarity index 100% rename from patches/server/0456-Support-components-in-ItemMeta.patch rename to patches/server/0455-Support-components-in-ItemMeta.patch diff --git a/patches/server/0457-Improve-EntityTargetLivingEntityEvent-for-1.16-mobs.patch b/patches/server/0456-Improve-EntityTargetLivingEntityEvent-for-1.16-mobs.patch similarity index 100% rename from patches/server/0457-Improve-EntityTargetLivingEntityEvent-for-1.16-mobs.patch rename to patches/server/0456-Improve-EntityTargetLivingEntityEvent-for-1.16-mobs.patch diff --git a/patches/server/0458-Add-entity-liquid-API.patch b/patches/server/0457-Add-entity-liquid-API.patch similarity index 65% rename from patches/server/0458-Add-entity-liquid-API.patch rename to patches/server/0457-Add-entity-liquid-API.patch index 4b36dbd34c..04793cc115 100644 --- a/patches/server/0458-Add-entity-liquid-API.patch +++ b/patches/server/0457-Add-entity-liquid-API.patch @@ -4,18 +4,6 @@ Date: Thu, 2 Jul 2020 18:11:43 -0500 Subject: [PATCH] Add entity liquid API -diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java -index a34797b5afd6460a5f98e9485c53d6963c6ee462..9bff42f4bd84b6ec294ff8515d52d40d8373b197 100644 ---- a/src/main/java/net/minecraft/world/entity/Entity.java -+++ b/src/main/java/net/minecraft/world/entity/Entity.java -@@ -1443,7 +1443,6 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource { - return this.isInWater() || this.isInRain(); - } - -- @Deprecated public final boolean isInWaterOrRainOrBubble() { return isInWaterRainOrBubble(); } // Paper - OBFHELPER - public boolean isInWaterRainOrBubble() { - return this.isInWater() || this.isInRain() || this.isInBubbleColumn(); - } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java index 5f232c45d6e01943cf1ca1d7802d4915887a6b32..904ce802b2aaebc1f48f7c444e2611fefa14f9a5 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java diff --git a/patches/server/0459-Update-itemstack-legacy-name-and-lore.patch b/patches/server/0458-Update-itemstack-legacy-name-and-lore.patch similarity index 100% rename from patches/server/0459-Update-itemstack-legacy-name-and-lore.patch rename to patches/server/0458-Update-itemstack-legacy-name-and-lore.patch diff --git a/patches/server/0460-Spawn-player-in-correct-world-on-login.patch b/patches/server/0459-Spawn-player-in-correct-world-on-login.patch similarity index 94% rename from patches/server/0460-Spawn-player-in-correct-world-on-login.patch rename to patches/server/0459-Spawn-player-in-correct-world-on-login.patch index aae0bb53c1..ed8eedfdde 100644 --- a/patches/server/0460-Spawn-player-in-correct-world-on-login.patch +++ b/patches/server/0459-Spawn-player-in-correct-world-on-login.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Spawn player in correct world on login diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java -index 8f33d924236811c5636469ad218096d18ec67643..f9fbbd0130c1d3e2ed51f0c79d275c6861aec4fd 100644 +index c1e62a0d1655993430da7e4cbd8075cd4239adb4..0b301b1f164853bfd23300993288a2958824e287 100644 --- a/src/main/java/net/minecraft/server/players/PlayerList.java +++ b/src/main/java/net/minecraft/server/players/PlayerList.java @@ -199,7 +199,18 @@ public abstract class PlayerList { diff --git a/patches/server/0461-Add-PrepareResultEvent.patch b/patches/server/0460-Add-PrepareResultEvent.patch similarity index 98% rename from patches/server/0461-Add-PrepareResultEvent.patch rename to patches/server/0460-Add-PrepareResultEvent.patch index 1b0f30d299..2a54b49b75 100644 --- a/patches/server/0461-Add-PrepareResultEvent.patch +++ b/patches/server/0460-Add-PrepareResultEvent.patch @@ -94,7 +94,7 @@ index cdebd0cdf6eb901464cf4c16089b10ea0147b54d..b47dc7671fab2117b989d647d7e8e36d private void setupRecipeList(Container input, ItemStack stack) { diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java -index 113e4db1d66b7af5b2ba976d094b4bf548b5800e..9a2f0c109181fc45c7388a2a622c4e6cf63cc771 100644 +index 02d89f77d643bcfa52981cb9a8e93688e089dd83..396a66ccd90f8b5da42b585b50d2f0d5a80697b7 100644 --- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java +++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java @@ -1591,19 +1591,44 @@ public class CraftEventFactory { diff --git a/patches/server/0462-Don-t-check-chunk-for-portal-on-world-gen-entity-add.patch b/patches/server/0461-Don-t-check-chunk-for-portal-on-world-gen-entity-add.patch similarity index 90% rename from patches/server/0462-Don-t-check-chunk-for-portal-on-world-gen-entity-add.patch rename to patches/server/0461-Don-t-check-chunk-for-portal-on-world-gen-entity-add.patch index cdd48d886c..bf202084b3 100644 --- a/patches/server/0462-Don-t-check-chunk-for-portal-on-world-gen-entity-add.patch +++ b/patches/server/0461-Don-t-check-chunk-for-portal-on-world-gen-entity-add.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Don't check chunk for portal on world gen entity add diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java -index 4cfb5c89538c8d0ce20883bc6d2a5f7dc4967acd..ddfa929499aa65d40d44d70a8dc6f2656f0242d4 100644 +index cf04841c7e30b9f45c4922977c12e0fed6049450..e76049a976bdfdf4a324a77e7a1721bd4303b058 100644 --- a/src/main/java/net/minecraft/world/entity/LivingEntity.java +++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java @@ -3410,7 +3410,7 @@ public abstract class LivingEntity extends Entity { diff --git a/patches/server/0463-Implement-Chunk-Priority-Urgency-System-for-Chunks.patch b/patches/server/0462-Implement-Chunk-Priority-Urgency-System-for-Chunks.patch similarity index 96% rename from patches/server/0463-Implement-Chunk-Priority-Urgency-System-for-Chunks.patch rename to patches/server/0462-Implement-Chunk-Priority-Urgency-System-for-Chunks.patch index a3617b907b..0634886f0c 100644 --- a/patches/server/0463-Implement-Chunk-Priority-Urgency-System-for-Chunks.patch +++ b/patches/server/0462-Implement-Chunk-Priority-Urgency-System-for-Chunks.patch @@ -23,10 +23,10 @@ Chunks in front of the player have higher priority, to help with fast traveling players keep up with their movement. diff --git a/src/main/java/com/destroystokyo/paper/io/chunk/ChunkTaskManager.java b/src/main/java/com/destroystokyo/paper/io/chunk/ChunkTaskManager.java -index 80c785eb503dc36d381f114a4eccffc1a81071f7..311a01d3590dabc7a4e41bb3493cd7ff228a515c 100644 +index 5b3ef259cf1bff7b23654c2a3e9fc96a7ebc9a03..21f37cf2b0e716e606d1b012ec02580413dc4b3f 100644 --- a/src/main/java/com/destroystokyo/paper/io/chunk/ChunkTaskManager.java +++ b/src/main/java/com/destroystokyo/paper/io/chunk/ChunkTaskManager.java -@@ -106,7 +106,7 @@ public final class ChunkTaskManager { +@@ -107,7 +107,7 @@ public final class ChunkTaskManager { } static void dumpChunkInfo(Set seenChunks, ChunkHolder chunkHolder, int x, int z) { @@ -35,7 +35,7 @@ index 80c785eb503dc36d381f114a4eccffc1a81071f7..311a01d3590dabc7a4e41bb3493cd7ff } static void dumpChunkInfo(Set seenChunks, ChunkHolder chunkHolder, int x, int z, int indent, int maxDepth) { -@@ -127,6 +127,31 @@ public final class ChunkTaskManager { +@@ -128,6 +128,31 @@ public final class ChunkTaskManager { PaperFileIOThread.LOGGER.error(indentStr + "Chunk Status - " + ((chunk == null) ? "null chunk" : chunk.getStatus().toString())); PaperFileIOThread.LOGGER.error(indentStr + "Chunk Ticket Status - " + ChunkHolder.getStatus(chunkHolder.getTicketLevel())); PaperFileIOThread.LOGGER.error(indentStr + "Chunk Holder Status - " + ((holderStatus == null) ? "null" : holderStatus.toString())); @@ -68,7 +68,7 @@ index 80c785eb503dc36d381f114a4eccffc1a81071f7..311a01d3590dabc7a4e41bb3493cd7ff } diff --git a/src/main/java/net/minecraft/server/MCUtil.java b/src/main/java/net/minecraft/server/MCUtil.java -index defeba92b2a7a5d9d5031f2adc0581d87070bb47..a6bcf936747720202857ba586fa35c46c9c91caf 100644 +index aebfcd07170109b9cf058df0d4e285b0d95fedb5..90ebe2ecd1566acd22e69a134090eb3bd3a8e485 100644 --- a/src/main/java/net/minecraft/server/MCUtil.java +++ b/src/main/java/net/minecraft/server/MCUtil.java @@ -681,6 +681,7 @@ public final class MCUtil { @@ -80,7 +80,7 @@ index defeba92b2a7a5d9d5031f2adc0581d87070bb47..a6bcf936747720202857ba586fa35c46 chunkData.addProperty("queued-for-unload", chunkMap.toDrop.contains(playerChunk.pos.longKey)); chunkData.addProperty("status", status == null ? "unloaded" : status.toString()); diff --git a/src/main/java/net/minecraft/server/level/ChunkHolder.java b/src/main/java/net/minecraft/server/level/ChunkHolder.java -index c21fd8a27be72056122643c9f3dda352d55bd0ce..20b2736dcb1d1c7c046b4bb5ce9352ca90aaf39a 100644 +index 36a9d52d9af3bc398010c52dc16ab23e53f2702a..ece4cd0de061969d4d2f07560e6cf38e631098b3 100644 --- a/src/main/java/net/minecraft/server/level/ChunkHolder.java +++ b/src/main/java/net/minecraft/server/level/ChunkHolder.java @@ -60,7 +60,7 @@ public class ChunkHolder { @@ -360,10 +360,10 @@ index c21fd8a27be72056122643c9f3dda352d55bd0ce..20b2736dcb1d1c7c046b4bb5ce9352ca return this.isEntityTickingReady; } diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java -index 73990ab5095253ae76d36968abf4d10f50af4d1b..e4348b4f45515b879f9b2f839e7af7fa9c16a463 100644 +index 3022b04038821d471503297628a897114ee273c1..dc000f7ecefdd5013c91cf37db4a15e54e889b24 100644 --- a/src/main/java/net/minecraft/server/level/ChunkMap.java +++ b/src/main/java/net/minecraft/server/level/ChunkMap.java -@@ -134,6 +134,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider +@@ -133,6 +133,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider public final ServerLevel level; private final ThreadedLevelLightEngine lightEngine; private final BlockableEventLoop mainThreadExecutor; @@ -371,7 +371,7 @@ index 73990ab5095253ae76d36968abf4d10f50af4d1b..e4348b4f45515b879f9b2f839e7af7fa public ChunkGenerator generator; private RandomState randomState; public final Supplier overworldDataStorage; -@@ -332,6 +333,15 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider +@@ -331,6 +332,15 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider } this.mainThreadExecutor = mainThreadExecutor; @@ -387,7 +387,7 @@ index 73990ab5095253ae76d36968abf4d10f50af4d1b..e4348b4f45515b879f9b2f839e7af7fa ProcessorMailbox threadedmailbox = ProcessorMailbox.create(executor, "worldgen"); Objects.requireNonNull(mainThreadExecutor); -@@ -447,6 +457,37 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider +@@ -446,6 +456,37 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider }); } @@ -424,8 +424,8 @@ index 73990ab5095253ae76d36968abf4d10f50af4d1b..e4348b4f45515b879f9b2f839e7af7fa + // Paper start public void updatePlayerMobTypeMap(Entity entity) { - if (!this.level.paperConfig.perPlayerMobSpawns) { -@@ -557,6 +598,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider + if (!this.level.paperConfig().entities.spawning.perPlayerMobSpawns) { +@@ -556,6 +597,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider List list1 = new ArrayList(); int j = centerChunk.x; int k = centerChunk.z; @@ -433,7 +433,7 @@ index 73990ab5095253ae76d36968abf4d10f50af4d1b..e4348b4f45515b879f9b2f839e7af7fa for (int l = -margin; l <= margin; ++l) { for (int i1 = -margin; i1 <= margin; ++i1) { -@@ -575,6 +617,14 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider +@@ -574,6 +616,14 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider ChunkStatus chunkstatus = (ChunkStatus) distanceToStatus.apply(j1); CompletableFuture> completablefuture = playerchunk.getOrScheduleFuture(chunkstatus, this); @@ -448,7 +448,7 @@ index 73990ab5095253ae76d36968abf4d10f50af4d1b..e4348b4f45515b879f9b2f839e7af7fa list1.add(playerchunk); list.add(completablefuture); -@@ -932,11 +982,19 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider +@@ -931,11 +981,19 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider if (requiredStatus == ChunkStatus.EMPTY) { return this.scheduleChunkLoad(chunkcoordintpair); } else { @@ -469,7 +469,7 @@ index 73990ab5095253ae76d36968abf4d10f50af4d1b..e4348b4f45515b879f9b2f839e7af7fa if (optional.isPresent() && ((ChunkAccess) optional.get()).getStatus().isOrAfter(requiredStatus)) { CompletableFuture> completablefuture = requiredStatus.load(this.level, this.structureTemplateManager, this.lightEngine, (ichunkaccess) -> { -@@ -948,6 +1006,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider +@@ -947,6 +1005,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider } else { return this.scheduleChunkGeneration(holder, requiredStatus); } @@ -477,7 +477,7 @@ index 73990ab5095253ae76d36968abf4d10f50af4d1b..e4348b4f45515b879f9b2f839e7af7fa } } -@@ -987,14 +1046,24 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider +@@ -986,14 +1045,24 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider }; CompletableFuture chunkSaveFuture = this.level.asyncChunkTaskManager.getChunkSaveFuture(pos.x, pos.z); @@ -507,7 +507,7 @@ index 73990ab5095253ae76d36968abf4d10f50af4d1b..e4348b4f45515b879f9b2f839e7af7fa return ret; // Paper end - Async chunk io } -@@ -1073,7 +1142,10 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider +@@ -1072,7 +1141,10 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider this.releaseLightTicket(chunkcoordintpair); return CompletableFuture.completedFuture(Either.right(playerchunk_failure)); }); @@ -519,7 +519,7 @@ index 73990ab5095253ae76d36968abf4d10f50af4d1b..e4348b4f45515b879f9b2f839e7af7fa } protected void releaseLightTicket(ChunkPos pos) { -@@ -1157,7 +1229,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider +@@ -1156,7 +1228,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider long i = chunkHolder.getPos().toLong(); Objects.requireNonNull(chunkHolder); @@ -529,7 +529,7 @@ index 73990ab5095253ae76d36968abf4d10f50af4d1b..e4348b4f45515b879f9b2f839e7af7fa } diff --git a/src/main/java/net/minecraft/server/level/DistanceManager.java b/src/main/java/net/minecraft/server/level/DistanceManager.java -index 211566dada0f820af331695b4c62035b89f25a53..d2865ce0523b74aaa935db72c6f3478894e13408 100644 +index 9bc956068df3baabb9f8e02ee74a6397de2bf587..b2df5e18ce5260a9781052db7afb0b9786fb887c 100644 --- a/src/main/java/net/minecraft/server/level/DistanceManager.java +++ b/src/main/java/net/minecraft/server/level/DistanceManager.java @@ -128,6 +128,7 @@ public abstract class DistanceManager { @@ -711,7 +711,7 @@ index 211566dada0f820af331695b4c62035b89f25a53..d2865ce0523b74aaa935db72c6f34788 Ticket ticket = new Ticket<>(TicketType.FORCED, 31, pos); long i = pos.toLong(); diff --git a/src/main/java/net/minecraft/server/level/ServerChunkCache.java b/src/main/java/net/minecraft/server/level/ServerChunkCache.java -index 92ef60cb5ec230ac359b321249cacca18fd4d2da..ab22b2a9287bb2c70404d6ff488af2001151f48d 100644 +index 585892f19bc0aea89889a358c0407f2975b9efe5..918fda0fbbafa39ce0f421dcaf10f8dcf1e5dabb 100644 --- a/src/main/java/net/minecraft/server/level/ServerChunkCache.java +++ b/src/main/java/net/minecraft/server/level/ServerChunkCache.java @@ -590,6 +590,26 @@ public class ServerChunkCache extends ChunkSource { @@ -796,7 +796,7 @@ index 92ef60cb5ec230ac359b321249cacca18fd4d2da..ab22b2a9287bb2c70404d6ff488af200 boolean flag1 = this.chunkMap.promoteChunkMap(); diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java -index b4d6f2bc63bb7ad2e08897b73392df5ab1c77910..8ffec264b8656f56a8370ea84b495a576b5007bb 100644 +index 58c67cc9a4c9c238fae89e165dc6ad01e569476f..315ada5d45e8681a8f0695410201758d8748b7ec 100644 --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java @@ -192,6 +192,7 @@ public class ServerPlayer extends Player { @@ -1112,7 +1112,7 @@ index 8770fe0db46b01e8b608637df4f1a669a3f4cdde..3c1698ba0d3bc412ab957777d9b5211d private final String name; private final Comparator comparator; diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java -index f9fbbd0130c1d3e2ed51f0c79d275c6861aec4fd..28ef198d96e78fb51125519f3707545f1e0f6b29 100644 +index 0b301b1f164853bfd23300993288a2958824e287..ec48afe87b5d159b5bdbe035e214ea7c9024fadb 100644 --- a/src/main/java/net/minecraft/server/players/PlayerList.java +++ b/src/main/java/net/minecraft/server/players/PlayerList.java @@ -178,6 +178,7 @@ public abstract class PlayerList { @@ -1135,7 +1135,7 @@ index f9fbbd0130c1d3e2ed51f0c79d275c6861aec4fd..28ef198d96e78fb51125519f3707545f if (updatingChunk != null) { return updatingChunk.getEntityTickingChunkFuture(); diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java -index 9bff42f4bd84b6ec294ff8515d52d40d8373b197..be6c44b0f5139a9de7605264b460093604988f9f 100644 +index 39c34df3b23eed1ca97234e8df64e9ac0a53ff46..f6df40664b07bf958331e3d1e88a239dd12fb96b 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java @@ -287,7 +287,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource { @@ -1148,7 +1148,7 @@ index 9bff42f4bd84b6ec294ff8515d52d40d8373b197..be6c44b0f5139a9de7605264b4600936 public float yRotO; public float xRotO; diff --git a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java -index 2e84b4e52055ec373e8d59c4bea8afefae1ba8e1..25132e88c08335e0cbd85d948d0863c9cbb28d3e 100644 +index 797ff36295412ac8429d573e039d870fd85eb569..3591ac3b7823e109e01ebfa54ac70aa4deabd4f6 100644 --- a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java +++ b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java @@ -141,7 +141,7 @@ public class LevelChunk extends ChunkAccess { @@ -1177,7 +1177,7 @@ index 2e84b4e52055ec373e8d59c4bea8afefae1ba8e1..25132e88c08335e0cbd85d948d0863c9 org.bukkit.event.world.ChunkUnloadEvent unloadEvent = new org.bukkit.event.world.ChunkUnloadEvent(this.bukkitChunk, this.isUnsaved()); server.getPluginManager().callEvent(unloadEvent); diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java -index 62aef8853b168d6330fb3fe357dfb8de310cc37f..d84db6b9cbabd7979c391fa7d1ae1f55b5fab227 100644 +index daa6f460d6a1006f91ea5fe63ce86625796801f4..f05c909f65240d3a9a71ac620c395d1e6a724fcd 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java @@ -1998,6 +1998,12 @@ public class CraftWorld extends CraftRegionAccessor implements World { @@ -1194,7 +1194,7 @@ index 62aef8853b168d6330fb3fe357dfb8de310cc37f..d84db6b9cbabd7979c391fa7d1ae1f55 net.minecraft.world.level.chunk.LevelChunk chunk = (net.minecraft.world.level.chunk.LevelChunk) either.left().orElse(null); if (chunk != null) addTicket(x, z); // Paper diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -index ccdbeadcb232832b12c3249a24966136b7ac54fd..55f7bf62671d55cf967b55ae7233b6caa735f3af 100644 +index 7a64562326cc462c448245a28fdbcce08fe30310..c4f26fc66554c70ad4ca97737a1d1d0a04559ff0 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java @@ -1028,6 +1028,16 @@ public class CraftPlayer extends CraftHumanEntity implements Player { diff --git a/patches/server/0464-Optimize-NetworkManager-Exception-Handling.patch b/patches/server/0463-Optimize-NetworkManager-Exception-Handling.patch similarity index 100% rename from patches/server/0464-Optimize-NetworkManager-Exception-Handling.patch rename to patches/server/0463-Optimize-NetworkManager-Exception-Handling.patch diff --git a/patches/server/0465-Optimize-the-advancement-data-player-iteration-to-be.patch b/patches/server/0464-Optimize-the-advancement-data-player-iteration-to-be.patch similarity index 100% rename from patches/server/0465-Optimize-the-advancement-data-player-iteration-to-be.patch rename to patches/server/0464-Optimize-the-advancement-data-player-iteration-to-be.patch diff --git a/patches/server/0466-Fix-arrows-never-despawning-MC-125757.patch b/patches/server/0465-Fix-arrows-never-despawning-MC-125757.patch similarity index 91% rename from patches/server/0466-Fix-arrows-never-despawning-MC-125757.patch rename to patches/server/0465-Fix-arrows-never-despawning-MC-125757.patch index 455dfc08f3..8bdc8589fd 100644 --- a/patches/server/0466-Fix-arrows-never-despawning-MC-125757.patch +++ b/patches/server/0465-Fix-arrows-never-despawning-MC-125757.patch @@ -9,7 +9,7 @@ instead of getting stuck in a never despawn state (bubble columns, etc). diff --git a/src/main/java/net/minecraft/world/entity/projectile/AbstractArrow.java b/src/main/java/net/minecraft/world/entity/projectile/AbstractArrow.java -index 62beefb6693d1801d9d8994c7247dca5bd646b0b..cad3d93c2a8cd8f5b55ba05a50a2cdc22729ebd8 100644 +index 7f1f4813ac007fbf79e8ba254075c015fe15e3a1..f02fb03c63975e5c1ccdd848f5727559929cce00 100644 --- a/src/main/java/net/minecraft/world/entity/projectile/AbstractArrow.java +++ b/src/main/java/net/minecraft/world/entity/projectile/AbstractArrow.java @@ -199,6 +199,7 @@ public abstract class AbstractArrow extends Projectile { diff --git a/patches/server/0467-Thread-Safe-Vanilla-Command-permission-checking.patch b/patches/server/0466-Thread-Safe-Vanilla-Command-permission-checking.patch similarity index 100% rename from patches/server/0467-Thread-Safe-Vanilla-Command-permission-checking.patch rename to patches/server/0466-Thread-Safe-Vanilla-Command-permission-checking.patch diff --git a/patches/server/0468-Fix-SPIGOT-5989.patch b/patches/server/0467-Fix-SPIGOT-5989.patch similarity index 97% rename from patches/server/0468-Fix-SPIGOT-5989.patch rename to patches/server/0467-Fix-SPIGOT-5989.patch index 75307e77e8..8af3e2590b 100644 --- a/patches/server/0468-Fix-SPIGOT-5989.patch +++ b/patches/server/0467-Fix-SPIGOT-5989.patch @@ -10,7 +10,7 @@ This fixes that by checking if the modified spawn location is still at a respawn anchor. diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java -index 28ef198d96e78fb51125519f3707545f1e0f6b29..34b5250649ba98b8f4a8a4cd1a76141d360fbe86 100644 +index ec48afe87b5d159b5bdbe035e214ea7c9024fadb..be7a25560cd5521ddfe4793c7e51b1036fc8a19c 100644 --- a/src/main/java/net/minecraft/server/players/PlayerList.java +++ b/src/main/java/net/minecraft/server/players/PlayerList.java @@ -835,6 +835,7 @@ public abstract class PlayerList { diff --git a/patches/server/0469-Fix-SPIGOT-5824-Bukkit-world-container-is-not-used.patch b/patches/server/0468-Fix-SPIGOT-5824-Bukkit-world-container-is-not-used.patch similarity index 72% rename from patches/server/0469-Fix-SPIGOT-5824-Bukkit-world-container-is-not-used.patch rename to patches/server/0468-Fix-SPIGOT-5824-Bukkit-world-container-is-not-used.patch index 2870246623..0f2d7322d3 100644 --- a/patches/server/0469-Fix-SPIGOT-5824-Bukkit-world-container-is-not-used.patch +++ b/patches/server/0468-Fix-SPIGOT-5824-Bukkit-world-container-is-not-used.patch @@ -5,15 +5,15 @@ Subject: [PATCH] Fix SPIGOT-5824 Bukkit world-container is not used diff --git a/src/main/java/net/minecraft/server/Main.java b/src/main/java/net/minecraft/server/Main.java -index efa3c79533ac2abff8387f3bbe6e312ffc727e77..41576d9c9518ae05f63c087736b323ce03f6046a 100644 +index 8fda43173012ed3134ed1f114143ceaad66cae4a..3e1b589031d46126bdd6b6f63d7a133304fb9574 100644 --- a/src/main/java/net/minecraft/server/Main.java +++ b/src/main/java/net/minecraft/server/Main.java -@@ -138,8 +138,17 @@ public class Main { +@@ -137,8 +137,17 @@ public class Main { return; } - File file = (File) optionset.valueOf("universe"); // CraftBukkit -- Services services = Services.create(new com.destroystokyo.paper.profile.PaperAuthenticationService(Proxy.NO_PROXY), file); // Paper +- Services services = Services.create(new com.destroystokyo.paper.profile.PaperAuthenticationService(Proxy.NO_PROXY), file, optionset); // Paper + // Paper start - fix SPIGOT-5824 + File file; + File userCacheFile = new File(Services.USERID_CACHE_FILE); @@ -24,27 +24,27 @@ index efa3c79533ac2abff8387f3bbe6e312ffc727e77..41576d9c9518ae05f63c087736b323ce + file = new File(bukkitConfiguration.getString("settings.world-container", ".")); + } + // Paper end - fix SPIGOT-5824 -+ Services services = Services.create(new com.destroystokyo.paper.profile.PaperAuthenticationService(Proxy.NO_PROXY), file, userCacheFile); // Paper ++ Services services = Services.create(new com.destroystokyo.paper.profile.PaperAuthenticationService(Proxy.NO_PROXY), file, userCacheFile, optionset); // Paper // CraftBukkit start String s = (String) Optional.ofNullable((String) optionset.valueOf("world")).orElse(dedicatedserversettings.getProperties().levelName); LevelStorageSource convertable = LevelStorageSource.createDefault(file.toPath()); diff --git a/src/main/java/net/minecraft/server/Services.java b/src/main/java/net/minecraft/server/Services.java -index 697ca7457115423a8c4d8a7d1f7a353237b56509..d249e0b753493eb46481ac2cd51e04af2ba0db00 100644 +index 86c218e41fbe2a55b1319b37d26fd5da4f0b3da6..c424ae9cc8d346d0f685de463f4e5772077c61dd 100644 --- a/src/main/java/net/minecraft/server/Services.java +++ b/src/main/java/net/minecraft/server/Services.java -@@ -8,12 +8,12 @@ import net.minecraft.server.players.GameProfileCache; - import net.minecraft.util.SignatureValidator; - - public record Services(MinecraftSessionService sessionService, SignatureValidator serviceSignatureValidator, GameProfileRepository profileRepository, GameProfileCache profileCache) { +@@ -19,12 +19,12 @@ public record Services(MinecraftSessionService sessionService, SignatureValidato + return java.util.Objects.requireNonNull(this.paperConfigurations); + } + // Paper end - private static final String USERID_CACHE_FILE = "usercache.json"; + public static final String USERID_CACHE_FILE = "usercache.json"; // Paper - private -> public -- public static Services create(YggdrasilAuthenticationService authenticationService, File rootDirectory) { -+ public static Services create(YggdrasilAuthenticationService authenticationService, File rootDirectory, File userCacheFile) { // Paper +- public static Services create(YggdrasilAuthenticationService authenticationService, File rootDirectory, joptsimple.OptionSet optionSet) throws Exception { // Paper ++ public static Services create(YggdrasilAuthenticationService authenticationService, File rootDirectory, File userCacheFile, joptsimple.OptionSet optionSet) throws Exception { // Paper MinecraftSessionService minecraftSessionService = authenticationService.createMinecraftSessionService(); GameProfileRepository gameProfileRepository = authenticationService.createProfileRepository(); - GameProfileCache gameProfileCache = new GameProfileCache(gameProfileRepository, new File(rootDirectory, "usercache.json")); + GameProfileCache gameProfileCache = new GameProfileCache(gameProfileRepository, userCacheFile); // Paper SignatureValidator signatureValidator = SignatureValidator.from(authenticationService.getServicesKey()); - return new Services(minecraftSessionService, signatureValidator, gameProfileRepository, gameProfileCache); - } + // Paper start + io.papermc.paper.configuration.PaperConfigurations paperConfigurations = io.papermc.paper.configuration.PaperConfigurations.setup(((File) optionSet.valueOf("paper-settings")).toPath(), java.nio.file.Path.of("config"), rootDirectory.toPath(), (File) optionSet.valueOf("spigot-settings")); diff --git a/patches/server/0470-Fix-SPIGOT-5885-Unable-to-disable-advancements.patch b/patches/server/0469-Fix-SPIGOT-5885-Unable-to-disable-advancements.patch similarity index 85% rename from patches/server/0470-Fix-SPIGOT-5885-Unable-to-disable-advancements.patch rename to patches/server/0469-Fix-SPIGOT-5885-Unable-to-disable-advancements.patch index dec87f29b0..d18114cb9b 100644 --- a/patches/server/0470-Fix-SPIGOT-5885-Unable-to-disable-advancements.patch +++ b/patches/server/0469-Fix-SPIGOT-5885-Unable-to-disable-advancements.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Fix SPIGOT-5885 Unable to disable advancements diff --git a/src/main/java/net/minecraft/server/Main.java b/src/main/java/net/minecraft/server/Main.java -index 41576d9c9518ae05f63c087736b323ce03f6046a..3d8449a91687f2637a6254bafd378707e810d769 100644 +index 3e1b589031d46126bdd6b6f63d7a133304fb9574..8bbc3a1e7f848047ff915d5bdf08d376e71c4025 100644 --- a/src/main/java/net/minecraft/server/Main.java +++ b/src/main/java/net/minecraft/server/Main.java -@@ -138,6 +138,7 @@ public class Main { +@@ -137,6 +137,7 @@ public class Main { return; } diff --git a/patches/server/0471-Fix-AdvancementDataPlayer-leak-due-from-quitting-ear.patch b/patches/server/0470-Fix-AdvancementDataPlayer-leak-due-from-quitting-ear.patch similarity index 100% rename from patches/server/0471-Fix-AdvancementDataPlayer-leak-due-from-quitting-ear.patch rename to patches/server/0470-Fix-AdvancementDataPlayer-leak-due-from-quitting-ear.patch diff --git a/patches/server/0472-Add-missing-strikeLighting-call-to-World-spigot-stri.patch b/patches/server/0471-Add-missing-strikeLighting-call-to-World-spigot-stri.patch similarity index 90% rename from patches/server/0472-Add-missing-strikeLighting-call-to-World-spigot-stri.patch rename to patches/server/0471-Add-missing-strikeLighting-call-to-World-spigot-stri.patch index 95247aca4a..1f8215e3b5 100644 --- a/patches/server/0472-Add-missing-strikeLighting-call-to-World-spigot-stri.patch +++ b/patches/server/0471-Add-missing-strikeLighting-call-to-World-spigot-stri.patch @@ -6,7 +6,7 @@ Subject: [PATCH] Add missing strikeLighting call to diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java -index d84db6b9cbabd7979c391fa7d1ae1f55b5fab227..539f973d6ee49c272d516f83472e49d10f67fad2 100644 +index f05c909f65240d3a9a71ac620c395d1e6a724fcd..324498a6add5288f175510ddd754ea2199d37cb7 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java @@ -2093,6 +2093,7 @@ public class CraftWorld extends CraftRegionAccessor implements World { diff --git a/patches/server/0473-Fix-some-rails-connecting-improperly.patch b/patches/server/0472-Fix-some-rails-connecting-improperly.patch similarity index 100% rename from patches/server/0473-Fix-some-rails-connecting-improperly.patch rename to patches/server/0472-Fix-some-rails-connecting-improperly.patch diff --git a/patches/server/0474-Fix-regex-mistake-in-CB-NBT-int-deserialization.patch b/patches/server/0473-Fix-regex-mistake-in-CB-NBT-int-deserialization.patch similarity index 100% rename from patches/server/0474-Fix-regex-mistake-in-CB-NBT-int-deserialization.patch rename to patches/server/0473-Fix-regex-mistake-in-CB-NBT-int-deserialization.patch diff --git a/patches/server/0475-Do-not-let-the-server-load-chunks-from-newer-version.patch b/patches/server/0474-Do-not-let-the-server-load-chunks-from-newer-version.patch similarity index 100% rename from patches/server/0475-Do-not-let-the-server-load-chunks-from-newer-version.patch rename to patches/server/0474-Do-not-let-the-server-load-chunks-from-newer-version.patch diff --git a/patches/server/0476-Brand-support.patch b/patches/server/0475-Brand-support.patch similarity index 95% rename from patches/server/0476-Brand-support.patch rename to patches/server/0475-Brand-support.patch index cae1e4ec13..2eea057639 100644 --- a/patches/server/0476-Brand-support.patch +++ b/patches/server/0475-Brand-support.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Brand support diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index fdf77097cff7c3af87e390b0bfd9e8aadf7c55ec..5c00238e29cfd6ed107e3bf988a9ac2e55e55361 100644 +index e257fbb337ea50f8e36e7e6015e231bd49751144..0017be03b57b337b010f56019a03e4d243bf2447 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java @@ -278,6 +278,8 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser @@ -56,7 +56,7 @@ index fdf77097cff7c3af87e390b0bfd9e8aadf7c55ec..5c00238e29cfd6ed107e3bf988a9ac2e return (!this.player.joining && !this.connection.isConnected()) || this.processedDisconnect; // Paper } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -index 55f7bf62671d55cf967b55ae7233b6caa735f3af..7d70233cf3e9b63f9d1a307aa690fadbaef80993 100644 +index c4f26fc66554c70ad4ca97737a1d1d0a04559ff0..7ba16160dcd74bc41bbd3102124aba9d19b3eb5f 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java @@ -2692,6 +2692,13 @@ public class CraftPlayer extends CraftHumanEntity implements Player { diff --git a/patches/server/0477-Add-setMaxPlayers-API.patch b/patches/server/0476-Add-setMaxPlayers-API.patch similarity index 89% rename from patches/server/0477-Add-setMaxPlayers-API.patch rename to patches/server/0476-Add-setMaxPlayers-API.patch index 11d4a67d99..5fe14b2089 100644 --- a/patches/server/0477-Add-setMaxPlayers-API.patch +++ b/patches/server/0476-Add-setMaxPlayers-API.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Add #setMaxPlayers API diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java -index 34b5250649ba98b8f4a8a4cd1a76141d360fbe86..2f3edb1383dd88514cddc271850b7f0a7f6c9230 100644 +index be7a25560cd5521ddfe4793c7e51b1036fc8a19c..869fa7c3913185c3537185426e75c076fbbdb7fe 100644 --- a/src/main/java/net/minecraft/server/players/PlayerList.java +++ b/src/main/java/net/minecraft/server/players/PlayerList.java @@ -146,7 +146,7 @@ public abstract class PlayerList { @@ -18,7 +18,7 @@ index 34b5250649ba98b8f4a8a4cd1a76141d360fbe86..2f3edb1383dd88514cddc271850b7f0a private int simulationDistance; private boolean allowCheatsForAllPlayers; diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -index 52ad386510af54e3c85ab7c952592982beaedbd1..a1a8578929a08396f9762dec0ef99956e7eeb459 100644 +index 0fa7ec60b30bfc3c3f858aa2a5a7f0fc73d3b6a5..a3ac723a675bbb0dc098ee045dc4612591b3cc63 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java @@ -663,6 +663,13 @@ public final class CraftServer implements Server { diff --git a/patches/server/0478-Add-playPickupItemAnimation-to-LivingEntity.patch b/patches/server/0477-Add-playPickupItemAnimation-to-LivingEntity.patch similarity index 100% rename from patches/server/0478-Add-playPickupItemAnimation-to-LivingEntity.patch rename to patches/server/0477-Add-playPickupItemAnimation-to-LivingEntity.patch diff --git a/patches/server/0479-Don-t-require-FACING-data.patch b/patches/server/0478-Don-t-require-FACING-data.patch similarity index 100% rename from patches/server/0479-Don-t-require-FACING-data.patch rename to patches/server/0478-Don-t-require-FACING-data.patch diff --git a/patches/server/0480-Fix-SpawnChangeEvent-not-firing-for-all-use-cases.patch b/patches/server/0479-Fix-SpawnChangeEvent-not-firing-for-all-use-cases.patch similarity index 88% rename from patches/server/0480-Fix-SpawnChangeEvent-not-firing-for-all-use-cases.patch rename to patches/server/0479-Fix-SpawnChangeEvent-not-firing-for-all-use-cases.patch index 8e12cafb8c..389932c2ac 100644 --- a/patches/server/0480-Fix-SpawnChangeEvent-not-firing-for-all-use-cases.patch +++ b/patches/server/0479-Fix-SpawnChangeEvent-not-firing-for-all-use-cases.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Fix SpawnChangeEvent not firing for all use-cases diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java -index c79dd3cdb5d3d1e8cb79a7efdf48f513679c5f51..877c13a7f2ddf00ce9902b7ff14bee57674842bc 100644 +index 59421d2d766d4c52e93b0849bce316dcfc1b76c4..839840ed837ff9dbe13a0e93b8da3bc85ce93146 100644 --- a/src/main/java/net/minecraft/server/level/ServerLevel.java +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java @@ -1847,6 +1847,7 @@ public class ServerLevel extends Level implements WorldGenLevel { @@ -15,9 +15,9 @@ index c79dd3cdb5d3d1e8cb79a7efdf48f513679c5f51..877c13a7f2ddf00ce9902b7ff14bee57 + new org.bukkit.event.world.SpawnChangeEvent(getWorld(), MCUtil.toLocation(this, prevSpawn)).callEvent(); // Paper if (this.keepSpawnInMemory) { // if this keepSpawnInMemory is false a plugin has already removed our tickets, do not re-add - this.removeTicketsForSpawn(this.paperConfig.keepLoadedRange, prevSpawn); + this.removeTicketsForSpawn(this.paperConfig().spawn.keepSpawnLoadedRange, prevSpawn); diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java -index 539f973d6ee49c272d516f83472e49d10f67fad2..99d109ebd9aa0af31916dc81d1a8b1f7bc6d42be 100644 +index 324498a6add5288f175510ddd754ea2199d37cb7..880aeefbda1cba04accf9075240c88c027b5763c 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java @@ -258,11 +258,13 @@ public class CraftWorld extends CraftRegionAccessor implements World { diff --git a/patches/server/0481-Add-moon-phase-API.patch b/patches/server/0480-Add-moon-phase-API.patch similarity index 100% rename from patches/server/0481-Add-moon-phase-API.patch rename to patches/server/0480-Add-moon-phase-API.patch diff --git a/patches/server/0482-Improve-Chunk-Status-Transition-Speed.patch b/patches/server/0481-Improve-Chunk-Status-Transition-Speed.patch similarity index 92% rename from patches/server/0482-Improve-Chunk-Status-Transition-Speed.patch rename to patches/server/0481-Improve-Chunk-Status-Transition-Speed.patch index e954daf786..1d367e43a3 100644 --- a/patches/server/0482-Improve-Chunk-Status-Transition-Speed.patch +++ b/patches/server/0481-Improve-Chunk-Status-Transition-Speed.patch @@ -36,7 +36,7 @@ scenario / path: Previously would have hopped to SERVER around 12+ times there extra. diff --git a/src/main/java/net/minecraft/server/level/ChunkHolder.java b/src/main/java/net/minecraft/server/level/ChunkHolder.java -index 20b2736dcb1d1c7c046b4bb5ce9352ca90aaf39a..7b37ce8e03e8cc7424ad2bd36ce5701f078ed7dd 100644 +index ece4cd0de061969d4d2f07560e6cf38e631098b3..90f65fdcc4acf6762c67a5cb3023d2493f03144f 100644 --- a/src/main/java/net/minecraft/server/level/ChunkHolder.java +++ b/src/main/java/net/minecraft/server/level/ChunkHolder.java @@ -95,6 +95,13 @@ public class ChunkHolder { @@ -54,10 +54,10 @@ index 20b2736dcb1d1c7c046b4bb5ce9352ca90aaf39a..7b37ce8e03e8cc7424ad2bd36ce5701f public ChunkHolder(ChunkPos pos, int level, LevelHeightAccessor world, LevelLightEngine lightingProvider, ChunkHolder.LevelChangeListener levelUpdateListener, ChunkHolder.PlayerProvider playersWatchingChunkProvider) { this.futures = new AtomicReferenceArray(ChunkHolder.CHUNK_STATUSES.size()); diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java -index e4348b4f45515b879f9b2f839e7af7fa9c16a463..648a03beb70ee3905360e992a891b74c38fcef68 100644 +index dc000f7ecefdd5013c91cf37db4a15e54e889b24..68038cc68a8abda416a0364dc87535dfc54cd8a1 100644 --- a/src/main/java/net/minecraft/server/level/ChunkMap.java +++ b/src/main/java/net/minecraft/server/level/ChunkMap.java -@@ -707,7 +707,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider +@@ -706,7 +706,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider return either.mapLeft((list) -> { return (LevelChunk) list.get(list.size() / 2); }); @@ -66,7 +66,7 @@ index e4348b4f45515b879f9b2f839e7af7fa9c16a463..648a03beb70ee3905360e992a891b74c } @Nullable -@@ -1113,6 +1113,12 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider +@@ -1112,6 +1112,12 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider return "chunkGenerate " + requiredStatus.getName(); }); Executor executor = (runnable) -> { diff --git a/patches/server/0482-Prevent-headless-pistons-from-being-created.patch b/patches/server/0482-Prevent-headless-pistons-from-being-created.patch new file mode 100644 index 0000000000..b31a2a9b3a --- /dev/null +++ b/patches/server/0482-Prevent-headless-pistons-from-being-created.patch @@ -0,0 +1,27 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: commandblockguy +Date: Fri, 14 Aug 2020 14:44:14 -0500 +Subject: [PATCH] Prevent headless pistons from being created + +Prevent headless pistons from being created by explosions or tree/mushroom growth. + +diff --git a/src/main/java/net/minecraft/world/level/Explosion.java b/src/main/java/net/minecraft/world/level/Explosion.java +index b18b0e1b5e059f08fd3117eaa0fb28a10fac6562..01477e7240f9e33d08d416a7d40ee10f3e5d4abf 100644 +--- a/src/main/java/net/minecraft/world/level/Explosion.java ++++ b/src/main/java/net/minecraft/world/level/Explosion.java +@@ -187,6 +187,15 @@ public class Explosion { + + if (f > 0.0F && this.damageCalculator.shouldBlockExplode(this, this.level, blockposition, iblockdata, f)) { + set.add(blockposition); ++ // Paper start - prevent headless pistons from forming ++ if (!io.papermc.paper.configuration.GlobalConfiguration.get().unsupportedSettings.allowHeadlessPistons && iblockdata.getBlock() == Blocks.MOVING_PISTON) { ++ BlockEntity extension = this.level.getBlockEntity(blockposition); ++ if (extension instanceof net.minecraft.world.level.block.piston.PistonMovingBlockEntity blockEntity && blockEntity.isSourcePiston()) { ++ net.minecraft.core.Direction direction = iblockdata.getValue(net.minecraft.world.level.block.piston.PistonHeadBlock.FACING); ++ set.add(blockposition.relative(direction.getOpposite())); ++ } ++ } ++ // Paper end + } + + d4 += d0 * 0.30000001192092896D; diff --git a/patches/server/0484-Add-BellRingEvent.patch b/patches/server/0483-Add-BellRingEvent.patch similarity index 100% rename from patches/server/0484-Add-BellRingEvent.patch rename to patches/server/0483-Add-BellRingEvent.patch diff --git a/patches/server/0483-Prevent-headless-pistons-from-being-created.patch b/patches/server/0483-Prevent-headless-pistons-from-being-created.patch deleted file mode 100644 index 5a7a1cff74..0000000000 --- a/patches/server/0483-Prevent-headless-pistons-from-being-created.patch +++ /dev/null @@ -1,51 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: commandblockguy -Date: Fri, 14 Aug 2020 14:44:14 -0500 -Subject: [PATCH] Prevent headless pistons from being created - -Prevent headless pistons from being created by explosions or tree/mushroom growth. - -diff --git a/src/main/java/com/destroystokyo/paper/PaperConfig.java b/src/main/java/com/destroystokyo/paper/PaperConfig.java -index 5e531f9fc67bd3092b39f1d3b46b9490319dd79a..ad67d41484052e38f3b955aafa1f74cf6e2b3701 100644 ---- a/src/main/java/com/destroystokyo/paper/PaperConfig.java -+++ b/src/main/java/com/destroystokyo/paper/PaperConfig.java -@@ -469,4 +469,10 @@ public class PaperConfig { - maxPlayerAutoSavePerTick = (playerAutoSaveRate == -1 || playerAutoSaveRate > 100) ? 10 : 20; - } - } -+ -+ public static boolean allowHeadlessPistons; -+ private static void allowHeadlessPistons() { -+ config.set("settings.unsupported-settings.allow-headless-pistons-readme", "This setting controls if players should be able to create headless pistons."); -+ allowHeadlessPistons = getBoolean("settings.unsupported-settings.allow-headless-pistons", false); -+ } - } -diff --git a/src/main/java/net/minecraft/world/level/Explosion.java b/src/main/java/net/minecraft/world/level/Explosion.java -index acb94f0dd47e292446c74958667becdc8087f505..92cef4fa250dc24dafdce4e27884457bdd097c79 100644 ---- a/src/main/java/net/minecraft/world/level/Explosion.java -+++ b/src/main/java/net/minecraft/world/level/Explosion.java -@@ -33,6 +33,8 @@ import net.minecraft.world.level.block.BaseFireBlock; - import net.minecraft.world.level.block.Block; - import net.minecraft.world.level.block.Blocks; - import net.minecraft.world.level.block.entity.BlockEntity; -+import net.minecraft.world.level.block.piston.PistonHeadBlock; -+import net.minecraft.world.level.block.piston.PistonMovingBlockEntity; - import net.minecraft.world.level.block.state.BlockState; - import net.minecraft.world.level.gameevent.GameEvent; - import net.minecraft.world.level.material.FluidState; -@@ -187,6 +189,15 @@ public class Explosion { - - if (f > 0.0F && this.damageCalculator.shouldBlockExplode(this, this.level, blockposition, iblockdata, f)) { - set.add(blockposition); -+ // Paper start - prevent headless pistons from forming -+ if (!com.destroystokyo.paper.PaperConfig.allowHeadlessPistons && iblockdata.getBlock() == Blocks.MOVING_PISTON) { -+ BlockEntity extension = this.level.getBlockEntity(blockposition); -+ if (extension instanceof PistonMovingBlockEntity && ((PistonMovingBlockEntity) extension).isSourcePiston()) { -+ net.minecraft.core.Direction direction = iblockdata.getValue(PistonHeadBlock.FACING); -+ set.add(blockposition.relative(direction.getOpposite())); -+ } -+ } -+ // Paper end - } - - d4 += d0 * 0.30000001192092896D; diff --git a/patches/server/0484-Add-zombie-targets-turtle-egg-config.patch b/patches/server/0484-Add-zombie-targets-turtle-egg-config.patch new file mode 100644 index 0000000000..a92287451d --- /dev/null +++ b/patches/server/0484-Add-zombie-targets-turtle-egg-config.patch @@ -0,0 +1,19 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: BillyGalbreath +Date: Sun, 23 Aug 2020 15:47:34 +0200 +Subject: [PATCH] Add zombie targets turtle egg config + + +diff --git a/src/main/java/net/minecraft/world/entity/monster/Zombie.java b/src/main/java/net/minecraft/world/entity/monster/Zombie.java +index 3c3095e7e684079bcba0ea5a6b44c8fe2a3f47c4..67fe3b79b6fe4064b26f87734174a394b9e2b3e3 100644 +--- a/src/main/java/net/minecraft/world/entity/monster/Zombie.java ++++ b/src/main/java/net/minecraft/world/entity/monster/Zombie.java +@@ -107,7 +107,7 @@ public class Zombie extends Monster { + + @Override + protected void registerGoals() { +- this.goalSelector.addGoal(4, new Zombie.ZombieAttackTurtleEggGoal(this, 1.0D, 3)); ++ if (level.paperConfig().entities.behavior.zombiesTargetTurtleEggs) this.goalSelector.addGoal(4, new Zombie.ZombieAttackTurtleEggGoal(this, 1.0D, 3)); // Paper + this.goalSelector.addGoal(8, new LookAtPlayerGoal(this, Player.class, 8.0F)); + this.goalSelector.addGoal(8, new RandomLookAroundGoal(this)); + this.addBehaviourGoals(); diff --git a/patches/server/0485-Add-zombie-targets-turtle-egg-config.patch b/patches/server/0485-Add-zombie-targets-turtle-egg-config.patch deleted file mode 100644 index a878f73986..0000000000 --- a/patches/server/0485-Add-zombie-targets-turtle-egg-config.patch +++ /dev/null @@ -1,35 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: BillyGalbreath -Date: Sun, 23 Aug 2020 15:47:34 +0200 -Subject: [PATCH] Add zombie targets turtle egg config - - -diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -index 72f622f79d8cc16c4abce1730811770cb793d9b2..5c8891025c03ff5507a5f677ffe320689e3672fc 100644 ---- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -@@ -68,6 +68,11 @@ public class PaperWorldConfig { - } - } - -+ public boolean zombiesTargetTurtleEggs = true; -+ private void zombiesTargetTurtleEggs() { -+ zombiesTargetTurtleEggs = getBoolean("zombies-target-turtle-eggs", zombiesTargetTurtleEggs); -+ } -+ - public short keepLoadedRange; - private void keepLoadedRange() { - keepLoadedRange = (short) (getInt("keep-spawn-loaded-range", Math.min(spigotConfig.viewDistance, 10)) * 16); -diff --git a/src/main/java/net/minecraft/world/entity/monster/Zombie.java b/src/main/java/net/minecraft/world/entity/monster/Zombie.java -index 6efce73f5233927104ec772e16a370926317d80d..847dbd6dae8e9a615ade642c598bc7bb45fb4722 100644 ---- a/src/main/java/net/minecraft/world/entity/monster/Zombie.java -+++ b/src/main/java/net/minecraft/world/entity/monster/Zombie.java -@@ -106,7 +106,7 @@ public class Zombie extends Monster { - - @Override - protected void registerGoals() { -- this.goalSelector.addGoal(4, new Zombie.ZombieAttackTurtleEggGoal(this, 1.0D, 3)); -+ if (level.paperConfig.zombiesTargetTurtleEggs) this.goalSelector.addGoal(4, new Zombie.ZombieAttackTurtleEggGoal(this, 1.0D, 3)); // Paper - this.goalSelector.addGoal(8, new LookAtPlayerGoal(this, Player.class, 8.0F)); - this.goalSelector.addGoal(8, new RandomLookAroundGoal(this)); - this.addBehaviourGoals(); diff --git a/patches/server/0485-Buffer-joins-to-world.patch b/patches/server/0485-Buffer-joins-to-world.patch new file mode 100644 index 0000000000..bf33110d9e --- /dev/null +++ b/patches/server/0485-Buffer-joins-to-world.patch @@ -0,0 +1,36 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Shane Freeder +Date: Wed, 19 Aug 2020 05:05:54 +0100 +Subject: [PATCH] Buffer joins to world + +This patch buffers the number of logins which will attempt to join +the world per tick, this attempts to reduce the impact that join floods +has on the server + +diff --git a/src/main/java/net/minecraft/network/Connection.java b/src/main/java/net/minecraft/network/Connection.java +index ed4587248fada36c4c206be1fa36fef42fc969e2..ddde8f9f53f352c806166354e6a445543ecc2fbf 100644 +--- a/src/main/java/net/minecraft/network/Connection.java ++++ b/src/main/java/net/minecraft/network/Connection.java +@@ -387,10 +387,22 @@ public class Connection extends SimpleChannelInboundHandler> { + } + // Paper end + ++ private static final int MAX_PER_TICK = io.papermc.paper.configuration.GlobalConfiguration.get().misc.maxJoinsPerTick; // Paper ++ private static int joinAttemptsThisTick; // Paper ++ private static int currTick; // Paper + public void tick() { + this.flushQueue(); ++ // Paper start ++ if (currTick != net.minecraft.server.MinecraftServer.currentTick) { ++ currTick = net.minecraft.server.MinecraftServer.currentTick; ++ joinAttemptsThisTick = 0; ++ } ++ // Paper end + if (this.packetListener instanceof ServerLoginPacketListenerImpl) { ++ if ( ((ServerLoginPacketListenerImpl) this.packetListener).state != ServerLoginPacketListenerImpl.State.READY_TO_ACCEPT // Paper ++ || (joinAttemptsThisTick++ < MAX_PER_TICK)) { // Paper - limit the number of joins which can be processed each tick + ((ServerLoginPacketListenerImpl) this.packetListener).tick(); ++ } // Paper + } + + if (this.packetListener instanceof ServerGamePacketListenerImpl) { diff --git a/patches/server/0486-Buffer-joins-to-world.patch b/patches/server/0486-Buffer-joins-to-world.patch deleted file mode 100644 index f37aecd2c1..0000000000 --- a/patches/server/0486-Buffer-joins-to-world.patch +++ /dev/null @@ -1,60 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Shane Freeder -Date: Wed, 19 Aug 2020 05:05:54 +0100 -Subject: [PATCH] Buffer joins to world - -This patch buffers the number of logins which will attempt to join -the world per tick, this attempts to reduce the impact that join floods -has on the server - -diff --git a/src/main/java/com/destroystokyo/paper/PaperConfig.java b/src/main/java/com/destroystokyo/paper/PaperConfig.java -index ad67d41484052e38f3b955aafa1f74cf6e2b3701..658569f9cefdbbfc30eef3b63e8bf552557a498a 100644 ---- a/src/main/java/com/destroystokyo/paper/PaperConfig.java -+++ b/src/main/java/com/destroystokyo/paper/PaperConfig.java -@@ -91,6 +91,11 @@ public class PaperConfig { - } - } - -+ public static int maxJoinsPerTick; -+ private static void maxJoinsPerTick() { -+ maxJoinsPerTick = getInt("settings.max-joins-per-tick", 3); -+ } -+ - public static void registerCommands() { - for (Map.Entry entry : commands.entrySet()) { - MinecraftServer.getServer().server.getCommandMap().register(entry.getKey(), "Paper", entry.getValue()); -diff --git a/src/main/java/net/minecraft/network/Connection.java b/src/main/java/net/minecraft/network/Connection.java -index ed4587248fada36c4c206be1fa36fef42fc969e2..2ea1895be13eef99a87a7d1b0348699f46f281fc 100644 ---- a/src/main/java/net/minecraft/network/Connection.java -+++ b/src/main/java/net/minecraft/network/Connection.java -@@ -40,6 +40,7 @@ import net.minecraft.network.protocol.Packet; - import net.minecraft.network.protocol.PacketFlow; - import net.minecraft.network.protocol.game.ClientboundDisconnectPacket; - import net.minecraft.network.protocol.login.ClientboundLoginDisconnectPacket; -+import net.minecraft.server.MinecraftServer; - import net.minecraft.server.RunningOnDifferentThreadException; - import net.minecraft.server.network.ServerGamePacketListenerImpl; - import net.minecraft.server.network.ServerLoginPacketListenerImpl; -@@ -387,10 +388,22 @@ public class Connection extends SimpleChannelInboundHandler> { - } - // Paper end - -+ private static final int MAX_PER_TICK = com.destroystokyo.paper.PaperConfig.maxJoinsPerTick; // Paper -+ private static int joinAttemptsThisTick; // Paper -+ private static int currTick; // Paper - public void tick() { - this.flushQueue(); -+ // Paper start -+ if (currTick != MinecraftServer.currentTick) { -+ currTick = MinecraftServer.currentTick; -+ joinAttemptsThisTick = 0; -+ } -+ // Paper end - if (this.packetListener instanceof ServerLoginPacketListenerImpl) { -+ if ( ((ServerLoginPacketListenerImpl) this.packetListener).state != ServerLoginPacketListenerImpl.State.READY_TO_ACCEPT // Paper -+ || (joinAttemptsThisTick++ < MAX_PER_TICK)) { // Paper - limit the number of joins which can be processed each tick - ((ServerLoginPacketListenerImpl) this.packetListener).tick(); -+ } // Paper - } - - if (this.packetListener instanceof ServerGamePacketListenerImpl) { diff --git a/patches/server/0487-Eigencraft-redstone-implementation.patch b/patches/server/0486-Eigencraft-redstone-implementation.patch similarity index 94% rename from patches/server/0487-Eigencraft-redstone-implementation.patch rename to patches/server/0486-Eigencraft-redstone-implementation.patch index 576bbd70cf..c9dd88f3fb 100644 --- a/patches/server/0487-Eigencraft-redstone-implementation.patch +++ b/patches/server/0486-Eigencraft-redstone-implementation.patch @@ -18,51 +18,6 @@ A lot of this code is self-contained in a helper class. Aside from making the obvious class/function renames and obfhelpers I didn't need to modify much. Just added Bukkit's event system and took a few liberties with dead code and comment misspellings. -diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -index 5c8891025c03ff5507a5f677ffe320689e3672fc..fbc909e383a43df7cff4de657cab654d79c6648f 100644 ---- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -@@ -73,6 +73,40 @@ public class PaperWorldConfig { - zombiesTargetTurtleEggs = getBoolean("zombies-target-turtle-eggs", zombiesTargetTurtleEggs); - } - -+ public enum RedstoneImplementation { -+ VANILLA, EIGENCRAFT -+ } -+ public RedstoneImplementation redstoneImplementation = RedstoneImplementation.VANILLA; -+ private void redstoneImplementation() { -+ String implementation; -+ if (PaperConfig.version < 27) { -+ implementation = "vanilla"; -+ if (config.contains("world-settings.default.use-faster-eigencraft-redstone")) { -+ implementation = config.getBoolean("world-settings.default.use-faster-eigencraft-redstone") ? "eigencraft" : "vanilla"; -+ config.set("world-settings.default.redstone-implementation", implementation); -+ } -+ if (config.contains("world-settings." + worldName + ".use-faster-eigencraft-redstone")) { -+ implementation = config.getBoolean("world-settings." + worldName + ".use-faster-eigencraft-redstone") ? "eigencraft" : "vanilla"; -+ config.set("world-settings." + worldName + ".redstone-implementation", implementation); -+ } -+ remove("use-faster-eigencraft-redstone"); -+ } else { -+ implementation = this.getString("redstone-implementation", "vanilla").toLowerCase().trim(); -+ } -+ switch (implementation) { -+ default: -+ logError("Invalid redstone-implementation config " + implementation + " - must be one of: vanilla, eigencraft"); -+ case "vanilla": -+ redstoneImplementation = RedstoneImplementation.VANILLA; -+ log("Using the Vanilla redstone implementation."); -+ break; -+ case "eigencraft": -+ redstoneImplementation = RedstoneImplementation.EIGENCRAFT; -+ log("Using Eigencraft's redstone implementation by theosib."); -+ break; -+ } -+ } -+ - public short keepLoadedRange; - private void keepLoadedRange() { - keepLoadedRange = (short) (getInt("keep-spawn-loaded-range", Math.min(spigotConfig.viewDistance, 10)) * 16); diff --git a/src/main/java/com/destroystokyo/paper/util/RedstoneWireTurbo.java b/src/main/java/com/destroystokyo/paper/util/RedstoneWireTurbo.java new file mode 100644 index 0000000000000000000000000000000000000000..d4273df8124d9d6d4a122f5ecef6f3d011da5860 @@ -983,7 +938,7 @@ index 0000000000000000000000000000000000000000..d4273df8124d9d6d4a122f5ecef6f3d0 + } +} diff --git a/src/main/java/net/minecraft/world/level/block/RedStoneWireBlock.java b/src/main/java/net/minecraft/world/level/block/RedStoneWireBlock.java -index 74241146a034c5817cddc608c095d829d765f06a..f7cda51086043bf4b1b613450639d8b44b418013 100644 +index 74241146a034c5817cddc608c095d829d765f06a..361ac29180bed08d5b5c15d37b4b04eb54ee6bac 100644 --- a/src/main/java/net/minecraft/world/level/block/RedStoneWireBlock.java +++ b/src/main/java/net/minecraft/world/level/block/RedStoneWireBlock.java @@ -253,6 +253,121 @@ public class RedStoneWireBlock extends Block { @@ -1000,7 +955,7 @@ index 74241146a034c5817cddc608c095d829d765f06a..f7cda51086043bf4b1b613450639d8b4 + * Note: Added 'source' argument so as to help determine direction of information flow + */ + private void updateSurroundingRedstone(Level worldIn, BlockPos pos, BlockState state, BlockPos source) { -+ if (worldIn.paperConfig.redstoneImplementation == com.destroystokyo.paper.PaperWorldConfig.RedstoneImplementation.EIGENCRAFT) { ++ if (worldIn.paperConfig().misc.redstoneImplementation == io.papermc.paper.configuration.WorldConfiguration.Misc.RedstoneImplementation.EIGENCRAFT) { + turbo.updateSurroundingRedstone(worldIn, pos, state, source); + return; + } @@ -1024,7 +979,7 @@ index 74241146a034c5817cddc608c095d829d765f06a..f7cda51086043bf4b1b613450639d8b4 + int k = worldIn.getBestNeighborSignal(pos1); + this.shouldSignal = true; + -+ if (worldIn.paperConfig.redstoneImplementation == com.destroystokyo.paper.PaperWorldConfig.RedstoneImplementation.VANILLA) { ++ if (worldIn.paperConfig().misc.redstoneImplementation == io.papermc.paper.configuration.WorldConfiguration.Misc.RedstoneImplementation.VANILLA) { + // This code is totally redundant to if statements just below the loop. + if (k > 0 && k > j - 1) { + j = k; @@ -1038,7 +993,7 @@ index 74241146a034c5817cddc608c095d829d765f06a..f7cda51086043bf4b1b613450639d8b4 + // redstone wire will be set to 'k'. If 'k' is already 15, then nothing inside the + // following loop can affect the power level of the wire. Therefore, the loop is + // skipped if k is already 15. -+ if (worldIn.paperConfig.redstoneImplementation == com.destroystokyo.paper.PaperWorldConfig.RedstoneImplementation.VANILLA || k < 15) { ++ if (worldIn.paperConfig().misc.redstoneImplementation == io.papermc.paper.configuration.WorldConfiguration.Misc.RedstoneImplementation.VANILLA || k < 15) { + for (Direction enumfacing : Direction.Plane.HORIZONTAL) { + BlockPos blockpos = pos1.relative(enumfacing); + boolean flag = blockpos.getX() != pos2.getX() || blockpos.getZ() != pos2.getZ(); @@ -1057,7 +1012,7 @@ index 74241146a034c5817cddc608c095d829d765f06a..f7cda51086043bf4b1b613450639d8b4 + } + } + -+ if (worldIn.paperConfig.redstoneImplementation == com.destroystokyo.paper.PaperWorldConfig.RedstoneImplementation.VANILLA) { ++ if (worldIn.paperConfig().misc.redstoneImplementation == io.papermc.paper.configuration.WorldConfiguration.Misc.RedstoneImplementation.VANILLA) { + // The old code would decrement the wire value only by 1 at a time. + if (l > j) { + j = l - 1; diff --git a/patches/server/0488-Fix-hex-colors-not-working-in-some-kick-messages.patch b/patches/server/0487-Fix-hex-colors-not-working-in-some-kick-messages.patch similarity index 85% rename from patches/server/0488-Fix-hex-colors-not-working-in-some-kick-messages.patch rename to patches/server/0487-Fix-hex-colors-not-working-in-some-kick-messages.patch index 74f19a45f0..6fbe13dead 100644 --- a/patches/server/0488-Fix-hex-colors-not-working-in-some-kick-messages.patch +++ b/patches/server/0487-Fix-hex-colors-not-working-in-some-kick-messages.patch @@ -5,15 +5,15 @@ Subject: [PATCH] Fix hex colors not working in some kick messages diff --git a/src/main/java/net/minecraft/server/network/ServerHandshakePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerHandshakePacketListenerImpl.java -index 941a9d8addd44e95c467b34f77658592b9f4ef06..ec98a6540a7c4d032234dea5148adaccff7298b9 100644 +index 14fa831c9984e72ae2185c4f9e07f65b0c2ed67c..9ece2ceac6c5095469b080f08bf7af8f7b31f003 100644 --- a/src/main/java/net/minecraft/server/network/ServerHandshakePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerHandshakePacketListenerImpl.java @@ -49,7 +49,7 @@ public class ServerHandshakePacketListenerImpl implements ServerHandshakePacketL synchronized (ServerHandshakePacketListenerImpl.throttleTracker) { if (ServerHandshakePacketListenerImpl.throttleTracker.containsKey(address) && !"127.0.0.1".equals(address.getHostAddress()) && currentTime - ServerHandshakePacketListenerImpl.throttleTracker.get(address) < connectionThrottle) { ServerHandshakePacketListenerImpl.throttleTracker.put(address, currentTime); -- MutableComponent chatmessage = Component.literal(com.destroystokyo.paper.PaperConfig.connectionThrottleKickMessage); // Paper - Configurable connection throttle kick message -+ Component chatmessage = org.bukkit.craftbukkit.util.CraftChatMessage.fromString(com.destroystokyo.paper.PaperConfig.connectionThrottleKickMessage, true)[0]; // Paper - Configurable connection throttle kick message // Paper - Fix hex colors not working in some kick messages +- MutableComponent chatmessage = Component.literal(io.papermc.paper.configuration.GlobalConfiguration.get().messages.kick.connectionThrottle); // Paper - Configurable connection throttle kick message ++ Component chatmessage = org.bukkit.craftbukkit.util.CraftChatMessage.fromString(io.papermc.paper.configuration.GlobalConfiguration.get().messages.kick.connectionThrottle, true)[0]; // Paper - Configurable connection throttle kick message // Paper - Fix hex colors not working in some kick messages this.connection.send(new ClientboundLoginDisconnectPacket(chatmessage)); this.connection.disconnect(chatmessage); return; @@ -34,10 +34,10 @@ index 941a9d8addd44e95c467b34f77658592b9f4ef06..ec98a6540a7c4d032234dea5148adacc this.connection.send(new ClientboundLoginDisconnectPacket(ichatmutablecomponent)); diff --git a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java -index 9cefee82f6bd89b825b3007c3306a5f3622a1e70..8da6770f88ce693251812f3c0a803a09286e56ad 100644 +index a0d694ad78576fe77f0d99269d15a0fc0cdda035..ed9c4a8e377867771d8376c485f56c6bd234192b 100644 --- a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java -@@ -112,7 +112,7 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener +@@ -111,7 +111,7 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener // CraftBukkit start @Deprecated public void disconnect(String s) { diff --git a/patches/server/0489-PortalCreateEvent-needs-to-know-its-entity.patch b/patches/server/0488-PortalCreateEvent-needs-to-know-its-entity.patch similarity index 100% rename from patches/server/0489-PortalCreateEvent-needs-to-know-its-entity.patch rename to patches/server/0488-PortalCreateEvent-needs-to-know-its-entity.patch diff --git a/patches/server/0490-Fix-CraftTeam-null-check.patch b/patches/server/0489-Fix-CraftTeam-null-check.patch similarity index 100% rename from patches/server/0490-Fix-CraftTeam-null-check.patch rename to patches/server/0489-Fix-CraftTeam-null-check.patch diff --git a/patches/server/0491-Add-more-Evoker-API.patch b/patches/server/0490-Add-more-Evoker-API.patch similarity index 100% rename from patches/server/0491-Add-more-Evoker-API.patch rename to patches/server/0490-Add-more-Evoker-API.patch diff --git a/patches/server/0492-Add-methods-to-get-translation-keys.patch b/patches/server/0491-Add-methods-to-get-translation-keys.patch similarity index 98% rename from patches/server/0492-Add-methods-to-get-translation-keys.patch rename to patches/server/0491-Add-methods-to-get-translation-keys.patch index d6ca0d4af9..63dbe07766 100644 --- a/patches/server/0492-Add-methods-to-get-translation-keys.patch +++ b/patches/server/0491-Add-methods-to-get-translation-keys.patch @@ -42,7 +42,7 @@ index 7d186c7595dbcd109cee2cc16d70d8302b4d6b8f..9bc659a7ab2030e851c85ca511fbba51 public net.minecraft.world.item.enchantment.Enchantment getHandle() { diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java -index bc6d9dc549b865d47899db947b7e5b00ff312d2f..25813d45ba3b39fa1e1d566ca04ed122717b916d 100644 +index 7d9a91b2afb6890a160c2cd1e1cf3f0fb6a10d92..c5d570131cd3c9b43ab7889454923c29078e0915 100644 --- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java +++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java @@ -478,6 +478,30 @@ public final class CraftMagicNumbers implements UnsafeValues { diff --git a/patches/server/0493-Create-HoverEvent-from-ItemStack-Entity.patch b/patches/server/0492-Create-HoverEvent-from-ItemStack-Entity.patch similarity index 100% rename from patches/server/0493-Create-HoverEvent-from-ItemStack-Entity.patch rename to patches/server/0492-Create-HoverEvent-from-ItemStack-Entity.patch diff --git a/patches/server/0494-Cache-block-data-strings.patch b/patches/server/0493-Cache-block-data-strings.patch similarity index 97% rename from patches/server/0494-Cache-block-data-strings.patch rename to patches/server/0493-Cache-block-data-strings.patch index 2c1b2b4ada..b97ee9f80b 100644 --- a/patches/server/0494-Cache-block-data-strings.patch +++ b/patches/server/0493-Cache-block-data-strings.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Cache block data strings diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index 817459063cbe37422d2d1b560f4751857139c6f6..c315fb7c53be4fc304df38d17426393546b2f6f6 100644 +index 67ba7274461ed438014cc208326a2c3fe7a2e43e..087e43bee2dad3c4fd9e84b6c81830d36bdec0fa 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java @@ -1997,6 +1997,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop entry : commands.entrySet()) { - MinecraftServer.getServer().server.getCommandMap().register(entry.getKey(), "Paper", entry.getValue()); diff --git a/src/main/java/org/bukkit/craftbukkit/scoreboard/CraftScoreboard.java b/src/main/java/org/bukkit/craftbukkit/scoreboard/CraftScoreboard.java index 9130c478b80fc50ef1fc4e27b1afa51e3f97d618..167376bcd547f55983ccbb0d46e571c45c7d1ed9 100644 --- a/src/main/java/org/bukkit/craftbukkit/scoreboard/CraftScoreboard.java @@ -68,7 +52,7 @@ index 9130c478b80fc50ef1fc4e27b1afa51e3f97d618..167376bcd547f55983ccbb0d46e571c4 return new CraftObjective(this, objective);*/ // Paper return registerNewObjective(name, criteria, net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer.legacySection().deserialize(displayName), renderType); // Paper diff --git a/src/main/java/org/bukkit/craftbukkit/scoreboard/CraftScoreboardManager.java b/src/main/java/org/bukkit/craftbukkit/scoreboard/CraftScoreboardManager.java -index ff090edcc85713083449cebb22bd1490123bc1ee..8ccfe9488db44d7d2cf4040a5b4cead33da1d5f4 100644 +index ff090edcc85713083449cebb22bd1490123bc1ee..60d5564b5eb9f91db6b02bd4fb037a11fc6dfeb3 100644 --- a/src/main/java/org/bukkit/craftbukkit/scoreboard/CraftScoreboardManager.java +++ b/src/main/java/org/bukkit/craftbukkit/scoreboard/CraftScoreboardManager.java @@ -30,6 +30,7 @@ public final class CraftScoreboardManager implements ScoreboardManager { @@ -85,7 +69,7 @@ index ff090edcc85713083449cebb22bd1490123bc1ee..8ccfe9488db44d7d2cf4040a5b4cead3 CraftScoreboard scoreboard = new CraftScoreboard(new ServerScoreboard(this.server)); - this.scoreboards.add(scoreboard); + // Paper start -+ if (com.destroystokyo.paper.PaperConfig.trackPluginScoreboards) { ++ if (io.papermc.paper.configuration.GlobalConfiguration.get().scoreboards.trackPluginScoreboards) { + scoreboard.registeredGlobally = true; + scoreboards.add(scoreboard); + } diff --git a/patches/server/0502-Entity-isTicking.patch b/patches/server/0501-Entity-isTicking.patch similarity index 95% rename from patches/server/0502-Entity-isTicking.patch rename to patches/server/0501-Entity-isTicking.patch index 11f997fff1..cc06f4cf36 100644 --- a/patches/server/0502-Entity-isTicking.patch +++ b/patches/server/0501-Entity-isTicking.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Entity#isTicking diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java -index e51d32717e29a4c1cba723edc24c851dea5ec2e7..d6c75e74bf680ee8968803708408954f6dfa3d79 100644 +index 5c59e51005362361c10e075d6e0e1e5c64c7a05e..592bc702b10ad580cbb473f03f9dac2db476f19f 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java @@ -58,6 +58,7 @@ import net.minecraft.resources.ResourceKey; diff --git a/patches/server/0503-Fix-deop-kicking-non-whitelisted-player-when-white-l.patch b/patches/server/0502-Fix-deop-kicking-non-whitelisted-player-when-white-l.patch similarity index 94% rename from patches/server/0503-Fix-deop-kicking-non-whitelisted-player-when-white-l.patch rename to patches/server/0502-Fix-deop-kicking-non-whitelisted-player-when-white-l.patch index 7917dc6e4f..94feafae9e 100644 --- a/patches/server/0503-Fix-deop-kicking-non-whitelisted-player-when-white-l.patch +++ b/patches/server/0502-Fix-deop-kicking-non-whitelisted-player-when-white-l.patch @@ -6,7 +6,7 @@ Subject: [PATCH] Fix deop kicking non-whitelisted player when white list is diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index c315fb7c53be4fc304df38d17426393546b2f6f6..1f8ce89b46996491043f37783a80f4928acab8ce 100644 +index 087e43bee2dad3c4fd9e84b6c81830d36bdec0fa..377c0011cd5c9d51360ff78e314d82259482ae35 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java @@ -2063,13 +2063,14 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop +Date: Wed, 30 Sep 2020 22:49:14 +0200 +Subject: [PATCH] Toggle for removing existing dragon + + +diff --git a/src/main/java/net/minecraft/world/level/dimension/end/EndDragonFight.java b/src/main/java/net/minecraft/world/level/dimension/end/EndDragonFight.java +index f32906729baf83d8b53d64ab750cddcc413a2927..3e1e8b42f963fab17e416760b93e7c1c0a9a7f45 100644 +--- a/src/main/java/net/minecraft/world/level/dimension/end/EndDragonFight.java ++++ b/src/main/java/net/minecraft/world/level/dimension/end/EndDragonFight.java +@@ -217,7 +217,7 @@ public class EndDragonFight { + this.dragonUUID = enderDragon.getUUID(); + LOGGER.info("Found that there's a dragon still alive ({})", (Object)enderDragon); + this.dragonKilled = false; +- if (!bl) { ++ if (!bl && this.level.paperConfig().entities.behavior.shouldRemoveDragon) { + LOGGER.info("But we didn't have a portal, let's remove it."); + enderDragon.discard(); + this.dragonUUID = null; diff --git a/patches/server/0519-Fix-client-lag-on-advancement-loading.patch b/patches/server/0518-Fix-client-lag-on-advancement-loading.patch similarity index 95% rename from patches/server/0519-Fix-client-lag-on-advancement-loading.patch rename to patches/server/0518-Fix-client-lag-on-advancement-loading.patch index 837dd436a8..e48d21e361 100644 --- a/patches/server/0519-Fix-client-lag-on-advancement-loading.patch +++ b/patches/server/0518-Fix-client-lag-on-advancement-loading.patch @@ -15,7 +15,7 @@ manually reload the advancement data for all players, which normally takes place as a part of the datapack reloading. diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java -index ab417ed4be57613c73fa26a42cecd548c51a1f8e..dd22329e6ebdaf319039b736f019be9bf7543ef9 100644 +index 7de4cf40d96caba35b43b6b4ac4daa1bf28ef27f..4192a6eff940bfe7823f100d4156f5c4d82d994c 100644 --- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java +++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java @@ -340,7 +340,13 @@ public final class CraftMagicNumbers implements UnsafeValues { diff --git a/patches/server/0518-Toggle-for-removing-existing-dragon.patch b/patches/server/0518-Toggle-for-removing-existing-dragon.patch deleted file mode 100644 index 0315aae202..0000000000 --- a/patches/server/0518-Toggle-for-removing-existing-dragon.patch +++ /dev/null @@ -1,38 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Mariell Hoversholm -Date: Wed, 30 Sep 2020 22:49:14 +0200 -Subject: [PATCH] Toggle for removing existing dragon - - -diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -index fbc909e383a43df7cff4de657cab654d79c6648f..49c3041e1608ba91f8c39e475e32c3e712639af3 100644 ---- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -@@ -107,6 +107,14 @@ public class PaperWorldConfig { - } - } - -+ public boolean shouldRemoveDragon = false; -+ private void shouldRemoveDragon() { -+ shouldRemoveDragon = getBoolean("should-remove-dragon", shouldRemoveDragon); -+ if (shouldRemoveDragon) { -+ log("The Ender Dragon will be removed if she already exists without a portal."); -+ } -+ } -+ - public short keepLoadedRange; - private void keepLoadedRange() { - keepLoadedRange = (short) (getInt("keep-spawn-loaded-range", Math.min(spigotConfig.viewDistance, 10)) * 16); -diff --git a/src/main/java/net/minecraft/world/level/dimension/end/EndDragonFight.java b/src/main/java/net/minecraft/world/level/dimension/end/EndDragonFight.java -index 2eb6e548889cd05c9bd6fe5947ea5bce3b43eaaa..9c5224bd63c63728e86555769702da2f9d0dbbce 100644 ---- a/src/main/java/net/minecraft/world/level/dimension/end/EndDragonFight.java -+++ b/src/main/java/net/minecraft/world/level/dimension/end/EndDragonFight.java -@@ -217,7 +217,7 @@ public class EndDragonFight { - this.dragonUUID = enderDragon.getUUID(); - LOGGER.info("Found that there's a dragon still alive ({})", (Object)enderDragon); - this.dragonKilled = false; -- if (!bl) { -+ if (!bl && this.level.paperConfig.shouldRemoveDragon) { - LOGGER.info("But we didn't have a portal, let's remove it."); - enderDragon.discard(); - this.dragonUUID = null; diff --git a/patches/server/0520-Item-no-age-no-player-pickup.patch b/patches/server/0519-Item-no-age-no-player-pickup.patch similarity index 100% rename from patches/server/0520-Item-no-age-no-player-pickup.patch rename to patches/server/0519-Item-no-age-no-player-pickup.patch diff --git a/patches/server/0521-Optimize-Pathfinder-Remove-Streams-Optimized-collect.patch b/patches/server/0520-Optimize-Pathfinder-Remove-Streams-Optimized-collect.patch similarity index 100% rename from patches/server/0521-Optimize-Pathfinder-Remove-Streams-Optimized-collect.patch rename to patches/server/0520-Optimize-Pathfinder-Remove-Streams-Optimized-collect.patch diff --git a/patches/server/0522-Beacon-API-custom-effect-ranges.patch b/patches/server/0521-Beacon-API-custom-effect-ranges.patch similarity index 100% rename from patches/server/0522-Beacon-API-custom-effect-ranges.patch rename to patches/server/0521-Beacon-API-custom-effect-ranges.patch diff --git a/patches/server/0523-Add-API-for-quit-reason.patch b/patches/server/0522-Add-API-for-quit-reason.patch similarity index 81% rename from patches/server/0523-Add-API-for-quit-reason.patch rename to patches/server/0522-Add-API-for-quit-reason.patch index 37a2814d14..3c78a34e16 100644 --- a/patches/server/0523-Add-API-for-quit-reason.patch +++ b/patches/server/0522-Add-API-for-quit-reason.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Add API for quit reason diff --git a/src/main/java/net/minecraft/network/Connection.java b/src/main/java/net/minecraft/network/Connection.java -index 2ea1895be13eef99a87a7d1b0348699f46f281fc..4798ac3a9c7a7d34eaca5cb50b013b071793ed94 100644 +index ddde8f9f53f352c806166354e6a445543ecc2fbf..91556b52edaa1d5c4dc73a825c77b9a66b002c61 100644 --- a/src/main/java/net/minecraft/network/Connection.java +++ b/src/main/java/net/minecraft/network/Connection.java -@@ -152,12 +152,15 @@ public class Connection extends SimpleChannelInboundHandler> { +@@ -151,12 +151,15 @@ public class Connection extends SimpleChannelInboundHandler> { this.handlingFault = true; if (this.channel.isOpen()) { @@ -25,7 +25,7 @@ index 2ea1895be13eef99a87a7d1b0348699f46f281fc..4798ac3a9c7a7d34eaca5cb50b013b07 Connection.LOGGER.debug("Failed to sent packet", throwable); ConnectionProtocol enumprotocol = this.getCurrentProtocol(); diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java -index 8ffec264b8656f56a8370ea84b495a576b5007bb..50af351200d5bc4ce292e4fd123e0b0cb5adb334 100644 +index 315ada5d45e8681a8f0695410201758d8748b7ec..f0ef38377ae735800323c486d9e42cd00cb69ac8 100644 --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java @@ -264,6 +264,7 @@ public class ServerPlayer extends Player { @@ -37,7 +37,7 @@ index 8ffec264b8656f56a8370ea84b495a576b5007bb..50af351200d5bc4ce292e4fd123e0b0c public ServerPlayer(MinecraftServer server, ServerLevel world, GameProfile profile, @Nullable ProfilePublicKey publicKey) { super(world, world.getSharedSpawnPos(), world.getSharedSpawnAngle(), profile, publicKey); diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index be836a29d9d37902813ecff255b09234a3ffc77f..4b144b1b17ea6f498eeeaa8cd4795fa5ce2c4e0f 100644 +index 40dc34dc5a68645695b9e4467ac0b845e90ba99c..116fbaf688c96578a4ef6b50a1726729a5d19953 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java @@ -468,6 +468,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser @@ -49,15 +49,15 @@ index be836a29d9d37902813ecff255b09234a3ffc77f..4b144b1b17ea6f498eeeaa8cd4795fa5 this.connection.disconnect(ichatbasecomponent); }); diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java -index 2f3edb1383dd88514cddc271850b7f0a7f6c9230..797249116d8fd1aeef914eb9f54b19945f13d20f 100644 +index 869fa7c3913185c3537185426e75c076fbbdb7fe..0dad9a0c98cc128d990d9bd2357895d9a07a0ac7 100644 --- a/src/main/java/net/minecraft/server/players/PlayerList.java +++ b/src/main/java/net/minecraft/server/players/PlayerList.java @@ -600,7 +600,7 @@ public abstract class PlayerList { entityplayer.closeContainer(org.bukkit.event.inventory.InventoryCloseEvent.Reason.DISCONNECT); // Paper } -- PlayerQuitEvent playerQuitEvent = new PlayerQuitEvent(entityplayer.getBukkitEntity(), net.kyori.adventure.text.Component.translatable("multiplayer.player.left", net.kyori.adventure.text.format.NamedTextColor.YELLOW, com.destroystokyo.paper.PaperConfig.useDisplayNameInQuit ? entityplayer.getBukkitEntity().displayName() : net.kyori.adventure.text.Component.text(entityplayer.getScoreboardName()))); -+ PlayerQuitEvent playerQuitEvent = new PlayerQuitEvent(entityplayer.getBukkitEntity(), net.kyori.adventure.text.Component.translatable("multiplayer.player.left", net.kyori.adventure.text.format.NamedTextColor.YELLOW, com.destroystokyo.paper.PaperConfig.useDisplayNameInQuit ? entityplayer.getBukkitEntity().displayName() : net.kyori.adventure.text.Component.text(entityplayer.getScoreboardName())), entityplayer.quitReason); // Paper - quit reason +- PlayerQuitEvent playerQuitEvent = new PlayerQuitEvent(entityplayer.getBukkitEntity(), net.kyori.adventure.text.Component.translatable("multiplayer.player.left", net.kyori.adventure.text.format.NamedTextColor.YELLOW, io.papermc.paper.configuration.GlobalConfiguration.get().messages.useDisplayNameInQuitMessage ? entityplayer.getBukkitEntity().displayName() : net.kyori.adventure.text.Component.text(entityplayer.getScoreboardName()))); ++ PlayerQuitEvent playerQuitEvent = new PlayerQuitEvent(entityplayer.getBukkitEntity(), net.kyori.adventure.text.Component.translatable("multiplayer.player.left", net.kyori.adventure.text.format.NamedTextColor.YELLOW, io.papermc.paper.configuration.GlobalConfiguration.get().messages.useDisplayNameInQuitMessage ? entityplayer.getBukkitEntity().displayName() : net.kyori.adventure.text.Component.text(entityplayer.getScoreboardName())), entityplayer.quitReason); // Paper - quit reason if (entityplayer.didPlayerJoinEvent) this.cserver.getPluginManager().callEvent(playerQuitEvent); // Paper - if we disconnected before join ever fired, don't fire quit entityplayer.getBukkitEntity().disconnect(playerQuitEvent.getQuitMessage()); diff --git a/patches/server/0524-Add-Wandering-Trader-spawn-rate-config-options.patch b/patches/server/0523-Add-Wandering-Trader-spawn-rate-config-options.patch similarity index 65% rename from patches/server/0524-Add-Wandering-Trader-spawn-rate-config-options.patch rename to patches/server/0523-Add-Wandering-Trader-spawn-rate-config-options.patch index d5e8b859bb..a5adffed4f 100644 --- a/patches/server/0524-Add-Wandering-Trader-spawn-rate-config-options.patch +++ b/patches/server/0523-Add-Wandering-Trader-spawn-rate-config-options.patch @@ -10,32 +10,8 @@ Usages of the vanilla WanderingTraderSpawnDelay and WanderingTraderSpawnChance v in IWorldServerData are removed as they were only used in certain places, with hardcoded values used in other places. -diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -index 49c3041e1608ba91f8c39e475e32c3e712639af3..c3523bb368fe9c64cc361e1e5f3c190d0f9f9b80 100644 ---- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -@@ -115,6 +115,19 @@ public class PaperWorldConfig { - } - } - -+ public int wanderingTraderSpawnMinuteTicks = 1200; -+ public int wanderingTraderSpawnDayTicks = 24000; -+ public int wanderingTraderSpawnChanceFailureIncrement = 25; -+ public int wanderingTraderSpawnChanceMin = 25; -+ public int wanderingTraderSpawnChanceMax = 75; -+ private void wanderingTraderSettings() { -+ wanderingTraderSpawnMinuteTicks = getInt("wandering-trader.spawn-minute-length", wanderingTraderSpawnMinuteTicks); -+ wanderingTraderSpawnDayTicks = getInt("wandering-trader.spawn-day-length", wanderingTraderSpawnDayTicks); -+ wanderingTraderSpawnChanceFailureIncrement = getInt("wandering-trader.spawn-chance-failure-increment", wanderingTraderSpawnChanceFailureIncrement); -+ wanderingTraderSpawnChanceMin = getInt("wandering-trader.spawn-chance-min", wanderingTraderSpawnChanceMin); -+ wanderingTraderSpawnChanceMax = getInt("wandering-trader.spawn-chance-max", wanderingTraderSpawnChanceMax); -+ } -+ - public short keepLoadedRange; - private void keepLoadedRange() { - keepLoadedRange = (short) (getInt("keep-spawn-loaded-range", Math.min(spigotConfig.viewDistance, 10)) * 16); diff --git a/src/main/java/net/minecraft/world/entity/npc/WanderingTraderSpawner.java b/src/main/java/net/minecraft/world/entity/npc/WanderingTraderSpawner.java -index 0130c5e7e1b42024f88c6d7dadd246b7744d7f91..32bf83d659292b1f067e50eeab101f8d0fe611d9 100644 +index 0130c5e7e1b42024f88c6d7dadd246b7744d7f91..fcde09e155727fe0b8b6acc79700fe4122fd22f0 100644 --- a/src/main/java/net/minecraft/world/entity/npc/WanderingTraderSpawner.java +++ b/src/main/java/net/minecraft/world/entity/npc/WanderingTraderSpawner.java @@ -43,43 +43,53 @@ public class WanderingTraderSpawner implements CustomSpawner { @@ -69,9 +45,9 @@ index 0130c5e7e1b42024f88c6d7dadd246b7744d7f91..32bf83d659292b1f067e50eeab101f8d public int tick(ServerLevel world, boolean spawnMonsters, boolean spawnAnimals) { + // Paper start + if (this.tickDelay == Integer.MIN_VALUE) { -+ this.tickDelay = world.paperConfig.wanderingTraderSpawnMinuteTicks; -+ this.spawnDelay = world.paperConfig.wanderingTraderSpawnDayTicks; -+ this.spawnChance = world.paperConfig.wanderingTraderSpawnChanceMin; ++ this.tickDelay = world.paperConfig().entities.spawning.wanderingTrader.spawnMinuteLength; ++ this.spawnDelay = world.paperConfig().entities.spawning.wanderingTrader.spawnDayLength; ++ this.spawnChance = world.paperConfig().entities.spawning.wanderingTrader.spawnChanceMin; + } if (!world.getGameRules().getBoolean(GameRules.RULE_DO_TRADER_SPAWNING)) { return 0; @@ -83,14 +59,14 @@ index 0130c5e7e1b42024f88c6d7dadd246b7744d7f91..32bf83d659292b1f067e50eeab101f8d - this.tickDelay = 1200; - this.spawnDelay -= 1200; - this.serverLevelData.setWanderingTraderSpawnDelay(this.spawnDelay); -+ this.tickDelay = world.paperConfig.wanderingTraderSpawnMinuteTicks; -+ this.spawnDelay = this.spawnDelay - world.paperConfig.wanderingTraderSpawnMinuteTicks; ++ this.tickDelay = world.paperConfig().entities.spawning.wanderingTrader.spawnMinuteLength; ++ this.spawnDelay = this.spawnDelay - world.paperConfig().entities.spawning.wanderingTrader.spawnMinuteLength; + //this.serverLevelData.setWanderingTraderSpawnDelay(this.spawnDelay); // Paper - We don't need to save this value to disk if it gets set back to a hardcoded value anyways if (this.spawnDelay > 0) { return 0; } else { - this.spawnDelay = 24000; -+ this.spawnDelay = world.paperConfig.wanderingTraderSpawnDayTicks; ++ this.spawnDelay = world.paperConfig().entities.spawning.wanderingTrader.spawnDayLength; if (!world.getGameRules().getBoolean(GameRules.RULE_DOMOBSPAWNING)) { return 0; } else { @@ -98,13 +74,13 @@ index 0130c5e7e1b42024f88c6d7dadd246b7744d7f91..32bf83d659292b1f067e50eeab101f8d - this.spawnChance = Mth.clamp(this.spawnChance + 25, (int) 25, (int) 75); - this.serverLevelData.setWanderingTraderSpawnChance(this.spawnChance); -+ this.spawnChance = Mth.clamp(i + world.paperConfig.wanderingTraderSpawnChanceFailureIncrement, world.paperConfig.wanderingTraderSpawnChanceMin, world.paperConfig.wanderingTraderSpawnChanceMax); ++ this.spawnChance = Mth.clamp(i + world.paperConfig().entities.spawning.wanderingTrader.spawnChanceFailureIncrement, world.paperConfig().entities.spawning.wanderingTrader.spawnChanceMin, world.paperConfig().entities.spawning.wanderingTrader.spawnChanceMax); + //this.serverLevelData.setWanderingTraderSpawnChance(this.spawnChance); // Paper - We don't need to save this value to disk if it gets set back to a hardcoded value anyways if (this.random.nextInt(100) > i) { return 0; } else if (this.spawn(world)) { - this.spawnChance = 25; -+ this.spawnChance = world.paperConfig.wanderingTraderSpawnChanceMin; ++ this.spawnChance = world.paperConfig().entities.spawning.wanderingTrader.spawnChanceMin; + // Paper end return 1; } else { diff --git a/patches/server/0525-Expose-world-spawn-angle.patch b/patches/server/0524-Expose-world-spawn-angle.patch similarity index 93% rename from patches/server/0525-Expose-world-spawn-angle.patch rename to patches/server/0524-Expose-world-spawn-angle.patch index f607cc0459..769d8e8343 100644 --- a/patches/server/0525-Expose-world-spawn-angle.patch +++ b/patches/server/0524-Expose-world-spawn-angle.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Expose world spawn angle diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java -index 797249116d8fd1aeef914eb9f54b19945f13d20f..bec5dbb3b103403e76cd42b942b352c453574ce1 100644 +index 0dad9a0c98cc128d990d9bd2357895d9a07a0ac7..75c713f7afd8c4fd5fffada7397b102751eb6423 100644 --- a/src/main/java/net/minecraft/server/players/PlayerList.java +++ b/src/main/java/net/minecraft/server/players/PlayerList.java @@ -878,7 +878,7 @@ public abstract class PlayerList { diff --git a/patches/server/0526-Add-Destroy-Speed-API.patch b/patches/server/0525-Add-Destroy-Speed-API.patch similarity index 100% rename from patches/server/0526-Add-Destroy-Speed-API.patch rename to patches/server/0525-Add-Destroy-Speed-API.patch diff --git a/patches/server/0527-Fix-Player-spawnParticle-x-y-z-precision-loss.patch b/patches/server/0526-Fix-Player-spawnParticle-x-y-z-precision-loss.patch similarity index 93% rename from patches/server/0527-Fix-Player-spawnParticle-x-y-z-precision-loss.patch rename to patches/server/0526-Fix-Player-spawnParticle-x-y-z-precision-loss.patch index b46ccc5378..e63b70f28a 100644 --- a/patches/server/0527-Fix-Player-spawnParticle-x-y-z-precision-loss.patch +++ b/patches/server/0526-Fix-Player-spawnParticle-x-y-z-precision-loss.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Fix Player spawnParticle x/y/z precision loss diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -index 635b182bb6a4831c457558c629afd7a34db4160e..551f82b78a9deca1b702d488743e079cca744f99 100644 +index e700ca8a3b3d381bb02476603849ea94d7e4413d..772c7c34df1938efb4f97ef21ba39d75a5b8a1a5 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java @@ -2254,7 +2254,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player { diff --git a/patches/server/0528-Add-LivingEntity-clearActiveItem.patch b/patches/server/0527-Add-LivingEntity-clearActiveItem.patch similarity index 100% rename from patches/server/0528-Add-LivingEntity-clearActiveItem.patch rename to patches/server/0527-Add-LivingEntity-clearActiveItem.patch diff --git a/patches/server/0529-Add-PlayerItemCooldownEvent.patch b/patches/server/0528-Add-PlayerItemCooldownEvent.patch similarity index 100% rename from patches/server/0529-Add-PlayerItemCooldownEvent.patch rename to patches/server/0528-Add-PlayerItemCooldownEvent.patch diff --git a/patches/server/0530-More-lightning-API.patch b/patches/server/0529-More-lightning-API.patch similarity index 100% rename from patches/server/0530-More-lightning-API.patch rename to patches/server/0529-More-lightning-API.patch diff --git a/patches/server/0531-Climbing-should-not-bypass-cramming-gamerule.patch b/patches/server/0530-Climbing-should-not-bypass-cramming-gamerule.patch similarity index 83% rename from patches/server/0531-Climbing-should-not-bypass-cramming-gamerule.patch rename to patches/server/0530-Climbing-should-not-bypass-cramming-gamerule.patch index af79c77a70..39cbeb6788 100644 --- a/patches/server/0531-Climbing-should-not-bypass-cramming-gamerule.patch +++ b/patches/server/0530-Climbing-should-not-bypass-cramming-gamerule.patch @@ -4,24 +4,8 @@ Date: Sun, 23 Aug 2020 20:59:00 +0200 Subject: [PATCH] Climbing should not bypass cramming gamerule -diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -index c3523bb368fe9c64cc361e1e5f3c190d0f9f9b80..4080c12fe98cba1d17da12648a8228de2720b838 100644 ---- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -@@ -128,6 +128,11 @@ public class PaperWorldConfig { - wanderingTraderSpawnChanceMax = getInt("wandering-trader.spawn-chance-max", wanderingTraderSpawnChanceMax); - } - -+ public boolean fixClimbingBypassingCrammingRule = false; -+ private void fixClimbingBypassingCrammingRule() { -+ fixClimbingBypassingCrammingRule = getBoolean("fix-climbing-bypassing-cramming-rule", fixClimbingBypassingCrammingRule); -+ } -+ - public short keepLoadedRange; - private void keepLoadedRange() { - keepLoadedRange = (short) (getInt("keep-spawn-loaded-range", Math.min(spigotConfig.viewDistance, 10)) * 16); diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java -index d6c75e74bf680ee8968803708408954f6dfa3d79..0ad4e512ea9400957a2f19a5b8854b628965104d 100644 +index 592bc702b10ad580cbb473f03f9dac2db476f19f..6b49e66f0e45eb7ed525fe4314d2a9615212f7e4 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java @@ -1831,6 +1831,12 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource { @@ -61,7 +45,7 @@ index 22f36cd3df49160f1b6668befdd05c2268edaa49..e39965c2e50bc8ee424ea07819346e06 } else if (entity.level.isClientSide && (!(entity1 instanceof Player) || !((Player) entity1).isLocalPlayer())) { return false; diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java -index ddfa929499aa65d40d44d70a8dc6f2656f0242d4..015e428daf0665af640cef788cfa029e8a198907 100644 +index e76049a976bdfdf4a324a77e7a1721bd4303b058..c2508c15eca1a0dbc1a368025651ec2a20b2cbb6 100644 --- a/src/main/java/net/minecraft/world/entity/LivingEntity.java +++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java @@ -3332,7 +3332,7 @@ public abstract class LivingEntity extends Entity { @@ -69,7 +53,7 @@ index ddfa929499aa65d40d44d70a8dc6f2656f0242d4..015e428daf0665af640cef788cfa029e } // Paper end - don't run getEntities if we're not going to use its result - List list = this.level.getEntities((Entity) this, this.getBoundingBox(), EntitySelector.pushableBy(this)); -+ List list = this.level.getEntities((Entity) this, this.getBoundingBox(), EntitySelector.pushable(this, level.paperConfig.fixClimbingBypassingCrammingRule)); // Paper - fix climbing bypassing cramming rule ++ List list = this.level.getEntities((Entity) this, this.getBoundingBox(), EntitySelector.pushable(this, level.paperConfig().collisions.fixClimbingBypassingCrammingRule)); // Paper - fix climbing bypassing cramming rule if (!list.isEmpty()) { // Paper - move up @@ -81,7 +65,7 @@ index ddfa929499aa65d40d44d70a8dc6f2656f0242d4..015e428daf0665af640cef788cfa029e @Override public boolean isPushable() { - return this.isAlive() && !this.isSpectator() && !this.onClimbable() && this.collides; // CraftBukkit -+ return this.isCollidable(level.paperConfig.fixClimbingBypassingCrammingRule); ++ return this.isCollidable(level.paperConfig().collisions.fixClimbingBypassingCrammingRule); + } + + @Override @@ -133,7 +117,7 @@ index 119ee27ceb873c67d1d0904da903401e216eb450..04a119e6641898454253e2478bc1b4df } diff --git a/src/main/java/net/minecraft/world/entity/decoration/ArmorStand.java b/src/main/java/net/minecraft/world/entity/decoration/ArmorStand.java -index b8c0a1b5703460d4c4d8923e18b56ab937b8226c..593f210e5bf842d38955205757c162c2fdede511 100644 +index 808e564789d826c1778c053ab91038e3d4d81b7f..150afceb491cfd254c0f1b84800e6df14cf26676 100644 --- a/src/main/java/net/minecraft/world/entity/decoration/ArmorStand.java +++ b/src/main/java/net/minecraft/world/entity/decoration/ArmorStand.java @@ -342,7 +342,7 @@ public class ArmorStand extends LivingEntity { diff --git a/patches/server/0532-Added-missing-default-perms-for-commands.patch b/patches/server/0531-Added-missing-default-perms-for-commands.patch similarity index 100% rename from patches/server/0532-Added-missing-default-perms-for-commands.patch rename to patches/server/0531-Added-missing-default-perms-for-commands.patch diff --git a/patches/server/0533-Add-PlayerShearBlockEvent.patch b/patches/server/0532-Add-PlayerShearBlockEvent.patch similarity index 100% rename from patches/server/0533-Add-PlayerShearBlockEvent.patch rename to patches/server/0532-Add-PlayerShearBlockEvent.patch diff --git a/patches/server/0534-Fix-curing-zombie-villager-discount-exploit.patch b/patches/server/0533-Fix-curing-zombie-villager-discount-exploit.patch similarity index 57% rename from patches/server/0534-Fix-curing-zombie-villager-discount-exploit.patch rename to patches/server/0533-Fix-curing-zombie-villager-discount-exploit.patch index f28e5d888d..c6cb27bebe 100644 --- a/patches/server/0534-Fix-curing-zombie-villager-discount-exploit.patch +++ b/patches/server/0533-Fix-curing-zombie-villager-discount-exploit.patch @@ -7,24 +7,8 @@ This fixes the exploit used to gain absurd trading discounts with infecting and curing a villager on repeat by simply resetting the relevant part of the reputation when it is cured. -diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -index 4080c12fe98cba1d17da12648a8228de2720b838..1de165b8f62915b9a7d3a834dd344b9e8b275d2e 100644 ---- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -@@ -133,6 +133,11 @@ public class PaperWorldConfig { - fixClimbingBypassingCrammingRule = getBoolean("fix-climbing-bypassing-cramming-rule", fixClimbingBypassingCrammingRule); - } - -+ public boolean fixCuringZombieVillagerDiscountExploit = true; -+ private void fixCuringExploit() { -+ fixCuringZombieVillagerDiscountExploit = getBoolean("game-mechanics.fix-curing-zombie-villager-discount-exploit", fixCuringZombieVillagerDiscountExploit); -+ } -+ - public short keepLoadedRange; - private void keepLoadedRange() { - keepLoadedRange = (short) (getInt("keep-spawn-loaded-range", Math.min(spigotConfig.viewDistance, 10)) * 16); diff --git a/src/main/java/net/minecraft/world/entity/npc/Villager.java b/src/main/java/net/minecraft/world/entity/npc/Villager.java -index 1d2b7950e3c498945a2ff85fda0e3bb30acd22cb..98debcec829ddaa9d37b7e9cc1f42dfd9123393c 100644 +index 1d2b7950e3c498945a2ff85fda0e3bb30acd22cb..10b45ec24a5a0867106d1694312385ad1e267f43 100644 --- a/src/main/java/net/minecraft/world/entity/npc/Villager.java +++ b/src/main/java/net/minecraft/world/entity/npc/Villager.java @@ -976,6 +976,15 @@ public class Villager extends AbstractVillager implements ReputationEventHandler @@ -32,7 +16,7 @@ index 1d2b7950e3c498945a2ff85fda0e3bb30acd22cb..98debcec829ddaa9d37b7e9cc1f42dfd public void onReputationEventFrom(ReputationEventType interaction, Entity entity) { if (interaction == ReputationEventType.ZOMBIE_VILLAGER_CURED) { + // Paper start - fix MC-181190 -+ if (level.paperConfig.fixCuringZombieVillagerDiscountExploit) { ++ if (level.paperConfig().fixes.fixCuringZombieVillagerDiscountExploit) { + final GossipContainer.EntityGossips playerReputation = this.getGossips().getReputations().get(entity.getUUID()); + if (playerReputation != null) { + playerReputation.remove(GossipType.MAJOR_POSITIVE); diff --git a/patches/server/0535-Limit-recipe-packets.patch b/patches/server/0534-Limit-recipe-packets.patch similarity index 67% rename from patches/server/0535-Limit-recipe-packets.patch rename to patches/server/0534-Limit-recipe-packets.patch index f18c79a939..e4f56076b5 100644 --- a/patches/server/0535-Limit-recipe-packets.patch +++ b/patches/server/0534-Limit-recipe-packets.patch @@ -4,26 +4,8 @@ Date: Sat, 12 Dec 2020 23:45:28 +0000 Subject: [PATCH] Limit recipe packets -diff --git a/src/main/java/com/destroystokyo/paper/PaperConfig.java b/src/main/java/com/destroystokyo/paper/PaperConfig.java -index 4bd335699f5f53b8303a86758a9dedae75bf8464..ccc60a5465efa2b71fc2593d75af62c0b64fe66c 100644 ---- a/src/main/java/com/destroystokyo/paper/PaperConfig.java -+++ b/src/main/java/com/destroystokyo/paper/PaperConfig.java -@@ -366,6 +366,13 @@ public class PaperConfig { - tabSpamLimit = getInt("settings.spam-limiter.tab-spam-limit", tabSpamLimit); - } - -+ public static int autoRecipeIncrement = 1; -+ public static int autoRecipeLimit = 20; -+ private static void autoRecipieLimiters() { -+ autoRecipeIncrement = getInt("settings.spam-limiter.recipe-spam-increment", autoRecipeIncrement); -+ autoRecipeLimit = getInt("settings.spam-limiter.recipe-spam-limit", autoRecipeLimit); -+ } -+ - public static boolean velocitySupport; - public static boolean velocityOnlineMode; - public static byte[] velocitySecretKey; diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index 4b144b1b17ea6f498eeeaa8cd4795fa5ce2c4e0f..a9a6583d5d853623b863d61f663044437a936e55 100644 +index 116fbaf688c96578a4ef6b50a1726729a5d19953..ce557881898a7daa5181d7d7861004ef8926c023 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java @@ -247,6 +247,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser @@ -48,7 +30,7 @@ index 4b144b1b17ea6f498eeeaa8cd4795fa5ce2c4e0f..a9a6583d5d853623b863d61f66304443 public void handlePlaceRecipe(ServerboundPlaceRecipePacket packet) { + // Paper start + if (!org.bukkit.Bukkit.isPrimaryThread()) { -+ if (recipeSpamPackets.addAndGet(com.destroystokyo.paper.PaperConfig.autoRecipeIncrement) > com.destroystokyo.paper.PaperConfig.autoRecipeLimit) { ++ if (recipeSpamPackets.addAndGet(io.papermc.paper.configuration.GlobalConfiguration.get().spamLimiter.recipeSpamIncrement) > io.papermc.paper.configuration.GlobalConfiguration.get().spamLimiter.recipeSpamLimit) { + server.scheduleOnMain(() -> this.disconnect(net.minecraft.network.chat.Component.translatable("disconnect.spam", new Object[0]))); // Paper + return; + } diff --git a/patches/server/0536-Fix-CraftSound-backwards-compatibility.patch b/patches/server/0535-Fix-CraftSound-backwards-compatibility.patch similarity index 100% rename from patches/server/0536-Fix-CraftSound-backwards-compatibility.patch rename to patches/server/0535-Fix-CraftSound-backwards-compatibility.patch diff --git a/patches/server/0537-Player-Chunk-Load-Unload-Events.patch b/patches/server/0536-Player-Chunk-Load-Unload-Events.patch similarity index 94% rename from patches/server/0537-Player-Chunk-Load-Unload-Events.patch rename to patches/server/0536-Player-Chunk-Load-Unload-Events.patch index f6f95521c8..3e2f3de011 100644 --- a/patches/server/0537-Player-Chunk-Load-Unload-Events.patch +++ b/patches/server/0536-Player-Chunk-Load-Unload-Events.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Player Chunk Load/Unload Events diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java -index 50af351200d5bc4ce292e4fd123e0b0cb5adb334..0e712658dee832db147a73c24658a8c9116b79cc 100644 +index f0ef38377ae735800323c486d9e42cd00cb69ac8..2ff8d16cf94ab1c7b0f42657e8fb2f3b4aa8a1e2 100644 --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java @@ -2139,11 +2139,21 @@ public class ServerPlayer extends Player { diff --git a/patches/server/0538-Optimize-Dynamic-get-Missing-Keys.patch b/patches/server/0537-Optimize-Dynamic-get-Missing-Keys.patch similarity index 100% rename from patches/server/0538-Optimize-Dynamic-get-Missing-Keys.patch rename to patches/server/0537-Optimize-Dynamic-get-Missing-Keys.patch diff --git a/patches/server/0539-Expose-LivingEntity-hurt-direction.patch b/patches/server/0538-Expose-LivingEntity-hurt-direction.patch similarity index 100% rename from patches/server/0539-Expose-LivingEntity-hurt-direction.patch rename to patches/server/0538-Expose-LivingEntity-hurt-direction.patch diff --git a/patches/server/0540-Add-OBSTRUCTED-reason-to-BedEnterResult.patch b/patches/server/0539-Add-OBSTRUCTED-reason-to-BedEnterResult.patch similarity index 91% rename from patches/server/0540-Add-OBSTRUCTED-reason-to-BedEnterResult.patch rename to patches/server/0539-Add-OBSTRUCTED-reason-to-BedEnterResult.patch index c9021d6c43..39a249774d 100644 --- a/patches/server/0540-Add-OBSTRUCTED-reason-to-BedEnterResult.patch +++ b/patches/server/0539-Add-OBSTRUCTED-reason-to-BedEnterResult.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Add OBSTRUCTED reason to BedEnterResult diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java -index 9a2f0c109181fc45c7388a2a622c4e6cf63cc771..c5fd069085efa57f99698930640198c6fcaa4bfb 100644 +index 396a66ccd90f8b5da42b585b50d2f0d5a80697b7..04923ca78b5866162612c5bc82e03c4ccd024c7f 100644 --- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java +++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java @@ -263,6 +263,10 @@ public class CraftEventFactory { diff --git a/patches/server/0541-Do-not-crash-from-invalid-ingredient-lists-in-Villag.patch b/patches/server/0540-Do-not-crash-from-invalid-ingredient-lists-in-Villag.patch similarity index 100% rename from patches/server/0541-Do-not-crash-from-invalid-ingredient-lists-in-Villag.patch rename to patches/server/0540-Do-not-crash-from-invalid-ingredient-lists-in-Villag.patch diff --git a/patches/server/0542-Add-PlayerTradeEvent-and-PlayerPurchaseEvent.patch b/patches/server/0541-Add-PlayerTradeEvent-and-PlayerPurchaseEvent.patch similarity index 100% rename from patches/server/0542-Add-PlayerTradeEvent-and-PlayerPurchaseEvent.patch rename to patches/server/0541-Add-PlayerTradeEvent-and-PlayerPurchaseEvent.patch diff --git a/patches/server/0543-Implement-TargetHitEvent.patch b/patches/server/0542-Implement-TargetHitEvent.patch similarity index 100% rename from patches/server/0543-Implement-TargetHitEvent.patch rename to patches/server/0542-Implement-TargetHitEvent.patch diff --git a/patches/server/0544-Additional-Block-Material-API-s.patch b/patches/server/0543-Additional-Block-Material-API-s.patch similarity index 100% rename from patches/server/0544-Additional-Block-Material-API-s.patch rename to patches/server/0543-Additional-Block-Material-API-s.patch diff --git a/patches/server/0545-Fix-harming-potion-dupe.patch b/patches/server/0544-Fix-harming-potion-dupe.patch similarity index 100% rename from patches/server/0545-Fix-harming-potion-dupe.patch rename to patches/server/0544-Fix-harming-potion-dupe.patch diff --git a/patches/server/0546-Implement-API-to-get-Material-from-Boats-and-Minecar.patch b/patches/server/0545-Implement-API-to-get-Material-from-Boats-and-Minecar.patch similarity index 100% rename from patches/server/0546-Implement-API-to-get-Material-from-Boats-and-Minecar.patch rename to patches/server/0545-Implement-API-to-get-Material-from-Boats-and-Minecar.patch diff --git a/patches/server/0547-Cache-burn-durations.patch b/patches/server/0546-Cache-burn-durations.patch similarity index 100% rename from patches/server/0547-Cache-burn-durations.patch rename to patches/server/0546-Cache-burn-durations.patch diff --git a/patches/server/0547-Allow-disabling-mob-spawner-spawn-egg-transformation.patch b/patches/server/0547-Allow-disabling-mob-spawner-spawn-egg-transformation.patch new file mode 100644 index 0000000000..b11735c5d7 --- /dev/null +++ b/patches/server/0547-Allow-disabling-mob-spawner-spawn-egg-transformation.patch @@ -0,0 +1,19 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: BrodyBeckwith +Date: Fri, 9 Oct 2020 20:30:12 -0400 +Subject: [PATCH] Allow disabling mob spawner spawn egg transformation + + +diff --git a/src/main/java/net/minecraft/world/item/SpawnEggItem.java b/src/main/java/net/minecraft/world/item/SpawnEggItem.java +index b518c5d18c2d3486382ed4e59941b155d5534014..6df94a75b7c4c2593598088d84cf0a4a57e3fd99 100644 +--- a/src/main/java/net/minecraft/world/item/SpawnEggItem.java ++++ b/src/main/java/net/minecraft/world/item/SpawnEggItem.java +@@ -61,7 +61,7 @@ public class SpawnEggItem extends Item { + Direction enumdirection = context.getClickedFace(); + BlockState iblockdata = world.getBlockState(blockposition); + +- if (iblockdata.is(Blocks.SPAWNER)) { ++ if (!world.paperConfig().entities.spawning.disableMobSpawnerSpawnEggTransformation && iblockdata.is(Blocks.SPAWNER)) { // Paper + BlockEntity tileentity = world.getBlockEntity(blockposition); + + if (tileentity instanceof SpawnerBlockEntity) { diff --git a/patches/server/0548-Allow-disabling-mob-spawner-spawn-egg-transformation.patch b/patches/server/0548-Allow-disabling-mob-spawner-spawn-egg-transformation.patch deleted file mode 100644 index 7b3383e9de..0000000000 --- a/patches/server/0548-Allow-disabling-mob-spawner-spawn-egg-transformation.patch +++ /dev/null @@ -1,35 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: BrodyBeckwith -Date: Fri, 9 Oct 2020 20:30:12 -0400 -Subject: [PATCH] Allow disabling mob spawner spawn egg transformation - - -diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -index 1de165b8f62915b9a7d3a834dd344b9e8b275d2e..91943aab7cce9690ebbf192b04ab970fa20e7c92 100644 ---- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -@@ -138,6 +138,11 @@ public class PaperWorldConfig { - fixCuringZombieVillagerDiscountExploit = getBoolean("game-mechanics.fix-curing-zombie-villager-discount-exploit", fixCuringZombieVillagerDiscountExploit); - } - -+ public boolean disableMobSpawnerSpawnEggTransformation = false; -+ private void disableMobSpawnerSpawnEggTransformation() { -+ disableMobSpawnerSpawnEggTransformation = getBoolean("game-mechanics.disable-mob-spawner-spawn-egg-transformation", disableMobSpawnerSpawnEggTransformation); -+ } -+ - public short keepLoadedRange; - private void keepLoadedRange() { - keepLoadedRange = (short) (getInt("keep-spawn-loaded-range", Math.min(spigotConfig.viewDistance, 10)) * 16); -diff --git a/src/main/java/net/minecraft/world/item/SpawnEggItem.java b/src/main/java/net/minecraft/world/item/SpawnEggItem.java -index b518c5d18c2d3486382ed4e59941b155d5534014..fb37846e1c9b7715e32d0d5416b1ce4968e543df 100644 ---- a/src/main/java/net/minecraft/world/item/SpawnEggItem.java -+++ b/src/main/java/net/minecraft/world/item/SpawnEggItem.java -@@ -61,7 +61,7 @@ public class SpawnEggItem extends Item { - Direction enumdirection = context.getClickedFace(); - BlockState iblockdata = world.getBlockState(blockposition); - -- if (iblockdata.is(Blocks.SPAWNER)) { -+ if (!world.paperConfig.disableMobSpawnerSpawnEggTransformation && iblockdata.is(Blocks.SPAWNER)) { // Paper - BlockEntity tileentity = world.getBlockEntity(blockposition); - - if (tileentity instanceof SpawnerBlockEntity) { diff --git a/patches/server/0549-Fix-Not-a-string-Map-Conversion-spam.patch b/patches/server/0548-Fix-Not-a-string-Map-Conversion-spam.patch similarity index 100% rename from patches/server/0549-Fix-Not-a-string-Map-Conversion-spam.patch rename to patches/server/0548-Fix-Not-a-string-Map-Conversion-spam.patch diff --git a/patches/server/0550-Implement-PlayerFlowerPotManipulateEvent.patch b/patches/server/0549-Implement-PlayerFlowerPotManipulateEvent.patch similarity index 100% rename from patches/server/0550-Implement-PlayerFlowerPotManipulateEvent.patch rename to patches/server/0549-Implement-PlayerFlowerPotManipulateEvent.patch diff --git a/patches/server/0551-Fix-interact-event-not-being-called-in-adventure.patch b/patches/server/0550-Fix-interact-event-not-being-called-in-adventure.patch similarity index 95% rename from patches/server/0551-Fix-interact-event-not-being-called-in-adventure.patch rename to patches/server/0550-Fix-interact-event-not-being-called-in-adventure.patch index 32f6ee8f4e..4682ff433b 100644 --- a/patches/server/0551-Fix-interact-event-not-being-called-in-adventure.patch +++ b/patches/server/0550-Fix-interact-event-not-being-called-in-adventure.patch @@ -6,7 +6,7 @@ Subject: [PATCH] Fix interact event not being called in adventure Call PlayerInteractEvent when left-clicking on a block in adventure mode diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index a9a6583d5d853623b863d61f663044437a936e55..7f8a270d46f8217f4dcbbb5ed232158bac1b7464 100644 +index ce557881898a7daa5181d7d7861004ef8926c023..0f3a9acf5bd0b17f561a7616d0720951cfc78c23 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java @@ -1778,7 +1778,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser diff --git a/patches/server/0552-Zombie-API-breaking-doors.patch b/patches/server/0551-Zombie-API-breaking-doors.patch similarity index 100% rename from patches/server/0552-Zombie-API-breaking-doors.patch rename to patches/server/0551-Zombie-API-breaking-doors.patch diff --git a/patches/server/0553-Fix-nerfed-slime-when-splitting.patch b/patches/server/0552-Fix-nerfed-slime-when-splitting.patch similarity index 89% rename from patches/server/0553-Fix-nerfed-slime-when-splitting.patch rename to patches/server/0552-Fix-nerfed-slime-when-splitting.patch index f67073b7ae..726d362dff 100644 --- a/patches/server/0553-Fix-nerfed-slime-when-splitting.patch +++ b/patches/server/0552-Fix-nerfed-slime-when-splitting.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Fix nerfed slime when splitting diff --git a/src/main/java/net/minecraft/world/entity/monster/Slime.java b/src/main/java/net/minecraft/world/entity/monster/Slime.java -index aee0180c554949eb16fe1785344c28c4ecc1e0a0..bdc6a7e6a9fcd467f653d53afd7ca2e33776fb06 100644 +index 48feda682284321d18c846e4812909f0e7e649e3..15d5a8290be35c2caebf8e296300e8f32cb597c7 100644 --- a/src/main/java/net/minecraft/world/entity/monster/Slime.java +++ b/src/main/java/net/minecraft/world/entity/monster/Slime.java @@ -239,6 +239,7 @@ public class Slime extends Mob implements Enemy { diff --git a/patches/server/0554-Add-EntityLoadCrossbowEvent.patch b/patches/server/0553-Add-EntityLoadCrossbowEvent.patch similarity index 100% rename from patches/server/0554-Add-EntityLoadCrossbowEvent.patch rename to patches/server/0553-Add-EntityLoadCrossbowEvent.patch diff --git a/patches/server/0555-Guardian-beam-workaround.patch b/patches/server/0554-Guardian-beam-workaround.patch similarity index 100% rename from patches/server/0555-Guardian-beam-workaround.patch rename to patches/server/0554-Guardian-beam-workaround.patch diff --git a/patches/server/0556-Added-WorldGameRuleChangeEvent.patch b/patches/server/0555-Added-WorldGameRuleChangeEvent.patch similarity index 98% rename from patches/server/0556-Added-WorldGameRuleChangeEvent.patch rename to patches/server/0555-Added-WorldGameRuleChangeEvent.patch index 7f7440ef91..e521db51ae 100644 --- a/patches/server/0556-Added-WorldGameRuleChangeEvent.patch +++ b/patches/server/0555-Added-WorldGameRuleChangeEvent.patch @@ -64,7 +64,7 @@ index 800325a544bb9f228ccbeb0a52d7f380a8c6083e..3c93bfeb94168f832904a8462ae23b06 public int get() { diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java -index 99d109ebd9aa0af31916dc81d1a8b1f7bc6d42be..0440a9e3449cdf1a969ba8c7863b73842afebe48 100644 +index 880aeefbda1cba04accf9075240c88c027b5763c..8d6828c93eb76c2df4287df6f6ab9419bd05f2e7 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java @@ -1798,8 +1798,13 @@ public class CraftWorld extends CraftRegionAccessor implements World { diff --git a/patches/server/0557-Added-ServerResourcesReloadedEvent.patch b/patches/server/0556-Added-ServerResourcesReloadedEvent.patch similarity index 97% rename from patches/server/0557-Added-ServerResourcesReloadedEvent.patch rename to patches/server/0556-Added-ServerResourcesReloadedEvent.patch index 5ff3b660f0..7a9691f12e 100644 --- a/patches/server/0557-Added-ServerResourcesReloadedEvent.patch +++ b/patches/server/0556-Added-ServerResourcesReloadedEvent.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Added ServerResourcesReloadedEvent diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index 1f8ce89b46996491043f37783a80f4928acab8ce..f809420b1bd4fd9e4714cdad25cc5640e8ad9264 100644 +index 377c0011cd5c9d51360ff78e314d82259482ae35..4e2b59449f0916927fb4426a0e87b85ca17cbfcd 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java @@ -1966,7 +1966,13 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop +Date: Sat, 28 Nov 2020 18:43:52 -0800 +Subject: [PATCH] Added world settings for mobs picking up loot + + +diff --git a/src/main/java/net/minecraft/world/entity/monster/AbstractSkeleton.java b/src/main/java/net/minecraft/world/entity/monster/AbstractSkeleton.java +index 60064770f08cbee19eeb43bf7c144b6eefbc4888..c2a26b91d9065fdb52a1ded6c3295093c244d7eb 100644 +--- a/src/main/java/net/minecraft/world/entity/monster/AbstractSkeleton.java ++++ b/src/main/java/net/minecraft/world/entity/monster/AbstractSkeleton.java +@@ -150,7 +150,7 @@ public abstract class AbstractSkeleton extends Monster implements RangedAttackMo + this.populateDefaultEquipmentSlots(randomsource, difficulty); + this.populateDefaultEquipmentEnchantments(randomsource, difficulty); + this.reassessWeaponGoal(); +- this.setCanPickUpLoot(randomsource.nextFloat() < 0.55F * difficulty.getSpecialMultiplier()); ++ this.setCanPickUpLoot(this.level.paperConfig().entities.behavior.mobsCanAlwaysPickUpLoot.skeletons || randomsource.nextFloat() < 0.55F * difficulty.getSpecialMultiplier()); // Paper + if (this.getItemBySlot(EquipmentSlot.HEAD).isEmpty()) { + LocalDate localdate = LocalDate.now(); + int i = localdate.get(ChronoField.DAY_OF_MONTH); +diff --git a/src/main/java/net/minecraft/world/entity/monster/Zombie.java b/src/main/java/net/minecraft/world/entity/monster/Zombie.java +index 67fe3b79b6fe4064b26f87734174a394b9e2b3e3..c84bae4aac13698893420e669ca323194e28ca48 100644 +--- a/src/main/java/net/minecraft/world/entity/monster/Zombie.java ++++ b/src/main/java/net/minecraft/world/entity/monster/Zombie.java +@@ -509,7 +509,7 @@ public class Zombie extends Monster { + Object object = super.finalizeSpawn(world, difficulty, spawnReason, entityData, entityNbt); + float f = difficulty.getSpecialMultiplier(); + +- this.setCanPickUpLoot(randomsource.nextFloat() < 0.55F * f); ++ this.setCanPickUpLoot(this.level.paperConfig().entities.behavior.mobsCanAlwaysPickUpLoot.zombies || randomsource.nextFloat() < 0.55F * f); // Paper + if (object == null) { + object = new Zombie.ZombieGroupData(Zombie.getSpawnAsBabyOdds(randomsource), true); + } diff --git a/patches/server/0558-Added-world-settings-for-mobs-picking-up-loot.patch b/patches/server/0558-Added-world-settings-for-mobs-picking-up-loot.patch deleted file mode 100644 index 4896268efb..0000000000 --- a/patches/server/0558-Added-world-settings-for-mobs-picking-up-loot.patch +++ /dev/null @@ -1,51 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Jake Potrebic -Date: Sat, 28 Nov 2020 18:43:52 -0800 -Subject: [PATCH] Added world settings for mobs picking up loot - - -diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -index 91943aab7cce9690ebbf192b04ab970fa20e7c92..5af5b702f53f3664eac1f19a15689c92de8d40ae 100644 ---- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -@@ -787,6 +787,14 @@ public class PaperWorldConfig { - phantomOnlyAttackInsomniacs = getBoolean("phantoms-only-attack-insomniacs", phantomOnlyAttackInsomniacs); - } - -+ public boolean zombiesAlwaysCanPickUpLoot; -+ public boolean skeletonsAlwaysCanPickUpLoot; -+ private void setMobsAlwaysCanPickUpLoot() { -+ zombiesAlwaysCanPickUpLoot = getBoolean("mobs-can-always-pick-up-loot.zombies", false); -+ skeletonsAlwaysCanPickUpLoot = getBoolean("mobs-can-always-pick-up-loot.skeletons", false); -+ log("Zombies can always pick up loot: " + zombiesAlwaysCanPickUpLoot + ". Skeletons can always pick up loot: " + skeletonsAlwaysCanPickUpLoot + "."); -+ } -+ - public int expMergeMaxValue; - private void expMergeMaxValue() { - expMergeMaxValue = getInt("experience-merge-max-value", -1); -diff --git a/src/main/java/net/minecraft/world/entity/monster/AbstractSkeleton.java b/src/main/java/net/minecraft/world/entity/monster/AbstractSkeleton.java -index 60064770f08cbee19eeb43bf7c144b6eefbc4888..5f679d5f148e59376669a5faa970961df219fe35 100644 ---- a/src/main/java/net/minecraft/world/entity/monster/AbstractSkeleton.java -+++ b/src/main/java/net/minecraft/world/entity/monster/AbstractSkeleton.java -@@ -150,7 +150,7 @@ public abstract class AbstractSkeleton extends Monster implements RangedAttackMo - this.populateDefaultEquipmentSlots(randomsource, difficulty); - this.populateDefaultEquipmentEnchantments(randomsource, difficulty); - this.reassessWeaponGoal(); -- this.setCanPickUpLoot(randomsource.nextFloat() < 0.55F * difficulty.getSpecialMultiplier()); -+ this.setCanPickUpLoot(this.level.paperConfig.skeletonsAlwaysCanPickUpLoot || randomsource.nextFloat() < 0.55F * difficulty.getSpecialMultiplier()); // Paper - if (this.getItemBySlot(EquipmentSlot.HEAD).isEmpty()) { - LocalDate localdate = LocalDate.now(); - int i = localdate.get(ChronoField.DAY_OF_MONTH); -diff --git a/src/main/java/net/minecraft/world/entity/monster/Zombie.java b/src/main/java/net/minecraft/world/entity/monster/Zombie.java -index 847dbd6dae8e9a615ade642c598bc7bb45fb4722..6d0461a2cf3c06d85177ca4959f330c1ec7f6788 100644 ---- a/src/main/java/net/minecraft/world/entity/monster/Zombie.java -+++ b/src/main/java/net/minecraft/world/entity/monster/Zombie.java -@@ -508,7 +508,7 @@ public class Zombie extends Monster { - Object object = super.finalizeSpawn(world, difficulty, spawnReason, entityData, entityNbt); - float f = difficulty.getSpecialMultiplier(); - -- this.setCanPickUpLoot(randomsource.nextFloat() < 0.55F * f); -+ this.setCanPickUpLoot(this.level.paperConfig.zombiesAlwaysCanPickUpLoot || randomsource.nextFloat() < 0.55F * f); // Paper - if (object == null) { - object = new Zombie.ZombieGroupData(Zombie.getSpawnAsBabyOdds(randomsource), true); - } diff --git a/patches/server/0559-Implemented-BlockFailedDispenseEvent.patch b/patches/server/0558-Implemented-BlockFailedDispenseEvent.patch similarity index 96% rename from patches/server/0559-Implemented-BlockFailedDispenseEvent.patch rename to patches/server/0558-Implemented-BlockFailedDispenseEvent.patch index 0f004df82e..18962ea0b8 100644 --- a/patches/server/0559-Implemented-BlockFailedDispenseEvent.patch +++ b/patches/server/0558-Implemented-BlockFailedDispenseEvent.patch @@ -32,7 +32,7 @@ index 1415ad60163f6584619cc7caa61f1848d6ebaa93..801c4c120e98584bcf218a4ef9bd66d7 } else { ItemStack itemstack = tileentitydispenser.getItem(i); diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java -index c5fd069085efa57f99698930640198c6fcaa4bfb..ed5c598a803748bc001f8ee5ca40b8aa6fe72a3a 100644 +index 04923ca78b5866162612c5bc82e03c4ccd024c7f..99ce890f6014b66f7fd699cf72089fd3224fe30b 100644 --- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java +++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java @@ -1865,4 +1865,12 @@ public class CraftEventFactory { diff --git a/patches/server/0560-Added-PlayerLecternPageChangeEvent.patch b/patches/server/0559-Added-PlayerLecternPageChangeEvent.patch similarity index 100% rename from patches/server/0560-Added-PlayerLecternPageChangeEvent.patch rename to patches/server/0559-Added-PlayerLecternPageChangeEvent.patch diff --git a/patches/server/0561-Added-PlayerLoomPatternSelectEvent.patch b/patches/server/0560-Added-PlayerLoomPatternSelectEvent.patch similarity index 100% rename from patches/server/0561-Added-PlayerLoomPatternSelectEvent.patch rename to patches/server/0560-Added-PlayerLoomPatternSelectEvent.patch diff --git a/patches/server/0561-Configurable-door-breaking-difficulty.patch b/patches/server/0561-Configurable-door-breaking-difficulty.patch new file mode 100644 index 0000000000..45e5e3e168 --- /dev/null +++ b/patches/server/0561-Configurable-door-breaking-difficulty.patch @@ -0,0 +1,33 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Jake Potrebic +Date: Sun, 3 Jan 2021 22:27:43 -0800 +Subject: [PATCH] Configurable door breaking difficulty + +Co-authored-by: Doc + +diff --git a/src/main/java/net/minecraft/world/entity/monster/Vindicator.java b/src/main/java/net/minecraft/world/entity/monster/Vindicator.java +index ffc8e20d916940fb5e28bac610e3c6bd3d493f78..a9e75a16a7dc0ff5d4f0faa92ebc444559a39325 100644 +--- a/src/main/java/net/minecraft/world/entity/monster/Vindicator.java ++++ b/src/main/java/net/minecraft/world/entity/monster/Vindicator.java +@@ -197,7 +197,7 @@ public class Vindicator extends AbstractIllager { + + static class VindicatorBreakDoorGoal extends BreakDoorGoal { + public VindicatorBreakDoorGoal(Mob mob) { +- super(mob, 6, Vindicator.DOOR_BREAKING_PREDICATE); ++ super(mob, 6, com.google.common.base.Predicates.in(mob.level.paperConfig().entities.behavior.doorBreakingDifficulty.getOrDefault(mob.getType(), mob.level.paperConfig().entities.behavior.doorBreakingDifficulty.get(EntityType.VINDICATOR)))); // Paper + this.setFlags(EnumSet.of(Goal.Flag.MOVE)); + } + +diff --git a/src/main/java/net/minecraft/world/entity/monster/Zombie.java b/src/main/java/net/minecraft/world/entity/monster/Zombie.java +index c84bae4aac13698893420e669ca323194e28ca48..3e1fa4336cc18eaeb048d0a1d592cf74820ff3b2 100644 +--- a/src/main/java/net/minecraft/world/entity/monster/Zombie.java ++++ b/src/main/java/net/minecraft/world/entity/monster/Zombie.java +@@ -98,7 +98,7 @@ public class Zombie extends Monster { + + public Zombie(EntityType type, Level world) { + super(type, world); +- this.breakDoorGoal = new BreakDoorGoal(this, Zombie.DOOR_BREAKING_PREDICATE); ++ this.breakDoorGoal = new BreakDoorGoal(this, com.google.common.base.Predicates.in(world.paperConfig().entities.behavior.doorBreakingDifficulty.getOrDefault(type, world.paperConfig().entities.behavior.doorBreakingDifficulty.get(EntityType.ZOMBIE)))); // Paper + } + + public Zombie(Level world) { diff --git a/patches/server/0562-Configurable-door-breaking-difficulty.patch b/patches/server/0562-Configurable-door-breaking-difficulty.patch deleted file mode 100644 index fd7f614a89..0000000000 --- a/patches/server/0562-Configurable-door-breaking-difficulty.patch +++ /dev/null @@ -1,65 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Jake Potrebic -Date: Sun, 3 Jan 2021 22:27:43 -0800 -Subject: [PATCH] Configurable door breaking difficulty - -Co-authored-by: Doc - -diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -index 5af5b702f53f3664eac1f19a15689c92de8d40ae..5d7fe47e134b50a870e3653230ff4067b2cf9074 100644 ---- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -@@ -142,6 +142,27 @@ public class PaperWorldConfig { - private void disableMobSpawnerSpawnEggTransformation() { - disableMobSpawnerSpawnEggTransformation = getBoolean("game-mechanics.disable-mob-spawner-spawn-egg-transformation", disableMobSpawnerSpawnEggTransformation); - } -+ -+ private final List> entitiesValidForBreakDoors = Arrays.asList(net.minecraft.world.entity.EntityType.ZOMBIE, net.minecraft.world.entity.EntityType.ZOMBIE_VILLAGER, net.minecraft.world.entity.EntityType.HUSK, net.minecraft.world.entity.EntityType.ZOMBIFIED_PIGLIN, net.minecraft.world.entity.EntityType.VINDICATOR); -+ public java.util.Map, java.util.List> entitiesDifficultyBreakDoors = new it.unimi.dsi.fastutil.objects.Reference2ObjectOpenHashMap<>(); -+ private void setupEntityBreakingDoors() { -+ for (net.minecraft.world.entity.EntityType entityType : entitiesValidForBreakDoors) { -+ java.util.function.Predicate difficultyPredicate = net.minecraft.world.entity.monster.Zombie.DOOR_BREAKING_PREDICATE; -+ if (entityType == net.minecraft.world.entity.EntityType.VINDICATOR) { -+ difficultyPredicate = net.minecraft.world.entity.monster.Vindicator.DOOR_BREAKING_PREDICATE; -+ } -+ entitiesDifficultyBreakDoors.put( -+ entityType, -+ getEnumList( -+ "door-breaking-difficulty." + entityType.id, -+ java.util.Arrays.stream(net.minecraft.world.Difficulty.values()) -+ .filter(difficultyPredicate) -+ .collect(Collectors.toList()), -+ net.minecraft.world.Difficulty.class -+ ) -+ ); -+ } -+ } - - public short keepLoadedRange; - private void keepLoadedRange() { -diff --git a/src/main/java/net/minecraft/world/entity/monster/Vindicator.java b/src/main/java/net/minecraft/world/entity/monster/Vindicator.java -index ffc8e20d916940fb5e28bac610e3c6bd3d493f78..8914a0e2aab28fe2198f8e117f206abffae8b7d0 100644 ---- a/src/main/java/net/minecraft/world/entity/monster/Vindicator.java -+++ b/src/main/java/net/minecraft/world/entity/monster/Vindicator.java -@@ -197,7 +197,7 @@ public class Vindicator extends AbstractIllager { - - static class VindicatorBreakDoorGoal extends BreakDoorGoal { - public VindicatorBreakDoorGoal(Mob mob) { -- super(mob, 6, Vindicator.DOOR_BREAKING_PREDICATE); -+ super(mob, 6, com.google.common.base.Predicates.in(mob.level.paperConfig.entitiesDifficultyBreakDoors.getOrDefault(mob.getType(), mob.level.paperConfig.entitiesDifficultyBreakDoors.get(EntityType.VINDICATOR)))); // Paper - this.setFlags(EnumSet.of(Goal.Flag.MOVE)); - } - -diff --git a/src/main/java/net/minecraft/world/entity/monster/Zombie.java b/src/main/java/net/minecraft/world/entity/monster/Zombie.java -index 6d0461a2cf3c06d85177ca4959f330c1ec7f6788..4e348ea70ecc3836befcffcaa27c12a104f29c2a 100644 ---- a/src/main/java/net/minecraft/world/entity/monster/Zombie.java -+++ b/src/main/java/net/minecraft/world/entity/monster/Zombie.java -@@ -97,7 +97,7 @@ public class Zombie extends Monster { - - public Zombie(EntityType type, Level world) { - super(type, world); -- this.breakDoorGoal = new BreakDoorGoal(this, Zombie.DOOR_BREAKING_PREDICATE); -+ this.breakDoorGoal = new BreakDoorGoal(this, com.google.common.base.Predicates.in(world.paperConfig.entitiesDifficultyBreakDoors.getOrDefault(type, world.paperConfig.entitiesDifficultyBreakDoors.get(EntityType.ZOMBIE)))); // Paper - } - - public Zombie(Level world) { diff --git a/patches/server/0563-Empty-commands-shall-not-be-dispatched.patch b/patches/server/0562-Empty-commands-shall-not-be-dispatched.patch similarity index 100% rename from patches/server/0563-Empty-commands-shall-not-be-dispatched.patch rename to patches/server/0562-Empty-commands-shall-not-be-dispatched.patch diff --git a/patches/server/0564-Implement-API-to-expose-exact-interaction-point.patch b/patches/server/0563-Implement-API-to-expose-exact-interaction-point.patch similarity index 97% rename from patches/server/0564-Implement-API-to-expose-exact-interaction-point.patch rename to patches/server/0563-Implement-API-to-expose-exact-interaction-point.patch index 36a21049de..40da330f0e 100644 --- a/patches/server/0564-Implement-API-to-expose-exact-interaction-point.patch +++ b/patches/server/0563-Implement-API-to-expose-exact-interaction-point.patch @@ -18,7 +18,7 @@ index 32c78828b0c85949832dc25843c881b8eecc63d6..06e7a8b8227260c002a88119544b99a1 this.interactResult = event.useItemInHand() == Event.Result.DENY; this.interactPosition = blockposition.immutable(); diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java -index ed5c598a803748bc001f8ee5ca40b8aa6fe72a3a..dbc777a7d872116da0f60953fc6a650df17d9f5c 100644 +index 99ce890f6014b66f7fd699cf72089fd3224fe30b..dadbb7d5295eea5097a2563775ae86b8a14d92f8 100644 --- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java +++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java @@ -56,7 +56,9 @@ import net.minecraft.world.level.storage.loot.parameters.LootContextParams; diff --git a/patches/server/0565-Remove-stale-POIs.patch b/patches/server/0564-Remove-stale-POIs.patch similarity index 91% rename from patches/server/0565-Remove-stale-POIs.patch rename to patches/server/0564-Remove-stale-POIs.patch index 5090856560..b98565818a 100644 --- a/patches/server/0565-Remove-stale-POIs.patch +++ b/patches/server/0564-Remove-stale-POIs.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Remove stale POIs diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java -index 8788325368e80eb162b0f665ae0995fe74317b4a..c2c2c5f10b1f748a90f5d72148c9a9e6bdecfaf4 100644 +index 9278e992e24b35d8a700ac241968e41955720cfd..a679742adaca71926614203eab53099deeb6fc51 100644 --- a/src/main/java/net/minecraft/server/level/ServerLevel.java +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java @@ -1912,6 +1912,11 @@ public class ServerLevel extends Level implements WorldGenLevel { diff --git a/patches/server/0566-Fix-villager-boat-exploit.patch b/patches/server/0565-Fix-villager-boat-exploit.patch similarity index 93% rename from patches/server/0566-Fix-villager-boat-exploit.patch rename to patches/server/0565-Fix-villager-boat-exploit.patch index e4b9ff8cca..41111aa03e 100644 --- a/patches/server/0566-Fix-villager-boat-exploit.patch +++ b/patches/server/0565-Fix-villager-boat-exploit.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Fix villager boat exploit diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java -index bec5dbb3b103403e76cd42b942b352c453574ce1..9a27895d9528dd10e196fe7e7d2fb9d7561fa704 100644 +index 75c713f7afd8c4fd5fffada7397b102751eb6423..6c7105af36339514db02800e651cd0948d48bdaf 100644 --- a/src/main/java/net/minecraft/server/players/PlayerList.java +++ b/src/main/java/net/minecraft/server/players/PlayerList.java @@ -625,6 +625,14 @@ public abstract class PlayerList { diff --git a/patches/server/0567-Add-sendOpLevel-API.patch b/patches/server/0566-Add-sendOpLevel-API.patch similarity index 91% rename from patches/server/0567-Add-sendOpLevel-API.patch rename to patches/server/0566-Add-sendOpLevel-API.patch index cb137d2e5f..ffbc6cda63 100644 --- a/patches/server/0567-Add-sendOpLevel-API.patch +++ b/patches/server/0566-Add-sendOpLevel-API.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Add sendOpLevel API diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java -index 9a27895d9528dd10e196fe7e7d2fb9d7561fa704..7662e4f590d9e3146783239a662b452741b97147 100644 +index 6c7105af36339514db02800e651cd0948d48bdaf..42b2f5c61e2bd07c3c86d889949c5f24345680d6 100644 --- a/src/main/java/net/minecraft/server/players/PlayerList.java +++ b/src/main/java/net/minecraft/server/players/PlayerList.java @@ -1123,6 +1123,11 @@ public abstract class PlayerList { @@ -32,7 +32,7 @@ index 9a27895d9528dd10e196fe7e7d2fb9d7561fa704..7662e4f590d9e3146783239a662b4527 public boolean isWhiteListed(GameProfile profile) { diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -index 551f82b78a9deca1b702d488743e079cca744f99..9a213d1313f0418e4f68e40083ae764e5d1b6c78 100644 +index 772c7c34df1938efb4f97ef21ba39d75a5b8a1a5..482a6385d6d8072e2724054b91ea0347a648f8bc 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java @@ -606,6 +606,13 @@ public class CraftPlayer extends CraftHumanEntity implements Player { diff --git a/patches/server/0568-Add-PaperRegistry.patch b/patches/server/0567-Add-PaperRegistry.patch similarity index 98% rename from patches/server/0568-Add-PaperRegistry.patch rename to patches/server/0567-Add-PaperRegistry.patch index 1a87131b17..db485181c1 100644 --- a/patches/server/0568-Add-PaperRegistry.patch +++ b/patches/server/0567-Add-PaperRegistry.patch @@ -193,7 +193,7 @@ index 0000000000000000000000000000000000000000..6f39e343147803e15e7681c993b8797a +public record RegistryKey(Class apiClass, ResourceKey> resourceKey) { +} diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index f809420b1bd4fd9e4714cdad25cc5640e8ad9264..129a93d401a2d0912b1229fa394243861506c461 100644 +index 4e2b59449f0916927fb4426a0e87b85ca17cbfcd..2dbd4718b98f90842600ae4cde927b09d5fc738b 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java @@ -1998,6 +1998,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop 10.0F) { -+ if (f > entity.level.paperConfig.maxLeashDistance) { // Paper ++ if (f > entity.level.paperConfig().misc.maxLeashDistance) { // Paper this.level.getCraftServer().getPluginManager().callEvent(new EntityUnleashEvent(this.getBukkitEntity(), EntityUnleashEvent.UnleashReason.DISTANCE)); // CraftBukkit this.dropLeash(true, true); } @@ -39,7 +22,7 @@ index 3db309e709cd72e3aae184ff2f8b1a7b98f2c7a8..9f2e5cd76376f0f15ed7d93018af2f60 this.onLeashDistance(f); - if (f > 10.0F) { -+ if (f > entity.level.paperConfig.maxLeashDistance) { // Paper ++ if (f > entity.level.paperConfig().misc.maxLeashDistance) { // Paper this.level.getCraftServer().getPluginManager().callEvent(new EntityUnleashEvent(this.getBukkitEntity(), EntityUnleashEvent.UnleashReason.DISTANCE)); // CraftBukkit this.dropLeash(true, true); this.goalSelector.disableControlFlag(Goal.Flag.MOVE); diff --git a/patches/server/0575-Implement-BlockPreDispenseEvent.patch b/patches/server/0574-Implement-BlockPreDispenseEvent.patch similarity index 95% rename from patches/server/0575-Implement-BlockPreDispenseEvent.patch rename to patches/server/0574-Implement-BlockPreDispenseEvent.patch index f868b59a7c..356107718c 100644 --- a/patches/server/0575-Implement-BlockPreDispenseEvent.patch +++ b/patches/server/0574-Implement-BlockPreDispenseEvent.patch @@ -17,7 +17,7 @@ index 85c5319837295bd2f85baebfe8d6660b267f1d5f..8f55d0753fa26924235c943595f0d1a0 tileentitydispenser.setItem(i, idispensebehavior.dispense(sourceblock, itemstack)); } diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java -index dbc777a7d872116da0f60953fc6a650df17d9f5c..30bf86f0f22b783273286b4372541f8a2def0eb2 100644 +index dadbb7d5295eea5097a2563775ae86b8a14d92f8..448dff5c789283f0c17373f3efed2660f16199d1 100644 --- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java +++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java @@ -1883,5 +1883,11 @@ public class CraftEventFactory { diff --git a/patches/server/0576-Added-firing-of-PlayerChangeBeaconEffectEvent.patch b/patches/server/0575-Added-firing-of-PlayerChangeBeaconEffectEvent.patch similarity index 100% rename from patches/server/0576-Added-firing-of-PlayerChangeBeaconEffectEvent.patch rename to patches/server/0575-Added-firing-of-PlayerChangeBeaconEffectEvent.patch diff --git a/patches/server/0576-Add-toggle-for-always-placing-the-dragon-egg.patch b/patches/server/0576-Add-toggle-for-always-placing-the-dragon-egg.patch new file mode 100644 index 0000000000..caffaecf90 --- /dev/null +++ b/patches/server/0576-Add-toggle-for-always-placing-the-dragon-egg.patch @@ -0,0 +1,19 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: William Blake Galbreath +Date: Thu, 26 Nov 2020 11:47:24 +0000 +Subject: [PATCH] Add toggle for always placing the dragon egg + + +diff --git a/src/main/java/net/minecraft/world/level/dimension/end/EndDragonFight.java b/src/main/java/net/minecraft/world/level/dimension/end/EndDragonFight.java +index 3e1e8b42f963fab17e416760b93e7c1c0a9a7f45..42dc41311e9bc716dcd88f90cbbf533884bf92a3 100644 +--- a/src/main/java/net/minecraft/world/level/dimension/end/EndDragonFight.java ++++ b/src/main/java/net/minecraft/world/level/dimension/end/EndDragonFight.java +@@ -368,7 +368,7 @@ public class EndDragonFight { + this.dragonEvent.setVisible(false); + this.spawnExitPortal(true); + this.spawnNewGateway(); +- if (!this.previouslyKilled) { ++ if (this.level.paperConfig().entities.behavior.enderDragonsDeathAlwaysPlacesDragonEgg || !this.previouslyKilled) { // Paper - always place dragon egg + this.level.setBlockAndUpdate(this.level.getHeightmapPos(Heightmap.Types.MOTION_BLOCKING, EndPodiumFeature.END_PODIUM_LOCATION), Blocks.DRAGON_EGG.defaultBlockState()); + } + diff --git a/patches/server/0577-Add-toggle-for-always-placing-the-dragon-egg.patch b/patches/server/0577-Add-toggle-for-always-placing-the-dragon-egg.patch deleted file mode 100644 index 27f838dae5..0000000000 --- a/patches/server/0577-Add-toggle-for-always-placing-the-dragon-egg.patch +++ /dev/null @@ -1,35 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: William Blake Galbreath -Date: Thu, 26 Nov 2020 11:47:24 +0000 -Subject: [PATCH] Add toggle for always placing the dragon egg - - -diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -index 0d3133cc423d024be8fdd0f270564bf550cd8232..d4eaf3f33b6733ddb542e1fc6837d0e46ea7aa53 100644 ---- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -@@ -819,6 +819,11 @@ public class PaperWorldConfig { - perPlayerMobSpawns = getBoolean("per-player-mob-spawns", true); - } - -+ public boolean enderDragonsDeathAlwaysPlacesDragonEgg = false; -+ private void enderDragonsDeathAlwaysPlacesDragonEgg() { -+ enderDragonsDeathAlwaysPlacesDragonEgg = getBoolean("ender-dragons-death-always-places-dragon-egg", enderDragonsDeathAlwaysPlacesDragonEgg); -+ } -+ - public boolean phantomIgnoreCreative = true; - public boolean phantomOnlyAttackInsomniacs = true; - private void phantomSettings() { -diff --git a/src/main/java/net/minecraft/world/level/dimension/end/EndDragonFight.java b/src/main/java/net/minecraft/world/level/dimension/end/EndDragonFight.java -index 9c5224bd63c63728e86555769702da2f9d0dbbce..452b4cddd2afa4875c760f479c22b017ab05d05e 100644 ---- a/src/main/java/net/minecraft/world/level/dimension/end/EndDragonFight.java -+++ b/src/main/java/net/minecraft/world/level/dimension/end/EndDragonFight.java -@@ -368,7 +368,7 @@ public class EndDragonFight { - this.dragonEvent.setVisible(false); - this.spawnExitPortal(true); - this.spawnNewGateway(); -- if (!this.previouslyKilled) { -+ if (this.level.paperConfig.enderDragonsDeathAlwaysPlacesDragonEgg || !this.previouslyKilled) { // Paper - always place dragon egg - this.level.setBlockAndUpdate(this.level.getHeightmapPos(Heightmap.Types.MOTION_BLOCKING, EndPodiumFeature.END_PODIUM_LOCATION), Blocks.DRAGON_EGG.defaultBlockState()); - } - diff --git a/patches/server/0578-Added-PlayerStonecutterRecipeSelectEvent.patch b/patches/server/0577-Added-PlayerStonecutterRecipeSelectEvent.patch similarity index 100% rename from patches/server/0578-Added-PlayerStonecutterRecipeSelectEvent.patch rename to patches/server/0577-Added-PlayerStonecutterRecipeSelectEvent.patch diff --git a/patches/server/0579-Add-dropLeash-variable-to-EntityUnleashEvent.patch b/patches/server/0578-Add-dropLeash-variable-to-EntityUnleashEvent.patch similarity index 95% rename from patches/server/0579-Add-dropLeash-variable-to-EntityUnleashEvent.patch rename to patches/server/0578-Add-dropLeash-variable-to-EntityUnleashEvent.patch index c161493716..28592b4b7e 100644 --- a/patches/server/0579-Add-dropLeash-variable-to-EntityUnleashEvent.patch +++ b/patches/server/0578-Add-dropLeash-variable-to-EntityUnleashEvent.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Add dropLeash variable to EntityUnleashEvent diff --git a/src/main/java/net/minecraft/world/entity/Mob.java b/src/main/java/net/minecraft/world/entity/Mob.java -index 9e0f1938f534a61abc00ed80c8effd7d15056195..0582c118b6206406764d1ea83ca6289cbb0a1392 100644 +index 1a2e5e8c32a2fabe3b92ded6c630b8258b57bc0f..837c0a8bd15388bdb60d6950a437640459adde3c 100644 --- a/src/main/java/net/minecraft/world/entity/Mob.java +++ b/src/main/java/net/minecraft/world/entity/Mob.java @@ -1242,12 +1242,15 @@ public abstract class Mob extends LivingEntity { @@ -69,13 +69,13 @@ index 9e0f1938f534a61abc00ed80c8effd7d15056195..0582c118b6206406764d1ea83ca6289c if (!itemstack.isEmpty()) itemstack.setCount(0); // CraftBukkit }); diff --git a/src/main/java/net/minecraft/world/entity/PathfinderMob.java b/src/main/java/net/minecraft/world/entity/PathfinderMob.java -index 9f2e5cd76376f0f15ed7d93018af2f605eb12e15..41fa86e009a6bc2faf32a211639e8bc6a40bb00c 100644 +index 15f56707a1f06f5c33f231a15a6c5f4b4a85cb4e..f5cb3576aa2560c86f4a1df9d51d8ecde4e98905 100644 --- a/src/main/java/net/minecraft/world/entity/PathfinderMob.java +++ b/src/main/java/net/minecraft/world/entity/PathfinderMob.java @@ -49,8 +49,11 @@ public abstract class PathfinderMob extends Mob { if (this instanceof TamableAnimal && ((TamableAnimal) this).isInSittingPose()) { - if (f > entity.level.paperConfig.maxLeashDistance) { // Paper + if (f > entity.level.paperConfig().misc.maxLeashDistance) { // Paper - this.level.getCraftServer().getPluginManager().callEvent(new EntityUnleashEvent(this.getBukkitEntity(), EntityUnleashEvent.UnleashReason.DISTANCE)); // CraftBukkit - this.dropLeash(true, true); + // Paper start - drop leash variable @@ -89,7 +89,7 @@ index 9f2e5cd76376f0f15ed7d93018af2f605eb12e15..41fa86e009a6bc2faf32a211639e8bc6 @@ -58,8 +61,11 @@ public abstract class PathfinderMob extends Mob { this.onLeashDistance(f); - if (f > entity.level.paperConfig.maxLeashDistance) { // Paper + if (f > entity.level.paperConfig().misc.maxLeashDistance) { // Paper - this.level.getCraftServer().getPluginManager().callEvent(new EntityUnleashEvent(this.getBukkitEntity(), EntityUnleashEvent.UnleashReason.DISTANCE)); // CraftBukkit - this.dropLeash(true, true); + // Paper start - drop leash variable @@ -122,7 +122,7 @@ index 7eb315aac7737cf443c693147c2cfd871f201724..03de59302041b0bc13922ec129501417 } } diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java -index 30bf86f0f22b783273286b4372541f8a2def0eb2..dbe2d218aa2561b404519245d3ef09b9a1e234e3 100644 +index 448dff5c789283f0c17373f3efed2660f16199d1..ad0a12f5d1b2179b31a307c0c5ca8478fbf43fc1 100644 --- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java +++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java @@ -1524,8 +1524,10 @@ public class CraftEventFactory { diff --git a/patches/server/0580-Reset-shield-blocking-on-dimension-change.patch b/patches/server/0579-Reset-shield-blocking-on-dimension-change.patch similarity index 89% rename from patches/server/0580-Reset-shield-blocking-on-dimension-change.patch rename to patches/server/0579-Reset-shield-blocking-on-dimension-change.patch index e8ed9d6592..3136003d65 100644 --- a/patches/server/0580-Reset-shield-blocking-on-dimension-change.patch +++ b/patches/server/0579-Reset-shield-blocking-on-dimension-change.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Reset shield blocking on dimension change diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java -index 0e712658dee832db147a73c24658a8c9116b79cc..e37bf6844a3cdc85c51787b865f0f37ce70dfaa2 100644 +index 2ff8d16cf94ab1c7b0f42657e8fb2f3b4aa8a1e2..a6a14bf7221dbbb7a1ef42ba8961711e60aa0bf2 100644 --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java @@ -1182,6 +1182,11 @@ public class ServerPlayer extends Player { diff --git a/patches/server/0581-add-DragonEggFormEvent.patch b/patches/server/0580-add-DragonEggFormEvent.patch similarity index 78% rename from patches/server/0581-add-DragonEggFormEvent.patch rename to patches/server/0580-add-DragonEggFormEvent.patch index 4bfe0c03fd..40273bbb47 100644 --- a/patches/server/0581-add-DragonEggFormEvent.patch +++ b/patches/server/0580-add-DragonEggFormEvent.patch @@ -5,7 +5,7 @@ Subject: [PATCH] add DragonEggFormEvent diff --git a/src/main/java/net/minecraft/world/level/dimension/end/EndDragonFight.java b/src/main/java/net/minecraft/world/level/dimension/end/EndDragonFight.java -index 452b4cddd2afa4875c760f479c22b017ab05d05e..ad5b20fb16b19bb2099c2fd840e8f5c20f345577 100644 +index 42dc41311e9bc716dcd88f90cbbf533884bf92a3..99b175625c79fe5c4d944810e3fe11be5eed997f 100644 --- a/src/main/java/net/minecraft/world/level/dimension/end/EndDragonFight.java +++ b/src/main/java/net/minecraft/world/level/dimension/end/EndDragonFight.java @@ -368,9 +368,23 @@ public class EndDragonFight { @@ -17,12 +17,12 @@ index 452b4cddd2afa4875c760f479c22b017ab05d05e..ad5b20fb16b19bb2099c2fd840e8f5c2 + org.bukkit.craftbukkit.block.CraftBlockState eggState = org.bukkit.craftbukkit.block.CraftBlockStates.getBlockState(this.level, eggPosition); + eggState.setData(Blocks.DRAGON_EGG.defaultBlockState()); + io.papermc.paper.event.block.DragonEggFormEvent eggEvent = new io.papermc.paper.event.block.DragonEggFormEvent(org.bukkit.craftbukkit.block.CraftBlock.at(this.level, eggPosition), eggState, -+ new org.bukkit.craftbukkit.boss.CraftDragonBattle(this)); ++ new org.bukkit.craftbukkit.boss.CraftDragonBattle(this)); + // Paper end - DragonEggFormEvent - if (this.level.paperConfig.enderDragonsDeathAlwaysPlacesDragonEgg || !this.previouslyKilled) { // Paper - always place dragon egg + if (this.level.paperConfig().entities.behavior.enderDragonsDeathAlwaysPlacesDragonEgg || !this.previouslyKilled) { // Paper - always place dragon egg - this.level.setBlockAndUpdate(this.level.getHeightmapPos(Heightmap.Types.MOTION_BLOCKING, EndPodiumFeature.END_PODIUM_LOCATION), Blocks.DRAGON_EGG.defaultBlockState()); + // Paper start - DragonEggFormEvent -+ //this.world.setTypeUpdate(this.world.getHighestBlockYAt(HeightMap.Type.MOTION_BLOCKING, WorldGenEndTrophy.a), Blocks.DRAGON_EGG.getBlockData()); ++ //this.level.setBlockAndUpdate(this.level.getHeightmapPos(Heightmap.Types.MOTION_BLOCKING, EndPodiumFeature.END_PODIUM_LOCATION), Blocks.DRAGON_EGG.defaultBlockState()); + } else { + eggEvent.setCancelled(true); + } diff --git a/patches/server/0582-EntityMoveEvent.patch b/patches/server/0581-EntityMoveEvent.patch similarity index 87% rename from patches/server/0582-EntityMoveEvent.patch rename to patches/server/0581-EntityMoveEvent.patch index 4c326eccf7..b8e9affe53 100644 --- a/patches/server/0582-EntityMoveEvent.patch +++ b/patches/server/0581-EntityMoveEvent.patch @@ -5,7 +5,7 @@ Subject: [PATCH] EntityMoveEvent diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index 129a93d401a2d0912b1229fa394243861506c461..d800c1e7e6e5473f2fc4a288315371ccc97806b0 100644 +index 2dbd4718b98f90842600ae4cde927b09d5fc738b..b82e510939281efa3f32d21e8080adcf232285fc 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java @@ -1493,6 +1493,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop 0; // Paper + worldserver.hasEntityMoveEvent = io.papermc.paper.event.entity.EntityMoveEvent.getHandlerList().getRegisteredListeners().length > 0; // Paper - net.minecraft.world.level.block.entity.HopperBlockEntity.skipHopperEvents = worldserver.paperConfig.disableHopperMoveEvents || org.bukkit.event.inventory.InventoryMoveItemEvent.getHandlerList().getRegisteredListeners().length == 0; // Paper + net.minecraft.world.level.block.entity.HopperBlockEntity.skipHopperEvents = worldserver.paperConfig().hopper.disableMoveEvent || org.bukkit.event.inventory.InventoryMoveItemEvent.getHandlerList().getRegisteredListeners().length == 0; // Paper this.profiler.push(() -> { diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java -index c2c2c5f10b1f748a90f5d72148c9a9e6bdecfaf4..e0e046e2ec8f32ef2c57a2fea77386be47c2a1bf 100644 +index a679742adaca71926614203eab53099deeb6fc51..d9ecc467fb2a001856f58c090a6c8fe2d7b717e0 100644 --- a/src/main/java/net/minecraft/server/level/ServerLevel.java +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java @@ -214,6 +214,7 @@ public class ServerLevel extends Level implements WorldGenLevel { @@ -29,7 +29,7 @@ index c2c2c5f10b1f748a90f5d72148c9a9e6bdecfaf4..e0e046e2ec8f32ef2c57a2fea77386be return new Throwable(entity + " Added to world at " + new java.util.Date()); } diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java -index 015e428daf0665af640cef788cfa029e8a198907..db3874f683f19ef4ae2b5e02e08c5c000ae90661 100644 +index c2508c15eca1a0dbc1a368025651ec2a20b2cbb6..5ad9e0c4a00fee75a173904866cd7d210433a3e4 100644 --- a/src/main/java/net/minecraft/world/entity/LivingEntity.java +++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java @@ -3278,6 +3278,20 @@ public abstract class LivingEntity extends Entity { diff --git a/patches/server/0582-added-option-to-disable-pathfinding-updates-on-block.patch b/patches/server/0582-added-option-to-disable-pathfinding-updates-on-block.patch new file mode 100644 index 0000000000..6a807399b8 --- /dev/null +++ b/patches/server/0582-added-option-to-disable-pathfinding-updates-on-block.patch @@ -0,0 +1,26 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: lukas81298 +Date: Mon, 25 Jan 2021 14:37:57 +0100 +Subject: [PATCH] added option to disable pathfinding updates on block changes + + +diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java +index d9ecc467fb2a001856f58c090a6c8fe2d7b717e0..5c42b8ca8498074e0d371dd24ff2ac91afbaf69c 100644 +--- a/src/main/java/net/minecraft/server/level/ServerLevel.java ++++ b/src/main/java/net/minecraft/server/level/ServerLevel.java +@@ -1486,6 +1486,7 @@ public class ServerLevel extends Level implements WorldGenLevel { + } + + this.getChunkSource().blockChanged(pos); ++ if(this.paperConfig().misc.updatePathfindingOnBlockUpdate) { // Paper - option to disable pathfinding updates + VoxelShape voxelshape = oldState.getCollisionShape(this, pos); + VoxelShape voxelshape1 = newState.getCollisionShape(this, pos); + +@@ -1527,6 +1528,7 @@ public class ServerLevel extends Level implements WorldGenLevel { + } + + } ++ } // Paper + } + + @Override diff --git a/patches/server/0584-Inline-shift-direction-fields.patch b/patches/server/0583-Inline-shift-direction-fields.patch similarity index 100% rename from patches/server/0584-Inline-shift-direction-fields.patch rename to patches/server/0583-Inline-shift-direction-fields.patch diff --git a/patches/server/0583-added-option-to-disable-pathfinding-updates-on-block.patch b/patches/server/0583-added-option-to-disable-pathfinding-updates-on-block.patch deleted file mode 100644 index 1a5b928caa..0000000000 --- a/patches/server/0583-added-option-to-disable-pathfinding-updates-on-block.patch +++ /dev/null @@ -1,42 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: lukas81298 -Date: Mon, 25 Jan 2021 14:37:57 +0100 -Subject: [PATCH] added option to disable pathfinding updates on block changes - - -diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -index d4eaf3f33b6733ddb542e1fc6837d0e46ea7aa53..f139bdead1370ae65fb6b8d2ec45b3dfd7a90653 100644 ---- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -@@ -824,6 +824,11 @@ public class PaperWorldConfig { - enderDragonsDeathAlwaysPlacesDragonEgg = getBoolean("ender-dragons-death-always-places-dragon-egg", enderDragonsDeathAlwaysPlacesDragonEgg); - } - -+ public boolean updatePathfindingOnBlockUpdate = true; -+ private void setUpdatePathfindingOnBlockUpdate() { -+ updatePathfindingOnBlockUpdate = getBoolean("update-pathfinding-on-block-update", this.updatePathfindingOnBlockUpdate); -+ } -+ - public boolean phantomIgnoreCreative = true; - public boolean phantomOnlyAttackInsomniacs = true; - private void phantomSettings() { -diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java -index e0e046e2ec8f32ef2c57a2fea77386be47c2a1bf..5ad461eb42724ade2574c0ce9c68df655a4524b4 100644 ---- a/src/main/java/net/minecraft/server/level/ServerLevel.java -+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java -@@ -1486,6 +1486,7 @@ public class ServerLevel extends Level implements WorldGenLevel { - } - - this.getChunkSource().blockChanged(pos); -+ if(this.paperConfig.updatePathfindingOnBlockUpdate) { // Paper - option to disable pathfinding updates - VoxelShape voxelshape = oldState.getCollisionShape(this, pos); - VoxelShape voxelshape1 = newState.getCollisionShape(this, pos); - -@@ -1527,6 +1528,7 @@ public class ServerLevel extends Level implements WorldGenLevel { - } - - } -+ } // Paper - } - - @Override diff --git a/patches/server/0585-Allow-adding-items-to-BlockDropItemEvent.patch b/patches/server/0584-Allow-adding-items-to-BlockDropItemEvent.patch similarity index 95% rename from patches/server/0585-Allow-adding-items-to-BlockDropItemEvent.patch rename to patches/server/0584-Allow-adding-items-to-BlockDropItemEvent.patch index 43455ca0d7..3d7a598a0f 100644 --- a/patches/server/0585-Allow-adding-items-to-BlockDropItemEvent.patch +++ b/patches/server/0584-Allow-adding-items-to-BlockDropItemEvent.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Allow adding items to BlockDropItemEvent diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java -index dbe2d218aa2561b404519245d3ef09b9a1e234e3..b7e0d588d0fa1253e5f3dbd580de190c53a455ea 100644 +index ad0a12f5d1b2179b31a307c0c5ca8478fbf43fc1..090c0cd38877ec06faa1e0ac43389a68c7153dac 100644 --- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java +++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java @@ -396,13 +396,30 @@ public class CraftEventFactory { diff --git a/patches/server/0586-Add-getMainThreadExecutor-to-BukkitScheduler.patch b/patches/server/0585-Add-getMainThreadExecutor-to-BukkitScheduler.patch similarity index 100% rename from patches/server/0586-Add-getMainThreadExecutor-to-BukkitScheduler.patch rename to patches/server/0585-Add-getMainThreadExecutor-to-BukkitScheduler.patch diff --git a/patches/server/0587-living-entity-allow-attribute-registration.patch b/patches/server/0586-living-entity-allow-attribute-registration.patch similarity index 100% rename from patches/server/0587-living-entity-allow-attribute-registration.patch rename to patches/server/0586-living-entity-allow-attribute-registration.patch diff --git a/patches/server/0588-fix-dead-slime-setSize-invincibility.patch b/patches/server/0587-fix-dead-slime-setSize-invincibility.patch similarity index 100% rename from patches/server/0588-fix-dead-slime-setSize-invincibility.patch rename to patches/server/0587-fix-dead-slime-setSize-invincibility.patch diff --git a/patches/server/0589-Merchant-getRecipes-should-return-an-immutable-list.patch b/patches/server/0588-Merchant-getRecipes-should-return-an-immutable-list.patch similarity index 100% rename from patches/server/0589-Merchant-getRecipes-should-return-an-immutable-list.patch rename to patches/server/0588-Merchant-getRecipes-should-return-an-immutable-list.patch diff --git a/patches/server/0590-Add-support-for-hex-color-codes-in-console.patch b/patches/server/0589-Add-support-for-hex-color-codes-in-console.patch similarity index 92% rename from patches/server/0590-Add-support-for-hex-color-codes-in-console.patch rename to patches/server/0589-Add-support-for-hex-color-codes-in-console.patch index 1b0022b5cd..15c5829fef 100644 --- a/patches/server/0590-Add-support-for-hex-color-codes-in-console.patch +++ b/patches/server/0589-Add-support-for-hex-color-codes-in-console.patch @@ -5,21 +5,6 @@ Subject: [PATCH] Add support for hex color codes in console Converts upstream's hex color code legacy format into actual hex color codes in the console. -diff --git a/src/main/java/com/destroystokyo/paper/PaperConfig.java b/src/main/java/com/destroystokyo/paper/PaperConfig.java -index ccc60a5465efa2b71fc2593d75af62c0b64fe66c..3e519fcc3c2930c6e9642b93e78f8c2b8726dea3 100644 ---- a/src/main/java/com/destroystokyo/paper/PaperConfig.java -+++ b/src/main/java/com/destroystokyo/paper/PaperConfig.java -@@ -449,8 +449,10 @@ public class PaperConfig { - } - - public static boolean deobfuscateStacktraces = true; -+ public static boolean useRgbForNamedTextColors = true; - private static void loggerSettings() { - deobfuscateStacktraces = getBoolean("settings.loggers.deobfuscate-stacktraces", deobfuscateStacktraces); -+ useRgbForNamedTextColors = getBoolean("settings.loggers.use-rgb-for-named-text-colors", useRgbForNamedTextColors); - } - - public static boolean allowBlockPermanentBreakingExploits = false; diff --git a/src/main/java/com/destroystokyo/paper/console/TerminalConsoleCommandSender.java b/src/main/java/com/destroystokyo/paper/console/TerminalConsoleCommandSender.java index 685deaa0e5d1ddc13e3a7c0471b1cfcf1710c869..709f2a420ceaffe0101c676ec23e949e8d684465 100644 --- a/src/main/java/com/destroystokyo/paper/console/TerminalConsoleCommandSender.java @@ -53,13 +38,13 @@ index 685deaa0e5d1ddc13e3a7c0471b1cfcf1710c869..709f2a420ceaffe0101c676ec23e949e } diff --git a/src/main/java/io/papermc/paper/console/HexFormattingConverter.java b/src/main/java/io/papermc/paper/console/HexFormattingConverter.java new file mode 100644 -index 0000000000000000000000000000000000000000..ea83ee8762c126c449993a7497257b0bd8663452 +index 0000000000000000000000000000000000000000..f39ae450e316255d315aeb362bf967eadef6ba23 --- /dev/null +++ b/src/main/java/io/papermc/paper/console/HexFormattingConverter.java @@ -0,0 +1,212 @@ +package io.papermc.paper.console; + -+import com.destroystokyo.paper.PaperConfig; ++import io.papermc.paper.configuration.GlobalConfiguration; +import io.papermc.paper.adventure.PaperAdventure; +import net.kyori.adventure.text.format.NamedTextColor; +import net.kyori.adventure.text.format.TextColor; @@ -227,7 +212,7 @@ index 0000000000000000000000000000000000000000..ea83ee8762c126c449993a7497257b0b + + Matcher matcher = NAMED_PATTERN.matcher(content); + StringBuilder buffer = new StringBuilder(); -+ final String[] ansiCodes = PaperConfig.useRgbForNamedTextColors ? RGB_ANSI_CODES : ANSI_ANSI_CODES; ++ final String[] ansiCodes = GlobalConfiguration.get().logging.useRgbForNamedTextColors ? RGB_ANSI_CODES : ANSI_ANSI_CODES; + while (matcher.find()) { + int format = LOOKUP.indexOf(Character.toLowerCase(matcher.group().charAt(1))); + if (format != -1) { @@ -270,7 +255,7 @@ index 0000000000000000000000000000000000000000..ea83ee8762c126c449993a7497257b0b + +} diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index d800c1e7e6e5473f2fc4a288315371ccc97806b0..24e1c7562efbfe4fc8c19f66587dd708f2b2702b 100644 +index b82e510939281efa3f32d21e8080adcf232285fc..3e496aa054ee707abcfd48e31dc0f62ae3371e9d 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java @@ -1670,7 +1670,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop implements EntityTypeTest { @@ -44,7 +44,7 @@ index d7cb3d8b37f225ee4796246aa907da1092fa9a0d..abb2c5c4ac481c7529aa29322babb192 @Override diff --git a/src/main/java/net/minecraft/world/entity/npc/WanderingTraderSpawner.java b/src/main/java/net/minecraft/world/entity/npc/WanderingTraderSpawner.java -index 32bf83d659292b1f067e50eeab101f8d0fe611d9..4ee71a58aff50caf5bd715a4cbe50b134b52c9ff 100644 +index fcde09e155727fe0b8b6acc79700fe4122fd22f0..daa7c4bd8a3f6c28f02b7117b061f0def29e3743 100644 --- a/src/main/java/net/minecraft/world/entity/npc/WanderingTraderSpawner.java +++ b/src/main/java/net/minecraft/world/entity/npc/WanderingTraderSpawner.java @@ -123,7 +123,7 @@ public class WanderingTraderSpawner implements CustomSpawner { diff --git a/patches/server/0607-copy-TESign-isEditable-from-snapshots.patch b/patches/server/0606-copy-TESign-isEditable-from-snapshots.patch similarity index 100% rename from patches/server/0607-copy-TESign-isEditable-from-snapshots.patch rename to patches/server/0606-copy-TESign-isEditable-from-snapshots.patch diff --git a/patches/server/0608-Drop-carried-item-when-player-has-disconnected.patch b/patches/server/0607-Drop-carried-item-when-player-has-disconnected.patch similarity index 92% rename from patches/server/0608-Drop-carried-item-when-player-has-disconnected.patch rename to patches/server/0607-Drop-carried-item-when-player-has-disconnected.patch index 3d969b11f7..0a38c072e9 100644 --- a/patches/server/0608-Drop-carried-item-when-player-has-disconnected.patch +++ b/patches/server/0607-Drop-carried-item-when-player-has-disconnected.patch @@ -7,7 +7,7 @@ Fixes disappearance of held items, when a player gets disconnected and PlayerDro Closes #5036 diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java -index a57b018e7fb82a04e90a4448c75d792337e1a212..f97583b667854cfcb1a25eda844492a03d327a76 100644 +index 2266e4608ff5ed11cbd76767365fe74742b8bc63..39857a042d13c3660cd7cd49cd1117cafbc5dfad 100644 --- a/src/main/java/net/minecraft/server/players/PlayerList.java +++ b/src/main/java/net/minecraft/server/players/PlayerList.java @@ -618,6 +618,14 @@ public abstract class PlayerList { diff --git a/patches/server/0609-forced-whitelist-use-configurable-kick-message.patch b/patches/server/0608-forced-whitelist-use-configurable-kick-message.patch similarity index 92% rename from patches/server/0609-forced-whitelist-use-configurable-kick-message.patch rename to patches/server/0608-forced-whitelist-use-configurable-kick-message.patch index e6a1580a57..54a1281cd5 100644 --- a/patches/server/0609-forced-whitelist-use-configurable-kick-message.patch +++ b/patches/server/0608-forced-whitelist-use-configurable-kick-message.patch @@ -5,7 +5,7 @@ Subject: [PATCH] forced whitelist: use configurable kick message diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index 24e1c7562efbfe4fc8c19f66587dd708f2b2702b..3b950c0a6a660d5d9b957cfc08d85fc2bdb706e4 100644 +index 3e496aa054ee707abcfd48e31dc0f62ae3371e9d..855a4a27cfa706432da6b75e1d80d1214917dab6 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java @@ -2080,7 +2080,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop, Integer> entityPerChunkSaveLimits = new HashMap<>(); -+ private void entityPerChunkSaveLimits() { -+ getInt("entity-per-chunk-save-limit.experience_orb", -1); -+ getInt("entity-per-chunk-save-limit.snowball", -1); -+ getInt("entity-per-chunk-save-limit.ender_pearl", -1); -+ getInt("entity-per-chunk-save-limit.arrow", -1); -+ getInt("entity-per-chunk-save-limit.fireball", -1); -+ getInt("entity-per-chunk-save-limit.small_fireball", -1); -+ -+ addEntityPerChunkSaveLimitsFromSection(config.getConfigurationSection("world-settings.default.entity-per-chunk-save-limit"), entityPerChunkSaveLimits); -+ addEntityPerChunkSaveLimitsFromSection(config.getConfigurationSection("world-settings." + worldName + ".entity-per-chunk-save-limit"), entityPerChunkSaveLimits); -+ } -+ -+ private static void addEntityPerChunkSaveLimitsFromSection(final org.bukkit.configuration.ConfigurationSection section, final Map, Integer> limitMap) { -+ if (section == null) { -+ return; -+ } -+ for (final String key : section.getKeys(false)) { -+ final int value = section.getInt(key); -+ final net.minecraft.world.entity.EntityType type = net.minecraft.world.entity.EntityType.byString(key).orElse(null); -+ if (type == null) { -+ logError("Invalid entity-per-chunk-save-limit config, '" + key+ "' is not a valid entity type. Correct this in paper.yml."); -+ continue; -+ } -+ if (value >= 0) { -+ limitMap.put(type, value); -+ } else { -+ limitMap.remove(type); -+ } -+ } -+ } -+ - public short keepLoadedRange; - private void keepLoadedRange() { - keepLoadedRange = (short) (getInt("keep-spawn-loaded-range", Math.min(spigotConfig.viewDistance, 10)) * 16); diff --git a/src/main/java/net/minecraft/world/entity/EntityType.java b/src/main/java/net/minecraft/world/entity/EntityType.java -index 93f9d3035f42ad5d7d5bac924728b731b7de04e6..b3a769bd144f948b4782bf47a7d37c45b52deab0 100644 +index e7bfd61be4974dbe6abc2ebb870664ff1fce19cb..ac0f0a4da4282c13f6e1f37710cb615d66b8ef2c 100644 --- a/src/main/java/net/minecraft/world/entity/EntityType.java +++ b/src/main/java/net/minecraft/world/entity/EntityType.java @@ -563,9 +563,20 @@ public class EntityType implements EntityTypeTest { @@ -74,7 +22,7 @@ index 93f9d3035f42ad5d7d5bac924728b731b7de04e6..b3a769bd144f948b4782bf47a7d37c45 EntityType.loadEntityRecursive((CompoundTag) nbtbase, world, (entity) -> { + // Paper start + final EntityType entityType = entity.getType(); -+ final int saveLimit = world.paperConfig.entityPerChunkSaveLimits.getOrDefault(entityType, -1); ++ final int saveLimit = world.paperConfig().chunks.entityPerChunkSaveLimit.getOrDefault(entityType, -1); + if (saveLimit > -1) { + if (this.loadedEntityCounts.getOrDefault(entityType, 0) >= saveLimit) { + return null; @@ -86,7 +34,7 @@ index 93f9d3035f42ad5d7d5bac924728b731b7de04e6..b3a769bd144f948b4782bf47a7d37c45 return entity; }); diff --git a/src/main/java/net/minecraft/world/level/chunk/storage/EntityStorage.java b/src/main/java/net/minecraft/world/level/chunk/storage/EntityStorage.java -index dae66dd5dbebc7fd8fc331b1f5f06ec461667830..6408eeb7434f07c30b5e9207ab5f905a593fec79 100644 +index dae66dd5dbebc7fd8fc331b1f5f06ec461667830..de7afc737b1ab099edc29a4ef94baa76329c2947 100644 --- a/src/main/java/net/minecraft/world/level/chunk/storage/EntityStorage.java +++ b/src/main/java/net/minecraft/world/level/chunk/storage/EntityStorage.java @@ -90,7 +90,18 @@ public class EntityStorage implements EntityPersistentStorage { @@ -97,7 +45,7 @@ index dae66dd5dbebc7fd8fc331b1f5f06ec461667830..6408eeb7434f07c30b5e9207ab5f905a dataList.getEntities().forEach((entity) -> { + // Paper start + final EntityType entityType = entity.getType(); -+ final int saveLimit = this.level.paperConfig.entityPerChunkSaveLimits.getOrDefault(entityType, -1); ++ final int saveLimit = this.level.paperConfig().chunks.entityPerChunkSaveLimit.getOrDefault(entityType, -1); + if (saveLimit > -1) { + if (savedEntityCounts.getOrDefault(entityType, 0) >= saveLimit) { + return; diff --git a/patches/server/0612-Expose-protocol-version.patch b/patches/server/0611-Expose-protocol-version.patch similarity index 91% rename from patches/server/0612-Expose-protocol-version.patch rename to patches/server/0611-Expose-protocol-version.patch index 29d0b0c734..5da137f698 100644 --- a/patches/server/0612-Expose-protocol-version.patch +++ b/patches/server/0611-Expose-protocol-version.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Expose protocol version diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java -index bfc413c1ac8dc2f7449cbab304789285121b6185..a74efa4a5888f090d04f6cac57bee98f1132ebe7 100644 +index 599c948db312dc6e416d9f67ec072c16bf2cab74..a978c39049efb30fcb66703b708a0e40868e2a58 100644 --- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java +++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java @@ -536,6 +536,11 @@ public final class CraftMagicNumbers implements UnsafeValues { diff --git a/patches/server/0613-Allow-for-Component-suggestion-tooltips-in-AsyncTabC.patch b/patches/server/0612-Allow-for-Component-suggestion-tooltips-in-AsyncTabC.patch similarity index 98% rename from patches/server/0613-Allow-for-Component-suggestion-tooltips-in-AsyncTabC.patch rename to patches/server/0612-Allow-for-Component-suggestion-tooltips-in-AsyncTabC.patch index cb965157a9..8fa1a77e82 100644 --- a/patches/server/0613-Allow-for-Component-suggestion-tooltips-in-AsyncTabC.patch +++ b/patches/server/0612-Allow-for-Component-suggestion-tooltips-in-AsyncTabC.patch @@ -6,7 +6,7 @@ Subject: [PATCH] Allow for Component suggestion tooltips in diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index 7ce74b7f960a69fdb6e8dedf20b317ee92ad904b..228de7514e67e7c768e8a1e08484fa4fe2ddb9fd 100644 +index 19d00d89c2ebcf6c81ca55207ae3eaa38af97647..d2c951a0e9031af3621b58d02711e55f236168e0 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java @@ -802,12 +802,11 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser diff --git a/patches/server/0614-Enhance-console-tab-completions-for-brigadier-comman.patch b/patches/server/0613-Enhance-console-tab-completions-for-brigadier-comman.patch similarity index 86% rename from patches/server/0614-Enhance-console-tab-completions-for-brigadier-comman.patch rename to patches/server/0613-Enhance-console-tab-completions-for-brigadier-comman.patch index b2e7900d7d..670044d0ed 100644 --- a/patches/server/0614-Enhance-console-tab-completions-for-brigadier-comman.patch +++ b/patches/server/0613-Enhance-console-tab-completions-for-brigadier-comman.patch @@ -4,27 +4,8 @@ Date: Tue, 30 Mar 2021 16:06:08 -0700 Subject: [PATCH] Enhance console tab completions for brigadier commands -diff --git a/src/main/java/com/destroystokyo/paper/PaperConfig.java b/src/main/java/com/destroystokyo/paper/PaperConfig.java -index 3e519fcc3c2930c6e9642b93e78f8c2b8726dea3..39dada86032dce8573d1be40d13daca0e93e47be 100644 ---- a/src/main/java/com/destroystokyo/paper/PaperConfig.java -+++ b/src/main/java/com/destroystokyo/paper/PaperConfig.java -@@ -101,6 +101,14 @@ public class PaperConfig { - trackPluginScoreboards = getBoolean("settings.track-plugin-scoreboards", false); - } - -+ -+ public static boolean enableBrigadierConsoleHighlighting = true; -+ public static boolean enableBrigadierConsoleCompletions = true; -+ private static void consoleSettings() { -+ enableBrigadierConsoleHighlighting = getBoolean("settings.console.enable-brigadier-highlighting", enableBrigadierConsoleHighlighting); -+ enableBrigadierConsoleCompletions = getBoolean("settings.console.enable-brigadier-completions", enableBrigadierConsoleCompletions); -+ } -+ - public static void registerCommands() { - for (Map.Entry entry : commands.entrySet()) { - MinecraftServer.getServer().server.getCommandMap().register(entry.getKey(), "Paper", entry.getValue()); diff --git a/src/main/java/com/destroystokyo/paper/console/PaperConsole.java b/src/main/java/com/destroystokyo/paper/console/PaperConsole.java -index a4070b59e261f0f1ac4beec47b11492f4724bf27..e0b1f0671d16ddddcb6725acd25a1d1d69e42701 100644 +index a4070b59e261f0f1ac4beec47b11492f4724bf27..b0390eedb507d27426d1e1d73bd4ab63aec89ebe 100644 --- a/src/main/java/com/destroystokyo/paper/console/PaperConsole.java +++ b/src/main/java/com/destroystokyo/paper/console/PaperConsole.java @@ -16,11 +16,15 @@ public final class PaperConsole extends SimpleTerminalConsole { @@ -38,7 +19,7 @@ index a4070b59e261f0f1ac4beec47b11492f4724bf27..e0b1f0671d16ddddcb6725acd25a1d1d .completer(new ConsoleCommandCompleter(this.server)) - ); + .option(LineReader.Option.COMPLETE_IN_WORD, true); -+ if (com.destroystokyo.paper.PaperConfig.enableBrigadierConsoleHighlighting) { ++ if (io.papermc.paper.configuration.GlobalConfiguration.get().console.enableBrigadierHighlighting) { + builder.highlighter(new io.papermc.paper.console.BrigadierCommandHighlighter(this.server, this.server.createCommandSourceStack())); + } + return super.buildReader(builder); @@ -47,7 +28,7 @@ index a4070b59e261f0f1ac4beec47b11492f4724bf27..e0b1f0671d16ddddcb6725acd25a1d1d @Override diff --git a/src/main/java/io/papermc/paper/console/BrigadierCommandCompleter.java b/src/main/java/io/papermc/paper/console/BrigadierCommandCompleter.java new file mode 100644 -index 0000000000000000000000000000000000000000..d3f80b5dcd366c5b8a48cb885d825d243b01ac4c +index 0000000000000000000000000000000000000000..5fee12b106a50f7c92c9ecf8256d5e12aec64260 --- /dev/null +++ b/src/main/java/io/papermc/paper/console/BrigadierCommandCompleter.java @@ -0,0 +1,95 @@ @@ -83,7 +64,7 @@ index 0000000000000000000000000000000000000000..d3f80b5dcd366c5b8a48cb885d825d24 + } + + public void complete(final @NonNull LineReader reader, final @NonNull ParsedLine line, final @NonNull List candidates, final @NonNull List existing) { -+ if (!com.destroystokyo.paper.PaperConfig.enableBrigadierConsoleCompletions) { ++ if (!io.papermc.paper.configuration.GlobalConfiguration.get().console.enableBrigadierCompletions) { + this.addCandidates(candidates, Collections.emptyList(), existing); + return; + } @@ -217,7 +198,7 @@ index 0000000000000000000000000000000000000000..5ab8365b806dd035800ba9b449c9bc92 + public void setErrorIndex(final int errorIndex) {} +} diff --git a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java -index d673947406c0a33465b6132aba78b3d12f9adaec..ec24ec2000124465b18b204828486ca3f3eb051c 100644 +index 7b78b8edb0c5e544d0cc136fc7b84d1867f20ab6..b2039aba3bebd5eb7957438a7cfc97d5e1d5bc8c 100644 --- a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java +++ b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java @@ -178,7 +178,7 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface @@ -229,14 +210,14 @@ index d673947406c0a33465b6132aba78b3d12f9adaec..ec24ec2000124465b18b204828486ca3 DedicatedServer.LOGGER.info("Starting minecraft server version {}", SharedConstants.getCurrentVersion().getName()); if (Runtime.getRuntime().maxMemory() / 1024L / 1024L < 512L) { DedicatedServer.LOGGER.warn("To start the server with more ram, launch it as \"java -Xmx1024M -Xms1024M -jar minecraft_server.jar\""); -@@ -212,6 +212,7 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface - DedicatedServer.LOGGER.error("Unable to load server configuration", e); - return false; - } +@@ -210,6 +210,7 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface + paperConfigurations.initializeGlobalConfiguration(); + paperConfigurations.initializeWorldDefaultsConfiguration(); + org.spigotmc.WatchdogThread.doStart(org.spigotmc.SpigotConfig.timeoutTime, org.spigotmc.SpigotConfig.restartOnCrash); + thread.start(); // Paper - start console thread after MinecraftServer.console & PaperConfig are initialized - com.destroystokyo.paper.PaperConfig.registerCommands(); + io.papermc.paper.configuration.PaperConfigurations.registerCommands(this); com.destroystokyo.paper.VersionHistoryManager.INSTANCE.getClass(); // load version history now - io.papermc.paper.util.ObfHelper.INSTANCE.getClass(); // load mappings for stacktrace deobf and etc. + // Paper end diff --git a/src/main/java/org/bukkit/craftbukkit/command/ConsoleCommandCompleter.java b/src/main/java/org/bukkit/craftbukkit/command/ConsoleCommandCompleter.java index 14cd8ae69d9b25dc5edad4ff96ff4a9acb1f22cb..b3484487fa8baa4d1dd6c595586fb26a01a2153d 100644 --- a/src/main/java/org/bukkit/craftbukkit/command/ConsoleCommandCompleter.java diff --git a/patches/server/0615-Fix-PlayerItemConsumeEvent-cancelling-properly.patch b/patches/server/0614-Fix-PlayerItemConsumeEvent-cancelling-properly.patch similarity index 92% rename from patches/server/0615-Fix-PlayerItemConsumeEvent-cancelling-properly.patch rename to patches/server/0614-Fix-PlayerItemConsumeEvent-cancelling-properly.patch index 6385c15717..bd11a625a1 100644 --- a/patches/server/0615-Fix-PlayerItemConsumeEvent-cancelling-properly.patch +++ b/patches/server/0614-Fix-PlayerItemConsumeEvent-cancelling-properly.patch @@ -9,7 +9,7 @@ till their item is switched. This patch clears the active item when the event is cancelled diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java -index db3874f683f19ef4ae2b5e02e08c5c000ae90661..aff3c2020a604942b5ba407156ebf5953ffa0377 100644 +index 5ad9e0c4a00fee75a173904866cd7d210433a3e4..2d892c04efc4db941bf8ad57029589b55d0155f7 100644 --- a/src/main/java/net/minecraft/world/entity/LivingEntity.java +++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java @@ -3752,6 +3752,7 @@ public abstract class LivingEntity extends Entity { diff --git a/patches/server/0616-Add-bypass-host-check.patch b/patches/server/0615-Add-bypass-host-check.patch similarity index 95% rename from patches/server/0616-Add-bypass-host-check.patch rename to patches/server/0615-Add-bypass-host-check.patch index 0787e81404..8dc2084e8a 100644 --- a/patches/server/0616-Add-bypass-host-check.patch +++ b/patches/server/0615-Add-bypass-host-check.patch @@ -8,7 +8,7 @@ Paper.bypassHostCheck Seriously, fix your firewalls. -.- diff --git a/src/main/java/net/minecraft/server/network/ServerHandshakePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerHandshakePacketListenerImpl.java -index ec98a6540a7c4d032234dea5148adaccff7298b9..a54bb43a3acf31be0278fee3d23de9acfdfc64cf 100644 +index 9ece2ceac6c5095469b080f08bf7af8f7b31f003..142737266a2afcbbd70556615f56730d44e862f9 100644 --- a/src/main/java/net/minecraft/server/network/ServerHandshakePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerHandshakePacketListenerImpl.java @@ -29,6 +29,7 @@ public class ServerHandshakePacketListenerImpl implements ServerHandshakePacketL diff --git a/patches/server/0617-Set-area-affect-cloud-rotation.patch b/patches/server/0616-Set-area-affect-cloud-rotation.patch similarity index 100% rename from patches/server/0617-Set-area-affect-cloud-rotation.patch rename to patches/server/0616-Set-area-affect-cloud-rotation.patch diff --git a/patches/server/0618-add-isDeeplySleeping-to-HumanEntity.patch b/patches/server/0617-add-isDeeplySleeping-to-HumanEntity.patch similarity index 100% rename from patches/server/0618-add-isDeeplySleeping-to-HumanEntity.patch rename to patches/server/0617-add-isDeeplySleeping-to-HumanEntity.patch diff --git a/patches/server/0619-add-consumeFuel-to-FurnaceBurnEvent.patch b/patches/server/0618-add-consumeFuel-to-FurnaceBurnEvent.patch similarity index 100% rename from patches/server/0619-add-consumeFuel-to-FurnaceBurnEvent.patch rename to patches/server/0618-add-consumeFuel-to-FurnaceBurnEvent.patch diff --git a/patches/server/0620-add-get-set-drop-chance-to-EntityEquipment.patch b/patches/server/0619-add-get-set-drop-chance-to-EntityEquipment.patch similarity index 100% rename from patches/server/0620-add-get-set-drop-chance-to-EntityEquipment.patch rename to patches/server/0619-add-get-set-drop-chance-to-EntityEquipment.patch diff --git a/patches/server/0621-fix-PigZombieAngerEvent-cancellation.patch b/patches/server/0620-fix-PigZombieAngerEvent-cancellation.patch similarity index 100% rename from patches/server/0621-fix-PigZombieAngerEvent-cancellation.patch rename to patches/server/0620-fix-PigZombieAngerEvent-cancellation.patch diff --git a/patches/server/0622-Fix-checkReach-check-for-Shulker-boxes.patch b/patches/server/0621-Fix-checkReach-check-for-Shulker-boxes.patch similarity index 100% rename from patches/server/0622-Fix-checkReach-check-for-Shulker-boxes.patch rename to patches/server/0621-Fix-checkReach-check-for-Shulker-boxes.patch diff --git a/patches/server/0623-fix-PlayerItemHeldEvent-firing-twice.patch b/patches/server/0622-fix-PlayerItemHeldEvent-firing-twice.patch similarity index 93% rename from patches/server/0623-fix-PlayerItemHeldEvent-firing-twice.patch rename to patches/server/0622-fix-PlayerItemHeldEvent-firing-twice.patch index 26c38ddfde..f2bb8665c6 100644 --- a/patches/server/0623-fix-PlayerItemHeldEvent-firing-twice.patch +++ b/patches/server/0622-fix-PlayerItemHeldEvent-firing-twice.patch @@ -5,7 +5,7 @@ Subject: [PATCH] fix PlayerItemHeldEvent firing twice diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index 228de7514e67e7c768e8a1e08484fa4fe2ddb9fd..8703d877812f582174673a3063f59c346e6bcf08 100644 +index d2c951a0e9031af3621b58d02711e55f236168e0..cea82a7cdbf50e9fb4ba705860c09bbbaca18167 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java @@ -1985,6 +1985,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser diff --git a/patches/server/0624-Added-PlayerDeepSleepEvent.patch b/patches/server/0623-Added-PlayerDeepSleepEvent.patch similarity index 91% rename from patches/server/0624-Added-PlayerDeepSleepEvent.patch rename to patches/server/0623-Added-PlayerDeepSleepEvent.patch index 95e659acc4..3d655f6013 100644 --- a/patches/server/0624-Added-PlayerDeepSleepEvent.patch +++ b/patches/server/0623-Added-PlayerDeepSleepEvent.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Added PlayerDeepSleepEvent diff --git a/src/main/java/net/minecraft/world/entity/player/Player.java b/src/main/java/net/minecraft/world/entity/player/Player.java -index a8b122503a5e46242706b6f654b8fc259bf7321c..ef920c0596a50c6bbe0e5b05df2fe3c700d05e83 100644 +index f1a1a251256646d0d3a457f1fc8af20ae085f5ef..2c65305037583d55fa20783d0f264382467f8c3f 100644 --- a/src/main/java/net/minecraft/world/entity/player/Player.java +++ b/src/main/java/net/minecraft/world/entity/player/Player.java @@ -253,6 +253,11 @@ public abstract class Player extends LivingEntity { diff --git a/patches/server/0625-More-World-API.patch b/patches/server/0624-More-World-API.patch similarity index 97% rename from patches/server/0625-More-World-API.patch rename to patches/server/0624-More-World-API.patch index 1ed7114635..c3e37d3592 100644 --- a/patches/server/0625-More-World-API.patch +++ b/patches/server/0624-More-World-API.patch @@ -5,7 +5,7 @@ Subject: [PATCH] More World API diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java -index 0440a9e3449cdf1a969ba8c7863b73842afebe48..1dd7f21b6088f94bd523578fe6a1bb2c542145c5 100644 +index 8d6828c93eb76c2df4287df6f6ab9419bd05f2e7..4ba0106e5dd95dbe5cf1db091abf34dea330fb54 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java @@ -1967,6 +1967,65 @@ public class CraftWorld extends CraftRegionAccessor implements World { diff --git a/patches/server/0626-Added-PlayerBedFailEnterEvent.patch b/patches/server/0625-Added-PlayerBedFailEnterEvent.patch similarity index 100% rename from patches/server/0626-Added-PlayerBedFailEnterEvent.patch rename to patches/server/0625-Added-PlayerBedFailEnterEvent.patch diff --git a/patches/server/0627-Implement-methods-to-convert-between-Component-and-B.patch b/patches/server/0626-Implement-methods-to-convert-between-Component-and-B.patch similarity index 86% rename from patches/server/0627-Implement-methods-to-convert-between-Component-and-B.patch rename to patches/server/0626-Implement-methods-to-convert-between-Component-and-B.patch index 0a4eb1d823..eeab95b094 100644 --- a/patches/server/0627-Implement-methods-to-convert-between-Component-and-B.patch +++ b/patches/server/0626-Implement-methods-to-convert-between-Component-and-B.patch @@ -42,13 +42,13 @@ index 0000000000000000000000000000000000000000..dd6012b6a097575b2d1471be5069ecce + } +} diff --git a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java -index ec24ec2000124465b18b204828486ca3f3eb051c..949e2050dae9048f53cd5b8452763be5fbd70958 100644 +index b2039aba3bebd5eb7957438a7cfc97d5e1d5bc8c..c6f70d057b7626b6b5bae0b2760f564f55af17a7 100644 --- a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java +++ b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java -@@ -216,6 +216,7 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface - com.destroystokyo.paper.PaperConfig.registerCommands(); +@@ -213,6 +213,7 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface + thread.start(); // Paper - start console thread after MinecraftServer.console & PaperConfig are initialized + io.papermc.paper.configuration.PaperConfigurations.registerCommands(this); com.destroystokyo.paper.VersionHistoryManager.INSTANCE.getClass(); // load version history now - io.papermc.paper.util.ObfHelper.INSTANCE.getClass(); // load mappings for stacktrace deobf and etc. + io.papermc.paper.brigadier.PaperBrigadierProviderImpl.INSTANCE.getClass(); // init PaperBrigadierProvider // Paper end diff --git a/patches/server/0628-Fix-anchor-respawn-acting-as-a-bed-respawn-from-the-.patch b/patches/server/0627-Fix-anchor-respawn-acting-as-a-bed-respawn-from-the-.patch similarity index 95% rename from patches/server/0628-Fix-anchor-respawn-acting-as-a-bed-respawn-from-the-.patch rename to patches/server/0627-Fix-anchor-respawn-acting-as-a-bed-respawn-from-the-.patch index 41a91ce850..b2973e3d1e 100644 --- a/patches/server/0628-Fix-anchor-respawn-acting-as-a-bed-respawn-from-the-.patch +++ b/patches/server/0627-Fix-anchor-respawn-acting-as-a-bed-respawn-from-the-.patch @@ -6,7 +6,7 @@ Subject: [PATCH] Fix anchor respawn acting as a bed respawn from the end diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java -index f97583b667854cfcb1a25eda844492a03d327a76..9ebfa6940a5e9a1a9e396d3b0de1ddf4fc85d43c 100644 +index 39857a042d13c3660cd7cd49cd1117cafbc5dfad..fec39b8a3f67af2628913056634d6ee62b77d05d 100644 --- a/src/main/java/net/minecraft/server/players/PlayerList.java +++ b/src/main/java/net/minecraft/server/players/PlayerList.java @@ -851,6 +851,7 @@ public abstract class PlayerList { diff --git a/patches/server/0629-Introduce-beacon-activation-deactivation-events.patch b/patches/server/0628-Introduce-beacon-activation-deactivation-events.patch similarity index 100% rename from patches/server/0629-Introduce-beacon-activation-deactivation-events.patch rename to patches/server/0628-Introduce-beacon-activation-deactivation-events.patch diff --git a/patches/server/0630-add-RespawnFlags-to-PlayerRespawnEvent.patch b/patches/server/0629-add-RespawnFlags-to-PlayerRespawnEvent.patch similarity index 94% rename from patches/server/0630-add-RespawnFlags-to-PlayerRespawnEvent.patch rename to patches/server/0629-add-RespawnFlags-to-PlayerRespawnEvent.patch index 35dcdd5eba..f8fd41ed09 100644 --- a/patches/server/0630-add-RespawnFlags-to-PlayerRespawnEvent.patch +++ b/patches/server/0629-add-RespawnFlags-to-PlayerRespawnEvent.patch @@ -5,7 +5,7 @@ Subject: [PATCH] add RespawnFlags to PlayerRespawnEvent diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index 8703d877812f582174673a3063f59c346e6bcf08..5a6fac2ac3befcd0c7d9b5eee5099c4a86f9dda2 100644 +index cea82a7cdbf50e9fb4ba705860c09bbbaca18167..648a21537673929dbd9d25ecd0f0f49ee28b03a8 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java @@ -2673,7 +2673,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser @@ -18,7 +18,7 @@ index 8703d877812f582174673a3063f59c346e6bcf08..5a6fac2ac3befcd0c7d9b5eee5099c4a } else { if (this.player.getHealth() > 0.0F) { diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java -index 9ebfa6940a5e9a1a9e396d3b0de1ddf4fc85d43c..11b5335a7f30113da58c39aa15ca5e6f0b2588d5 100644 +index fec39b8a3f67af2628913056634d6ee62b77d05d..a4278a4ca0b41813b8f88d01dcc8d75b4f458908 100644 --- a/src/main/java/net/minecraft/server/players/PlayerList.java +++ b/src/main/java/net/minecraft/server/players/PlayerList.java @@ -810,6 +810,12 @@ public abstract class PlayerList { diff --git a/patches/server/0631-Add-Channel-initialization-listeners.patch b/patches/server/0630-Add-Channel-initialization-listeners.patch similarity index 100% rename from patches/server/0631-Add-Channel-initialization-listeners.patch rename to patches/server/0630-Add-Channel-initialization-listeners.patch diff --git a/patches/server/0632-Send-empty-commands-if-tab-completion-is-disabled.patch b/patches/server/0631-Send-empty-commands-if-tab-completion-is-disabled.patch similarity index 100% rename from patches/server/0632-Send-empty-commands-if-tab-completion-is-disabled.patch rename to patches/server/0631-Send-empty-commands-if-tab-completion-is-disabled.patch diff --git a/patches/server/0633-Add-more-WanderingTrader-API.patch b/patches/server/0632-Add-more-WanderingTrader-API.patch similarity index 100% rename from patches/server/0633-Add-more-WanderingTrader-API.patch rename to patches/server/0632-Add-more-WanderingTrader-API.patch diff --git a/patches/server/0634-Add-EntityBlockStorage-clearEntities.patch b/patches/server/0633-Add-EntityBlockStorage-clearEntities.patch similarity index 100% rename from patches/server/0634-Add-EntityBlockStorage-clearEntities.patch rename to patches/server/0633-Add-EntityBlockStorage-clearEntities.patch diff --git a/patches/server/0635-Add-Adventure-message-to-PlayerAdvancementDoneEvent.patch b/patches/server/0634-Add-Adventure-message-to-PlayerAdvancementDoneEvent.patch similarity index 100% rename from patches/server/0635-Add-Adventure-message-to-PlayerAdvancementDoneEvent.patch rename to patches/server/0634-Add-Adventure-message-to-PlayerAdvancementDoneEvent.patch diff --git a/patches/server/0636-Add-raw-address-to-AsyncPlayerPreLoginEvent.patch b/patches/server/0635-Add-raw-address-to-AsyncPlayerPreLoginEvent.patch similarity index 92% rename from patches/server/0636-Add-raw-address-to-AsyncPlayerPreLoginEvent.patch rename to patches/server/0635-Add-raw-address-to-AsyncPlayerPreLoginEvent.patch index 82d8d96bc4..abd2395baf 100644 --- a/patches/server/0636-Add-raw-address-to-AsyncPlayerPreLoginEvent.patch +++ b/patches/server/0635-Add-raw-address-to-AsyncPlayerPreLoginEvent.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Add raw address to AsyncPlayerPreLoginEvent diff --git a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java -index 8da6770f88ce693251812f3c0a803a09286e56ad..ffbd711375c400c9faaa4c984463a24af2f4993f 100644 +index ed9c4a8e377867771d8376c485f56c6bd234192b..71614fb07ba771ec9a00772074b031b77210d425 100644 --- a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java -@@ -415,12 +415,13 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener +@@ -414,12 +414,13 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener // Paper end String playerName = ServerLoginPacketListenerImpl.this.gameProfile.getName(); java.net.InetAddress address = ((java.net.InetSocketAddress) ServerLoginPacketListenerImpl.this.connection.getRemoteAddress()).getAddress(); diff --git a/patches/server/0637-Inventory-close.patch b/patches/server/0636-Inventory-close.patch similarity index 100% rename from patches/server/0637-Inventory-close.patch rename to patches/server/0636-Inventory-close.patch diff --git a/patches/server/0638-call-PortalCreateEvent-players-and-end-platform.patch b/patches/server/0637-call-PortalCreateEvent-players-and-end-platform.patch similarity index 94% rename from patches/server/0638-call-PortalCreateEvent-players-and-end-platform.patch rename to patches/server/0637-call-PortalCreateEvent-players-and-end-platform.patch index 4021d2ea23..5d47108775 100644 --- a/patches/server/0638-call-PortalCreateEvent-players-and-end-platform.patch +++ b/patches/server/0637-call-PortalCreateEvent-players-and-end-platform.patch @@ -5,7 +5,7 @@ Subject: [PATCH] call PortalCreateEvent players and end platform diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java -index e37bf6844a3cdc85c51787b865f0f37ce70dfaa2..1b37b428f7692020473f229eb2c9049b65bd1351 100644 +index a6a14bf7221dbbb7a1ef42ba8961711e60aa0bf2..eae9d91f5b08b6ac32ca204dbd962245808d63ee 100644 --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java @@ -1209,15 +1209,21 @@ public class ServerPlayer extends Player { diff --git a/patches/server/0639-Add-a-should-burn-in-sunlight-API-for-Phantoms-and-S.patch b/patches/server/0638-Add-a-should-burn-in-sunlight-API-for-Phantoms-and-S.patch similarity index 96% rename from patches/server/0639-Add-a-should-burn-in-sunlight-API-for-Phantoms-and-S.patch rename to patches/server/0638-Add-a-should-burn-in-sunlight-API-for-Phantoms-and-S.patch index 154fd68ac3..15c8339c99 100644 --- a/patches/server/0639-Add-a-should-burn-in-sunlight-API-for-Phantoms-and-S.patch +++ b/patches/server/0638-Add-a-should-burn-in-sunlight-API-for-Phantoms-and-S.patch @@ -6,7 +6,7 @@ Subject: [PATCH] Add a "should burn in sunlight" API for Phantoms and diff --git a/src/main/java/net/minecraft/world/entity/monster/AbstractSkeleton.java b/src/main/java/net/minecraft/world/entity/monster/AbstractSkeleton.java -index 5f679d5f148e59376669a5faa970961df219fe35..e5bb1baa22db202a6d17ef639bc4940ed1605337 100644 +index c2a26b91d9065fdb52a1ded6c3295093c244d7eb..b8abee145fc92faddef98da913eca7715b6bfc03 100644 --- a/src/main/java/net/minecraft/world/entity/monster/AbstractSkeleton.java +++ b/src/main/java/net/minecraft/world/entity/monster/AbstractSkeleton.java @@ -97,9 +97,15 @@ public abstract class AbstractSkeleton extends Monster implements RangedAttackMo @@ -48,7 +48,7 @@ index 5f679d5f148e59376669a5faa970961df219fe35..e5bb1baa22db202a6d17ef639bc4940e @Override public void setItemSlot(EquipmentSlot slot, ItemStack stack) { diff --git a/src/main/java/net/minecraft/world/entity/monster/Phantom.java b/src/main/java/net/minecraft/world/entity/monster/Phantom.java -index ca9324381a60fc3072719c39918a1c16ac88799b..b55640ed068becd40cbb7d7507b4e67ae9ee792a 100644 +index 180bcdeb262d61c56193dbf99f1c11f3a6889145..cb81c5d37c72845133c4e59acaf8de56dcc9e62a 100644 --- a/src/main/java/net/minecraft/world/entity/monster/Phantom.java +++ b/src/main/java/net/minecraft/world/entity/monster/Phantom.java @@ -144,7 +144,7 @@ public class Phantom extends FlyingMob implements Enemy { diff --git a/patches/server/0640-Fix-CraftPotionBrewer-cache.patch b/patches/server/0639-Fix-CraftPotionBrewer-cache.patch similarity index 100% rename from patches/server/0640-Fix-CraftPotionBrewer-cache.patch rename to patches/server/0639-Fix-CraftPotionBrewer-cache.patch diff --git a/patches/server/0641-Add-basic-Datapack-API.patch b/patches/server/0640-Add-basic-Datapack-API.patch similarity index 96% rename from patches/server/0641-Add-basic-Datapack-API.patch rename to patches/server/0640-Add-basic-Datapack-API.patch index 5ceca4dba9..81d0ee9fae 100644 --- a/patches/server/0641-Add-basic-Datapack-API.patch +++ b/patches/server/0640-Add-basic-Datapack-API.patch @@ -92,7 +92,7 @@ index 0000000000000000000000000000000000000000..cf4374493c11057451a62a655514415c + } +} diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -index 524d04e8ee8645909b88ab32e044131d3cabea4e..eb2d4225eea2940bc9091daf7d7aa96fc8cab675 100644 +index 288d6625c30e7d36c6c4ce372bccf3d42536be35..3752cd9e3ac1b1a82b79006ca09a873c9adbd7a4 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java @@ -276,6 +276,7 @@ public final class CraftServer implements Server { @@ -111,7 +111,7 @@ index 524d04e8ee8645909b88ab32e044131d3cabea4e..eb2d4225eea2940bc9091daf7d7aa96f } public boolean getCommandBlockOverride(String command) { -@@ -2732,5 +2734,11 @@ public final class CraftServer implements Server { +@@ -2729,5 +2731,11 @@ public final class CraftServer implements Server { public com.destroystokyo.paper.entity.ai.MobGoals getMobGoals() { return mobGoals; } diff --git a/patches/server/0642-Add-environment-variable-to-disable-server-gui.patch b/patches/server/0641-Add-environment-variable-to-disable-server-gui.patch similarity index 85% rename from patches/server/0642-Add-environment-variable-to-disable-server-gui.patch rename to patches/server/0641-Add-environment-variable-to-disable-server-gui.patch index 2d5cd86672..426508e900 100644 --- a/patches/server/0642-Add-environment-variable-to-disable-server-gui.patch +++ b/patches/server/0641-Add-environment-variable-to-disable-server-gui.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Add environment variable to disable server gui diff --git a/src/main/java/net/minecraft/server/Main.java b/src/main/java/net/minecraft/server/Main.java -index 3d8449a91687f2637a6254bafd378707e810d769..9ebfa8c8a3fc1299e513efd467c562459f2684e7 100644 +index 8bbc3a1e7f848047ff915d5bdf08d376e71c4025..ce4aed84d751a48dcd2a8409190db4a22d78f77b 100644 --- a/src/main/java/net/minecraft/server/Main.java +++ b/src/main/java/net/minecraft/server/Main.java -@@ -268,6 +268,7 @@ public class Main { +@@ -267,6 +267,7 @@ public class Main { */ boolean flag1 = !optionset.has("nogui") && !optionset.nonOptionArguments().contains("nogui"); diff --git a/patches/server/0643-additions-to-PlayerGameModeChangeEvent.patch b/patches/server/0642-additions-to-PlayerGameModeChangeEvent.patch similarity index 96% rename from patches/server/0643-additions-to-PlayerGameModeChangeEvent.patch rename to patches/server/0642-additions-to-PlayerGameModeChangeEvent.patch index e3fc8ea36a..e9f9051073 100644 --- a/patches/server/0643-additions-to-PlayerGameModeChangeEvent.patch +++ b/patches/server/0642-additions-to-PlayerGameModeChangeEvent.patch @@ -45,7 +45,7 @@ index 65089c0e78c9913a92ae9c66d664f48e2112ad92..7882ee2b7813d437d3b7580f046f38e7 } diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java -index 1b37b428f7692020473f229eb2c9049b65bd1351..d78de27793ffca39a256accecd5033860ac23d1d 100644 +index eae9d91f5b08b6ac32ca204dbd962245808d63ee..fd131a583b57687837533f0541091a293b300169 100644 --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java @@ -1811,8 +1811,15 @@ public class ServerPlayer extends Player { @@ -126,7 +126,7 @@ index 06e7a8b8227260c002a88119544b99a11eec8a09..4d907501dfe7f1a4641542291f4abdd0 } diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index 5a6fac2ac3befcd0c7d9b5eee5099c4a86f9dda2..d216529f4cc40c99298ff823761dfe73e398f694 100644 +index 648a21537673929dbd9d25ecd0f0f49ee28b03a8..7777fad24d4d4e1ef623bbddf4657fa945a8b113 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java @@ -2682,7 +2682,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser @@ -139,7 +139,7 @@ index 5a6fac2ac3befcd0c7d9b5eee5099c4a86f9dda2..d216529f4cc40c99298ff823761dfe73 } } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -index 9a213d1313f0418e4f68e40083ae764e5d1b6c78..42e9ff7f10a63232a93dc44f220617d5140dcb20 100644 +index 482a6385d6d8072e2724054b91ea0347a648f8bc..708833d3389b822c08c107d513a79762b50dcec0 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java @@ -1377,7 +1377,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player { diff --git a/patches/server/0644-ItemStack-repair-check-API.patch b/patches/server/0643-ItemStack-repair-check-API.patch similarity index 97% rename from patches/server/0644-ItemStack-repair-check-API.patch rename to patches/server/0643-ItemStack-repair-check-API.patch index 8369dcd099..553e56cb06 100644 --- a/patches/server/0644-ItemStack-repair-check-API.patch +++ b/patches/server/0643-ItemStack-repair-check-API.patch @@ -5,7 +5,7 @@ Subject: [PATCH] ItemStack repair check API diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java -index a74efa4a5888f090d04f6cac57bee98f1132ebe7..54184e94a3516c2be27c39951efee28b45160284 100644 +index a978c39049efb30fcb66703b708a0e40868e2a58..57b7fedcccbb9a0c1cc56eb6be48a18e2fbadc7f 100644 --- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java +++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java @@ -537,6 +537,14 @@ public final class CraftMagicNumbers implements UnsafeValues { diff --git a/patches/server/0645-More-Enchantment-API.patch b/patches/server/0644-More-Enchantment-API.patch similarity index 100% rename from patches/server/0645-More-Enchantment-API.patch rename to patches/server/0644-More-Enchantment-API.patch diff --git a/patches/server/0646-Move-range-check-for-block-placing-up.patch b/patches/server/0645-Move-range-check-for-block-placing-up.patch similarity index 92% rename from patches/server/0646-Move-range-check-for-block-placing-up.patch rename to patches/server/0645-Move-range-check-for-block-placing-up.patch index 9f5423d1e2..99df97d4ba 100644 --- a/patches/server/0646-Move-range-check-for-block-placing-up.patch +++ b/patches/server/0645-Move-range-check-for-block-placing-up.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Move range check for block placing up diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index d216529f4cc40c99298ff823761dfe73e398f694..205f8f270da077aaefaad509acb5923b97788feb 100644 +index 7777fad24d4d4e1ef623bbddf4657fa945a8b113..a2b77ca661205e14e6794533de3e66130f7be683 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java @@ -1762,6 +1762,11 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser diff --git a/patches/server/0647-Fix-and-optimise-world-force-upgrading.patch b/patches/server/0646-Fix-and-optimise-world-force-upgrading.patch similarity index 95% rename from patches/server/0647-Fix-and-optimise-world-force-upgrading.patch rename to patches/server/0646-Fix-and-optimise-world-force-upgrading.patch index 2f7e81ce9e..af0546deec 100644 --- a/patches/server/0647-Fix-and-optimise-world-force-upgrading.patch +++ b/patches/server/0646-Fix-and-optimise-world-force-upgrading.patch @@ -244,7 +244,7 @@ index 0000000000000000000000000000000000000000..95cac7edae8ac64811fc6a2f6b97dd4a + } +} diff --git a/src/main/java/net/minecraft/server/Main.java b/src/main/java/net/minecraft/server/Main.java -index 9ebfa8c8a3fc1299e513efd467c562459f2684e7..1e9ff7ecd03a4202376884104570ab56f4226a97 100644 +index ce4aed84d751a48dcd2a8409190db4a22d78f77b..0a843e0afbcb1af8e2641515eb244b791b819b8c 100644 --- a/src/main/java/net/minecraft/server/Main.java +++ b/src/main/java/net/minecraft/server/Main.java @@ -16,6 +16,7 @@ import java.util.Objects; @@ -255,9 +255,9 @@ index 9ebfa8c8a3fc1299e513efd467c562459f2684e7..1e9ff7ecd03a4202376884104570ab56 import joptsimple.NonOptionArgumentSpec; import joptsimple.OptionParser; import joptsimple.OptionSet; -@@ -312,6 +313,15 @@ public class Main { +@@ -297,6 +298,15 @@ public class Main { + } - // Paper end + // Paper start - fix and optimise world upgrading + public static void convertWorldButItWorks(net.minecraft.resources.ResourceKey dimensionType, net.minecraft.world.level.storage.LevelStorageSource.LevelStorageAccess worldSession, @@ -272,10 +272,10 @@ index 9ebfa8c8a3fc1299e513efd467c562459f2684e7..1e9ff7ecd03a4202376884104570ab56 Main.LOGGER.info("Forcing world upgrade! {}", session.getLevelId()); // CraftBukkit WorldUpgrader worldupgrader = new WorldUpgrader(session, dataFixer, generatorOptions, eraseCache); diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index 3b950c0a6a660d5d9b957cfc08d85fc2bdb706e4..6693a1861a775b755aa06844a37753ba9ec3bbc5 100644 +index 855a4a27cfa706432da6b75e1d80d1214917dab6..86609f740b6bf4890c63d8de15f366032eb024ff 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java -@@ -541,11 +541,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop explosionDensityCache = new HashMap<>(); // Paper - Optimize explosions public java.util.ArrayDeque redstoneUpdateInfos; // Paper - Move from Map in BlockRedstoneTorch to here @@ -323,7 +323,7 @@ index c2315b4eb3d62c01f117e4f00b2280114f0945f9..c22e6e9d043f9afcb8c2fe24e9edd180 return this.world; } diff --git a/src/main/java/net/minecraft/world/level/chunk/storage/RegionFileStorage.java b/src/main/java/net/minecraft/world/level/chunk/storage/RegionFileStorage.java -index 4bc33c31d497aa7d69226ab870fd78902bedfd5b..089e8414c7bdc102ba0d914af576df1a05af7519 100644 +index a96a6af2bcec3134b7caa32299bd07af50e83b89..0d96d1c0b66c57c680759f3567ef1b0c326d8cfa 100644 --- a/src/main/java/net/minecraft/world/level/chunk/storage/RegionFileStorage.java +++ b/src/main/java/net/minecraft/world/level/chunk/storage/RegionFileStorage.java @@ -32,6 +32,28 @@ public class RegionFileStorage implements AutoCloseable { @@ -356,10 +356,10 @@ index 4bc33c31d497aa7d69226ab870fd78902bedfd5b..089e8414c7bdc102ba0d914af576df1a return this.regionCache.getAndMoveToFirst(ChunkPos.asLong(chunkcoordintpair.getRegionX(), chunkcoordintpair.getRegionZ())); } diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -index eb2d4225eea2940bc9091daf7d7aa96fc8cab675..59e1303353e029ee754bde2e43f2bca622154381 100644 +index 3752cd9e3ac1b1a82b79006ca09a873c9adbd7a4..2d14b47ba9687ccad6e1eb7c83172a77e3f5172a 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -@@ -1194,12 +1194,7 @@ public final class CraftServer implements Server { +@@ -1193,12 +1193,7 @@ public final class CraftServer implements Server { } worlddata.checkName(name); worlddata.setModdedInfo(this.console.getServerModName(), this.console.getModdedStatus().shouldReportAsModified()); @@ -373,7 +373,7 @@ index eb2d4225eea2940bc9091daf7d7aa96fc8cab675..59e1303353e029ee754bde2e43f2bca6 long j = BiomeManager.obfuscateSeed(creator.seed()); List list = ImmutableList.of(new PhantomSpawner(), new PatrolSpawner(), new CatSpawner(), new VillageSiege(), new WanderingTraderSpawner(worlddata)); -@@ -1211,6 +1206,13 @@ public final class CraftServer implements Server { +@@ -1210,6 +1205,13 @@ public final class CraftServer implements Server { biomeProvider = generator.getDefaultBiomeProvider(worldInfo); } diff --git a/patches/server/0648-Add-Mob-lookAt-API.patch b/patches/server/0647-Add-Mob-lookAt-API.patch similarity index 100% rename from patches/server/0648-Add-Mob-lookAt-API.patch rename to patches/server/0647-Add-Mob-lookAt-API.patch diff --git a/patches/server/0649-Add-Unix-domain-socket-support.patch b/patches/server/0648-Add-Unix-domain-socket-support.patch similarity index 93% rename from patches/server/0649-Add-Unix-domain-socket-support.patch rename to patches/server/0648-Add-Unix-domain-socket-support.patch index 1018b4a410..e9e6b4e2e6 100644 --- a/patches/server/0649-Add-Unix-domain-socket-support.patch +++ b/patches/server/0648-Add-Unix-domain-socket-support.patch @@ -11,10 +11,10 @@ Tested-by: Mariell Hoversholm Reviewed-by: Mariell Hoversholm diff --git a/src/main/java/net/minecraft/network/Connection.java b/src/main/java/net/minecraft/network/Connection.java -index 4798ac3a9c7a7d34eaca5cb50b013b071793ed94..00ab93e02a884e51cd6cc647c7e58c2e53b8a7cc 100644 +index 91556b52edaa1d5c4dc73a825c77b9a66b002c61..00abdd5bba02b7cdf8dbdc423594f0fde890dd84 100644 --- a/src/main/java/net/minecraft/network/Connection.java +++ b/src/main/java/net/minecraft/network/Connection.java -@@ -628,6 +628,11 @@ public class Connection extends SimpleChannelInboundHandler> { +@@ -627,6 +627,11 @@ public class Connection extends SimpleChannelInboundHandler> { // Spigot Start public SocketAddress getRawAddress() { @@ -27,10 +27,10 @@ index 4798ac3a9c7a7d34eaca5cb50b013b071793ed94..00ab93e02a884e51cd6cc647c7e58c2e } // Spigot End diff --git a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java -index 949e2050dae9048f53cd5b8452763be5fbd70958..5cc3a55b90135f0aa97c5faaf6c1b6f4d6fe9a0e 100644 +index c6f70d057b7626b6b5bae0b2760f564f55af17a7..3fc342502ca24165ea5dcf0cc6e9867d0378d69f 100644 --- a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java +++ b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java -@@ -226,6 +226,20 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface +@@ -223,6 +223,20 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface this.setEnforceWhitelist(dedicatedserverproperties.enforceWhitelist); // this.worldData.setGameType(dedicatedserverproperties.gamemode); // CraftBukkit - moved to world loading DedicatedServer.LOGGER.info("Default game type: {}", dedicatedserverproperties.gamemode); @@ -41,7 +41,7 @@ index 949e2050dae9048f53cd5b8452763be5fbd70958..5cc3a55b90135f0aa97c5faaf6c1b6f4 + DedicatedServer.LOGGER.error("**** INVALID CONFIGURATION!"); + DedicatedServer.LOGGER.error("You are trying to use a Unix domain socket but you're not on a supported OS."); + return false; -+ } else if (!com.destroystokyo.paper.PaperConfig.velocitySupport && !org.spigotmc.SpigotConfig.bungee) { ++ } else if (!io.papermc.paper.configuration.GlobalConfiguration.get().proxies.velocity.enabled && !org.spigotmc.SpigotConfig.bungee) { + DedicatedServer.LOGGER.error("**** INVALID CONFIGURATION!"); + DedicatedServer.LOGGER.error("Unix domain sockets require IPs to be forwarded from a proxy."); + return false; @@ -51,7 +51,7 @@ index 949e2050dae9048f53cd5b8452763be5fbd70958..5cc3a55b90135f0aa97c5faaf6c1b6f4 InetAddress inetaddress = null; if (!this.getLocalIp().isEmpty()) { -@@ -235,12 +249,15 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface +@@ -232,12 +246,15 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface if (this.getPort() < 0) { this.setPort(dedicatedserverproperties.serverPort); } @@ -107,7 +107,7 @@ index 076c1d5fb69a4a30b3e412e85b17db09fd9a1def..9e7154c9df96d5a0577886d43a98a736 } diff --git a/src/main/java/net/minecraft/server/network/ServerHandshakePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerHandshakePacketListenerImpl.java -index a54bb43a3acf31be0278fee3d23de9acfdfc64cf..95340e4067ff1cbc9539615adb260377a5187cb7 100644 +index 142737266a2afcbbd70556615f56730d44e862f9..c7ac8193b7f4b29d0d85891de0eca67912c8811c 100644 --- a/src/main/java/net/minecraft/server/network/ServerHandshakePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerHandshakePacketListenerImpl.java @@ -43,6 +43,7 @@ public class ServerHandshakePacketListenerImpl implements ServerHandshakePacketL diff --git a/patches/server/0650-Add-EntityInsideBlockEvent.patch b/patches/server/0649-Add-EntityInsideBlockEvent.patch similarity index 99% rename from patches/server/0650-Add-EntityInsideBlockEvent.patch rename to patches/server/0649-Add-EntityInsideBlockEvent.patch index bf2ffdb37f..0ca02bfa9a 100644 --- a/patches/server/0650-Add-EntityInsideBlockEvent.patch +++ b/patches/server/0649-Add-EntityInsideBlockEvent.patch @@ -65,7 +65,7 @@ index c187e9df237ee71562343bbb4b577b2dcd9b4f1c..a0194e78913017693df7d92516dfbacb this.checkPressed(state, world, pos); } diff --git a/src/main/java/net/minecraft/world/level/block/CactusBlock.java b/src/main/java/net/minecraft/world/level/block/CactusBlock.java -index 0d255201ebce3bb495a4e086da5e4d9195cbc091..1a735974c784c545d7f25548964b25b38ecdc762 100644 +index cb3d26af146859b87fc471174f8f63dfe7caa5fd..0fbabb84ef13e68b12212d9bfeb885c78893c116 100644 --- a/src/main/java/net/minecraft/world/level/block/CactusBlock.java +++ b/src/main/java/net/minecraft/world/level/block/CactusBlock.java @@ -116,6 +116,7 @@ public class CactusBlock extends Block { @@ -173,7 +173,7 @@ index 2d0191eeb746d496a481d66cdfa77078313a13ec..24d2da792bc498adf4251555a538df4c // CraftBukkit start if (entity.mayInteract(world, pos)) { diff --git a/src/main/java/net/minecraft/world/level/block/NetherPortalBlock.java b/src/main/java/net/minecraft/world/level/block/NetherPortalBlock.java -index fe073237dbec6e9890395575206bbc893bef6d9b..51f0dc173ddb29c6928badbc3c3a68ff3677a0e1 100644 +index 8c97cae63b4b373f1d67e797b9fe1064b5205da5..08a84e8fdb242f467fb20eec73764ef71691ad42 100644 --- a/src/main/java/net/minecraft/world/level/block/NetherPortalBlock.java +++ b/src/main/java/net/minecraft/world/level/block/NetherPortalBlock.java @@ -85,6 +85,7 @@ public class NetherPortalBlock extends Block { diff --git a/patches/server/0651-Attributes-API-for-item-defaults.patch b/patches/server/0650-Attributes-API-for-item-defaults.patch similarity index 94% rename from patches/server/0651-Attributes-API-for-item-defaults.patch rename to patches/server/0650-Attributes-API-for-item-defaults.patch index 828fca44d1..ab2191630c 100644 --- a/patches/server/0651-Attributes-API-for-item-defaults.patch +++ b/patches/server/0650-Attributes-API-for-item-defaults.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Attributes API for item defaults diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java -index 54184e94a3516c2be27c39951efee28b45160284..3ae0f73b00496ff05b845aff057fd4f91dad0ccd 100644 +index 57b7fedcccbb9a0c1cc56eb6be48a18e2fbadc7f..5345ab40f18437fc60080f9feff4ee0d59a9ed6d 100644 --- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java +++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java @@ -545,6 +545,19 @@ public final class CraftMagicNumbers implements UnsafeValues { diff --git a/patches/server/0652-Add-cause-to-Weather-ThunderChangeEvents.patch b/patches/server/0651-Add-cause-to-Weather-ThunderChangeEvents.patch similarity index 97% rename from patches/server/0652-Add-cause-to-Weather-ThunderChangeEvents.patch rename to patches/server/0651-Add-cause-to-Weather-ThunderChangeEvents.patch index 537e594f35..123a3800e6 100644 --- a/patches/server/0652-Add-cause-to-Weather-ThunderChangeEvents.patch +++ b/patches/server/0651-Add-cause-to-Weather-ThunderChangeEvents.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Add cause to Weather/ThunderChangeEvents diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java -index 5ad461eb42724ade2574c0ce9c68df655a4524b4..e0a5e978d584bcc0e692806b3d80d01710526eb3 100644 +index 5c42b8ca8498074e0d371dd24ff2ac91afbaf69c..c7f48b1fd8b12289a6773191277fc07bea735531 100644 --- a/src/main/java/net/minecraft/server/level/ServerLevel.java +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java @@ -490,8 +490,8 @@ public class ServerLevel extends Level implements WorldGenLevel { @@ -95,7 +95,7 @@ index 401787a5b55384b9ab7755e822b3b881dc45ac45..e537a8df45c31efa80cb898cbef9c3a0 if (weather.isCancelled()) { return; diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java -index 1dd7f21b6088f94bd523578fe6a1bb2c542145c5..464dfd15ba347896ea6bf21e7e95087d4324f4f4 100644 +index 4ba0106e5dd95dbe5cf1db091abf34dea330fb54..b6c43ae3703a302aa82cc0bc7f99a1502d2fd822 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java @@ -1189,7 +1189,7 @@ public class CraftWorld extends CraftRegionAccessor implements World { diff --git a/patches/server/0653-More-Lidded-Block-API.patch b/patches/server/0652-More-Lidded-Block-API.patch similarity index 100% rename from patches/server/0653-More-Lidded-Block-API.patch rename to patches/server/0652-More-Lidded-Block-API.patch diff --git a/patches/server/0654-Limit-item-frame-cursors-on-maps.patch b/patches/server/0653-Limit-item-frame-cursors-on-maps.patch similarity index 57% rename from patches/server/0654-Limit-item-frame-cursors-on-maps.patch rename to patches/server/0653-Limit-item-frame-cursors-on-maps.patch index 512ce670d0..4e2cd3bfa2 100644 --- a/patches/server/0654-Limit-item-frame-cursors-on-maps.patch +++ b/patches/server/0653-Limit-item-frame-cursors-on-maps.patch @@ -4,22 +4,8 @@ Date: Wed, 26 May 2021 15:09:33 -0700 Subject: [PATCH] Limit item frame cursors on maps -diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -index 7942d733655838f673a3d79cab2288dec70dc6e2..93aade43e28d87e631c1e61271485dd1cd24f9fc 100644 ---- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -@@ -897,4 +897,9 @@ public class PaperWorldConfig { - private void allowUsingSignsInsideSpawnProtection() { - allowUsingSignsInsideSpawnProtection = getBoolean("allow-using-signs-inside-spawn-protection", allowUsingSignsInsideSpawnProtection); - } -+ -+ public int mapItemFrameCursorLimit = 128; -+ private void mapItemFrameCursorLimit() { -+ mapItemFrameCursorLimit = getInt("map-item-frame-cursor-limit", mapItemFrameCursorLimit); -+ } - } diff --git a/src/main/java/net/minecraft/world/level/saveddata/maps/MapItemSavedData.java b/src/main/java/net/minecraft/world/level/saveddata/maps/MapItemSavedData.java -index 4acbcafc158cf11af51d9518ba5b83aaa75f52a1..6a78374b6ab3198571df7e17023d371667ebb24b 100644 +index 4acbcafc158cf11af51d9518ba5b83aaa75f52a1..67b88da702b780f79c0496cb17f1e6f1f8dd6c2b 100644 --- a/src/main/java/net/minecraft/world/level/saveddata/maps/MapItemSavedData.java +++ b/src/main/java/net/minecraft/world/level/saveddata/maps/MapItemSavedData.java @@ -295,8 +295,12 @@ public class MapItemSavedData extends SavedData { @@ -27,7 +13,7 @@ index 4acbcafc158cf11af51d9518ba5b83aaa75f52a1..6a78374b6ab3198571df7e17023d3716 MapFrame worldmapframe1 = new MapFrame(blockposition, entityitemframe.getDirection().get2DDataValue() * 90, entityitemframe.getId()); + // Paper start -+ if (this.decorations.size() < player.level.paperConfig.mapItemFrameCursorLimit) { ++ if (this.decorations.size() < player.level.paperConfig().maps.itemFrameCursorLimit) { this.addDecoration(MapDecoration.Type.FRAME, player.level, "frame-" + entityitemframe.getId(), (double) blockposition.getX(), (double) blockposition.getZ(), (double) (entityitemframe.getDirection().get2DDataValue() * 90), (Component) null); this.frameMarkers.put(worldmapframe1.getId(), worldmapframe1); + } diff --git a/patches/server/0655-Add-PlayerKickEvent-causes.patch b/patches/server/0654-Add-PlayerKickEvent-causes.patch similarity index 92% rename from patches/server/0655-Add-PlayerKickEvent-causes.patch rename to patches/server/0654-Add-PlayerKickEvent-causes.patch index b8e35b48e3..97816c0db8 100644 --- a/patches/server/0655-Add-PlayerKickEvent-causes.patch +++ b/patches/server/0654-Add-PlayerKickEvent-causes.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Add PlayerKickEvent causes diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index 6693a1861a775b755aa06844a37753ba9ec3bbc5..939170ade7c24bcf1c358f00931f867599cf9d54 100644 +index 86609f740b6bf4890c63d8de15f366032eb024ff..93631f0a59781b8310f7bf66c0ed4781b833ef79 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java @@ -2083,7 +2083,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop 80) { ServerGamePacketListenerImpl.LOGGER.warn("{} was kicked for floating too long!", this.player.getName().getString()); -- this.disconnect(com.destroystokyo.paper.PaperConfig.flyingKickPlayerMessage); // Paper - use configurable kick message -+ this.disconnect(com.destroystokyo.paper.PaperConfig.flyingKickPlayerMessage, org.bukkit.event.player.PlayerKickEvent.Cause.FLYING_PLAYER); // Paper - use configurable kick message & kick event cause +- this.disconnect(io.papermc.paper.configuration.GlobalConfiguration.get().messages.kick.flyingPlayer); // Paper - use configurable kick message ++ this.disconnect(io.papermc.paper.configuration.GlobalConfiguration.get().messages.kick.flyingPlayer, org.bukkit.event.player.PlayerKickEvent.Cause.FLYING_PLAYER); // Paper - use configurable kick message & kick event cause return; } } else { @@ -73,8 +73,8 @@ index 205f8f270da077aaefaad509acb5923b97788feb..338a026b283de5e83428073b8debb5cf if (this.clientVehicleIsFloating && this.player.getRootVehicle().getControllingPassenger() == this.player) { if (++this.aboveGroundVehicleTickCount > 80) { ServerGamePacketListenerImpl.LOGGER.warn("{} was kicked for floating a vehicle too long!", this.player.getName().getString()); -- this.disconnect(com.destroystokyo.paper.PaperConfig.flyingKickVehicleMessage); // Paper - use configurable kick message -+ this.disconnect(com.destroystokyo.paper.PaperConfig.flyingKickVehicleMessage, org.bukkit.event.player.PlayerKickEvent.Cause.FLYING_VEHICLE); // Paper - use configurable kick message & kick event cause +- this.disconnect(io.papermc.paper.configuration.GlobalConfiguration.get().messages.kick.flyingVehicle); // Paper - use configurable kick message ++ this.disconnect(io.papermc.paper.configuration.GlobalConfiguration.get().messages.kick.flyingVehicle, org.bukkit.event.player.PlayerKickEvent.Cause.FLYING_VEHICLE); // Paper - use configurable kick message & kick event cause return; } } else { @@ -124,7 +124,7 @@ index 205f8f270da077aaefaad509acb5923b97788feb..338a026b283de5e83428073b8debb5cf if (this.processedDisconnect) { @@ -455,7 +463,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser } - net.kyori.adventure.text.Component leaveMessage = net.kyori.adventure.text.Component.translatable("multiplayer.player.left", net.kyori.adventure.text.format.NamedTextColor.YELLOW, com.destroystokyo.paper.PaperConfig.useDisplayNameInQuit ? this.player.getBukkitEntity().displayName() : net.kyori.adventure.text.Component.text(this.player.getScoreboardName())); // Paper - Adventure + net.kyori.adventure.text.Component leaveMessage = net.kyori.adventure.text.Component.translatable("multiplayer.player.left", net.kyori.adventure.text.format.NamedTextColor.YELLOW, io.papermc.paper.configuration.GlobalConfiguration.get().messages.useDisplayNameInQuitMessage ? this.player.getBukkitEntity().displayName() : net.kyori.adventure.text.Component.text(this.player.getScoreboardName())); // Paper - Adventure - PlayerKickEvent event = new PlayerKickEvent(this.player.getBukkitEntity(), reason, leaveMessage); // Paper - Adventure + PlayerKickEvent event = new PlayerKickEvent(this.player.getBukkitEntity(), reason, leaveMessage, cause); // Paper - Adventure & kick event reason @@ -143,7 +143,7 @@ index 205f8f270da077aaefaad509acb5923b97788feb..338a026b283de5e83428073b8debb5cf @@ -783,13 +791,13 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser // PlayerConnectionUtils.ensureMainThread(packetplayintabcomplete, this, this.player.getWorldServer()); // Paper - run this async // CraftBukkit start - if (this.chatSpamTickCount.addAndGet(com.destroystokyo.paper.PaperConfig.tabSpamIncrement) > com.destroystokyo.paper.PaperConfig.tabSpamLimit && !this.server.getPlayerList().isOp(this.player.getGameProfile())) { // Paper start - split and make configurable + if (this.chatSpamTickCount.addAndGet(io.papermc.paper.configuration.GlobalConfiguration.get().spamLimiter.tabSpamIncrement) > io.papermc.paper.configuration.GlobalConfiguration.get().spamLimiter.tabSpamLimit && !this.server.getPlayerList().isOp(this.player.getGameProfile())) { // Paper start - split and make configurable - server.scheduleOnMain(() -> this.disconnect(Component.translatable("disconnect.spam", new Object[0]))); // Paper + server.scheduleOnMain(() -> this.disconnect(Component.translatable("disconnect.spam", new Object[0]), org.bukkit.event.player.PlayerKickEvent.Cause.SPAM)); // Paper - kick event cause return; @@ -275,7 +275,7 @@ index 205f8f270da077aaefaad509acb5923b97788feb..338a026b283de5e83428073b8debb5cf @@ -3035,7 +3043,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser // Paper start if (!org.bukkit.Bukkit.isPrimaryThread()) { - if (recipeSpamPackets.addAndGet(com.destroystokyo.paper.PaperConfig.autoRecipeIncrement) > com.destroystokyo.paper.PaperConfig.autoRecipeLimit) { + if (recipeSpamPackets.addAndGet(io.papermc.paper.configuration.GlobalConfiguration.get().spamLimiter.recipeSpamIncrement) > io.papermc.paper.configuration.GlobalConfiguration.get().spamLimiter.recipeSpamLimit) { - server.scheduleOnMain(() -> this.disconnect(net.minecraft.network.chat.Component.translatable("disconnect.spam", new Object[0]))); // Paper + server.scheduleOnMain(() -> this.disconnect(net.minecraft.network.chat.Component.translatable("disconnect.spam", new Object[0]), org.bukkit.event.player.PlayerKickEvent.Cause.SPAM)); // Paper - kick event cause return; @@ -318,7 +318,7 @@ index 205f8f270da077aaefaad509acb5923b97788feb..338a026b283de5e83428073b8debb5cf } diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java -index 11b5335a7f30113da58c39aa15ca5e6f0b2588d5..3562532e446e3a6b2ecfc4aa37693b3a4ec6af47 100644 +index a4278a4ca0b41813b8f88d01dcc8d75b4f458908..be163c1cc4c8982b89be86c004299cdcb8ba7387 100644 --- a/src/main/java/net/minecraft/server/players/PlayerList.java +++ b/src/main/java/net/minecraft/server/players/PlayerList.java @@ -719,7 +719,7 @@ public abstract class PlayerList { @@ -342,7 +342,7 @@ index 11b5335a7f30113da58c39aa15ca5e6f0b2588d5..3562532e446e3a6b2ecfc4aa37693b3a // CraftBukkit end diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -index 42e9ff7f10a63232a93dc44f220617d5140dcb20..10ae4c1a3cd93dc89a6b43256b522cf8f430ee3e 100644 +index 708833d3389b822c08c107d513a79762b50dcec0..294b7c0ad1e0088307baecbab5ad33f897be5bcd 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java @@ -516,7 +516,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player { diff --git a/patches/server/0656-Add-PufferFishStateChangeEvent.patch b/patches/server/0655-Add-PufferFishStateChangeEvent.patch similarity index 100% rename from patches/server/0656-Add-PufferFishStateChangeEvent.patch rename to patches/server/0655-Add-PufferFishStateChangeEvent.patch diff --git a/patches/server/0657-Fix-PlayerBucketEmptyEvent-result-itemstack.patch b/patches/server/0656-Fix-PlayerBucketEmptyEvent-result-itemstack.patch similarity index 100% rename from patches/server/0657-Fix-PlayerBucketEmptyEvent-result-itemstack.patch rename to patches/server/0656-Fix-PlayerBucketEmptyEvent-result-itemstack.patch diff --git a/patches/server/0658-Synchronize-PalettedContainer-instead-of-ThreadingDe.patch b/patches/server/0657-Synchronize-PalettedContainer-instead-of-ThreadingDe.patch similarity index 100% rename from patches/server/0658-Synchronize-PalettedContainer-instead-of-ThreadingDe.patch rename to patches/server/0657-Synchronize-PalettedContainer-instead-of-ThreadingDe.patch diff --git a/patches/server/0659-Add-option-to-fix-items-merging-through-walls.patch b/patches/server/0658-Add-option-to-fix-items-merging-through-walls.patch similarity index 59% rename from patches/server/0659-Add-option-to-fix-items-merging-through-walls.patch rename to patches/server/0658-Add-option-to-fix-items-merging-through-walls.patch index dea0165525..b628475ea9 100644 --- a/patches/server/0659-Add-option-to-fix-items-merging-through-walls.patch +++ b/patches/server/0658-Add-option-to-fix-items-merging-through-walls.patch @@ -4,22 +4,8 @@ Date: Wed, 10 Mar 2021 10:06:45 -0800 Subject: [PATCH] Add option to fix items merging through walls -diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -index 93aade43e28d87e631c1e61271485dd1cd24f9fc..de12b0f79d58177ab2fe1c925bca43f33ba8cffe 100644 ---- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -@@ -902,4 +902,9 @@ public class PaperWorldConfig { - private void mapItemFrameCursorLimit() { - mapItemFrameCursorLimit = getInt("map-item-frame-cursor-limit", mapItemFrameCursorLimit); - } -+ -+ public boolean fixItemsMergingThroughWalls; -+ private void fixItemsMergingThroughWalls() { -+ fixItemsMergingThroughWalls = getBoolean("fix-items-merging-through-walls", fixItemsMergingThroughWalls); -+ } - } diff --git a/src/main/java/net/minecraft/world/entity/item/ItemEntity.java b/src/main/java/net/minecraft/world/entity/item/ItemEntity.java -index 3364316079dba81778869380b70e621cb9ac6269..3b70e37140531884397696760dd9ef597c4655bc 100644 +index 296434a1659cd9ae3d582696336f75e3c156b8c4..0db5b0b05a9a213e28311a934b31bd32807eb2e0 100644 --- a/src/main/java/net/minecraft/world/entity/item/ItemEntity.java +++ b/src/main/java/net/minecraft/world/entity/item/ItemEntity.java @@ -251,6 +251,14 @@ public class ItemEntity extends Entity { @@ -27,7 +13,7 @@ index 3364316079dba81778869380b70e621cb9ac6269..3b70e37140531884397696760dd9ef59 if (entityitem.isMergable()) { + // Paper Start - Fix items merging through walls -+ if (this.level.paperConfig.fixItemsMergingThroughWalls) { ++ if (this.level.paperConfig().fixes.fixItemsMergingThroughWalls) { + net.minecraft.world.level.ClipContext rayTrace = new net.minecraft.world.level.ClipContext(this.position(), entityitem.position(), + net.minecraft.world.level.ClipContext.Block.COLLIDER, net.minecraft.world.level.ClipContext.Fluid.NONE, this); + net.minecraft.world.phys.BlockHitResult rayTraceResult = level.clip(rayTrace); diff --git a/patches/server/0660-Add-BellRevealRaiderEvent.patch b/patches/server/0659-Add-BellRevealRaiderEvent.patch similarity index 100% rename from patches/server/0660-Add-BellRevealRaiderEvent.patch rename to patches/server/0659-Add-BellRevealRaiderEvent.patch diff --git a/patches/server/0661-Fix-invulnerable-end-crystals.patch b/patches/server/0660-Fix-invulnerable-end-crystals.patch similarity index 77% rename from patches/server/0661-Fix-invulnerable-end-crystals.patch rename to patches/server/0660-Fix-invulnerable-end-crystals.patch index 9f55ffd619..e5ce326afa 100644 --- a/patches/server/0661-Fix-invulnerable-end-crystals.patch +++ b/patches/server/0660-Fix-invulnerable-end-crystals.patch @@ -5,22 +5,8 @@ Subject: [PATCH] Fix invulnerable end crystals MC-108513 -diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -index de12b0f79d58177ab2fe1c925bca43f33ba8cffe..554ec0e21fd4a9ede74f1012316862f41356eea3 100644 ---- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -@@ -907,4 +907,9 @@ public class PaperWorldConfig { - private void fixItemsMergingThroughWalls() { - fixItemsMergingThroughWalls = getBoolean("fix-items-merging-through-walls", fixItemsMergingThroughWalls); - } -+ -+ public boolean fixInvulnerableEndCrystalExploit = true; -+ private void fixInvulnerableEndCrystalExploit() { -+ fixInvulnerableEndCrystalExploit = getBoolean("unsupported-settings.fix-invulnerable-end-crystal-exploit", fixInvulnerableEndCrystalExploit); -+ } - } diff --git a/src/main/java/net/minecraft/world/entity/boss/enderdragon/EndCrystal.java b/src/main/java/net/minecraft/world/entity/boss/enderdragon/EndCrystal.java -index 78b0456a3f9e3f66d467386c3e5f68d07adf1977..d8c4f36ae0e65c6d0398fac80c93b78646bdf6a4 100644 +index 78b0456a3f9e3f66d467386c3e5f68d07adf1977..6a08ab40e60b80f8f5c4d3f02da121be9da05111 100644 --- a/src/main/java/net/minecraft/world/entity/boss/enderdragon/EndCrystal.java +++ b/src/main/java/net/minecraft/world/entity/boss/enderdragon/EndCrystal.java @@ -30,6 +30,7 @@ public class EndCrystal extends Entity { @@ -36,7 +22,7 @@ index 78b0456a3f9e3f66d467386c3e5f68d07adf1977..d8c4f36ae0e65c6d0398fac80c93b786 // CraftBukkit end } + // Paper start - Fix invulnerable end crystals -+ if (this.level.paperConfig.fixInvulnerableEndCrystalExploit && this.generatedByDragonFight && this.isInvulnerable()) { ++ if (this.level.paperConfig().unsupportedSettings.fixInvulnerableEndCrystalExploit && this.generatedByDragonFight && this.isInvulnerable()) { + if (!java.util.Objects.equals(((ServerLevel) this.level).uuid, this.getOriginWorld()) + || ((ServerLevel) this.level).dragonFight() == null + || ((ServerLevel) this.level).dragonFight().respawnStage == null diff --git a/patches/server/0662-Add-ElderGuardianAppearanceEvent.patch b/patches/server/0661-Add-ElderGuardianAppearanceEvent.patch similarity index 100% rename from patches/server/0662-Add-ElderGuardianAppearanceEvent.patch rename to patches/server/0661-Add-ElderGuardianAppearanceEvent.patch diff --git a/patches/server/0663-Fix-dangerous-end-portal-logic.patch b/patches/server/0662-Fix-dangerous-end-portal-logic.patch similarity index 97% rename from patches/server/0663-Fix-dangerous-end-portal-logic.patch rename to patches/server/0662-Fix-dangerous-end-portal-logic.patch index 3bb52e1012..f29fd98fb4 100644 --- a/patches/server/0663-Fix-dangerous-end-portal-logic.patch +++ b/patches/server/0662-Fix-dangerous-end-portal-logic.patch @@ -11,7 +11,7 @@ Move the tick logic into the post tick, where portaling was designed to happen in the first place. diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java -index 16a1f39c118778efa6b494cad1f9ad639e6dbb41..4af9eda54cf1430abc6abca07628635a2af35f53 100644 +index 7634e8a8859f6fbf68cc3f62c698ecb84264f9c0..8813d1720879f8b75d1d1c5f4e8f4414c663bfd6 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java @@ -453,6 +453,36 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource { diff --git a/patches/server/0664-Optimize-Biome-Mob-Lookups-for-Mob-Spawning.patch b/patches/server/0663-Optimize-Biome-Mob-Lookups-for-Mob-Spawning.patch similarity index 100% rename from patches/server/0664-Optimize-Biome-Mob-Lookups-for-Mob-Spawning.patch rename to patches/server/0663-Optimize-Biome-Mob-Lookups-for-Mob-Spawning.patch diff --git a/patches/server/0665-Make-item-validations-configurable.patch b/patches/server/0664-Make-item-validations-configurable.patch similarity index 50% rename from patches/server/0665-Make-item-validations-configurable.patch rename to patches/server/0664-Make-item-validations-configurable.patch index 82e15d5317..8a1a405f54 100644 --- a/patches/server/0665-Make-item-validations-configurable.patch +++ b/patches/server/0664-Make-item-validations-configurable.patch @@ -4,32 +4,8 @@ Date: Fri, 4 Jun 2021 12:12:35 -0700 Subject: [PATCH] Make item validations configurable -diff --git a/src/main/java/com/destroystokyo/paper/PaperConfig.java b/src/main/java/com/destroystokyo/paper/PaperConfig.java -index 39dada86032dce8573d1be40d13daca0e93e47be..1978f4bc9cf3ac5f24e6a558c50fd772b4ca2685 100644 ---- a/src/main/java/com/destroystokyo/paper/PaperConfig.java -+++ b/src/main/java/com/destroystokyo/paper/PaperConfig.java -@@ -502,4 +502,19 @@ public class PaperConfig { - config.set("settings.unsupported-settings.allow-headless-pistons-readme", "This setting controls if players should be able to create headless pistons."); - allowHeadlessPistons = getBoolean("settings.unsupported-settings.allow-headless-pistons", false); - } -+ -+ public static int itemValidationDisplayNameLength = 8192; -+ public static int itemValidationLocNameLength = 8192; -+ public static int itemValidationLoreLineLength = 8192; -+ public static int itemValidationBookTitleLength = 8192; -+ public static int itemValidationBookAuthorLength = 8192; -+ public static int itemValidationBookPageLength = 16384; -+ private static void itemValidationSettings() { -+ itemValidationDisplayNameLength = getInt("settings.item-validation.display-name", itemValidationDisplayNameLength); -+ itemValidationLocNameLength = getInt("settings.item-validation.loc-name", itemValidationLocNameLength); -+ itemValidationLoreLineLength = getInt("settings.item-validation.lore-line", itemValidationLoreLineLength); -+ itemValidationBookTitleLength = getInt("settings.item-validation.book.title", itemValidationBookTitleLength); -+ itemValidationBookAuthorLength = getInt("settings.item-validation.book.author", itemValidationBookAuthorLength); -+ itemValidationBookPageLength = getInt("settings.item-validation.book.page", itemValidationBookPageLength); -+ } - } diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaBook.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaBook.java -index fefa4d83c5699be0b55794cd28d13d27b66ef108..182cd92b4322127a81d5f14e5d4fd156057979c2 100644 +index fefa4d83c5699be0b55794cd28d13d27b66ef108..d662cb0567884ec91c900f5c90ecb36912b127dd 100644 --- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaBook.java +++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaBook.java @@ -92,11 +92,11 @@ public class CraftMetaBook extends CraftMetaItem implements BookMeta { @@ -37,12 +13,12 @@ index fefa4d83c5699be0b55794cd28d13d27b66ef108..182cd92b4322127a81d5f14e5d4fd156 if (tag.contains(BOOK_TITLE.NBT)) { - this.title = limit( tag.getString(BOOK_TITLE.NBT), 8192 ); // Spigot -+ this.title = limit( tag.getString(BOOK_TITLE.NBT), com.destroystokyo.paper.PaperConfig.itemValidationBookTitleLength); // Spigot // Paper - make configurable ++ this.title = limit( tag.getString(BOOK_TITLE.NBT), io.papermc.paper.configuration.GlobalConfiguration.get().itemValidation.book.title); // Spigot // Paper - make configurable } if (tag.contains(BOOK_AUTHOR.NBT)) { - this.author = limit( tag.getString(BOOK_AUTHOR.NBT), 8192 ); // Spigot -+ this.author = limit( tag.getString(BOOK_AUTHOR.NBT), com.destroystokyo.paper.PaperConfig.itemValidationBookAuthorLength ); // Spigot // Paper - make configurable ++ this.author = limit( tag.getString(BOOK_AUTHOR.NBT), io.papermc.paper.configuration.GlobalConfiguration.get().itemValidation.book.author ); // Spigot // Paper - make configurable } if (tag.contains(RESOLVED.NBT)) { @@ -51,12 +27,12 @@ index fefa4d83c5699be0b55794cd28d13d27b66ef108..182cd92b4322127a81d5f14e5d4fd156 page = this.validatePage(page); } - this.pages.add( limit( page, 16384 ) ); // Spigot -+ this.pages.add( limit( page, com.destroystokyo.paper.PaperConfig.itemValidationBookPageLength ) ); // Spigot // Paper - make configurable ++ this.pages.add( limit( page, io.papermc.paper.configuration.GlobalConfiguration.get().itemValidation.book.page ) ); // Spigot // Paper - make configurable } } } diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java -index c475ddea1c995df1dfcaf4f491f341761a5f8802..bf3d6c613d905554d3faa73765a16774f43c6546 100644 +index c475ddea1c995df1dfcaf4f491f341761a5f8802..c098003d5801b132d71adbaa9f85c41854c684e4 100644 --- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java +++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java @@ -357,18 +357,18 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta { @@ -64,12 +40,12 @@ index c475ddea1c995df1dfcaf4f491f341761a5f8802..bf3d6c613d905554d3faa73765a16774 if (display.contains(NAME.NBT)) { - this.displayName = limit( display.getString(NAME.NBT), 8192 ); // Spigot -+ this.displayName = limit( display.getString(NAME.NBT), com.destroystokyo.paper.PaperConfig.itemValidationDisplayNameLength ); // Spigot // Paper - make configurable ++ this.displayName = limit( display.getString(NAME.NBT), io.papermc.paper.configuration.GlobalConfiguration.get().itemValidation.displayName ); // Spigot // Paper - make configurable } if (display.contains(LOCNAME.NBT)) { - this.locName = limit( display.getString(LOCNAME.NBT), 8192 ); // Spigot -+ this.locName = limit( display.getString(LOCNAME.NBT), com.destroystokyo.paper.PaperConfig.itemValidationLocNameLength ); // Spigot // Paper - make configurable ++ this.locName = limit( display.getString(LOCNAME.NBT), io.papermc.paper.configuration.GlobalConfiguration.get().itemValidation.locName ); // Spigot // Paper - make configurable } if (display.contains(LORE.NBT)) { @@ -77,7 +53,7 @@ index c475ddea1c995df1dfcaf4f491f341761a5f8802..bf3d6c613d905554d3faa73765a16774 this.lore = new ArrayList(list.size()); for (int index = 0; index < list.size(); index++) { - String line = limit( list.getString(index), 8192 ); // Spigot -+ String line = limit( list.getString(index), com.destroystokyo.paper.PaperConfig.itemValidationLoreLineLength ); // Spigot // Paper - make configurable ++ String line = limit( list.getString(index), io.papermc.paper.configuration.GlobalConfiguration.get().itemValidation.loreLine ); // Spigot // Paper - make configurable this.lore.add(line); } } diff --git a/patches/server/0666-Line-Of-Sight-Changes.patch b/patches/server/0665-Line-Of-Sight-Changes.patch similarity index 98% rename from patches/server/0666-Line-Of-Sight-Changes.patch rename to patches/server/0665-Line-Of-Sight-Changes.patch index 2a21d9848a..0776c491ea 100644 --- a/patches/server/0666-Line-Of-Sight-Changes.patch +++ b/patches/server/0665-Line-Of-Sight-Changes.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Line Of Sight Changes diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java -index aff3c2020a604942b5ba407156ebf5953ffa0377..1bd4f72a5c0aba38609cb34dcb94ff03809f853c 100644 +index 2d892c04efc4db941bf8ad57029589b55d0155f7..ecb499ed17df00afcc0898d35b05b260f1d3fe6e 100644 --- a/src/main/java/net/minecraft/world/entity/LivingEntity.java +++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java @@ -3481,7 +3481,8 @@ public abstract class LivingEntity extends Entity { diff --git a/patches/server/0666-add-per-world-spawn-limits.patch b/patches/server/0666-add-per-world-spawn-limits.patch new file mode 100644 index 0000000000..2a6c716495 --- /dev/null +++ b/patches/server/0666-add-per-world-spawn-limits.patch @@ -0,0 +1,25 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: chase +Date: Wed, 2 Dec 2020 22:43:39 -0800 +Subject: [PATCH] add per world spawn limits + +Taken from #2982. Credit to Chasewhip8 + +diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java +index b6c43ae3703a302aa82cc0bc7f99a1502d2fd822..acd935f7b9652ae4e778d865e9be1f0bfe906fe0 100644 +--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java ++++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java +@@ -205,6 +205,13 @@ public class CraftWorld extends CraftRegionAccessor implements World { + this.biomeProvider = biomeProvider; + + this.environment = env; ++ // Paper start - per world spawn limits ++ for (SpawnCategory spawnCategory : SpawnCategory.values()) { ++ if (CraftSpawnCategory.isValidForLimits(spawnCategory)) { ++ setSpawnLimit(spawnCategory, this.world.paperConfig().entities.spawning.spawnLimits.getInt(CraftSpawnCategory.toNMS(spawnCategory))); ++ } ++ } ++ // Paper end + } + + @Override diff --git a/patches/server/0668-Fix-PotionSplashEvent-for-water-splash-potions.patch b/patches/server/0667-Fix-PotionSplashEvent-for-water-splash-potions.patch similarity index 100% rename from patches/server/0668-Fix-PotionSplashEvent-for-water-splash-potions.patch rename to patches/server/0667-Fix-PotionSplashEvent-for-water-splash-potions.patch diff --git a/patches/server/0667-add-per-world-spawn-limits.patch b/patches/server/0667-add-per-world-spawn-limits.patch deleted file mode 100644 index 92280af242..0000000000 --- a/patches/server/0667-add-per-world-spawn-limits.patch +++ /dev/null @@ -1,63 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: chase -Date: Wed, 2 Dec 2020 22:43:39 -0800 -Subject: [PATCH] add per world spawn limits - -Taken from #2982. Credit to Chasewhip8 - -diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -index 554ec0e21fd4a9ede74f1012316862f41356eea3..d2c6fa510c72cd7992fb7282ef152f7e86a6c1f3 100644 ---- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -@@ -58,6 +58,11 @@ public class PaperWorldConfig { - - set("despawn-ranges.soft", null); - set("despawn-ranges.hard", null); -+ -+ set("spawn-limits.monsters", null); -+ set("spawn-limits.animals", null); -+ set("spawn-limits.water-animals", null); -+ set("spawn-limits.water-ambient", null); - } - - if (this.config.isSet("world-settings.default.treasure-maps-return-already-discovered") || this.config.isSet("world-settings." + worldName + ".treasure-maps-return-already-discovered")) { -@@ -735,6 +740,21 @@ public class PaperWorldConfig { - zombieVillagerInfectionChance = getDouble("zombie-villager-infection-chance", zombieVillagerInfectionChance); - } - -+ public Reference2IntMap perWorldSpawnLimits = new Reference2IntOpenHashMap<>(net.minecraft.world.level.NaturalSpawner.SPAWNING_CATEGORIES.length); -+ private void perWorldSpawnLimits() { -+ perWorldSpawnLimits.defaultReturnValue(-1); -+ if (PaperConfig.version < 24) { -+ // ambient category already had correct name -+ perWorldSpawnLimits.put(MobCategory.MONSTER, getInt("spawn-limits.monsters", -1, false)); -+ perWorldSpawnLimits.put(MobCategory.CREATURE, getInt("spawn-limits.animals", -1, false)); -+ perWorldSpawnLimits.put(MobCategory.WATER_CREATURE, getInt("spawn-limits.water-animals", -1, false)); -+ perWorldSpawnLimits.put(MobCategory.WATER_AMBIENT, getInt("spawn-limits.water-ambient", -1, false)); -+ } -+ for (MobCategory value : net.minecraft.world.level.NaturalSpawner.SPAWNING_CATEGORIES) { -+ perWorldSpawnLimits.put(value, getInt("spawn-limits." + value.getName(), perWorldSpawnLimits.getInt(value))); -+ } -+ } -+ - public int lightQueueSize = 20; - private void lightQueueSize() { - lightQueueSize = getInt("light-queue-size", lightQueueSize); -diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java -index 464dfd15ba347896ea6bf21e7e95087d4324f4f4..aea681f994fc97390aa29a2338f9a92eb6a4a806 100644 ---- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java -+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java -@@ -205,6 +205,13 @@ public class CraftWorld extends CraftRegionAccessor implements World { - this.biomeProvider = biomeProvider; - - this.environment = env; -+ // Paper start - per world spawn limits -+ for (SpawnCategory spawnCategory : SpawnCategory.values()) { -+ if (CraftSpawnCategory.isValidForLimits(spawnCategory)) { -+ setSpawnLimit(spawnCategory, this.world.paperConfig.perWorldSpawnLimits.getInt(CraftSpawnCategory.toNMS(spawnCategory))); -+ } -+ } -+ // Paper end - } - - @Override diff --git a/patches/server/0669-Add-more-LimitedRegion-API.patch b/patches/server/0668-Add-more-LimitedRegion-API.patch similarity index 100% rename from patches/server/0669-Add-more-LimitedRegion-API.patch rename to patches/server/0668-Add-more-LimitedRegion-API.patch diff --git a/patches/server/0670-Fix-PlayerDropItemEvent-using-wrong-item.patch b/patches/server/0669-Fix-PlayerDropItemEvent-using-wrong-item.patch similarity index 89% rename from patches/server/0670-Fix-PlayerDropItemEvent-using-wrong-item.patch rename to patches/server/0669-Fix-PlayerDropItemEvent-using-wrong-item.patch index c79da63ade..051858a0d9 100644 --- a/patches/server/0670-Fix-PlayerDropItemEvent-using-wrong-item.patch +++ b/patches/server/0669-Fix-PlayerDropItemEvent-using-wrong-item.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Fix PlayerDropItemEvent using wrong item diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java -index d78de27793ffca39a256accecd5033860ac23d1d..641bfb20197e6885c019aa825ff06980fb2f7ca8 100644 +index fd131a583b57687837533f0541091a293b300169..f5b37334d21c3c3812b4f343e5af17234dd9f907 100644 --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java @@ -2206,7 +2206,7 @@ public class ServerPlayer extends Player { @@ -18,7 +18,7 @@ index d78de27793ffca39a256accecd5033860ac23d1d..641bfb20197e6885c019aa825ff06980 this.awardStat(Stats.DROP); diff --git a/src/main/java/net/minecraft/world/entity/player/Player.java b/src/main/java/net/minecraft/world/entity/player/Player.java -index ef920c0596a50c6bbe0e5b05df2fe3c700d05e83..3ef7815063d3dce4044710e685a01b8f02f7c005 100644 +index 2c65305037583d55fa20783d0f264382467f8c3f..494ecf80d856bb3030aaf3892a5b175d8827aeff 100644 --- a/src/main/java/net/minecraft/world/entity/player/Player.java +++ b/src/main/java/net/minecraft/world/entity/player/Player.java @@ -722,6 +722,11 @@ public abstract class Player extends LivingEntity { diff --git a/patches/server/0671-Missing-Entity-Behavior-API.patch b/patches/server/0670-Missing-Entity-Behavior-API.patch similarity index 100% rename from patches/server/0671-Missing-Entity-Behavior-API.patch rename to patches/server/0670-Missing-Entity-Behavior-API.patch diff --git a/patches/server/0672-Ensure-disconnect-for-book-edit-is-called-on-main.patch b/patches/server/0671-Ensure-disconnect-for-book-edit-is-called-on-main.patch similarity index 92% rename from patches/server/0672-Ensure-disconnect-for-book-edit-is-called-on-main.patch rename to patches/server/0671-Ensure-disconnect-for-book-edit-is-called-on-main.patch index 3b558c720c..3cbe3abbd5 100644 --- a/patches/server/0672-Ensure-disconnect-for-book-edit-is-called-on-main.patch +++ b/patches/server/0671-Ensure-disconnect-for-book-edit-is-called-on-main.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Ensure disconnect for book edit is called on main diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index 338a026b283de5e83428073b8debb5cfca07f653..7c4d962b71d8119f0310435a519ab61412b8d969 100644 +index 805b3e88dce0518fd55c3b6f45a70e5a83647830..143d364db73114cba2601ee117a1a80d19a922c5 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java @@ -1145,7 +1145,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser diff --git a/patches/server/0673-Fix-return-value-of-Block-applyBoneMeal-always-being.patch b/patches/server/0672-Fix-return-value-of-Block-applyBoneMeal-always-being.patch similarity index 100% rename from patches/server/0673-Fix-return-value-of-Block-applyBoneMeal-always-being.patch rename to patches/server/0672-Fix-return-value-of-Block-applyBoneMeal-always-being.patch diff --git a/patches/server/0674-Use-getChunkIfLoadedImmediately-in-places.patch b/patches/server/0673-Use-getChunkIfLoadedImmediately-in-places.patch similarity index 83% rename from patches/server/0674-Use-getChunkIfLoadedImmediately-in-places.patch rename to patches/server/0673-Use-getChunkIfLoadedImmediately-in-places.patch index 964759c364..023f90b1b4 100644 --- a/patches/server/0674-Use-getChunkIfLoadedImmediately-in-places.patch +++ b/patches/server/0673-Use-getChunkIfLoadedImmediately-in-places.patch @@ -8,7 +8,7 @@ ticket level 33 (yes getChunkIfLoaded will actually perform a chunk load in that case). diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java -index e0a5e978d584bcc0e692806b3d80d01710526eb3..62bb1fd46e4dff43e9c83c05260c7deaffe445a9 100644 +index 08c6230022d0bfcfec158114b2238635bc2bbc98..5ebc2f7486adbdd9748694d4edb9a737a17c4fed 100644 --- a/src/main/java/net/minecraft/server/level/ServerLevel.java +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java @@ -220,7 +220,7 @@ public class ServerLevel extends Level implements WorldGenLevel { @@ -30,10 +30,10 @@ index e0a5e978d584bcc0e692806b3d80d01710526eb3..62bb1fd46e4dff43e9c83c05260c7dea if (chunk != null) { for (int j2 = k; j2 <= j1; ++j2) { diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java -index c22e6e9d043f9afcb8c2fe24e9edd180304930dc..397afdf68e6330c5aaf465f219800985ad26e9e2 100644 +index 646e40b01a4df143802dc981a5594a17c37e5d10..91a36884e10c278f6e0efb4fbed1352492b38200 100644 --- a/src/main/java/net/minecraft/world/level/Level.java +++ b/src/main/java/net/minecraft/world/level/Level.java -@@ -195,6 +195,13 @@ public abstract class Level implements LevelAccessor, AutoCloseable { +@@ -200,6 +200,13 @@ public abstract class Level implements LevelAccessor, AutoCloseable { return (CraftServer) Bukkit.getServer(); } @@ -46,4 +46,4 @@ index c22e6e9d043f9afcb8c2fe24e9edd180304930dc..397afdf68e6330c5aaf465f219800985 + public abstract ResourceKey getTypeKey(); - protected Level(WritableLevelData worlddatamutable, ResourceKey resourcekey, 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.concurrent.Executor executor) { // Paper - Async-Anti-Xray - Pass executor + protected Level(WritableLevelData worlddatamutable, ResourceKey resourcekey, Holder holder, Supplier supplier, boolean flag, boolean flag1, long i, int j, org.bukkit.generator.ChunkGenerator gen, org.bukkit.generator.BiomeProvider biomeProvider, org.bukkit.World.Environment env, java.util.function.Function paperWorldConfigCreator, java.util.concurrent.Executor executor) { // Paper - Async-Anti-Xray - Pass executor diff --git a/patches/server/0675-Fix-commands-from-signs-not-firing-command-events.patch b/patches/server/0674-Fix-commands-from-signs-not-firing-command-events.patch similarity index 83% rename from patches/server/0675-Fix-commands-from-signs-not-firing-command-events.patch rename to patches/server/0674-Fix-commands-from-signs-not-firing-command-events.patch index a924dbbc05..c7d5ed0d5d 100644 --- a/patches/server/0675-Fix-commands-from-signs-not-firing-command-events.patch +++ b/patches/server/0674-Fix-commands-from-signs-not-firing-command-events.patch @@ -9,20 +9,6 @@ This patch changes sign command logic so that `run_command` click events: - work with double-slash commands like `//wand` - sends failure messages to the player who clicked the sign -diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -index d2c6fa510c72cd7992fb7282ef152f7e86a6c1f3..e55e319851e9551bcfa17ff5db5f9bb7f9ae2a00 100644 ---- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -@@ -932,4 +932,9 @@ public class PaperWorldConfig { - private void fixInvulnerableEndCrystalExploit() { - fixInvulnerableEndCrystalExploit = getBoolean("unsupported-settings.fix-invulnerable-end-crystal-exploit", fixInvulnerableEndCrystalExploit); - } -+ -+ public boolean showSignClickCommandFailureMessagesToPlayer = false; -+ private void showSignClickCommandFailureMessagesToPlayer() { -+ showSignClickCommandFailureMessagesToPlayer = getBoolean("show-sign-click-command-failure-msgs-to-player", showSignClickCommandFailureMessagesToPlayer); -+ } - } diff --git a/src/main/java/io/papermc/paper/commands/DelegatingCommandSource.java b/src/main/java/io/papermc/paper/commands/DelegatingCommandSource.java new file mode 100644 index 0000000000000000000000000000000000000000..01a2bc1feec808790bb93618ce46adb9bea5a9c8 @@ -72,7 +58,7 @@ index 0000000000000000000000000000000000000000..01a2bc1feec808790bb93618ce46adb9 + } +} diff --git a/src/main/java/net/minecraft/world/level/block/entity/SignBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/SignBlockEntity.java -index 831db5ee21938d71e99bf9d17b92a6ca15531740..517f9c6df4427f21ebac17a298a57e28d53e6fd0 100644 +index 831db5ee21938d71e99bf9d17b92a6ca15531740..6c96c3dde4e1b1b1b6952841edb41006e73737e9 100644 --- a/src/main/java/net/minecraft/world/level/block/entity/SignBlockEntity.java +++ b/src/main/java/net/minecraft/world/level/block/entity/SignBlockEntity.java @@ -40,6 +40,7 @@ public class SignBlockEntity extends BlockEntity implements CommandSource { // C @@ -106,7 +92,7 @@ index 831db5ee21938d71e99bf9d17b92a6ca15531740..517f9c6df4427f21ebac17a298a57e28 Object object = player == null ? Component.literal("Sign") : player.getDisplayName(); + // Paper start - send messages back to the player -+ CommandSource commandSource = this.level.paperConfig.showSignClickCommandFailureMessagesToPlayer ? new io.papermc.paper.commands.DelegatingCommandSource(this) { ++ CommandSource commandSource = this.level.paperConfig().misc.showSignClickCommandFailureMsgsToPlayer ? new io.papermc.paper.commands.DelegatingCommandSource(this) { + @Override + public void sendSystemMessage(Component message) { + player.sendSystemMessage(message); diff --git a/patches/server/0676-Adds-PlayerArmSwingEvent.patch b/patches/server/0675-Adds-PlayerArmSwingEvent.patch similarity index 92% rename from patches/server/0676-Adds-PlayerArmSwingEvent.patch rename to patches/server/0675-Adds-PlayerArmSwingEvent.patch index 0e58f1e40d..4b01c4b1fd 100644 --- a/patches/server/0676-Adds-PlayerArmSwingEvent.patch +++ b/patches/server/0675-Adds-PlayerArmSwingEvent.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Adds PlayerArmSwingEvent diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index 7c4d962b71d8119f0310435a519ab61412b8d969..ab4d0a34b32a3bdf61cebe29518838b4f2a3a9e0 100644 +index 143d364db73114cba2601ee117a1a80d19a922c5..692108b8edb33775687e5cdee3478b5e53da4cf9 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java @@ -2436,7 +2436,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser diff --git a/patches/server/0677-Fixes-kick-event-leave-message-not-being-sent.patch b/patches/server/0676-Fixes-kick-event-leave-message-not-being-sent.patch similarity index 86% rename from patches/server/0677-Fixes-kick-event-leave-message-not-being-sent.patch rename to patches/server/0676-Fixes-kick-event-leave-message-not-being-sent.patch index 05cd32dd95..36724aca44 100644 --- a/patches/server/0677-Fixes-kick-event-leave-message-not-being-sent.patch +++ b/patches/server/0676-Fixes-kick-event-leave-message-not-being-sent.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Fixes kick event leave message not being sent diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java -index 641bfb20197e6885c019aa825ff06980fb2f7ca8..5bd66fab9231a2be14d3586cfdad86f22abeb0db 100644 +index f5b37334d21c3c3812b4f343e5af17234dd9f907..5db3349f4e366caef84b0d1e811c031ebd4243f9 100644 --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java @@ -258,7 +258,6 @@ public class ServerPlayer extends Player { @@ -17,7 +17,7 @@ index 641bfb20197e6885c019aa825ff06980fb2f7ca8..5bd66fab9231a2be14d3586cfdad86f2 public PlayerNaturallySpawnCreaturesEvent playerNaturallySpawnedEvent; // Paper diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index ab4d0a34b32a3bdf61cebe29518838b4f2a3a9e0..bd784585238f80d6d28a56c98173bc4b9f638112 100644 +index 692108b8edb33775687e5cdee3478b5e53da4cf9..5e8e36711eac7b471f1b4fbd8920eaad0a6f46b4 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java @@ -473,7 +473,6 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser @@ -59,7 +59,7 @@ index ab4d0a34b32a3bdf61cebe29518838b4f2a3a9e0..bd784585238f80d6d28a56c98173bc4b this.server.getPlayerList().broadcastSystemMessage(PaperAdventure.asVanilla(quitMessage), ChatType.SYSTEM); // Paper end diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java -index 3562532e446e3a6b2ecfc4aa37693b3a4ec6af47..30c3a7c566b6cdc83695a36f03f1ff155a8eae20 100644 +index be163c1cc4c8982b89be86c004299cdcb8ba7387..56c9dc2bf76204cd40775d9f47a9ba20919bc04f 100644 --- a/src/main/java/net/minecraft/server/players/PlayerList.java +++ b/src/main/java/net/minecraft/server/players/PlayerList.java @@ -591,6 +591,11 @@ public abstract class PlayerList { @@ -67,7 +67,7 @@ index 3562532e446e3a6b2ecfc4aa37693b3a4ec6af47..30c3a7c566b6cdc83695a36f03f1ff15 public net.kyori.adventure.text.Component remove(ServerPlayer entityplayer) { // Paper - return Component + // Paper start -+ return this.remove(entityplayer, net.kyori.adventure.text.Component.translatable("multiplayer.player.left", net.kyori.adventure.text.format.NamedTextColor.YELLOW, com.destroystokyo.paper.PaperConfig.useDisplayNameInQuit ? entityplayer.getBukkitEntity().displayName() : net.kyori.adventure.text.Component.text(entityplayer.getScoreboardName()))); ++ return this.remove(entityplayer, net.kyori.adventure.text.Component.translatable("multiplayer.player.left", net.kyori.adventure.text.format.NamedTextColor.YELLOW, io.papermc.paper.configuration.GlobalConfiguration.get().messages.useDisplayNameInQuitMessage ? entityplayer.getBukkitEntity().displayName() : net.kyori.adventure.text.Component.text(entityplayer.getScoreboardName()))); + } + public net.kyori.adventure.text.Component remove(ServerPlayer entityplayer, net.kyori.adventure.text.Component leaveMessage) { + // Paper end @@ -78,7 +78,7 @@ index 3562532e446e3a6b2ecfc4aa37693b3a4ec6af47..30c3a7c566b6cdc83695a36f03f1ff15 entityplayer.closeContainer(org.bukkit.event.inventory.InventoryCloseEvent.Reason.DISCONNECT); // Paper } -- PlayerQuitEvent playerQuitEvent = new PlayerQuitEvent(entityplayer.getBukkitEntity(), net.kyori.adventure.text.Component.translatable("multiplayer.player.left", net.kyori.adventure.text.format.NamedTextColor.YELLOW, com.destroystokyo.paper.PaperConfig.useDisplayNameInQuit ? entityplayer.getBukkitEntity().displayName() : net.kyori.adventure.text.Component.text(entityplayer.getScoreboardName())), entityplayer.quitReason); // Paper - quit reason +- PlayerQuitEvent playerQuitEvent = new PlayerQuitEvent(entityplayer.getBukkitEntity(), net.kyori.adventure.text.Component.translatable("multiplayer.player.left", net.kyori.adventure.text.format.NamedTextColor.YELLOW, io.papermc.paper.configuration.GlobalConfiguration.get().messages.useDisplayNameInQuitMessage ? entityplayer.getBukkitEntity().displayName() : net.kyori.adventure.text.Component.text(entityplayer.getScoreboardName())), entityplayer.quitReason); // Paper - quit reason + PlayerQuitEvent playerQuitEvent = new PlayerQuitEvent(entityplayer.getBukkitEntity(), leaveMessage, entityplayer.quitReason); // Paper - quit reason if (entityplayer.didPlayerJoinEvent) this.cserver.getPluginManager().callEvent(playerQuitEvent); // Paper - if we disconnected before join ever fired, don't fire quit entityplayer.getBukkitEntity().disconnect(playerQuitEvent.getQuitMessage()); diff --git a/patches/server/0678-Add-config-for-mobs-immune-to-default-effects.patch b/patches/server/0677-Add-config-for-mobs-immune-to-default-effects.patch similarity index 51% rename from patches/server/0678-Add-config-for-mobs-immune-to-default-effects.patch rename to patches/server/0677-Add-config-for-mobs-immune-to-default-effects.patch index 44f08c3b19..1f63968266 100644 --- a/patches/server/0678-Add-config-for-mobs-immune-to-default-effects.patch +++ b/patches/server/0677-Add-config-for-mobs-immune-to-default-effects.patch @@ -4,34 +4,8 @@ Date: Wed, 2 Dec 2020 21:03:02 -0800 Subject: [PATCH] Add config for mobs immune to default effects -diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -index e55e319851e9551bcfa17ff5db5f9bb7f9ae2a00..2c8d64c965685ca2c17b8a735e1ea28a521398c9 100644 ---- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -@@ -730,6 +730,21 @@ public class PaperWorldConfig { - log("Hopper Ignore Container Entities inside Occluding Blocks: " + (hoppersIgnoreOccludingBlocks ? "enabled" : "disabled")); - } - -+ public boolean undeadImmuneToCertainEffects = true; -+ public boolean spidersImmuneToPoisonEffect = true; -+ public boolean witherImmuneToWitherEffect = true; -+ public boolean witherSkeletonImmuneToWitherEffect = true; -+ private void mobEffectChanges() { -+ undeadImmuneToCertainEffects = getBoolean("mob-effects.undead-immune-to-certain-effects", undeadImmuneToCertainEffects); -+ log("Undead immune to harmful effects: " + undeadImmuneToCertainEffects); -+ spidersImmuneToPoisonEffect = getBoolean("mob-effects.spiders-immune-to-poison-effect", spidersImmuneToPoisonEffect); -+ log("Spiders immune to poison effect: " + spidersImmuneToPoisonEffect); -+ witherImmuneToWitherEffect = getBoolean("mob-effects.immune-to-wither-effect.wither", witherImmuneToWitherEffect); -+ log("Wither immune to wither effect: " + witherImmuneToWitherEffect); -+ witherSkeletonImmuneToWitherEffect = getBoolean("mob-effects.immune-to-wither-effect.wither-skeleton", witherSkeletonImmuneToWitherEffect); -+ log("Wither skeleton immune to wither effect: " + witherSkeletonImmuneToWitherEffect); -+ } -+ - public boolean nerfNetherPortalPigmen = false; - private void nerfNetherPortalPigmen() { - nerfNetherPortalPigmen = getBoolean("game-mechanics.nerf-pigmen-from-nether-portals", nerfNetherPortalPigmen); diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java -index 1bd4f72a5c0aba38609cb34dcb94ff03809f853c..a6a8b6e50d23b046c8696f141af528f569a84ce9 100644 +index ecb499ed17df00afcc0898d35b05b260f1d3fe6e..378c0848db27a45c79acff43aa6068d1852a3beb 100644 --- a/src/main/java/net/minecraft/world/entity/LivingEntity.java +++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java @@ -1153,7 +1153,7 @@ public abstract class LivingEntity extends Entity { @@ -39,12 +13,12 @@ index 1bd4f72a5c0aba38609cb34dcb94ff03809f853c..a6a8b6e50d23b046c8696f141af528f5 MobEffect mobeffectlist = effect.getEffect(); - if (mobeffectlist == MobEffects.REGENERATION || mobeffectlist == MobEffects.POISON) { -+ if ((mobeffectlist == MobEffects.REGENERATION || mobeffectlist == MobEffects.POISON) && this.level.paperConfig.undeadImmuneToCertainEffects) { // Paper ++ if ((mobeffectlist == MobEffects.REGENERATION || mobeffectlist == MobEffects.POISON) && this.level.paperConfig().entities.mobEffects.undeadImmuneToCertainEffects) { // Paper return false; } } diff --git a/src/main/java/net/minecraft/world/entity/boss/wither/WitherBoss.java b/src/main/java/net/minecraft/world/entity/boss/wither/WitherBoss.java -index 92734f767fde60351a179a88350a97b861be0e88..d347ab0a638a972ea53a982f29af40423919870c 100644 +index 92734f767fde60351a179a88350a97b861be0e88..b3e2e834f4f151497bf842796dd8e3a8b5143f1b 100644 --- a/src/main/java/net/minecraft/world/entity/boss/wither/WitherBoss.java +++ b/src/main/java/net/minecraft/world/entity/boss/wither/WitherBoss.java @@ -612,7 +612,7 @@ public class WitherBoss extends Monster implements PowerableMob, RangedAttackMob @@ -52,12 +26,12 @@ index 92734f767fde60351a179a88350a97b861be0e88..d347ab0a638a972ea53a982f29af4042 @Override public boolean canBeAffected(MobEffectInstance effect) { - return effect.getEffect() == MobEffects.WITHER ? false : super.canBeAffected(effect); -+ return effect.getEffect() == MobEffects.WITHER && this.level.paperConfig.witherImmuneToWitherEffect ? false : super.canBeAffected(effect); // Paper ++ return effect.getEffect() == MobEffects.WITHER && this.level.paperConfig().entities.mobEffects.immuneToWitherEffect.wither ? false : super.canBeAffected(effect); // Paper } private class WitherDoNothingGoal extends Goal { diff --git a/src/main/java/net/minecraft/world/entity/monster/Spider.java b/src/main/java/net/minecraft/world/entity/monster/Spider.java -index 46779380f44a037d3915f287f40515a9bd31a439..694643c8ee7447da01ae02ca242338dbdbb3412a 100644 +index 46779380f44a037d3915f287f40515a9bd31a439..c3085ad5410b41d9c7703b28ca835dbee3f49ee7 100644 --- a/src/main/java/net/minecraft/world/entity/monster/Spider.java +++ b/src/main/java/net/minecraft/world/entity/monster/Spider.java @@ -133,7 +133,7 @@ public class Spider extends Monster { @@ -65,12 +39,12 @@ index 46779380f44a037d3915f287f40515a9bd31a439..694643c8ee7447da01ae02ca242338db @Override public boolean canBeAffected(MobEffectInstance effect) { - return effect.getEffect() == MobEffects.POISON ? false : super.canBeAffected(effect); -+ return effect.getEffect() == MobEffects.POISON && this.level.paperConfig.spidersImmuneToPoisonEffect ? false : super.canBeAffected(effect); // Paper ++ return effect.getEffect() == MobEffects.POISON && this.level.paperConfig().entities.mobEffects.spidersImmuneToPoisonEffect ? false : super.canBeAffected(effect); // Paper } public boolean isClimbing() { diff --git a/src/main/java/net/minecraft/world/entity/monster/WitherSkeleton.java b/src/main/java/net/minecraft/world/entity/monster/WitherSkeleton.java -index ea6233cb3ca30864e54d553a5d1071ea9147a868..c65319caa4bf95bd1d3bc41811b9cd401cc5c705 100644 +index ea6233cb3ca30864e54d553a5d1071ea9147a868..6449213d717271bcc516e393a78dfe1e5c762d68 100644 --- a/src/main/java/net/minecraft/world/entity/monster/WitherSkeleton.java +++ b/src/main/java/net/minecraft/world/entity/monster/WitherSkeleton.java @@ -123,6 +123,6 @@ public class WitherSkeleton extends AbstractSkeleton { @@ -78,6 +52,6 @@ index ea6233cb3ca30864e54d553a5d1071ea9147a868..c65319caa4bf95bd1d3bc41811b9cd40 @Override public boolean canBeAffected(MobEffectInstance effect) { - return effect.getEffect() == MobEffects.WITHER ? false : super.canBeAffected(effect); -+ return effect.getEffect() == MobEffects.WITHER && this.level.paperConfig.witherSkeletonImmuneToWitherEffect ? false : super.canBeAffected(effect); // Paper ++ return effect.getEffect() == MobEffects.WITHER && this.level.paperConfig().entities.mobEffects.immuneToWitherEffect.witherSkeleton ? false : super.canBeAffected(effect); // Paper } } diff --git a/patches/server/0679-Fix-incorrect-message-for-outdated-client.patch b/patches/server/0678-Fix-incorrect-message-for-outdated-client.patch similarity index 94% rename from patches/server/0679-Fix-incorrect-message-for-outdated-client.patch rename to patches/server/0678-Fix-incorrect-message-for-outdated-client.patch index 09cb64257e..0e9401324b 100644 --- a/patches/server/0679-Fix-incorrect-message-for-outdated-client.patch +++ b/patches/server/0678-Fix-incorrect-message-for-outdated-client.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Fix incorrect message for outdated client diff --git a/src/main/java/net/minecraft/server/network/ServerHandshakePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerHandshakePacketListenerImpl.java -index 95340e4067ff1cbc9539615adb260377a5187cb7..bf5a36ccb0a7dc10328c67f97e634661ce4c1b0e 100644 +index c7ac8193b7f4b29d0d85891de0eca67912c8811c..4c8cbac3ecc9b2a07367fdaf30ad8d7975410c86 100644 --- a/src/main/java/net/minecraft/server/network/ServerHandshakePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerHandshakePacketListenerImpl.java @@ -80,7 +80,7 @@ public class ServerHandshakePacketListenerImpl implements ServerHandshakePacketL diff --git a/patches/server/0680-Don-t-apply-cramming-damage-to-players.patch b/patches/server/0679-Don-t-apply-cramming-damage-to-players.patch similarity index 52% rename from patches/server/0680-Don-t-apply-cramming-damage-to-players.patch rename to patches/server/0679-Don-t-apply-cramming-damage-to-players.patch index 77dcc67341..203d0a904d 100644 --- a/patches/server/0680-Don-t-apply-cramming-damage-to-players.patch +++ b/patches/server/0679-Don-t-apply-cramming-damage-to-players.patch @@ -10,22 +10,8 @@ It does not make a lot of sense to damage players if they get crammed, For those who really want it a config option is provided. -diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -index 2c8d64c965685ca2c17b8a735e1ea28a521398c9..b0b17ae4f0e50a13b5e630a65d965f1279f4f825 100644 ---- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -@@ -952,4 +952,9 @@ public class PaperWorldConfig { - private void showSignClickCommandFailureMessagesToPlayer() { - showSignClickCommandFailureMessagesToPlayer = getBoolean("show-sign-click-command-failure-msgs-to-player", showSignClickCommandFailureMessagesToPlayer); - } -+ -+ public boolean allowPlayerCrammingDamage = false; -+ private void playerCrammingDamage() { -+ allowPlayerCrammingDamage = getBoolean("allow-player-cramming-damage", allowPlayerCrammingDamage); -+ } - } diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java -index 5bd66fab9231a2be14d3586cfdad86f22abeb0db..69dc85f2f0082331b43b7acb23e4cf447d318c40 100644 +index 5db3349f4e366caef84b0d1e811c031ebd4243f9..eb0d36082d3e6af7463b767dbb64be146941cc6d 100644 --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java @@ -1447,7 +1447,7 @@ public class ServerPlayer extends Player { @@ -33,7 +19,7 @@ index 5bd66fab9231a2be14d3586cfdad86f22abeb0db..69dc85f2f0082331b43b7acb23e4cf44 @Override public boolean isInvulnerableTo(DamageSource damageSource) { - return super.isInvulnerableTo(damageSource) || this.isChangingDimension() || this.getAbilities().invulnerable && damageSource == DamageSource.WITHER; -+ return super.isInvulnerableTo(damageSource) || this.isChangingDimension() || this.getAbilities().invulnerable && damageSource == DamageSource.WITHER || !level.paperConfig.allowPlayerCrammingDamage && damageSource == DamageSource.CRAMMING; // Paper - disable player cramming ++ return super.isInvulnerableTo(damageSource) || this.isChangingDimension() || this.getAbilities().invulnerable && damageSource == DamageSource.WITHER || !level.paperConfig().collisions.allowPlayerCrammingDamage && damageSource == DamageSource.CRAMMING; // Paper - disable player cramming } @Override diff --git a/patches/server/0681-Rate-options-and-timings-for-sensors-and-behaviors.patch b/patches/server/0680-Rate-options-and-timings-for-sensors-and-behaviors.patch similarity index 58% rename from patches/server/0681-Rate-options-and-timings-for-sensors-and-behaviors.patch rename to patches/server/0680-Rate-options-and-timings-for-sensors-and-behaviors.patch index 370f722f01..f64d6e096d 100644 --- a/patches/server/0681-Rate-options-and-timings-for-sensors-and-behaviors.patch +++ b/patches/server/0680-Rate-options-and-timings-for-sensors-and-behaviors.patch @@ -9,10 +9,10 @@ This adds config options to specify the tick rate for sensors ones might need tweaking. diff --git a/src/main/java/co/aikar/timings/MinecraftTimings.java b/src/main/java/co/aikar/timings/MinecraftTimings.java -index b47b7dce26805badd422c1867733ff4bfd00e9f4..b27021a42cbed3f0648a8d0903d00d03922ae221 100644 +index 9fdc3e9936262b8eb8d502c4dd2ba47a7eceacce..3b717a6a1be16f780923e7ae3269462d3d082615 100644 --- a/src/main/java/co/aikar/timings/MinecraftTimings.java +++ b/src/main/java/co/aikar/timings/MinecraftTimings.java -@@ -113,6 +113,14 @@ public final class MinecraftTimings { +@@ -114,6 +114,14 @@ public final class MinecraftTimings { return Timings.ofSafe("Minecraft", "## tickEntity - " + entityType + " - " + type, tickEntityTimer); } @@ -27,81 +27,8 @@ index b47b7dce26805badd422c1867733ff4bfd00e9f4..b27021a42cbed3f0648a8d0903d00d03 /** * Get a named timer for the specified tile entity type to track type specific timings. * @param entity -diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -index b0b17ae4f0e50a13b5e630a65d965f1279f4f825..cfea4d7ecc2f4ce077a1204bc482e94adfc36d2d 100644 ---- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -@@ -9,8 +9,10 @@ import it.unimi.dsi.fastutil.objects.Reference2IntOpenHashMap; - import net.minecraft.world.entity.MobCategory; - import com.destroystokyo.paper.antixray.ChunkPacketBlockControllerAntiXray.EngineMode; - import java.util.HashMap; -+import java.util.Locale; - import java.util.Map; - import org.bukkit.Bukkit; -+import org.bukkit.configuration.ConfigurationSection; - import org.bukkit.configuration.file.YamlConfiguration; - import org.spigotmc.SpigotWorldConfig; - -@@ -957,4 +959,57 @@ public class PaperWorldConfig { - private void playerCrammingDamage() { - allowPlayerCrammingDamage = getBoolean("allow-player-cramming-damage", allowPlayerCrammingDamage); - } -+ -+ private com.google.common.collect.Table sensorTickRates; -+ private com.google.common.collect.Table behaviorTickRates; -+ private void tickRates() { -+ config.addDefault("world-settings.default.tick-rates.sensor.villager.secondarypoisensor", 40); -+ config.addDefault("world-settings.default.tick-rates.behavior.villager.validatenearbypoi", -1); // Example -+ log("Tick rates:"); -+ sensorTickRates = loadTickRates("sensor"); -+ behaviorTickRates = loadTickRates("behavior"); -+ } -+ -+ private com.google.common.collect.Table loadTickRates(String type) { -+ log(" " + type + ":"); -+ com.google.common.collect.Table table = com.google.common.collect.HashBasedTable.create(); -+ -+ ConfigurationSection typeSection = config.getConfigurationSection("world-settings." + worldName + ".tick-rates." + type); -+ if (typeSection == null) { -+ typeSection = config.getConfigurationSection("world-settings.default.tick-rates." + type); -+ } -+ if (typeSection != null) { -+ for (String entity : typeSection.getKeys(false)) { -+ ConfigurationSection entitySection = typeSection.getConfigurationSection(entity); -+ if (entitySection != null) { -+ log(" " + entity + ":"); -+ for (String typeName : entitySection.getKeys(false)) { -+ if (entitySection.isInt(typeName)) { -+ int tickRate = entitySection.getInt(typeName); -+ table.put(entity.toLowerCase(Locale.ROOT), typeName.toLowerCase(Locale.ROOT), tickRate); -+ log(" " + typeName + ": " + tickRate); -+ } -+ } -+ } -+ } -+ } -+ -+ if (table.isEmpty()) { -+ log(" None configured"); -+ } -+ return table; -+ } -+ -+ public int getBehaviorTickRate(String typeName, String entityType, int def) { -+ return getIntOrDefault(behaviorTickRates, typeName, entityType, def); -+ } -+ -+ public int getSensorTickRate(String typeName, String entityType, int def) { -+ return getIntOrDefault(sensorTickRates, typeName, entityType, def); -+ } -+ -+ private int getIntOrDefault(com.google.common.collect.Table table, String rowKey, String columnKey, int def) { -+ Integer rate = table.get(columnKey, rowKey); -+ return rate != null && rate > -1 ? rate : def; -+ } - } diff --git a/src/main/java/net/minecraft/world/entity/ai/behavior/Behavior.java b/src/main/java/net/minecraft/world/entity/ai/behavior/Behavior.java -index ea5dea8fc6af73afb3b9f79bcb254e1644a3b302..36e9db7c2f70a9d35f5bc31d4dd611726dcee38f 100644 +index ea5dea8fc6af73afb3b9f79bcb254e1644a3b302..eb5a332f0705dd2e5568749a22f2f318d68010d1 100644 --- a/src/main/java/net/minecraft/world/entity/ai/behavior/Behavior.java +++ b/src/main/java/net/minecraft/world/entity/ai/behavior/Behavior.java @@ -13,6 +13,10 @@ public abstract class Behavior { @@ -136,7 +63,7 @@ index ea5dea8fc6af73afb3b9f79bcb254e1644a3b302..36e9db7c2f70a9d35f5bc31d4dd61172 public final boolean tryStart(ServerLevel world, E entity, long time) { + // Paper start - behavior tick rate -+ int tickRate = world.paperConfig.getBehaviorTickRate(this.configKey, entity.getType().id, -1); ++ int tickRate = java.util.Objects.requireNonNullElse(world.paperConfig().tickRates.behavior.get(entity.getType(), this.configKey), -1); + if (tickRate > -1 && time < this.endTimestamp + tickRate) { + return false; + } @@ -166,7 +93,7 @@ index ea5dea8fc6af73afb3b9f79bcb254e1644a3b302..36e9db7c2f70a9d35f5bc31d4dd61172 } diff --git a/src/main/java/net/minecraft/world/entity/ai/sensing/Sensor.java b/src/main/java/net/minecraft/world/entity/ai/sensing/Sensor.java -index 7970eebbd6935402223e6bba962bb8ba7d861dfd..f661864c332a76f8c5b54bbf69e10516c7ece6ea 100644 +index 7970eebbd6935402223e6bba962bb8ba7d861dfd..fcdb9bde8e1605e30dde3e580491522d4b62cdc0 100644 --- a/src/main/java/net/minecraft/world/entity/ai/sensing/Sensor.java +++ b/src/main/java/net/minecraft/world/entity/ai/sensing/Sensor.java @@ -19,8 +19,21 @@ public abstract class Sensor { @@ -197,7 +124,7 @@ index 7970eebbd6935402223e6bba962bb8ba7d861dfd..f661864c332a76f8c5b54bbf69e10516 if (--this.timeToTick <= 0L) { - this.timeToTick = (long)this.scanRate; + // Paper start - configurable sensor tick rate and timings -+ this.timeToTick = world.paperConfig.getSensorTickRate(this.configKey, entity.getType().id, this.scanRate); ++ this.timeToTick = java.util.Objects.requireNonNullElse(world.paperConfig().tickRates.sensor.get(entity.getType(), this.configKey), this.scanRate); + this.timing.startTiming(); + // Paper end this.doTick(world, entity); diff --git a/patches/server/0682-Add-a-bunch-of-missing-forceDrop-toggles.patch b/patches/server/0681-Add-a-bunch-of-missing-forceDrop-toggles.patch similarity index 100% rename from patches/server/0682-Add-a-bunch-of-missing-forceDrop-toggles.patch rename to patches/server/0681-Add-a-bunch-of-missing-forceDrop-toggles.patch diff --git a/patches/server/0683-Stinger-API.patch b/patches/server/0682-Stinger-API.patch similarity index 100% rename from patches/server/0683-Stinger-API.patch rename to patches/server/0682-Stinger-API.patch diff --git a/patches/server/0684-Fix-incosistency-issue-with-empty-map-items-in-CB.patch b/patches/server/0683-Fix-incosistency-issue-with-empty-map-items-in-CB.patch similarity index 100% rename from patches/server/0684-Fix-incosistency-issue-with-empty-map-items-in-CB.patch rename to patches/server/0683-Fix-incosistency-issue-with-empty-map-items-in-CB.patch diff --git a/patches/server/0685-Add-System.out-err-catcher.patch b/patches/server/0684-Add-System.out-err-catcher.patch similarity index 98% rename from patches/server/0685-Add-System.out-err-catcher.patch rename to patches/server/0684-Add-System.out-err-catcher.patch index c79c78e86a..68064c8def 100644 --- a/patches/server/0685-Add-System.out-err-catcher.patch +++ b/patches/server/0684-Add-System.out-err-catcher.patch @@ -105,7 +105,7 @@ index 0000000000000000000000000000000000000000..76d0d00cd6742991e3f3ec827a75ee87 + } +} diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -index 59e1303353e029ee754bde2e43f2bca622154381..9486c53285fabb2d72b2bc3881673cd6640bd50e 100644 +index 2d14b47ba9687ccad6e1eb7c83172a77e3f5172a..df86cdc08d036c43000ce999647136270f97bc1b 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java @@ -278,6 +278,7 @@ public final class CraftServer implements Server { diff --git a/patches/server/0686-Fix-test-not-bootstrapping.patch b/patches/server/0685-Fix-test-not-bootstrapping.patch similarity index 100% rename from patches/server/0686-Fix-test-not-bootstrapping.patch rename to patches/server/0685-Fix-test-not-bootstrapping.patch diff --git a/patches/server/0687-Rewrite-LogEvents-to-contain-the-source-jars-in-stac.patch b/patches/server/0686-Rewrite-LogEvents-to-contain-the-source-jars-in-stac.patch similarity index 100% rename from patches/server/0687-Rewrite-LogEvents-to-contain-the-source-jars-in-stac.patch rename to patches/server/0686-Rewrite-LogEvents-to-contain-the-source-jars-in-stac.patch diff --git a/patches/server/0688-Improve-boat-collision-performance.patch b/patches/server/0687-Improve-boat-collision-performance.patch similarity index 95% rename from patches/server/0688-Improve-boat-collision-performance.patch rename to patches/server/0687-Improve-boat-collision-performance.patch index a82c3a3a00..14e93cde69 100644 --- a/patches/server/0688-Improve-boat-collision-performance.patch +++ b/patches/server/0687-Improve-boat-collision-performance.patch @@ -17,7 +17,7 @@ index 70b8b86ed827217e536e35a690160adf9e974bb5..5f9e3d37c3ba79d26806374d73f87328 }; diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java -index a6a8b6e50d23b046c8696f141af528f569a84ce9..a32aa337c890eabeb400903df153aff323bc8645 100644 +index 378c0848db27a45c79acff43aa6068d1852a3beb..84d8edf3afe0a2a41092d8d2a0b940d1b949da8b 100644 --- a/src/main/java/net/minecraft/world/entity/LivingEntity.java +++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java @@ -1341,7 +1341,7 @@ public abstract class LivingEntity extends Entity { @@ -54,7 +54,7 @@ index a6a8b6e50d23b046c8696f141af528f569a84ce9..a32aa337c890eabeb400903df153aff3 } } diff --git a/src/main/java/net/minecraft/world/entity/vehicle/Boat.java b/src/main/java/net/minecraft/world/entity/vehicle/Boat.java -index ae069489eeb52489e69c10207739f07f867c58e4..4642012c72cb77302f69c808d73d8d42e8bbc39e 100644 +index 502a04ba27184f66e85b2ca31d92f5f306922f4b..eb753323f67badb1bed28405c07b03078e322b44 100644 --- a/src/main/java/net/minecraft/world/entity/vehicle/Boat.java +++ b/src/main/java/net/minecraft/world/entity/vehicle/Boat.java @@ -691,8 +691,8 @@ public class Boat extends Entity { diff --git a/patches/server/0689-Prevent-AFK-kick-while-watching-end-credits.patch b/patches/server/0688-Prevent-AFK-kick-while-watching-end-credits.patch similarity index 93% rename from patches/server/0689-Prevent-AFK-kick-while-watching-end-credits.patch rename to patches/server/0688-Prevent-AFK-kick-while-watching-end-credits.patch index 85e42467cb..267af4959d 100644 --- a/patches/server/0689-Prevent-AFK-kick-while-watching-end-credits.patch +++ b/patches/server/0688-Prevent-AFK-kick-while-watching-end-credits.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Prevent AFK kick while watching end credits. diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index bd784585238f80d6d28a56c98173bc4b9f638112..8ceae524899d6aa739f358b8c88968fb4df56481 100644 +index 5e8e36711eac7b471f1b4fbd8920eaad0a6f46b4..f77926fa842d681be3c6a0bcfa3d4fbaf42dc85a 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java @@ -412,7 +412,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser diff --git a/patches/server/0690-Allow-skipping-writing-of-comments-to-server.propert.patch b/patches/server/0689-Allow-skipping-writing-of-comments-to-server.propert.patch similarity index 100% rename from patches/server/0690-Allow-skipping-writing-of-comments-to-server.propert.patch rename to patches/server/0689-Allow-skipping-writing-of-comments-to-server.propert.patch diff --git a/patches/server/0691-Add-PlayerSetSpawnEvent.patch b/patches/server/0690-Add-PlayerSetSpawnEvent.patch similarity index 97% rename from patches/server/0691-Add-PlayerSetSpawnEvent.patch rename to patches/server/0690-Add-PlayerSetSpawnEvent.patch index 713e30cab4..a741b5e52b 100644 --- a/patches/server/0691-Add-PlayerSetSpawnEvent.patch +++ b/patches/server/0690-Add-PlayerSetSpawnEvent.patch @@ -32,7 +32,7 @@ index ce1c7512cc368e196ae94ee22c6a228c975b4980..1e41de9523c5fa3b9cfced798a5c35a2 String string = resourceKey.location().toString(); if (targets.size() == 1) { diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java -index 69dc85f2f0082331b43b7acb23e4cf447d318c40..a39a387a744ec1f63c06fc05b431983a6e8bf70a 100644 +index eb0d36082d3e6af7463b767dbb64be146941cc6d..157be83b74298b848a47436ab0fea9a04556a3ce 100644 --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java @@ -1288,7 +1288,7 @@ public class ServerPlayer extends Player { @@ -89,7 +89,7 @@ index 69dc85f2f0082331b43b7acb23e4cf447d318c40..a39a387a744ec1f63c06fc05b431983a public void trackChunk(ChunkPos chunkPos, Packet chunkDataPacket) { diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java -index 30c3a7c566b6cdc83695a36f03f1ff155a8eae20..ed0e162c39f1f1ed9b02cdb2fc353a3fcbe79182 100644 +index 56c9dc2bf76204cd40775d9f47a9ba20919bc04f..bf2888b678567ace5959d989e5dd119c65a9500d 100644 --- a/src/main/java/net/minecraft/server/players/PlayerList.java +++ b/src/main/java/net/minecraft/server/players/PlayerList.java @@ -895,13 +895,13 @@ public abstract class PlayerList { @@ -129,7 +129,7 @@ index c3e49a781f838e6a46cb89744f3f1846de182275..c2f3d3a09327e7cb7d3167609eb3ce68 } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -index 10ae4c1a3cd93dc89a6b43256b522cf8f430ee3e..e1cb5c8cc3acc1596328808df3f6938776ab9b17 100644 +index 294b7c0ad1e0088307baecbab5ad33f897be5bcd..c27b099fb6636666612044935b598763df7c9251 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java @@ -1197,9 +1197,9 @@ public class CraftPlayer extends CraftHumanEntity implements Player { diff --git a/patches/server/0692-Make-hoppers-respect-inventory-max-stack-size.patch b/patches/server/0691-Make-hoppers-respect-inventory-max-stack-size.patch similarity index 94% rename from patches/server/0692-Make-hoppers-respect-inventory-max-stack-size.patch rename to patches/server/0691-Make-hoppers-respect-inventory-max-stack-size.patch index 5a3c2f89c7..b4d44f1e40 100644 --- a/patches/server/0692-Make-hoppers-respect-inventory-max-stack-size.patch +++ b/patches/server/0691-Make-hoppers-respect-inventory-max-stack-size.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Make hoppers respect inventory max stack size diff --git a/src/main/java/net/minecraft/world/level/block/entity/HopperBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/HopperBlockEntity.java -index 80ca90806bc1e52b6995ba287bc4195617aa9e67..b030bc64abc73607d3df651fec727654df09a4f9 100644 +index 9cb783a3001291ddba44776c6bff0c6369684399..8ab1d401ed55d4cce55704317cbffe53ebc9f119 100644 --- a/src/main/java/net/minecraft/world/level/block/entity/HopperBlockEntity.java +++ b/src/main/java/net/minecraft/world/level/block/entity/HopperBlockEntity.java @@ -586,17 +586,19 @@ public class HopperBlockEntity extends RandomizableContainerBlockEntity implemen diff --git a/patches/server/0693-Optimize-entity-tracker-passenger-checks.patch b/patches/server/0692-Optimize-entity-tracker-passenger-checks.patch similarity index 100% rename from patches/server/0693-Optimize-entity-tracker-passenger-checks.patch rename to patches/server/0692-Optimize-entity-tracker-passenger-checks.patch diff --git a/patches/server/0693-Config-option-for-Piglins-guarding-chests.patch b/patches/server/0693-Config-option-for-Piglins-guarding-chests.patch new file mode 100644 index 0000000000..c66e6ea022 --- /dev/null +++ b/patches/server/0693-Config-option-for-Piglins-guarding-chests.patch @@ -0,0 +1,18 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Jason Penilla <11360596+jpenilla@users.noreply.github.com> +Date: Wed, 2 Dec 2020 03:07:58 -0800 +Subject: [PATCH] Config option for Piglins guarding chests + + +diff --git a/src/main/java/net/minecraft/world/entity/monster/piglin/PiglinAi.java b/src/main/java/net/minecraft/world/entity/monster/piglin/PiglinAi.java +index 8aecd15cfb915f44bc6208b656e7db309270c132..9f220cf0668b5153c419215e8e25e418e765a1d6 100644 +--- a/src/main/java/net/minecraft/world/entity/monster/piglin/PiglinAi.java ++++ b/src/main/java/net/minecraft/world/entity/monster/piglin/PiglinAi.java +@@ -463,6 +463,7 @@ public class PiglinAi { + } + + public static void angerNearbyPiglins(Player player, boolean blockOpen) { ++ if (!player.level.paperConfig().entities.behavior.piglinsGuardChests) return; // Paper + List list = player.level.getEntitiesOfClass(Piglin.class, player.getBoundingBox().inflate(16.0D)); + + list.stream().filter(PiglinAi::isIdle).filter((entitypiglin) -> { diff --git a/patches/server/0695-Added-EntityDamageItemEvent.patch b/patches/server/0694-Added-EntityDamageItemEvent.patch similarity index 100% rename from patches/server/0695-Added-EntityDamageItemEvent.patch rename to patches/server/0694-Added-EntityDamageItemEvent.patch diff --git a/patches/server/0694-Config-option-for-Piglins-guarding-chests.patch b/patches/server/0694-Config-option-for-Piglins-guarding-chests.patch deleted file mode 100644 index 34dd701b2d..0000000000 --- a/patches/server/0694-Config-option-for-Piglins-guarding-chests.patch +++ /dev/null @@ -1,34 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Jason Penilla <11360596+jpenilla@users.noreply.github.com> -Date: Wed, 2 Dec 2020 03:07:58 -0800 -Subject: [PATCH] Config option for Piglins guarding chests - - -diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -index cfea4d7ecc2f4ce077a1204bc482e94adfc36d2d..11be4a7acf0338134eb7eb24600c6462ac1b582b 100644 ---- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -@@ -82,6 +82,11 @@ public class PaperWorldConfig { - zombiesTargetTurtleEggs = getBoolean("zombies-target-turtle-eggs", zombiesTargetTurtleEggs); - } - -+ public boolean piglinsGuardChests = true; -+ private void piglinsGuardChests() { -+ piglinsGuardChests = getBoolean("piglins-guard-chests", piglinsGuardChests); -+ } -+ - public enum RedstoneImplementation { - VANILLA, EIGENCRAFT - } -diff --git a/src/main/java/net/minecraft/world/entity/monster/piglin/PiglinAi.java b/src/main/java/net/minecraft/world/entity/monster/piglin/PiglinAi.java -index 8aecd15cfb915f44bc6208b656e7db309270c132..0ca5ff8a85a17009ab53afc4d0487683c4af9d47 100644 ---- a/src/main/java/net/minecraft/world/entity/monster/piglin/PiglinAi.java -+++ b/src/main/java/net/minecraft/world/entity/monster/piglin/PiglinAi.java -@@ -463,6 +463,7 @@ public class PiglinAi { - } - - public static void angerNearbyPiglins(Player player, boolean blockOpen) { -+ if (!player.level.paperConfig.piglinsGuardChests) return; // Paper - List list = player.level.getEntitiesOfClass(Piglin.class, player.getBoundingBox().inflate(16.0D)); - - list.stream().filter(PiglinAi::isIdle).filter((entitypiglin) -> { diff --git a/patches/server/0696-Optimize-indirect-passenger-iteration.patch b/patches/server/0695-Optimize-indirect-passenger-iteration.patch similarity index 95% rename from patches/server/0696-Optimize-indirect-passenger-iteration.patch rename to patches/server/0695-Optimize-indirect-passenger-iteration.patch index ccb5c733a9..a8f78d1095 100644 --- a/patches/server/0696-Optimize-indirect-passenger-iteration.patch +++ b/patches/server/0695-Optimize-indirect-passenger-iteration.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Optimize indirect passenger iteration diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java -index 4af9eda54cf1430abc6abca07628635a2af35f53..861bd56910aa3ae1c683d01eacf4750c8a12971d 100644 +index 8813d1720879f8b75d1d1c5f4e8f4414c663bfd6..03f57e6891dd870d481e4b12e6ef3dc032e26db1 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java @@ -3594,26 +3594,41 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource { diff --git a/patches/server/0697-Fix-block-drops-position-losing-precision-millions-o.patch b/patches/server/0696-Fix-block-drops-position-losing-precision-millions-o.patch similarity index 96% rename from patches/server/0697-Fix-block-drops-position-losing-precision-millions-o.patch rename to patches/server/0696-Fix-block-drops-position-losing-precision-millions-o.patch index 1fa8179586..418540c464 100644 --- a/patches/server/0697-Fix-block-drops-position-losing-precision-millions-o.patch +++ b/patches/server/0696-Fix-block-drops-position-losing-precision-millions-o.patch @@ -6,7 +6,7 @@ Subject: [PATCH] Fix block drops position losing precision millions of blocks diff --git a/src/main/java/net/minecraft/world/level/block/Block.java b/src/main/java/net/minecraft/world/level/block/Block.java -index 24556481bf72dae526eb0f13826d693d6516bfb4..5eff2180dba05c29fb0a653caea695fa1b50e0a0 100644 +index d63c320051b9d58c3503d268c7913673679c79dd..718c67c630f7799c20df9850d9c2056a7218c220 100644 --- a/src/main/java/net/minecraft/world/level/block/Block.java +++ b/src/main/java/net/minecraft/world/level/block/Block.java @@ -346,9 +346,11 @@ public class Block extends BlockBehaviour implements ItemLike { diff --git a/patches/server/0697-Configurable-item-frame-map-cursor-update-interval.patch b/patches/server/0697-Configurable-item-frame-map-cursor-update-interval.patch new file mode 100644 index 0000000000..bf8bc4b191 --- /dev/null +++ b/patches/server/0697-Configurable-item-frame-map-cursor-update-interval.patch @@ -0,0 +1,19 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Warrior <50800980+Warriorrrr@users.noreply.github.com> +Date: Fri, 13 Aug 2021 01:14:38 +0200 +Subject: [PATCH] Configurable item frame map cursor update interval + + +diff --git a/src/main/java/net/minecraft/server/level/ServerEntity.java b/src/main/java/net/minecraft/server/level/ServerEntity.java +index 98142edeb105e213545b47ba1addf2e6f799861c..4d5abfd4fdb0fb0d00840c8a6ef601e78b090888 100644 +--- a/src/main/java/net/minecraft/server/level/ServerEntity.java ++++ b/src/main/java/net/minecraft/server/level/ServerEntity.java +@@ -100,7 +100,7 @@ public class ServerEntity { + if (true || this.tickCount % 10 == 0) { // CraftBukkit - Moved below, should always enter this block + ItemStack itemstack = entityitemframe.getItem(); + +- if (this.tickCount % 10 == 0 && itemstack.getItem() instanceof MapItem) { // CraftBukkit - Moved this.tickCounter % 10 logic here so item frames do not enter the other blocks ++ if (this.level.paperConfig().maps.itemFrameCursorUpdateInterval > 0 && this.tickCount % this.level.paperConfig().maps.itemFrameCursorUpdateInterval == 0 && itemstack.getItem() instanceof MapItem) { // CraftBukkit - Moved this.tickCounter % 10 logic here so item frames do not enter the other blocks // Paper - Make item frame map cursor update interval configurable + Integer integer = MapItem.getMapId(itemstack); + MapItemSavedData worldmap = MapItem.getSavedData(integer, this.level); + diff --git a/patches/server/0698-Configurable-item-frame-map-cursor-update-interval.patch b/patches/server/0698-Configurable-item-frame-map-cursor-update-interval.patch deleted file mode 100644 index a67a7f126f..0000000000 --- a/patches/server/0698-Configurable-item-frame-map-cursor-update-interval.patch +++ /dev/null @@ -1,35 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Warrior <50800980+Warriorrrr@users.noreply.github.com> -Date: Fri, 13 Aug 2021 01:14:38 +0200 -Subject: [PATCH] Configurable item frame map cursor update interval - - -diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -index 11be4a7acf0338134eb7eb24600c6462ac1b582b..f3a28661841a194cc3a952cc54e036ff6845080b 100644 ---- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -@@ -945,6 +945,11 @@ public class PaperWorldConfig { - mapItemFrameCursorLimit = getInt("map-item-frame-cursor-limit", mapItemFrameCursorLimit); - } - -+ public int mapItemFrameCursorUpdateInterval = 10; -+ private void itemFrameCursorUpdateInterval() { -+ mapItemFrameCursorUpdateInterval = getInt("map-item-frame-cursor-update-interval", mapItemFrameCursorUpdateInterval); -+ } -+ - public boolean fixItemsMergingThroughWalls; - private void fixItemsMergingThroughWalls() { - fixItemsMergingThroughWalls = getBoolean("fix-items-merging-through-walls", fixItemsMergingThroughWalls); -diff --git a/src/main/java/net/minecraft/server/level/ServerEntity.java b/src/main/java/net/minecraft/server/level/ServerEntity.java -index 98142edeb105e213545b47ba1addf2e6f799861c..66df9492004ae648c5a5db8d1e76931284297ec1 100644 ---- a/src/main/java/net/minecraft/server/level/ServerEntity.java -+++ b/src/main/java/net/minecraft/server/level/ServerEntity.java -@@ -100,7 +100,7 @@ public class ServerEntity { - if (true || this.tickCount % 10 == 0) { // CraftBukkit - Moved below, should always enter this block - ItemStack itemstack = entityitemframe.getItem(); - -- if (this.tickCount % 10 == 0 && itemstack.getItem() instanceof MapItem) { // CraftBukkit - Moved this.tickCounter % 10 logic here so item frames do not enter the other blocks -+ if (this.level.paperConfig.mapItemFrameCursorUpdateInterval > 0 && this.tickCount % this.level.paperConfig.mapItemFrameCursorUpdateInterval == 0 && itemstack.getItem() instanceof MapItem) { // CraftBukkit - Moved this.tickCounter % 10 logic here so item frames do not enter the other blocks // Paper - Make item frame map cursor update interval configurable - Integer integer = MapItem.getMapId(itemstack); - MapItemSavedData worldmap = MapItem.getSavedData(integer, this.level); - diff --git a/patches/server/0699-Make-EntityUnleashEvent-cancellable.patch b/patches/server/0698-Make-EntityUnleashEvent-cancellable.patch similarity index 86% rename from patches/server/0699-Make-EntityUnleashEvent-cancellable.patch rename to patches/server/0698-Make-EntityUnleashEvent-cancellable.patch index cd5f23d28b..10b64ca856 100644 --- a/patches/server/0699-Make-EntityUnleashEvent-cancellable.patch +++ b/patches/server/0698-Make-EntityUnleashEvent-cancellable.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Make EntityUnleashEvent cancellable diff --git a/src/main/java/net/minecraft/world/entity/Mob.java b/src/main/java/net/minecraft/world/entity/Mob.java -index 0582c118b6206406764d1ea83ca6289cbb0a1392..11f3a492748d291c9c58c09d6ed62188f0868438 100644 +index 837c0a8bd15388bdb60d6950a437640459adde3c..a49dfe4f81d449c5dd7ba5b8f9af7fec5c54f5de 100644 --- a/src/main/java/net/minecraft/world/entity/Mob.java +++ b/src/main/java/net/minecraft/world/entity/Mob.java @@ -1482,7 +1482,7 @@ public abstract class Mob extends LivingEntity { @@ -18,11 +18,11 @@ index 0582c118b6206406764d1ea83ca6289cbb0a1392..11f3a492748d291c9c58c09d6ed62188 // Paper end } diff --git a/src/main/java/net/minecraft/world/entity/PathfinderMob.java b/src/main/java/net/minecraft/world/entity/PathfinderMob.java -index 41fa86e009a6bc2faf32a211639e8bc6a40bb00c..32cd54c9154f43824e2f05ab277321cde26d6545 100644 +index f5cb3576aa2560c86f4a1df9d51d8ecde4e98905..7b2a81f9a79c5e96beba44ffe9b56a305ac2404f 100644 --- a/src/main/java/net/minecraft/world/entity/PathfinderMob.java +++ b/src/main/java/net/minecraft/world/entity/PathfinderMob.java @@ -51,7 +51,7 @@ public abstract class PathfinderMob extends Mob { - if (f > entity.level.paperConfig.maxLeashDistance) { // Paper + if (f > entity.level.paperConfig().misc.maxLeashDistance) { // Paper // Paper start - drop leash variable EntityUnleashEvent event = new EntityUnleashEvent(this.getBukkitEntity(), EntityUnleashEvent.UnleashReason.DISTANCE, true); - this.level.getCraftServer().getPluginManager().callEvent(event); // CraftBukkit @@ -31,7 +31,7 @@ index 41fa86e009a6bc2faf32a211639e8bc6a40bb00c..32cd54c9154f43824e2f05ab277321cd // Paper end } @@ -63,7 +63,7 @@ public abstract class PathfinderMob extends Mob { - if (f > entity.level.paperConfig.maxLeashDistance) { // Paper + if (f > entity.level.paperConfig().misc.maxLeashDistance) { // Paper // Paper start - drop leash variable EntityUnleashEvent event = new EntityUnleashEvent(this.getBukkitEntity(), EntityUnleashEvent.UnleashReason.DISTANCE, true); - this.level.getCraftServer().getPluginManager().callEvent(event); // CraftBukkit diff --git a/patches/server/0700-Clear-bucket-NBT-after-dispense.patch b/patches/server/0699-Clear-bucket-NBT-after-dispense.patch similarity index 100% rename from patches/server/0700-Clear-bucket-NBT-after-dispense.patch rename to patches/server/0699-Clear-bucket-NBT-after-dispense.patch diff --git a/patches/server/0701-Change-EnderEye-target-without-changing-other-things.patch b/patches/server/0700-Change-EnderEye-target-without-changing-other-things.patch similarity index 100% rename from patches/server/0701-Change-EnderEye-target-without-changing-other-things.patch rename to patches/server/0700-Change-EnderEye-target-without-changing-other-things.patch diff --git a/patches/server/0702-Add-BlockBreakBlockEvent.patch b/patches/server/0701-Add-BlockBreakBlockEvent.patch similarity index 96% rename from patches/server/0702-Add-BlockBreakBlockEvent.patch rename to patches/server/0701-Add-BlockBreakBlockEvent.patch index 117e5f65af..b139762722 100644 --- a/patches/server/0702-Add-BlockBreakBlockEvent.patch +++ b/patches/server/0701-Add-BlockBreakBlockEvent.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Add BlockBreakBlockEvent diff --git a/src/main/java/net/minecraft/world/level/block/Block.java b/src/main/java/net/minecraft/world/level/block/Block.java -index 5eff2180dba05c29fb0a653caea695fa1b50e0a0..218ecfad4322e60274f9d9b14e32aa2b155b1bc5 100644 +index 718c67c630f7799c20df9850d9c2056a7218c220..224ce424b9a22548212ac157ec273c6dd80d6cfb 100644 --- a/src/main/java/net/minecraft/world/level/block/Block.java +++ b/src/main/java/net/minecraft/world/level/block/Block.java @@ -333,6 +333,23 @@ public class Block extends BlockBehaviour implements ItemLike { @@ -33,7 +33,7 @@ index 5eff2180dba05c29fb0a653caea695fa1b50e0a0..218ecfad4322e60274f9d9b14e32aa2b public static void dropResources(BlockState state, Level world, BlockPos pos, @Nullable BlockEntity blockEntity, Entity entity, ItemStack stack) { if (world instanceof ServerLevel) { diff --git a/src/main/java/net/minecraft/world/level/block/piston/PistonBaseBlock.java b/src/main/java/net/minecraft/world/level/block/piston/PistonBaseBlock.java -index 053bb85355c1b0fd93477187f4cedc582c6a480b..6d3c9d6c75897af52bbcce50bf23f28269a3ff5c 100644 +index 8d73893100884c08aa552ff41c2a07a3e714df47..24a822ade17849a083161216c184f02c30b5cb1f 100644 --- a/src/main/java/net/minecraft/world/level/block/piston/PistonBaseBlock.java +++ b/src/main/java/net/minecraft/world/level/block/piston/PistonBaseBlock.java @@ -400,7 +400,7 @@ public class PistonBaseBlock extends DirectionalBlock { diff --git a/patches/server/0703-Option-to-prevent-NBT-copy-in-smithing-recipes.patch b/patches/server/0702-Option-to-prevent-NBT-copy-in-smithing-recipes.patch similarity index 100% rename from patches/server/0703-Option-to-prevent-NBT-copy-in-smithing-recipes.patch rename to patches/server/0702-Option-to-prevent-NBT-copy-in-smithing-recipes.patch diff --git a/patches/server/0704-More-CommandBlock-API.patch b/patches/server/0703-More-CommandBlock-API.patch similarity index 100% rename from patches/server/0704-More-CommandBlock-API.patch rename to patches/server/0703-More-CommandBlock-API.patch diff --git a/patches/server/0705-Add-missing-team-sidebar-display-slots.patch b/patches/server/0704-Add-missing-team-sidebar-display-slots.patch similarity index 100% rename from patches/server/0705-Add-missing-team-sidebar-display-slots.patch rename to patches/server/0704-Add-missing-team-sidebar-display-slots.patch diff --git a/patches/server/0706-Add-back-EntityPortalExitEvent.patch b/patches/server/0705-Add-back-EntityPortalExitEvent.patch similarity index 97% rename from patches/server/0706-Add-back-EntityPortalExitEvent.patch rename to patches/server/0705-Add-back-EntityPortalExitEvent.patch index b0e8735935..0b3f2effaa 100644 --- a/patches/server/0706-Add-back-EntityPortalExitEvent.patch +++ b/patches/server/0705-Add-back-EntityPortalExitEvent.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Add back EntityPortalExitEvent diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java -index 861bd56910aa3ae1c683d01eacf4750c8a12971d..b83070b44fe90a53a2807716598aee5c34116eca 100644 +index 03f57e6891dd870d481e4b12e6ef3dc032e26db1..213b55b648b727ad605da62b691397c789279781 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java @@ -3095,6 +3095,23 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource { diff --git a/patches/server/0707-Add-methods-to-find-targets-for-lightning-strikes.patch b/patches/server/0706-Add-methods-to-find-targets-for-lightning-strikes.patch similarity index 93% rename from patches/server/0707-Add-methods-to-find-targets-for-lightning-strikes.patch rename to patches/server/0706-Add-methods-to-find-targets-for-lightning-strikes.patch index 6dd627c368..4f3fa57b81 100644 --- a/patches/server/0707-Add-methods-to-find-targets-for-lightning-strikes.patch +++ b/patches/server/0706-Add-methods-to-find-targets-for-lightning-strikes.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Add methods to find targets for lightning strikes diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java -index 62bb1fd46e4dff43e9c83c05260c7deaffe445a9..87d7a28aa9060b0576b443cb67cea9e77de8e2f6 100644 +index 7a9552e7d92acde83073792ed931fb7fd53b4ca5..1637a809256350685d85abedf0a57971ce5613ea 100644 --- a/src/main/java/net/minecraft/server/level/ServerLevel.java +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java @@ -772,6 +772,11 @@ public class ServerLevel extends Level implements WorldGenLevel { @@ -29,7 +29,7 @@ index 62bb1fd46e4dff43e9c83c05260c7deaffe445a9..87d7a28aa9060b0576b443cb67cea9e7 blockposition1 = blockposition1.above(2); } diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java -index aea681f994fc97390aa29a2338f9a92eb6a4a806..8187f1fd64add9b76e56df7f15024bb1eb7e393d 100644 +index acd935f7b9652ae4e778d865e9be1f0bfe906fe0..7a2a8e1aeca2002378a40be5cef32238350086a7 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java @@ -691,6 +691,23 @@ public class CraftWorld extends CraftRegionAccessor implements World { diff --git a/patches/server/0708-Get-entity-default-attributes.patch b/patches/server/0707-Get-entity-default-attributes.patch similarity index 98% rename from patches/server/0708-Get-entity-default-attributes.patch rename to patches/server/0707-Get-entity-default-attributes.patch index 90d656a93e..fe8d293a99 100644 --- a/patches/server/0708-Get-entity-default-attributes.patch +++ b/patches/server/0707-Get-entity-default-attributes.patch @@ -90,7 +90,7 @@ index 0000000000000000000000000000000000000000..4ecba0b02c2813a890aecc5586987879 + } +} diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java -index 3ae0f73b00496ff05b845aff057fd4f91dad0ccd..074de9061b4bd6a59e584746f560c43ff4755f93 100644 +index 5345ab40f18437fc60080f9feff4ee0d59a9ed6d..23c0a1cbff74067bb1700ec443f14ee441085b3c 100644 --- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java +++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java @@ -562,6 +562,18 @@ public final class CraftMagicNumbers implements UnsafeValues { diff --git a/patches/server/0709-Left-handed-API.patch b/patches/server/0708-Left-handed-API.patch similarity index 100% rename from patches/server/0709-Left-handed-API.patch rename to patches/server/0708-Left-handed-API.patch diff --git a/patches/server/0710-Add-advancement-display-API.patch b/patches/server/0709-Add-advancement-display-API.patch similarity index 100% rename from patches/server/0710-Add-advancement-display-API.patch rename to patches/server/0709-Add-advancement-display-API.patch diff --git a/patches/server/0711-Add-ItemFactory-getMonsterEgg-API.patch b/patches/server/0710-Add-ItemFactory-getMonsterEgg-API.patch similarity index 100% rename from patches/server/0711-Add-ItemFactory-getMonsterEgg-API.patch rename to patches/server/0710-Add-ItemFactory-getMonsterEgg-API.patch diff --git a/patches/server/0712-Add-critical-damage-API.patch b/patches/server/0711-Add-critical-damage-API.patch similarity index 95% rename from patches/server/0712-Add-critical-damage-API.patch rename to patches/server/0711-Add-critical-damage-API.patch index 0deb340885..2082161bf9 100644 --- a/patches/server/0712-Add-critical-damage-API.patch +++ b/patches/server/0711-Add-critical-damage-API.patch @@ -29,7 +29,7 @@ index 752f9f11227a47b7bed675b93e95af89c6732f63..67bce77093dcc126098731047447da20 public static DamageSource sting(LivingEntity attacker) { return new EntityDamageSource("sting", attacker); diff --git a/src/main/java/net/minecraft/world/entity/player/Player.java b/src/main/java/net/minecraft/world/entity/player/Player.java -index 3ef7815063d3dce4044710e685a01b8f02f7c005..25408bec63bbc8ff44882f7491e81eb1f91058ee 100644 +index 494ecf80d856bb3030aaf3892a5b175d8827aeff..d6458ad451c9c7665f5ff0101962af4469029e2c 100644 --- a/src/main/java/net/minecraft/world/entity/player/Player.java +++ b/src/main/java/net/minecraft/world/entity/player/Player.java @@ -1273,7 +1273,7 @@ public abstract class Player extends LivingEntity { @@ -39,7 +39,7 @@ index 3ef7815063d3dce4044710e685a01b8f02f7c005..25408bec63bbc8ff44882f7491e81eb1 - boolean flag2 = flag && this.fallDistance > 0.0F && !this.onGround && !this.onClimbable() && !this.isInWater() && !this.hasEffect(MobEffects.BLINDNESS) && !this.isPassenger() && target instanceof LivingEntity; + boolean flag2 = flag && this.fallDistance > 0.0F && !this.onGround && !this.onClimbable() && !this.isInWater() && !this.hasEffect(MobEffects.BLINDNESS) && !this.isPassenger() && target instanceof LivingEntity; // Paper - Add critical damage API - conflict on change - flag2 = flag2 && !level.paperConfig.disablePlayerCrits; // Paper + flag2 = flag2 && !level.paperConfig().entities.behavior.disablePlayerCrits; // Paper flag2 = flag2 && !this.isSprinting(); @@ -1313,7 +1313,7 @@ public abstract class Player extends LivingEntity { } @@ -60,7 +60,7 @@ index 3ef7815063d3dce4044710e685a01b8f02f7c005..25408bec63bbc8ff44882f7491e81eb1 } // CraftBukkit end diff --git a/src/main/java/net/minecraft/world/entity/projectile/AbstractArrow.java b/src/main/java/net/minecraft/world/entity/projectile/AbstractArrow.java -index cad3d93c2a8cd8f5b55ba05a50a2cdc22729ebd8..0d1458152b7ef8227b601d287b53989059468dce 100644 +index f02fb03c63975e5c1ccdd848f5727559929cce00..8564ecd20578d907bcfa1b9c149da22e424e254a 100644 --- a/src/main/java/net/minecraft/world/entity/projectile/AbstractArrow.java +++ b/src/main/java/net/minecraft/world/entity/projectile/AbstractArrow.java @@ -382,6 +382,7 @@ public abstract class AbstractArrow extends Projectile { @@ -72,7 +72,7 @@ index cad3d93c2a8cd8f5b55ba05a50a2cdc22729ebd8..0d1458152b7ef8227b601d287b539890 int k = entity.getRemainingFireTicks(); diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java -index b7e0d588d0fa1253e5f3dbd580de190c53a455ea..ceacb62aef0dd0f73f1542a1898ceb62c3f4c367 100644 +index 090c0cd38877ec06faa1e0ac43389a68c7153dac..389bf0d695dccb1d2547d61d62be97376e2505f9 100644 --- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java +++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java @@ -978,7 +978,7 @@ public class CraftEventFactory { diff --git a/patches/server/0713-Fix-issues-with-mob-conversion.patch b/patches/server/0712-Fix-issues-with-mob-conversion.patch similarity index 100% rename from patches/server/0713-Fix-issues-with-mob-conversion.patch rename to patches/server/0712-Fix-issues-with-mob-conversion.patch diff --git a/patches/server/0714-Add-isCollidable-methods-to-various-places.patch b/patches/server/0713-Add-isCollidable-methods-to-various-places.patch similarity index 96% rename from patches/server/0714-Add-isCollidable-methods-to-various-places.patch rename to patches/server/0713-Add-isCollidable-methods-to-various-places.patch index 289e80cf53..a553062120 100644 --- a/patches/server/0714-Add-isCollidable-methods-to-various-places.patch +++ b/patches/server/0713-Add-isCollidable-methods-to-various-places.patch @@ -37,7 +37,7 @@ index 7b9e943b391c061782fccd2b8d705ceec8db50fe..966ac60daebb7bb211ab8096fc0c5f33 + // Paper end } diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java -index 074de9061b4bd6a59e584746f560c43ff4755f93..3ce051a68288732a850558d85154f4575ca09d5d 100644 +index 23c0a1cbff74067bb1700ec443f14ee441085b3c..142451a2aa0ba9e9eae6e62294e2cbdfd5361ca2 100644 --- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java +++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java @@ -574,6 +574,12 @@ public final class CraftMagicNumbers implements UnsafeValues { diff --git a/patches/server/0715-Goat-ram-API.patch b/patches/server/0714-Goat-ram-API.patch similarity index 100% rename from patches/server/0715-Goat-ram-API.patch rename to patches/server/0714-Goat-ram-API.patch diff --git a/patches/server/0716-Add-API-for-resetting-a-single-score.patch b/patches/server/0715-Add-API-for-resetting-a-single-score.patch similarity index 100% rename from patches/server/0716-Add-API-for-resetting-a-single-score.patch rename to patches/server/0715-Add-API-for-resetting-a-single-score.patch diff --git a/patches/server/0717-Add-Raw-Byte-Entity-Serialization.patch b/patches/server/0716-Add-Raw-Byte-Entity-Serialization.patch similarity index 95% rename from patches/server/0717-Add-Raw-Byte-Entity-Serialization.patch rename to patches/server/0716-Add-Raw-Byte-Entity-Serialization.patch index e7c8cf0295..3aea9a6b35 100644 --- a/patches/server/0717-Add-Raw-Byte-Entity-Serialization.patch +++ b/patches/server/0716-Add-Raw-Byte-Entity-Serialization.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Add Raw Byte Entity Serialization diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java -index b83070b44fe90a53a2807716598aee5c34116eca..0fdcb84b9ae3df528e91877518154da9919eea55 100644 +index 213b55b648b727ad605da62b691397c789279781..5defa93d6016c383590b5cb882fdbb90700ba5d9 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java @@ -1920,6 +1920,15 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource { @@ -45,7 +45,7 @@ index 2a3addb00244b8ba68a3eeebba016553782946fd..ad3d005992d7f79b4c756410b063427a // Paper end } diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java -index 3ce051a68288732a850558d85154f4575ca09d5d..8d0de7b529a9dc946b6b56e83238dcacb4496906 100644 +index 142451a2aa0ba9e9eae6e62294e2cbdfd5361ca2..e8787c6d674178be3beadf3391e77948d9460b0c 100644 --- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java +++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java @@ -457,6 +457,30 @@ public final class CraftMagicNumbers implements UnsafeValues { diff --git a/patches/server/0718-Vanilla-command-permission-fixes.patch b/patches/server/0717-Vanilla-command-permission-fixes.patch similarity index 100% rename from patches/server/0718-Vanilla-command-permission-fixes.patch rename to patches/server/0717-Vanilla-command-permission-fixes.patch diff --git a/patches/server/0719-Make-CallbackExecutor-strict-again.patch b/patches/server/0718-Make-CallbackExecutor-strict-again.patch similarity index 93% rename from patches/server/0719-Make-CallbackExecutor-strict-again.patch rename to patches/server/0718-Make-CallbackExecutor-strict-again.patch index 0560879842..9be593b78b 100644 --- a/patches/server/0719-Make-CallbackExecutor-strict-again.patch +++ b/patches/server/0718-Make-CallbackExecutor-strict-again.patch @@ -10,10 +10,10 @@ schedules. Effectively, use the callback executor as a tool of finding issues rather than hiding these issues. diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java -index 648a03beb70ee3905360e992a891b74c38fcef68..cf5dd1f83e3fa3fce9e40a38733c0238305a2bb3 100644 +index 68038cc68a8abda416a0364dc87535dfc54cd8a1..4cdab0f5667c2dd183a07194736506997320b3ce 100644 --- a/src/main/java/net/minecraft/server/level/ChunkMap.java +++ b/src/main/java/net/minecraft/server/level/ChunkMap.java -@@ -168,17 +168,28 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider +@@ -167,17 +167,28 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider public final CallbackExecutor callbackExecutor = new CallbackExecutor(); public static final class CallbackExecutor implements java.util.concurrent.Executor, Runnable { diff --git a/patches/server/0720-Do-not-allow-the-server-to-unload-chunks-at-request-.patch b/patches/server/0719-Do-not-allow-the-server-to-unload-chunks-at-request-.patch similarity index 92% rename from patches/server/0720-Do-not-allow-the-server-to-unload-chunks-at-request-.patch rename to patches/server/0719-Do-not-allow-the-server-to-unload-chunks-at-request-.patch index b1ffe71780..169dae61cc 100644 --- a/patches/server/0720-Do-not-allow-the-server-to-unload-chunks-at-request-.patch +++ b/patches/server/0719-Do-not-allow-the-server-to-unload-chunks-at-request-.patch @@ -10,7 +10,7 @@ to be unloaded will simply be unloaded next tick, rather than immediately. diff --git a/src/main/java/net/minecraft/server/level/ServerChunkCache.java b/src/main/java/net/minecraft/server/level/ServerChunkCache.java -index ab22b2a9287bb2c70404d6ff488af2001151f48d..588b018fac48a371cd285a13c1dd5e978b5aceef 100644 +index 918fda0fbbafa39ce0f421dcaf10f8dcf1e5dabb..30347bba40c77c95933997800b9149fcd2326bb1 100644 --- a/src/main/java/net/minecraft/server/level/ServerChunkCache.java +++ b/src/main/java/net/minecraft/server/level/ServerChunkCache.java @@ -873,6 +873,7 @@ public class ServerChunkCache extends ChunkSource { diff --git a/patches/server/0721-Do-not-run-close-logic-for-inventories-on-chunk-unlo.patch b/patches/server/0720-Do-not-run-close-logic-for-inventories-on-chunk-unlo.patch similarity index 92% rename from patches/server/0721-Do-not-run-close-logic-for-inventories-on-chunk-unlo.patch rename to patches/server/0720-Do-not-run-close-logic-for-inventories-on-chunk-unlo.patch index bcab49e966..2fd4f5ad6b 100644 --- a/patches/server/0721-Do-not-run-close-logic-for-inventories-on-chunk-unlo.patch +++ b/patches/server/0720-Do-not-run-close-logic-for-inventories-on-chunk-unlo.patch @@ -9,7 +9,7 @@ chunk through it. This should also be OK from a leak prevention/ state desync POV because the TE is getting unloaded anyways. diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java -index 87d7a28aa9060b0576b443cb67cea9e77de8e2f6..ea58a43df4b6637a1a9e736aeead6d88396f6395 100644 +index 1637a809256350685d85abedf0a57971ce5613ea..a110acecd0459ff2731dbc5f10cc0d990afd4d5b 100644 --- a/src/main/java/net/minecraft/server/level/ServerLevel.java +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java @@ -1330,9 +1330,13 @@ public class ServerLevel extends Level implements WorldGenLevel { @@ -28,7 +28,7 @@ index 87d7a28aa9060b0576b443cb67cea9e77de8e2f6..ea58a43df4b6637a1a9e736aeead6d88 } // Spigot End diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java -index a39a387a744ec1f63c06fc05b431983a6e8bf70a..866e4aa0080363976861fcbfe6aedc380bbc5e53 100644 +index 157be83b74298b848a47436ab0fea9a04556a3ce..b98574dd173630e976177080613899400bef3552 100644 --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java @@ -1589,6 +1589,18 @@ public class ServerPlayer extends Player { @@ -51,7 +51,7 @@ index a39a387a744ec1f63c06fc05b431983a6e8bf70a..866e4aa0080363976861fcbfe6aedc38 public void doCloseContainer() { this.containerMenu.removed(this); diff --git a/src/main/java/net/minecraft/world/entity/player/Player.java b/src/main/java/net/minecraft/world/entity/player/Player.java -index 25408bec63bbc8ff44882f7491e81eb1f91058ee..2987d675af3b778d20be66e2ac2cddf6b4957d1d 100644 +index d6458ad451c9c7665f5ff0101962af4469029e2c..cd9cbfa5ef94994b3f7f2ecdde843620e7e6c071 100644 --- a/src/main/java/net/minecraft/world/entity/player/Player.java +++ b/src/main/java/net/minecraft/world/entity/player/Player.java @@ -505,6 +505,11 @@ public abstract class Player extends LivingEntity { diff --git a/patches/server/0722-Correctly-handle-recursion-for-chunkholder-updates.patch b/patches/server/0721-Correctly-handle-recursion-for-chunkholder-updates.patch similarity index 95% rename from patches/server/0722-Correctly-handle-recursion-for-chunkholder-updates.patch rename to patches/server/0721-Correctly-handle-recursion-for-chunkholder-updates.patch index 7917b39d36..f152c64ae6 100644 --- a/patches/server/0722-Correctly-handle-recursion-for-chunkholder-updates.patch +++ b/patches/server/0721-Correctly-handle-recursion-for-chunkholder-updates.patch @@ -8,7 +8,7 @@ cause a recursive call which would handle the increase but then the caller would think the chunk would be unloaded. diff --git a/src/main/java/net/minecraft/server/level/ChunkHolder.java b/src/main/java/net/minecraft/server/level/ChunkHolder.java -index e4dcce973fa6d6db8ddd37400125be8b7ee64c64..2e86997038f8ec950dd84f363ed2b1827b86ee4b 100644 +index 96fb6e6ba3d1f9d5bd412f4f2bfb9450efa17948..eda3929ea7dee63c3598f676f719770637940f53 100644 --- a/src/main/java/net/minecraft/server/level/ChunkHolder.java +++ b/src/main/java/net/minecraft/server/level/ChunkHolder.java @@ -467,8 +467,10 @@ public class ChunkHolder { diff --git a/patches/server/0723-Fix-GameProfileCache-concurrency.patch b/patches/server/0722-Fix-GameProfileCache-concurrency.patch similarity index 98% rename from patches/server/0723-Fix-GameProfileCache-concurrency.patch rename to patches/server/0722-Fix-GameProfileCache-concurrency.patch index 0b608ff606..38778e1156 100644 --- a/patches/server/0723-Fix-GameProfileCache-concurrency.patch +++ b/patches/server/0722-Fix-GameProfileCache-concurrency.patch @@ -7,7 +7,7 @@ Separate lookup and state access locks prevent lookups from stalling simple state access/write calls diff --git a/src/main/java/net/minecraft/server/players/GameProfileCache.java b/src/main/java/net/minecraft/server/players/GameProfileCache.java -index ddd78b2836c1f4a6b4fcd532153f5d3e17f91ea8..2097d9eef58eb291c9055189fc3da6222ab8429f 100644 +index ce3ed1572641599055edf654f20b2a5ecac952dc..b9cdfe42d9a8015b0ddc0cedd9dba4064ce8682d 100644 --- a/src/main/java/net/minecraft/server/players/GameProfileCache.java +++ b/src/main/java/net/minecraft/server/players/GameProfileCache.java @@ -62,6 +62,11 @@ public class GameProfileCache { diff --git a/patches/server/0724-Fix-chunks-refusing-to-unload-at-low-TPS.patch b/patches/server/0723-Fix-chunks-refusing-to-unload-at-low-TPS.patch similarity index 88% rename from patches/server/0724-Fix-chunks-refusing-to-unload-at-low-TPS.patch rename to patches/server/0723-Fix-chunks-refusing-to-unload-at-low-TPS.patch index b90b735883..0392a992e7 100644 --- a/patches/server/0724-Fix-chunks-refusing-to-unload-at-low-TPS.patch +++ b/patches/server/0723-Fix-chunks-refusing-to-unload-at-low-TPS.patch @@ -10,10 +10,10 @@ chunk future to complete. We can simply schedule to the immediate executor to get this effect, rather than the main mailbox. diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java -index cf5dd1f83e3fa3fce9e40a38733c0238305a2bb3..63ef27cf48071eca0f6450e6276f956d94b7dd59 100644 +index 4cdab0f5667c2dd183a07194736506997320b3ce..80c83eaabddb3f6fd13322d4aca2eb74a9c19e34 100644 --- a/src/main/java/net/minecraft/server/level/ChunkMap.java +++ b/src/main/java/net/minecraft/server/level/ChunkMap.java -@@ -1326,9 +1326,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider +@@ -1325,9 +1325,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider return chunk; }); diff --git a/patches/server/0725-Do-not-allow-ticket-level-changes-while-unloading-pl.patch b/patches/server/0724-Do-not-allow-ticket-level-changes-while-unloading-pl.patch similarity index 89% rename from patches/server/0725-Do-not-allow-ticket-level-changes-while-unloading-pl.patch rename to patches/server/0724-Do-not-allow-ticket-level-changes-while-unloading-pl.patch index eff067d8bb..5326eed0f7 100644 --- a/patches/server/0725-Do-not-allow-ticket-level-changes-while-unloading-pl.patch +++ b/patches/server/0724-Do-not-allow-ticket-level-changes-while-unloading-pl.patch @@ -8,10 +8,10 @@ Sync loading the chunk at this stage would cause it to load older data, as well as screwing our region state. diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java -index 63ef27cf48071eca0f6450e6276f956d94b7dd59..30fbb3df9b91697cca0f0fc7982dced758bdd778 100644 +index 80c83eaabddb3f6fd13322d4aca2eb74a9c19e34..6212d3203a13ccedbc67a7d2b8bde6af3f5c744a 100644 --- a/src/main/java/net/minecraft/server/level/ChunkMap.java +++ b/src/main/java/net/minecraft/server/level/ChunkMap.java -@@ -317,6 +317,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider +@@ -316,6 +316,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider } // Paper end @@ -19,7 +19,7 @@ index 63ef27cf48071eca0f6450e6276f956d94b7dd59..30fbb3df9b91697cca0f0fc7982dced7 public ChunkMap(ServerLevel world, LevelStorageSource.LevelStorageAccess session, DataFixer dataFixer, StructureTemplateManager structureTemplateManager, Executor executor, BlockableEventLoop mainThreadExecutor, LightChunkGetter chunkProvider, ChunkGenerator chunkGenerator, ChunkProgressListener worldGenerationProgressListener, ChunkStatusUpdateListener chunkStatusChangeListener, Supplier persistentStateManagerFactory, int viewDistance, boolean dsync) { super(session.getDimensionPath(world.dimension()).resolve("region"), dataFixer, dsync); this.visibleChunkMap = this.updatingChunkMap.clone(); -@@ -723,6 +724,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider +@@ -722,6 +723,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider @Nullable ChunkHolder updateChunkScheduling(long pos, int level, @Nullable ChunkHolder holder, int k) { @@ -27,7 +27,7 @@ index 63ef27cf48071eca0f6450e6276f956d94b7dd59..30fbb3df9b91697cca0f0fc7982dced7 if (k > ChunkMap.MAX_CHUNK_DISTANCE && level > ChunkMap.MAX_CHUNK_DISTANCE) { return holder; } else { -@@ -926,6 +928,12 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider +@@ -925,6 +927,12 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider if (completablefuture1 != completablefuture) { this.scheduleUnload(pos, holder); } else { @@ -40,7 +40,7 @@ index 63ef27cf48071eca0f6450e6276f956d94b7dd59..30fbb3df9b91697cca0f0fc7982dced7 // Paper start boolean removed; if ((removed = this.pendingUnloads.remove(pos, holder)) && ichunkaccess != null) { -@@ -963,6 +971,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider +@@ -962,6 +970,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider this.regionManagers.get(index).removeChunk(holder.pos.x, holder.pos.z); } } // Paper end @@ -49,7 +49,7 @@ index 63ef27cf48071eca0f6450e6276f956d94b7dd59..30fbb3df9b91697cca0f0fc7982dced7 } }; diff --git a/src/main/java/net/minecraft/server/level/ServerChunkCache.java b/src/main/java/net/minecraft/server/level/ServerChunkCache.java -index 588b018fac48a371cd285a13c1dd5e978b5aceef..f8c85ceaa3754febf0fe5643ef97eecb429286e9 100644 +index 30347bba40c77c95933997800b9149fcd2326bb1..591c9577a66f5663f7728b70f44e33ca029af085 100644 --- a/src/main/java/net/minecraft/server/level/ServerChunkCache.java +++ b/src/main/java/net/minecraft/server/level/ServerChunkCache.java @@ -809,6 +809,7 @@ public class ServerChunkCache extends ChunkSource { diff --git a/patches/server/0726-Do-not-allow-ticket-level-changes-when-updating-chun.patch b/patches/server/0725-Do-not-allow-ticket-level-changes-when-updating-chun.patch similarity index 95% rename from patches/server/0726-Do-not-allow-ticket-level-changes-when-updating-chun.patch rename to patches/server/0725-Do-not-allow-ticket-level-changes-when-updating-chun.patch index 3ed6a785f4..c863630ea8 100644 --- a/patches/server/0726-Do-not-allow-ticket-level-changes-when-updating-chun.patch +++ b/patches/server/0725-Do-not-allow-ticket-level-changes-when-updating-chun.patch @@ -8,7 +8,7 @@ This WILL cause state corruption if it happens. So, don't allow it. diff --git a/src/main/java/net/minecraft/server/level/ChunkHolder.java b/src/main/java/net/minecraft/server/level/ChunkHolder.java -index 2e86997038f8ec950dd84f363ed2b1827b86ee4b..77c7fe4d39f09499274ac34fd6c3f3a99cfbdd1d 100644 +index eda3929ea7dee63c3598f676f719770637940f53..b75b3c4d274252a3a5c53059b9702728eeada389 100644 --- a/src/main/java/net/minecraft/server/level/ChunkHolder.java +++ b/src/main/java/net/minecraft/server/level/ChunkHolder.java @@ -447,7 +447,13 @@ public class ChunkHolder { diff --git a/patches/server/0727-Do-not-submit-profile-lookups-to-worldgen-threads.patch b/patches/server/0726-Do-not-submit-profile-lookups-to-worldgen-threads.patch similarity index 97% rename from patches/server/0727-Do-not-submit-profile-lookups-to-worldgen-threads.patch rename to patches/server/0726-Do-not-submit-profile-lookups-to-worldgen-threads.patch index 5f60b59067..6d27cf2624 100644 --- a/patches/server/0727-Do-not-submit-profile-lookups-to-worldgen-threads.patch +++ b/patches/server/0726-Do-not-submit-profile-lookups-to-worldgen-threads.patch @@ -37,7 +37,7 @@ index 5f9e3d37c3ba79d26806374d73f87328cebb562d..206c6ce227ba19620185ac835af28d67 public static LongSupplier timeSource = System::nanoTime; public static final Ticker TICKER = new Ticker() { diff --git a/src/main/java/net/minecraft/server/players/GameProfileCache.java b/src/main/java/net/minecraft/server/players/GameProfileCache.java -index 2097d9eef58eb291c9055189fc3da6222ab8429f..1c5dfd2aa50118fcd2a451472873975d75a8e327 100644 +index b9cdfe42d9a8015b0ddc0cedd9dba4064ce8682d..25e7d076ce6180c6cbbca89cb905404cd6122892 100644 --- a/src/main/java/net/minecraft/server/players/GameProfileCache.java +++ b/src/main/java/net/minecraft/server/players/GameProfileCache.java @@ -206,7 +206,7 @@ public class GameProfileCache { diff --git a/patches/server/0728-Log-when-the-async-catcher-is-tripped.patch b/patches/server/0727-Log-when-the-async-catcher-is-tripped.patch similarity index 100% rename from patches/server/0728-Log-when-the-async-catcher-is-tripped.patch rename to patches/server/0727-Log-when-the-async-catcher-is-tripped.patch diff --git a/patches/server/0729-Add-paper-mobcaps-and-paper-playermobcaps.patch b/patches/server/0728-Add-paper-mobcaps-and-paper-playermobcaps.patch similarity index 96% rename from patches/server/0729-Add-paper-mobcaps-and-paper-playermobcaps.patch rename to patches/server/0728-Add-paper-mobcaps-and-paper-playermobcaps.patch index f74a663756..8c3c041b63 100644 --- a/patches/server/0729-Add-paper-mobcaps-and-paper-playermobcaps.patch +++ b/patches/server/0728-Add-paper-mobcaps-and-paper-playermobcaps.patch @@ -10,7 +10,7 @@ Also has a hover text on each mob category listing what entity types are in said category diff --git a/src/main/java/com/destroystokyo/paper/PaperCommand.java b/src/main/java/com/destroystokyo/paper/PaperCommand.java -index fa0b824747c5b15cfb29e22b2d30b9c6932c1320..ca401a3203176578f9cd399aa740f07147e45de9 100644 +index f953ea6f63d7aee3564d57eb250b02a28d36a187..3322b811ef7e6018383227de0e605324ae3ed48f 100644 --- a/src/main/java/com/destroystokyo/paper/PaperCommand.java +++ b/src/main/java/com/destroystokyo/paper/PaperCommand.java @@ -3,6 +3,7 @@ package com.destroystokyo.paper; @@ -208,7 +208,7 @@ index fa0b824747c5b15cfb29e22b2d30b9c6932c1320..ca401a3203176578f9cd399aa740f071 + final ServerPlayer serverPlayer = ((CraftPlayer) player).getHandle(); + final ServerLevel level = serverPlayer.getLevel(); + -+ if (!level.paperConfig.perPlayerMobSpawns) { ++ if (!level.paperConfig().entities.spawning.perPlayerMobSpawns) { + sender.sendMessage(Component.text("Use '/paper mobcaps' for worlds where per-player mob spawning is disabled.", NamedTextColor.RED)); + return; + } @@ -275,7 +275,7 @@ index fa0b824747c5b15cfb29e22b2d30b9c6932c1320..ca401a3203176578f9cd399aa740f071 List worlds; if (args.length < 2 || args[1].equals("*")) { diff --git a/src/main/java/net/minecraft/world/level/NaturalSpawner.java b/src/main/java/net/minecraft/world/level/NaturalSpawner.java -index 611dbcebd54604da5bd3e6ed510032db2a70401d..a04b8eeb9b4cbd700b95552c46fdf0da4c03b3eb 100644 +index fa23e9c476d4edc6176d8b8a6cb13c52d2f66a87..4150e8cd7197eac53042d56f0a53a4951f8824ce 100644 --- a/src/main/java/net/minecraft/world/level/NaturalSpawner.java +++ b/src/main/java/net/minecraft/world/level/NaturalSpawner.java @@ -191,6 +191,16 @@ public final class NaturalSpawner { @@ -296,10 +296,10 @@ index 611dbcebd54604da5bd3e6ed510032db2a70401d..a04b8eeb9b4cbd700b95552c46fdf0da // Paper start - add parameters and int ret type spawnCategoryForChunk(group, world, chunk, checker, runner, Integer.MAX_VALUE, null); diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -index 9486c53285fabb2d72b2bc3881673cd6640bd50e..a97565735bf6005b77859e8453171cd8eaefab81 100644 +index df86cdc08d036c43000ce999647136270f97bc1b..efaaa74878ad18082a0b95ce2697b3638bc1284b 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -@@ -2131,6 +2131,11 @@ public final class CraftServer implements Server { +@@ -2130,6 +2130,11 @@ public final class CraftServer implements Server { @Override public int getSpawnLimit(SpawnCategory spawnCategory) { @@ -312,7 +312,7 @@ index 9486c53285fabb2d72b2bc3881673cd6640bd50e..a97565735bf6005b77859e8453171cd8 } diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java -index 8187f1fd64add9b76e56df7f15024bb1eb7e393d..ed2c1f50fd8baee7c291675177f1bc2d86ee9d68 100644 +index 7a2a8e1aeca2002378a40be5cef32238350086a7..9bcfcd0f61cba99ff74b35a50a6e419dfea880ee 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java @@ -1706,9 +1706,14 @@ public class CraftWorld extends CraftRegionAccessor implements World { diff --git a/patches/server/0730-Prevent-unload-calls-removing-tickets-for-sync-loads.patch b/patches/server/0729-Prevent-unload-calls-removing-tickets-for-sync-loads.patch similarity index 96% rename from patches/server/0730-Prevent-unload-calls-removing-tickets-for-sync-loads.patch rename to patches/server/0729-Prevent-unload-calls-removing-tickets-for-sync-loads.patch index e4ed50c8f5..a8485996ae 100644 --- a/patches/server/0730-Prevent-unload-calls-removing-tickets-for-sync-loads.patch +++ b/patches/server/0729-Prevent-unload-calls-removing-tickets-for-sync-loads.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Prevent unload() calls removing tickets for sync loads diff --git a/src/main/java/net/minecraft/server/level/DistanceManager.java b/src/main/java/net/minecraft/server/level/DistanceManager.java -index d2865ce0523b74aaa935db72c6f3478894e13408..ea4e46c113d3f0a5db6c891021e2e4c5eb275cd4 100644 +index b2df5e18ce5260a9781052db7afb0b9786fb887c..537d34a0325a985948c744929b90144a66a35ee3 100644 --- a/src/main/java/net/minecraft/server/level/DistanceManager.java +++ b/src/main/java/net/minecraft/server/level/DistanceManager.java @@ -545,7 +545,7 @@ public abstract class DistanceManager { @@ -18,7 +18,7 @@ index d2865ce0523b74aaa935db72c6f3478894e13408..ea4e46c113d3f0a5db6c891021e2e4c5 while (objectiterator.hasNext()) { diff --git a/src/main/java/net/minecraft/server/level/ServerChunkCache.java b/src/main/java/net/minecraft/server/level/ServerChunkCache.java -index f8c85ceaa3754febf0fe5643ef97eecb429286e9..ad36cf0788044d2249d71223d85d9a43c0d16067 100644 +index 591c9577a66f5663f7728b70f44e33ca029af085..ce88da358c8a89564a911e6c818e906e845006ff 100644 --- a/src/main/java/net/minecraft/server/level/ServerChunkCache.java +++ b/src/main/java/net/minecraft/server/level/ServerChunkCache.java @@ -714,6 +714,8 @@ public class ServerChunkCache extends ChunkSource { diff --git a/patches/server/0731-Sanitize-ResourceLocation-error-logging.patch b/patches/server/0730-Sanitize-ResourceLocation-error-logging.patch similarity index 100% rename from patches/server/0731-Sanitize-ResourceLocation-error-logging.patch rename to patches/server/0730-Sanitize-ResourceLocation-error-logging.patch diff --git a/patches/server/0732-Allow-controlled-flushing-for-network-manager.patch b/patches/server/0731-Allow-controlled-flushing-for-network-manager.patch similarity index 92% rename from patches/server/0732-Allow-controlled-flushing-for-network-manager.patch rename to patches/server/0731-Allow-controlled-flushing-for-network-manager.patch index e976537d0b..66923c8221 100644 --- a/patches/server/0732-Allow-controlled-flushing-for-network-manager.patch +++ b/patches/server/0731-Allow-controlled-flushing-for-network-manager.patch @@ -9,10 +9,10 @@ This patch will be used to optimise out flush calls in later patches. diff --git a/src/main/java/net/minecraft/network/Connection.java b/src/main/java/net/minecraft/network/Connection.java -index 00ab93e02a884e51cd6cc647c7e58c2e53b8a7cc..47d4a22577f583acad44c1124a39ede6c33d03fa 100644 +index 00abdd5bba02b7cdf8dbdc423594f0fde890dd84..05b1b2bdc5396d7f95106bd7c75c4e319e7975a2 100644 --- a/src/main/java/net/minecraft/network/Connection.java +++ b/src/main/java/net/minecraft/network/Connection.java -@@ -104,6 +104,39 @@ public class Connection extends SimpleChannelInboundHandler> { +@@ -103,6 +103,39 @@ public class Connection extends SimpleChannelInboundHandler> { public ConnectionProtocol protocol; // Paper end @@ -52,7 +52,7 @@ index 00ab93e02a884e51cd6cc647c7e58c2e53b8a7cc..47d4a22577f583acad44c1124a39ede6 public Connection(PacketFlow side) { this.receiving = side; } -@@ -269,7 +302,7 @@ public class Connection extends SimpleChannelInboundHandler> { +@@ -268,7 +301,7 @@ public class Connection extends SimpleChannelInboundHandler> { net.minecraft.server.MCUtil.isMainThread() && packet.isReady() && this.queue.isEmpty() && (packet.getExtraPackets() == null || packet.getExtraPackets().isEmpty()) ))) { @@ -61,7 +61,7 @@ index 00ab93e02a884e51cd6cc647c7e58c2e53b8a7cc..47d4a22577f583acad44c1124a39ede6 return; } // write the packets to the queue, then flush - antixray hooks there already -@@ -293,6 +326,14 @@ public class Connection extends SimpleChannelInboundHandler> { +@@ -292,6 +325,14 @@ public class Connection extends SimpleChannelInboundHandler> { } private void sendPacket(Packet packet, @Nullable GenericFutureListener> callback) { @@ -76,7 +76,7 @@ index 00ab93e02a884e51cd6cc647c7e58c2e53b8a7cc..47d4a22577f583acad44c1124a39ede6 ConnectionProtocol enumprotocol = ConnectionProtocol.getProtocolForPacket(packet); ConnectionProtocol enumprotocol1 = this.getCurrentProtocol(); -@@ -303,16 +344,21 @@ public class Connection extends SimpleChannelInboundHandler> { +@@ -302,16 +343,21 @@ public class Connection extends SimpleChannelInboundHandler> { } if (this.channel.eventLoop().inEventLoop()) { @@ -100,7 +100,7 @@ index 00ab93e02a884e51cd6cc647c7e58c2e53b8a7cc..47d4a22577f583acad44c1124a39ede6 if (packetState != currentState) { this.setProtocol(packetState); } -@@ -326,7 +372,7 @@ public class Connection extends SimpleChannelInboundHandler> { +@@ -325,7 +371,7 @@ public class Connection extends SimpleChannelInboundHandler> { try { // Paper end @@ -109,7 +109,7 @@ index 00ab93e02a884e51cd6cc647c7e58c2e53b8a7cc..47d4a22577f583acad44c1124a39ede6 if (callback != null) { channelfuture.addListener(callback); -@@ -368,6 +414,10 @@ public class Connection extends SimpleChannelInboundHandler> { +@@ -367,6 +413,10 @@ public class Connection extends SimpleChannelInboundHandler> { } private boolean processQueue() { if (this.queue.isEmpty()) return true; @@ -120,7 +120,7 @@ index 00ab93e02a884e51cd6cc647c7e58c2e53b8a7cc..47d4a22577f583acad44c1124a39ede6 // If we are on main, we are safe here in that nothing else should be processing queue off main anymore // But if we are not on main due to login/status, the parent is synchronized on packetQueue java.util.Iterator iterator = this.queue.iterator(); -@@ -375,16 +425,22 @@ public class Connection extends SimpleChannelInboundHandler> { +@@ -374,16 +424,22 @@ public class Connection extends SimpleChannelInboundHandler> { PacketHolder queued = iterator.next(); // poll -> peek // Fix NPE (Spigot bug caused by handleDisconnection()) diff --git a/patches/server/0733-Add-more-async-catchers.patch b/patches/server/0732-Add-more-async-catchers.patch similarity index 96% rename from patches/server/0733-Add-more-async-catchers.patch rename to patches/server/0732-Add-more-async-catchers.patch index 7233314926..30eca154ba 100644 --- a/patches/server/0733-Add-more-async-catchers.patch +++ b/patches/server/0732-Add-more-async-catchers.patch @@ -31,7 +31,7 @@ index 2830d32bba3dc85847e3a5d9b4d98f822e34b606..a176a886235494fdc722030a93658d36 throw new UnsupportedOperationException("Only one concurrent iteration supported"); } else { diff --git a/src/main/java/net/minecraft/world/level/entity/PersistentEntitySectionManager.java b/src/main/java/net/minecraft/world/level/entity/PersistentEntitySectionManager.java -index 823489437dad68f52213f25d84d84ac64f7cc208..664fd701130713379dbc0c3a452732fe529ce4a4 100644 +index e53e912351a0753c429512f018281a656837bde2..fcf85047d89d5c55df78ab2a6d81cb6da254ecd7 100644 --- a/src/main/java/net/minecraft/world/level/entity/PersistentEntitySectionManager.java +++ b/src/main/java/net/minecraft/world/level/entity/PersistentEntitySectionManager.java @@ -166,6 +166,7 @@ public class PersistentEntitySectionManager implements A diff --git a/patches/server/0734-Rewrite-entity-bounding-box-lookup-calls.patch b/patches/server/0733-Rewrite-entity-bounding-box-lookup-calls.patch similarity index 98% rename from patches/server/0734-Rewrite-entity-bounding-box-lookup-calls.patch rename to patches/server/0733-Rewrite-entity-bounding-box-lookup-calls.patch index f9ddd228f1..f8d53251ba 100644 --- a/patches/server/0734-Rewrite-entity-bounding-box-lookup-calls.patch +++ b/patches/server/0733-Rewrite-entity-bounding-box-lookup-calls.patch @@ -914,7 +914,7 @@ index 0000000000000000000000000000000000000000..3ba094e640d7fe7803e2bbdab8ff3beb + } +} diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java -index ea58a43df4b6637a1a9e736aeead6d88396f6395..18f28b5ea2919fb12fd1e76555026c2161564372 100644 +index a110acecd0459ff2731dbc5f10cc0d990afd4d5b..3ce6df8c6084cbc19a2e57e5934e1e6b944aa2fd 100644 --- a/src/main/java/net/minecraft/server/level/ServerLevel.java +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java @@ -446,7 +446,7 @@ public class ServerLevel extends Level implements WorldGenLevel { @@ -953,7 +953,7 @@ index ba3023c7dd5b3bcf66f829fe5dc9757f96d16b45..05ff7bcc79e617904903cf082f6687d2 + // Paper end } diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java -index 0fdcb84b9ae3df528e91877518154da9919eea55..576dd79386c1514778aaaf558452e8eb9c354764 100644 +index 5defa93d6016c383590b5cb882fdbb90700ba5d9..9e0593c642186b1ef64432a20b41474ff51b7e15 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java @@ -484,6 +484,56 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource { @@ -1051,18 +1051,18 @@ index 1a3be6f0570c7c746eafa36544debe90d7629432..c0817ef8927f00e2fd3fbf3289f8041f List getEntities(EntityTypeTest filter, AABB box, Predicate predicate); diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java -index 397afdf68e6330c5aaf465f219800985ad26e9e2..e613d3171200dc436a45bd1980a106d936e351cd 100644 +index e3efc697f0730703ec42aad79de004a476bd09b6..27e00259a3cec2205cce3e2b99f03a9e9ba45a1b 100644 --- a/src/main/java/net/minecraft/world/level/Level.java +++ b/src/main/java/net/minecraft/world/level/Level.java -@@ -289,6 +289,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable { +@@ -294,6 +294,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable { this.entityLimiter = new org.spigotmc.TickLimiter(spigotConfig.entityMaxTickTime); this.tileLimiter = new org.spigotmc.TickLimiter(spigotConfig.tileMaxTickTime); - this.chunkPacketBlockController = this.paperConfig.antiXray ? new com.destroystokyo.paper.antixray.ChunkPacketBlockControllerAntiXray(this, executor) : com.destroystokyo.paper.antixray.ChunkPacketBlockController.NO_OPERATION_INSTANCE; // Paper - Anti-Xray + this.chunkPacketBlockController = this.paperConfig().anticheat.antiXray.enabled ? new com.destroystokyo.paper.antixray.ChunkPacketBlockControllerAntiXray(this, executor) : com.destroystokyo.paper.antixray.ChunkPacketBlockController.NO_OPERATION_INSTANCE; // Paper - Anti-Xray + this.entitySliceManager = new io.papermc.paper.world.EntitySliceManager((ServerLevel)this); // Paper } // Paper start -@@ -963,26 +964,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable { +@@ -968,26 +969,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable { public List getEntities(@Nullable Entity except, AABB box, Predicate predicate) { this.getProfiler().incrementCounter("getEntities"); List list = Lists.newArrayList(); @@ -1090,7 +1090,7 @@ index 397afdf68e6330c5aaf465f219800985ad26e9e2..e613d3171200dc436a45bd1980a106d9 return list; } -@@ -991,27 +973,22 @@ public abstract class Level implements LevelAccessor, AutoCloseable { +@@ -996,27 +978,22 @@ public abstract class Level implements LevelAccessor, AutoCloseable { this.getProfiler().incrementCounter("getEntities"); List list = Lists.newArrayList(); @@ -1133,7 +1133,7 @@ index 397afdf68e6330c5aaf465f219800985ad26e9e2..e613d3171200dc436a45bd1980a106d9 return list; } -@@ -1338,4 +1315,46 @@ public abstract class Level implements LevelAccessor, AutoCloseable { +@@ -1343,4 +1320,46 @@ public abstract class Level implements LevelAccessor, AutoCloseable { public long nextSubTickCount() { return (long) (this.subTickCount++); } @@ -1181,7 +1181,7 @@ index 397afdf68e6330c5aaf465f219800985ad26e9e2..e613d3171200dc436a45bd1980a106d9 + // Paper end } diff --git a/src/main/java/net/minecraft/world/level/entity/PersistentEntitySectionManager.java b/src/main/java/net/minecraft/world/level/entity/PersistentEntitySectionManager.java -index 664fd701130713379dbc0c3a452732fe529ce4a4..3019646ae30ce7f89e1e1f3eb39eaa69e58a0f50 100644 +index fcf85047d89d5c55df78ab2a6d81cb6da254ecd7..8ad1c6f8147cfbd4677252a0d76f147786babe59 100644 --- a/src/main/java/net/minecraft/world/level/entity/PersistentEntitySectionManager.java +++ b/src/main/java/net/minecraft/world/level/entity/PersistentEntitySectionManager.java @@ -49,8 +49,10 @@ public class PersistentEntitySectionManager implements A @@ -1229,7 +1229,7 @@ index 664fd701130713379dbc0c3a452732fe529ce4a4..3019646ae30ce7f89e1e1f3eb39eaa69 Visibility visibility = PersistentEntitySectionManager.getEffectiveStatus(this.entity, this.currentSection.getStatus()); diff --git a/src/main/java/org/bukkit/craftbukkit/CraftChunk.java b/src/main/java/org/bukkit/craftbukkit/CraftChunk.java -index e28efd61e5b773064af077be6497caec63df1140..4a9b20e0dae3d502738e71e0f6119bdb3e0e2f16 100644 +index 518dfbb7dbd4221937636cf46d27109de6f431a4..e86b3ee5c8225d9f789cf426cc1418fde0fa12f0 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftChunk.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftChunk.java @@ -134,9 +134,7 @@ public class CraftChunk implements Chunk { diff --git a/patches/server/0735-Optimise-chunk-tick-iteration.patch b/patches/server/0734-Optimise-chunk-tick-iteration.patch similarity index 96% rename from patches/server/0735-Optimise-chunk-tick-iteration.patch rename to patches/server/0734-Optimise-chunk-tick-iteration.patch index 606da50a10..e96ebef03b 100644 --- a/patches/server/0735-Optimise-chunk-tick-iteration.patch +++ b/patches/server/0734-Optimise-chunk-tick-iteration.patch @@ -6,7 +6,7 @@ Subject: [PATCH] Optimise chunk tick iteration Use a dedicated list of entity ticking chunks to reduce the cost diff --git a/src/main/java/net/minecraft/server/level/ChunkHolder.java b/src/main/java/net/minecraft/server/level/ChunkHolder.java -index 77c7fe4d39f09499274ac34fd6c3f3a99cfbdd1d..020617ec8e5e77920d36380f019e430286006f89 100644 +index b75b3c4d274252a3a5c53059b9702728eeada389..8bea90cb57f38f33e8b3162e24e353993a98ebbf 100644 --- a/src/main/java/net/minecraft/server/level/ChunkHolder.java +++ b/src/main/java/net/minecraft/server/level/ChunkHolder.java @@ -86,11 +86,21 @@ public class ChunkHolder { @@ -70,10 +70,10 @@ index 77c7fe4d39f09499274ac34fd6c3f3a99cfbdd1d..020617ec8e5e77920d36380f019e4302 int i = 0; diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java -index 30fbb3df9b91697cca0f0fc7982dced758bdd778..bb9f0614b9a2945c78f1b45a70adcb6a22bfda2b 100644 +index 6212d3203a13ccedbc67a7d2b8bde6af3f5c744a..539c18cf9d86508c738476568334effb29df8b97 100644 --- a/src/main/java/net/minecraft/server/level/ChunkMap.java +++ b/src/main/java/net/minecraft/server/level/ChunkMap.java -@@ -163,6 +163,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider +@@ -162,6 +162,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider private final Queue unloadQueue; int viewDistance; public final com.destroystokyo.paper.util.misc.PlayerAreaMap playerMobDistanceMap; // Paper @@ -82,7 +82,7 @@ index 30fbb3df9b91697cca0f0fc7982dced758bdd778..bb9f0614b9a2945c78f1b45a70adcb6a // CraftBukkit start - recursion-safe executor for Chunk loadCallback() and unloadCallback() public final CallbackExecutor callbackExecutor = new CallbackExecutor(); diff --git a/src/main/java/net/minecraft/server/level/ServerChunkCache.java b/src/main/java/net/minecraft/server/level/ServerChunkCache.java -index ad36cf0788044d2249d71223d85d9a43c0d16067..108164945f2aa088834585d9d80274ea551608d9 100644 +index ce88da358c8a89564a911e6c818e906e845006ff..438406936633b9c67d21b26527c3d1654118c744 100644 --- a/src/main/java/net/minecraft/server/level/ServerChunkCache.java +++ b/src/main/java/net/minecraft/server/level/ServerChunkCache.java @@ -47,6 +47,7 @@ import net.minecraft.world.level.levelgen.structure.templatesystem.StructureTemp @@ -121,7 +121,7 @@ index ad36cf0788044d2249d71223d85d9a43c0d16067..108164945f2aa088834585d9d80274ea - Iterator iterator1 = list.iterator(); + // Paper start - optimise chunk tick iteration + Iterator iterator1; -+ if (this.level.paperConfig.perPlayerMobSpawns) { ++ if (this.level.paperConfig().entities.spawning.perPlayerMobSpawns) { + iterator1 = this.entityTickingChunks.iterator(); + } else { + iterator1 = this.entityTickingChunks.unsafeIterator(); diff --git a/patches/server/0736-Execute-chunk-tasks-mid-tick.patch b/patches/server/0735-Execute-chunk-tasks-mid-tick.patch similarity index 92% rename from patches/server/0736-Execute-chunk-tasks-mid-tick.patch rename to patches/server/0735-Execute-chunk-tasks-mid-tick.patch index 345b9b6263..f65e59a5d5 100644 --- a/patches/server/0736-Execute-chunk-tasks-mid-tick.patch +++ b/patches/server/0735-Execute-chunk-tasks-mid-tick.patch @@ -6,10 +6,10 @@ Subject: [PATCH] Execute chunk tasks mid-tick This will help the server load chunks if tick times are high. diff --git a/src/main/java/co/aikar/timings/MinecraftTimings.java b/src/main/java/co/aikar/timings/MinecraftTimings.java -index b27021a42cbed3f0648a8d0903d00d03922ae221..eada966d7f108a6081be7a848f5c1dfcb1eed676 100644 +index 3b717a6a1be16f780923e7ae3269462d3d082615..8563c66834b0b9e77bca42e4f916d82a9bfe66e2 100644 --- a/src/main/java/co/aikar/timings/MinecraftTimings.java +++ b/src/main/java/co/aikar/timings/MinecraftTimings.java -@@ -45,6 +45,8 @@ public final class MinecraftTimings { +@@ -46,6 +46,8 @@ public final class MinecraftTimings { public static final Timing antiXrayUpdateTimer = Timings.ofSafe("anti-xray - update"); public static final Timing antiXrayObfuscateTimer = Timings.ofSafe("anti-xray - obfuscate"); @@ -19,7 +19,7 @@ index b27021a42cbed3f0648a8d0903d00d03922ae221..eada966d7f108a6081be7a848f5c1dfc private MinecraftTimings() {} diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index 939170ade7c24bcf1c358f00931f867599cf9d54..786eafffa9bc51399c7fdf0012dfdaa9c92e71b0 100644 +index 93631f0a59781b8310f7bf66c0ed4781b833ef79..17efe9e0a17672b815c64491dbca70b7519b6aca 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java @@ -1302,6 +1302,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop void guardEntityTick(Consumer tickConsumer, T entity) { try { tickConsumer.accept(entity); diff --git a/patches/server/0737-Do-not-copy-visible-chunks.patch b/patches/server/0736-Do-not-copy-visible-chunks.patch similarity index 92% rename from patches/server/0737-Do-not-copy-visible-chunks.patch rename to patches/server/0736-Do-not-copy-visible-chunks.patch index d3e9b80e30..46b36ddce3 100644 --- a/patches/server/0737-Do-not-copy-visible-chunks.patch +++ b/patches/server/0736-Do-not-copy-visible-chunks.patch @@ -9,7 +9,7 @@ the function. I saw approximately 1/3rd of the function on the copy. diff --git a/src/main/java/com/destroystokyo/paper/PaperCommand.java b/src/main/java/com/destroystokyo/paper/PaperCommand.java -index ca401a3203176578f9cd399aa740f07147e45de9..dcda01dd8668c7ef7c63709179135deafb83eee5 100644 +index 3322b811ef7e6018383227de0e605324ae3ed48f..d0ef7380d5a325cf8950422b8ee5167da7ac6e0a 100644 --- a/src/main/java/com/destroystokyo/paper/PaperCommand.java +++ b/src/main/java/com/destroystokyo/paper/PaperCommand.java @@ -483,7 +483,7 @@ public class PaperCommand extends Command { @@ -22,7 +22,7 @@ index ca401a3203176578f9cd399aa740f07147e45de9..dcda01dd8668c7ef7c63709179135dea continue; } diff --git a/src/main/java/net/minecraft/server/MCUtil.java b/src/main/java/net/minecraft/server/MCUtil.java -index a6bcf936747720202857ba586fa35c46c9c91caf..63294b95ec062e32c87e52560353374db430cbe5 100644 +index 90ebe2ecd1566acd22e69a134090eb3bd3a8e485..48ec2f7a3813f8ce2baf32667a09f377e2764710 100644 --- a/src/main/java/net/minecraft/server/MCUtil.java +++ b/src/main/java/net/minecraft/server/MCUtil.java @@ -625,7 +625,7 @@ public final class MCUtil { @@ -35,10 +35,10 @@ index a6bcf936747720202857ba586fa35c46c9c91caf..63294b95ec062e32c87e52560353374d List allChunks = new ArrayList<>(visibleChunks.values()); List players = world.players; diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java -index bb9f0614b9a2945c78f1b45a70adcb6a22bfda2b..66a627a6b58ef5b420aceb0a3a1bcf90aec13198 100644 +index 539c18cf9d86508c738476568334effb29df8b97..667ccb6c75010a07fea5c0fa001f553814a1804a 100644 --- a/src/main/java/net/minecraft/server/level/ChunkMap.java +++ b/src/main/java/net/minecraft/server/level/ChunkMap.java -@@ -126,9 +126,11 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider +@@ -125,9 +125,11 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider private static final int MIN_VIEW_DISTANCE = 3; public static final int MAX_VIEW_DISTANCE = 33; public static final int MAX_CHUNK_DISTANCE = 33 + ChunkStatus.maxDistance(); @@ -52,7 +52,7 @@ index bb9f0614b9a2945c78f1b45a70adcb6a22bfda2b..66a627a6b58ef5b420aceb0a3a1bcf90 private final Long2ObjectLinkedOpenHashMap pendingUnloads; public final LongSet entitiesInLevel; public final ServerLevel level; -@@ -321,7 +323,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider +@@ -320,7 +322,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider boolean unloadingPlayerChunk = false; // Paper - do not allow ticket level changes while unloading chunks public ChunkMap(ServerLevel world, LevelStorageSource.LevelStorageAccess session, DataFixer dataFixer, StructureTemplateManager structureTemplateManager, Executor executor, BlockableEventLoop mainThreadExecutor, LightChunkGetter chunkProvider, ChunkGenerator chunkGenerator, ChunkProgressListener worldGenerationProgressListener, ChunkStatusUpdateListener chunkStatusChangeListener, Supplier persistentStateManagerFactory, int viewDistance, boolean dsync) { super(session.getDimensionPath(world.dimension()).resolve("region"), dataFixer, dsync); @@ -61,7 +61,7 @@ index bb9f0614b9a2945c78f1b45a70adcb6a22bfda2b..66a627a6b58ef5b420aceb0a3a1bcf90 this.pendingUnloads = new Long2ObjectLinkedOpenHashMap(); this.entitiesInLevel = new LongOpenHashSet(); this.toDrop = new LongOpenHashSet(); -@@ -557,12 +559,17 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider +@@ -556,12 +558,17 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider @Nullable public ChunkHolder getUpdatingChunkIfPresent(long pos) { @@ -81,7 +81,7 @@ index bb9f0614b9a2945c78f1b45a70adcb6a22bfda2b..66a627a6b58ef5b420aceb0a3a1bcf90 } protected IntSupplier getChunkQueueLevel(long pos) { -@@ -702,9 +709,9 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider +@@ -701,9 +708,9 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider }; stringbuilder.append("Updating:").append(System.lineSeparator()); @@ -93,7 +93,7 @@ index bb9f0614b9a2945c78f1b45a70adcb6a22bfda2b..66a627a6b58ef5b420aceb0a3a1bcf90 CrashReport crashreport = CrashReport.forThrowable(exception, "Chunk loading"); CrashReportCategory crashreportsystemdetails = crashreport.addCategory("Chunk loading"); -@@ -755,7 +762,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider +@@ -754,7 +761,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider // Paper end } @@ -102,7 +102,7 @@ index bb9f0614b9a2945c78f1b45a70adcb6a22bfda2b..66a627a6b58ef5b420aceb0a3a1bcf90 this.modified = true; } -@@ -835,7 +842,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider +@@ -834,7 +841,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider protected void saveAllChunks(boolean flush) { if (flush) { @@ -111,7 +111,7 @@ index bb9f0614b9a2945c78f1b45a70adcb6a22bfda2b..66a627a6b58ef5b420aceb0a3a1bcf90 MutableBoolean mutableboolean = new MutableBoolean(); do { -@@ -866,7 +873,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider +@@ -865,7 +872,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider //this.flushWorker(); // Paper - nuke IOWorker this.level.asyncChunkTaskManager.flush(); // Paper - flush to preserve behavior compat with pre-async behaviour } else { @@ -120,7 +120,7 @@ index bb9f0614b9a2945c78f1b45a70adcb6a22bfda2b..66a627a6b58ef5b420aceb0a3a1bcf90 } } -@@ -889,14 +896,14 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider +@@ -888,14 +895,14 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider } public boolean hasWork() { @@ -137,7 +137,7 @@ index bb9f0614b9a2945c78f1b45a70adcb6a22bfda2b..66a627a6b58ef5b420aceb0a3a1bcf90 if (playerchunk != null) { playerchunk.onChunkRemove(); // Paper -@@ -991,7 +998,12 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider +@@ -990,7 +997,12 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider if (!this.modified) { return false; } else { @@ -151,7 +151,7 @@ index bb9f0614b9a2945c78f1b45a70adcb6a22bfda2b..66a627a6b58ef5b420aceb0a3a1bcf90 this.modified = false; return true; } -@@ -1491,7 +1503,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider +@@ -1490,7 +1502,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider this.viewDistance = j; this.distanceManager.updatePlayerTickets(this.viewDistance + 1); @@ -160,7 +160,7 @@ index bb9f0614b9a2945c78f1b45a70adcb6a22bfda2b..66a627a6b58ef5b420aceb0a3a1bcf90 while (objectiterator.hasNext()) { ChunkHolder playerchunk = (ChunkHolder) objectiterator.next(); -@@ -1534,7 +1546,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider +@@ -1533,7 +1545,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider } public int size() { @@ -169,7 +169,7 @@ index bb9f0614b9a2945c78f1b45a70adcb6a22bfda2b..66a627a6b58ef5b420aceb0a3a1bcf90 } public DistanceManager getDistanceManager() { -@@ -1542,13 +1554,13 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider +@@ -1541,13 +1553,13 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider } protected Iterable getChunks() { @@ -186,7 +186,7 @@ index bb9f0614b9a2945c78f1b45a70adcb6a22bfda2b..66a627a6b58ef5b420aceb0a3a1bcf90 while (objectbidirectionaliterator.hasNext()) { Entry entry = (Entry) objectbidirectionaliterator.next(); diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java -index ed2c1f50fd8baee7c291675177f1bc2d86ee9d68..58f6348b04d776d510c0ede4e36a202e2fcb765c 100644 +index 9bcfcd0f61cba99ff74b35a50a6e419dfea880ee..c4913fd3efb52669645d2d71bce1bdf71d4fa063 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java @@ -161,7 +161,7 @@ public class CraftWorld extends CraftRegionAccessor implements World { diff --git a/patches/server/0738-Attempt-to-recalculate-regionfile-header-if-it-is-co.patch b/patches/server/0737-Attempt-to-recalculate-regionfile-header-if-it-is-co.patch similarity index 99% rename from patches/server/0738-Attempt-to-recalculate-regionfile-header-if-it-is-co.patch rename to patches/server/0737-Attempt-to-recalculate-regionfile-header-if-it-is-co.patch index 3d61f5f5c5..06d2ade2a6 100644 --- a/patches/server/0738-Attempt-to-recalculate-regionfile-header-if-it-is-co.patch +++ b/patches/server/0737-Attempt-to-recalculate-regionfile-header-if-it-is-co.patch @@ -685,7 +685,7 @@ index 861a25a15f1aab20e3245b6d5cdad5d23bdfd6d0..8ff8855c5267379b3a5f5d8baa4a275f return bytebuffer; } diff --git a/src/main/java/net/minecraft/world/level/chunk/storage/RegionFileStorage.java b/src/main/java/net/minecraft/world/level/chunk/storage/RegionFileStorage.java -index 089e8414c7bdc102ba0d914af576df1a05af7519..e5b444c6f2e45c50b4f7ab49c0dad801938f6cd9 100644 +index 0d96d1c0b66c57c680759f3567ef1b0c326d8cfa..6986a170f37f70e8eb89d79d5d2615a06a5e0f0c 100644 --- a/src/main/java/net/minecraft/world/level/chunk/storage/RegionFileStorage.java +++ b/src/main/java/net/minecraft/world/level/chunk/storage/RegionFileStorage.java @@ -26,7 +26,15 @@ public class RegionFileStorage implements AutoCloseable { diff --git a/patches/server/0739-Custom-table-implementation-for-blockstate-state-loo.patch b/patches/server/0738-Custom-table-implementation-for-blockstate-state-loo.patch similarity index 100% rename from patches/server/0739-Custom-table-implementation-for-blockstate-state-loo.patch rename to patches/server/0738-Custom-table-implementation-for-blockstate-state-loo.patch diff --git a/patches/server/0740-Detail-more-information-in-watchdog-dumps.patch b/patches/server/0739-Detail-more-information-in-watchdog-dumps.patch similarity index 96% rename from patches/server/0740-Detail-more-information-in-watchdog-dumps.patch rename to patches/server/0739-Detail-more-information-in-watchdog-dumps.patch index 0ae53045e0..8fa5925263 100644 --- a/patches/server/0740-Detail-more-information-in-watchdog-dumps.patch +++ b/patches/server/0739-Detail-more-information-in-watchdog-dumps.patch @@ -7,10 +7,10 @@ Subject: [PATCH] Detail more information in watchdog dumps - Dump player name, player uuid, position, and world for packet handling diff --git a/src/main/java/net/minecraft/network/Connection.java b/src/main/java/net/minecraft/network/Connection.java -index 47d4a22577f583acad44c1124a39ede6c33d03fa..2c298b11dee7df7733bdd9539a96a63739940f7d 100644 +index 05b1b2bdc5396d7f95106bd7c75c4e319e7975a2..05a15b2da76a6d246b705e682b61a7c40c5dade7 100644 --- a/src/main/java/net/minecraft/network/Connection.java +++ b/src/main/java/net/minecraft/network/Connection.java -@@ -466,7 +466,14 @@ public class Connection extends SimpleChannelInboundHandler> { +@@ -465,7 +465,14 @@ public class Connection extends SimpleChannelInboundHandler> { } if (this.packetListener instanceof ServerGamePacketListenerImpl) { @@ -77,7 +77,7 @@ index a34f22cadc09e53ea4de787b04d050b99dddbcac..c8012de68b997d6270ba4a5d79bc93c0 }); throw RunningOnDifferentThreadException.RUNNING_ON_DIFFERENT_THREAD; diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java -index 07f5c61fc3da270215133d2d0240e96f701a6216..4566c7b0cd5551f2e348e532911e77c62d3de2f2 100644 +index 78e2e9285b018aa52726cc61f7027e49e9dd9d68..6d1489332681d938a1c3db832ab967ba494f3b97 100644 --- a/src/main/java/net/minecraft/server/level/ServerLevel.java +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java @@ -998,7 +998,26 @@ public class ServerLevel extends Level implements WorldGenLevel { @@ -123,7 +123,7 @@ index 07f5c61fc3da270215133d2d0240e96f701a6216..4566c7b0cd5551f2e348e532911e77c6 private void tickPassenger(Entity vehicle, Entity passenger) { diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java -index 576dd79386c1514778aaaf558452e8eb9c354764..e7af0e4fc239a247019271c2901f804b558addf7 100644 +index 9e0593c642186b1ef64432a20b41474ff51b7e15..85b55badc57ce6c062b87d87cc730d20bb9e27c0 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java @@ -965,7 +965,42 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource { @@ -204,10 +204,10 @@ index 576dd79386c1514778aaaf558452e8eb9c354764..e7af0e4fc239a247019271c2901f804b int j = Mth.floor(y); int k = Mth.floor(z); diff --git a/src/main/java/org/spigotmc/WatchdogThread.java b/src/main/java/org/spigotmc/WatchdogThread.java -index dcfbe77bdb25d9c58ffb7b75c48bdb580bc0de47..24fefa521093448e608e217af7b88a6397a4b054 100644 +index 7823e97add506d42161fd86f830e4d988b2113d8..d568fc92d03c313a782796cc720a1ebb1a5ad8be 100644 --- a/src/main/java/org/spigotmc/WatchdogThread.java +++ b/src/main/java/org/spigotmc/WatchdogThread.java -@@ -23,6 +23,78 @@ public class WatchdogThread extends Thread +@@ -22,6 +22,78 @@ public class WatchdogThread extends Thread private volatile long lastTick; private volatile boolean stopping; @@ -286,7 +286,7 @@ index dcfbe77bdb25d9c58ffb7b75c48bdb580bc0de47..24fefa521093448e608e217af7b88a63 private WatchdogThread(long timeoutTime, boolean restart) { super( "Paper Watchdog Thread" ); -@@ -121,6 +193,7 @@ public class WatchdogThread extends Thread +@@ -120,6 +192,7 @@ public class WatchdogThread extends Thread log.log( Level.SEVERE, "------------------------------" ); log.log( Level.SEVERE, "Server thread dump (Look for plugins here before reporting to Paper!):" ); // Paper com.destroystokyo.paper.io.chunk.ChunkTaskManager.dumpAllChunkLoadInfo(); // Paper diff --git a/patches/server/0741-Manually-inline-methods-in-BlockPosition.patch b/patches/server/0740-Manually-inline-methods-in-BlockPosition.patch similarity index 100% rename from patches/server/0741-Manually-inline-methods-in-BlockPosition.patch rename to patches/server/0740-Manually-inline-methods-in-BlockPosition.patch diff --git a/patches/server/0742-Distance-manager-tick-timings.patch b/patches/server/0741-Distance-manager-tick-timings.patch similarity index 89% rename from patches/server/0742-Distance-manager-tick-timings.patch rename to patches/server/0741-Distance-manager-tick-timings.patch index c4e31d4c0e..db94c0a980 100644 --- a/patches/server/0742-Distance-manager-tick-timings.patch +++ b/patches/server/0741-Distance-manager-tick-timings.patch @@ -7,10 +7,10 @@ Recently this has been taking up more time, so add a timings to really figure out how much. diff --git a/src/main/java/co/aikar/timings/MinecraftTimings.java b/src/main/java/co/aikar/timings/MinecraftTimings.java -index eada966d7f108a6081be7a848f5c1dfcb1eed676..a977f7483f37df473096b2234dc1308bbaa6a8b6 100644 +index 8563c66834b0b9e77bca42e4f916d82a9bfe66e2..4567ddf1cef02405b44a9e217a72b326fadb19ab 100644 --- a/src/main/java/co/aikar/timings/MinecraftTimings.java +++ b/src/main/java/co/aikar/timings/MinecraftTimings.java -@@ -44,6 +44,7 @@ public final class MinecraftTimings { +@@ -45,6 +45,7 @@ public final class MinecraftTimings { public static final Timing antiXrayUpdateTimer = Timings.ofSafe("anti-xray - update"); public static final Timing antiXrayObfuscateTimer = Timings.ofSafe("anti-xray - obfuscate"); @@ -19,7 +19,7 @@ index eada966d7f108a6081be7a848f5c1dfcb1eed676..a977f7483f37df473096b2234dc1308b public static final Timing midTickChunkTasks = Timings.ofSafe("Mid Tick Chunk Tasks"); diff --git a/src/main/java/net/minecraft/server/level/ServerChunkCache.java b/src/main/java/net/minecraft/server/level/ServerChunkCache.java -index 6058a6d30880f789244e4054cadd43941b7778bd..cc57efc087268d7639544dd12765082909db827a 100644 +index 2de322ffc2eedae9efe39f9b771c447dd76f26fb..7524d9cf7184b345cbd7f0bd1d85601b75c29087 100644 --- a/src/main/java/net/minecraft/server/level/ServerChunkCache.java +++ b/src/main/java/net/minecraft/server/level/ServerChunkCache.java @@ -824,6 +824,7 @@ public class ServerChunkCache extends ChunkSource { @@ -37,4 +37,4 @@ index 6058a6d30880f789244e4054cadd43941b7778bd..cc57efc087268d7639544dd127650829 + } finally { co.aikar.timings.MinecraftTimings.distanceManagerTick.stopTiming(); } // Paper - add timings for distance manager } - // Paper start - helper + // Paper start diff --git a/patches/server/0743-Name-craft-scheduler-threads-according-to-the-plugin.patch b/patches/server/0742-Name-craft-scheduler-threads-according-to-the-plugin.patch similarity index 100% rename from patches/server/0743-Name-craft-scheduler-threads-according-to-the-plugin.patch rename to patches/server/0742-Name-craft-scheduler-threads-according-to-the-plugin.patch diff --git a/patches/server/0744-Make-sure-inlined-getChunkAt-has-inlined-logic-for-l.patch b/patches/server/0743-Make-sure-inlined-getChunkAt-has-inlined-logic-for-l.patch similarity index 90% rename from patches/server/0744-Make-sure-inlined-getChunkAt-has-inlined-logic-for-l.patch rename to patches/server/0743-Make-sure-inlined-getChunkAt-has-inlined-logic-for-l.patch index 058a23ad78..6ddb3e23e6 100644 --- a/patches/server/0744-Make-sure-inlined-getChunkAt-has-inlined-logic-for-l.patch +++ b/patches/server/0743-Make-sure-inlined-getChunkAt-has-inlined-logic-for-l.patch @@ -13,10 +13,10 @@ Paper recently reverted this optimisation, so it's been reintroduced here. diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java -index f9ffdeb250e472180616d5b7e944b69e17a217dd..f0721f2311769cff31ffb83a6c1cfeb9927f32a4 100644 +index f87844acb092bedad5e742c8000a1a09759bdd6d..e07b094cf19bc94a4e3ef726f37973eaff7aaf6d 100644 --- a/src/main/java/net/minecraft/world/level/Level.java +++ b/src/main/java/net/minecraft/world/level/Level.java -@@ -364,6 +364,15 @@ public abstract class Level implements LevelAccessor, AutoCloseable { +@@ -369,6 +369,15 @@ public abstract class Level implements LevelAccessor, AutoCloseable { @Override public final LevelChunk getChunk(int chunkX, int chunkZ) { // Paper - final to help inline diff --git a/patches/server/0744-Add-packet-limiter-config.patch b/patches/server/0744-Add-packet-limiter-config.patch new file mode 100644 index 0000000000..4529ed0a4f --- /dev/null +++ b/patches/server/0744-Add-packet-limiter-config.patch @@ -0,0 +1,98 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Spottedleaf +Date: Fri, 30 Oct 2020 22:37:16 -0700 +Subject: [PATCH] Add packet limiter config + +Example config: +packet-limiter: + kick-message: '&cSent too many packets' + limits: + all: + interval: 7.0 + max-packet-rate: 500.0 + PacketPlayInAutoRecipe: + interval: 4.0 + max-packet-rate: 5.0 + action: DROP + +all section refers to all incoming packets, the action for all is +hard coded to KICK. + +For specific limits, the section name is the class's name, +and an action can be defined: DROP or KICK + +If interval or rate are less-than 0, the limit is ignored + +diff --git a/src/main/java/net/minecraft/network/Connection.java b/src/main/java/net/minecraft/network/Connection.java +index 05a15b2da76a6d246b705e682b61a7c40c5dade7..f13c93764d6026b7e53123a8f6f123d986ded3a5 100644 +--- a/src/main/java/net/minecraft/network/Connection.java ++++ b/src/main/java/net/minecraft/network/Connection.java +@@ -135,6 +135,22 @@ public class Connection extends SimpleChannelInboundHandler> { + } + } + // Paper end - allow controlled flushing ++ // Paper start - packet limiter ++ protected final Object PACKET_LIMIT_LOCK = new Object(); ++ protected final @Nullable io.papermc.paper.util.IntervalledCounter allPacketCounts = io.papermc.paper.configuration.GlobalConfiguration.get().packetLimiter.allPackets.isEnabled() ? new io.papermc.paper.util.IntervalledCounter( ++ (long)(io.papermc.paper.configuration.GlobalConfiguration.get().packetLimiter.allPackets.interval() * 1.0e9) ++ ) : null; ++ protected final java.util.Map>, io.papermc.paper.util.IntervalledCounter> packetSpecificLimits = new java.util.HashMap<>(); ++ ++ private boolean stopReadingPackets; ++ private void killForPacketSpam() { ++ this.sendPacket(new ClientboundDisconnectPacket(org.bukkit.craftbukkit.util.CraftChatMessage.fromString(io.papermc.paper.configuration.GlobalConfiguration.get().packetLimiter.kickMessage, true)[0]), (future) -> { ++ this.disconnect(org.bukkit.craftbukkit.util.CraftChatMessage.fromString(io.papermc.paper.configuration.GlobalConfiguration.get().packetLimiter.kickMessage, true)[0]); ++ }); ++ this.setReadOnly(); ++ this.stopReadingPackets = true; ++ } ++ // Paper end - packet limiter + + public Connection(PacketFlow side) { + this.receiving = side; +@@ -215,6 +231,45 @@ public class Connection extends SimpleChannelInboundHandler> { + + protected void channelRead0(ChannelHandlerContext channelhandlercontext, Packet packet) { + if (this.channel.isOpen()) { ++ // Paper start - packet limiter ++ if (this.stopReadingPackets) { ++ return; ++ } ++ if (this.allPacketCounts != null || ++ io.papermc.paper.configuration.GlobalConfiguration.get().packetLimiter.overrides.containsKey(packet.getClass())) { ++ long time = System.nanoTime(); ++ synchronized (PACKET_LIMIT_LOCK) { ++ if (this.allPacketCounts != null) { ++ this.allPacketCounts.updateAndAdd(1, time); ++ if (this.allPacketCounts.getRate() >= io.papermc.paper.configuration.GlobalConfiguration.get().packetLimiter.allPackets.maxPacketRate()) { ++ this.killForPacketSpam(); ++ return; ++ } ++ } ++ ++ for (Class check = packet.getClass(); check != Object.class; check = check.getSuperclass()) { ++ io.papermc.paper.configuration.GlobalConfiguration.PacketLimiter.PacketLimit packetSpecificLimit = ++ io.papermc.paper.configuration.GlobalConfiguration.get().packetLimiter.overrides.get(check); ++ if (packetSpecificLimit == null) { ++ continue; ++ } ++ io.papermc.paper.util.IntervalledCounter counter = this.packetSpecificLimits.computeIfAbsent((Class)check, (clazz) -> { ++ return new io.papermc.paper.util.IntervalledCounter((long)(packetSpecificLimit.interval() * 1.0e9)); ++ }); ++ counter.updateAndAdd(1, time); ++ if (counter.getRate() >= packetSpecificLimit.maxPacketRate()) { ++ switch (packetSpecificLimit.action()) { ++ case DROP: ++ return; ++ case KICK: ++ this.killForPacketSpam(); ++ return; ++ } ++ } ++ } ++ } ++ } ++ // Paper end - packet limiter + try { + Connection.genericsFtw(packet, this.packetListener); + } catch (RunningOnDifferentThreadException cancelledpackethandleexception) { diff --git a/patches/server/0745-Add-packet-limiter-config.patch b/patches/server/0745-Add-packet-limiter-config.patch deleted file mode 100644 index 8eb6ee2256..0000000000 --- a/patches/server/0745-Add-packet-limiter-config.patch +++ /dev/null @@ -1,205 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Spottedleaf -Date: Fri, 30 Oct 2020 22:37:16 -0700 -Subject: [PATCH] Add packet limiter config - -Example config: -packet-limiter: - kick-message: '&cSent too many packets' - limits: - all: - interval: 7.0 - max-packet-rate: 500.0 - PacketPlayInAutoRecipe: - interval: 4.0 - max-packet-rate: 5.0 - action: DROP - -all section refers to all incoming packets, the action for all is -hard coded to KICK. - -For specific limits, the section name is the class's name, -and an action can be defined: DROP or KICK - -If interval or rate are less-than 0, the limit is ignored - -diff --git a/src/main/java/com/destroystokyo/paper/PaperConfig.java b/src/main/java/com/destroystokyo/paper/PaperConfig.java -index 1978f4bc9cf3ac5f24e6a558c50fd772b4ca2685..96d5b89d67f0904c0a6f68a7bbffc48457e850de 100644 ---- a/src/main/java/com/destroystokyo/paper/PaperConfig.java -+++ b/src/main/java/com/destroystokyo/paper/PaperConfig.java -@@ -517,4 +517,102 @@ public class PaperConfig { - itemValidationBookAuthorLength = getInt("settings.item-validation.book.author", itemValidationBookAuthorLength); - itemValidationBookPageLength = getInt("settings.item-validation.book.page", itemValidationBookPageLength); - } -+ -+ public static final class PacketLimit { -+ public final double packetLimitInterval; -+ public final double maxPacketRate; -+ public final ViolateAction violateAction; -+ -+ public PacketLimit(final double packetLimitInterval, final double maxPacketRate, final ViolateAction violateAction) { -+ this.packetLimitInterval = packetLimitInterval; -+ this.maxPacketRate = maxPacketRate; -+ this.violateAction = violateAction; -+ } -+ -+ public static enum ViolateAction { -+ KICK, DROP; -+ } -+ } -+ -+ public static String kickMessage; -+ public static PacketLimit allPacketsLimit; -+ public static java.util.Map>, PacketLimit> packetSpecificLimits = new java.util.HashMap<>(); -+ -+ private static void packetLimiter() { -+ packetSpecificLimits.clear(); -+ kickMessage = org.bukkit.ChatColor.translateAlternateColorCodes('&', getString("settings.packet-limiter.kick-message", "&cSent too many packets")); -+ allPacketsLimit = new PacketLimit( -+ getDouble("settings.packet-limiter.limits.all.interval", 7.0), -+ getDouble("settings.packet-limiter.limits.all.max-packet-rate", 500.0), -+ PacketLimit.ViolateAction.KICK -+ ); -+ if (allPacketsLimit.maxPacketRate <= 0.0 || allPacketsLimit.packetLimitInterval <= 0.0) { -+ allPacketsLimit = null; -+ } -+ final ConfigurationSection section = config.getConfigurationSection("settings.packet-limiter.limits"); -+ -+ // add default packets -+ -+ // auto recipe limiting -+ getDouble("settings.packet-limiter.limits." + -+ "PacketPlayInAutoRecipe" + ".interval", 4.0); -+ getDouble("settings.packet-limiter.limits." + -+ "PacketPlayInAutoRecipe" + ".max-packet-rate", 5.0); -+ getString("settings.packet-limiter.limits." + -+ "PacketPlayInAutoRecipe" + ".action", PacketLimit.ViolateAction.DROP.name()); -+ -+ final Map mojangToSpigot = new HashMap<>(); -+ final Map maps = io.papermc.paper.util.ObfHelper.INSTANCE.mappingsByObfName(); -+ if (maps != null) { -+ maps.forEach((spigotName, classMapping) -> -+ mojangToSpigot.put(classMapping.mojangName(), classMapping.obfName())); -+ } -+ -+ for (final String packetClassName : section.getKeys(false)) { -+ if (packetClassName.equals("all")) { -+ continue; -+ } -+ Class packetClazz = null; -+ -+ for (final String subpackage : List.of("game", "handshake", "login", "status")) { -+ final String fullName = "net.minecraft.network.protocol." + subpackage + "." + packetClassName; -+ try { -+ packetClazz = Class.forName(fullName); -+ break; -+ } catch (final ClassNotFoundException ex) { -+ try { -+ final String spigot = mojangToSpigot.get(fullName); -+ if (spigot != null) { -+ packetClazz = Class.forName(spigot); -+ } -+ } catch (final ClassNotFoundException ignore) {} -+ } -+ } -+ -+ if (packetClazz == null || !net.minecraft.network.protocol.Packet.class.isAssignableFrom(packetClazz)) { -+ MinecraftServer.LOGGER.warn("Packet '" + packetClassName + "' does not exist, cannot limit it! Please update paper.yml"); -+ continue; -+ } -+ -+ if (!(section.get(packetClassName.concat(".interval")) instanceof Number) || !(section.get(packetClassName.concat(".max-packet-rate")) instanceof Number)) { -+ throw new RuntimeException("Packet limit setting " + packetClassName + " is missing interval or max-packet-rate!"); -+ } -+ -+ final String actionString = section.getString(packetClassName.concat(".action"), "KICK"); -+ PacketLimit.ViolateAction action = PacketLimit.ViolateAction.KICK; -+ for (PacketLimit.ViolateAction test : PacketLimit.ViolateAction.values()) { -+ if (actionString.equalsIgnoreCase(test.name())) { -+ action = test; -+ break; -+ } -+ } -+ -+ final double interval = section.getDouble(packetClassName.concat(".interval")); -+ final double rate = section.getDouble(packetClassName.concat(".max-packet-rate")); -+ -+ if (interval > 0.0 && rate > 0.0) { -+ packetSpecificLimits.put((Class)packetClazz, new PacketLimit(interval, rate, action)); -+ } -+ } -+ } - } -diff --git a/src/main/java/net/minecraft/network/Connection.java b/src/main/java/net/minecraft/network/Connection.java -index 2c298b11dee7df7733bdd9539a96a63739940f7d..094366b2c44992cbd41dceb5d71eb9f4edf3dd05 100644 ---- a/src/main/java/net/minecraft/network/Connection.java -+++ b/src/main/java/net/minecraft/network/Connection.java -@@ -136,6 +136,22 @@ public class Connection extends SimpleChannelInboundHandler> { - } - } - // Paper end - allow controlled flushing -+ // Paper start - packet limiter -+ protected final Object PACKET_LIMIT_LOCK = new Object(); -+ protected final io.papermc.paper.util.IntervalledCounter allPacketCounts = com.destroystokyo.paper.PaperConfig.allPacketsLimit != null ? new io.papermc.paper.util.IntervalledCounter( -+ (long)(com.destroystokyo.paper.PaperConfig.allPacketsLimit.packetLimitInterval * 1.0e9) -+ ) : null; -+ protected final java.util.Map>, io.papermc.paper.util.IntervalledCounter> packetSpecificLimits = new java.util.HashMap<>(); -+ -+ private boolean stopReadingPackets; -+ private void killForPacketSpam() { -+ this.sendPacket(new ClientboundDisconnectPacket(org.bukkit.craftbukkit.util.CraftChatMessage.fromString(com.destroystokyo.paper.PaperConfig.kickMessage, true)[0]), (future) -> { -+ this.disconnect(org.bukkit.craftbukkit.util.CraftChatMessage.fromString(com.destroystokyo.paper.PaperConfig.kickMessage, true)[0]); -+ }); -+ this.setReadOnly(); -+ this.stopReadingPackets = true; -+ } -+ // Paper end - packet limiter - - public Connection(PacketFlow side) { - this.receiving = side; -@@ -216,6 +232,45 @@ public class Connection extends SimpleChannelInboundHandler> { - - protected void channelRead0(ChannelHandlerContext channelhandlercontext, Packet packet) { - if (this.channel.isOpen()) { -+ // Paper start - packet limiter -+ if (this.stopReadingPackets) { -+ return; -+ } -+ if (this.allPacketCounts != null || -+ com.destroystokyo.paper.PaperConfig.packetSpecificLimits.containsKey(packet.getClass())) { -+ long time = System.nanoTime(); -+ synchronized (PACKET_LIMIT_LOCK) { -+ if (this.allPacketCounts != null) { -+ this.allPacketCounts.updateAndAdd(1, time); -+ if (this.allPacketCounts.getRate() >= com.destroystokyo.paper.PaperConfig.allPacketsLimit.maxPacketRate) { -+ this.killForPacketSpam(); -+ return; -+ } -+ } -+ -+ for (Class check = packet.getClass(); check != Object.class; check = check.getSuperclass()) { -+ com.destroystokyo.paper.PaperConfig.PacketLimit packetSpecificLimit = -+ com.destroystokyo.paper.PaperConfig.packetSpecificLimits.get(check); -+ if (packetSpecificLimit == null) { -+ continue; -+ } -+ io.papermc.paper.util.IntervalledCounter counter = this.packetSpecificLimits.computeIfAbsent((Class)check, (clazz) -> { -+ return new io.papermc.paper.util.IntervalledCounter((long)(packetSpecificLimit.packetLimitInterval * 1.0e9)); -+ }); -+ counter.updateAndAdd(1, time); -+ if (counter.getRate() >= packetSpecificLimit.maxPacketRate) { -+ switch (packetSpecificLimit.violateAction) { -+ case DROP: -+ return; -+ case KICK: -+ this.killForPacketSpam(); -+ return; -+ } -+ } -+ } -+ } -+ } -+ // Paper end - packet limiter - try { - Connection.genericsFtw(packet, this.packetListener); - } catch (RunningOnDifferentThreadException cancelledpackethandleexception) { diff --git a/patches/server/0746-Use-correct-LevelStem-registry-when-loading-default-.patch b/patches/server/0745-Use-correct-LevelStem-registry-when-loading-default-.patch similarity index 94% rename from patches/server/0746-Use-correct-LevelStem-registry-when-loading-default-.patch rename to patches/server/0745-Use-correct-LevelStem-registry-when-loading-default-.patch index c6e7dcb625..452390ee7d 100644 --- a/patches/server/0746-Use-correct-LevelStem-registry-when-loading-default-.patch +++ b/patches/server/0745-Use-correct-LevelStem-registry-when-loading-default-.patch @@ -24,10 +24,10 @@ index 8da1226a6c293abb038d10c7921a77ed71ad06cc..f958f0ae738a6fb26400e17e54c8d69e } else { Holder holder = registry.getOrCreateHolderOrThrow(entryKey); diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index 786eafffa9bc51399c7fdf0012dfdaa9c92e71b0..6279b843ad04769b202b74913e328c86f256ee13 100644 +index 17efe9e0a17672b815c64491dbca70b7519b6aca..79153def3866e9761fcd6eca7d81574fe64f2895 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java -@@ -549,7 +549,14 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop list = ImmutableList.of(new PhantomSpawner(), new PatrolSpawner(), new CatSpawner(), new VillageSiege(), new WanderingTraderSpawner(iworlddataserver)); diff --git a/patches/server/0747-Don-t-read-neighbour-chunk-data-off-disk-when-conver.patch b/patches/server/0746-Don-t-read-neighbour-chunk-data-off-disk-when-conver.patch similarity index 100% rename from patches/server/0747-Don-t-read-neighbour-chunk-data-off-disk-when-conver.patch rename to patches/server/0746-Don-t-read-neighbour-chunk-data-off-disk-when-conver.patch diff --git a/patches/server/0748-Consolidate-flush-calls-for-entity-tracker-packets.patch b/patches/server/0747-Consolidate-flush-calls-for-entity-tracker-packets.patch similarity index 96% rename from patches/server/0748-Consolidate-flush-calls-for-entity-tracker-packets.patch rename to patches/server/0747-Consolidate-flush-calls-for-entity-tracker-packets.patch index b56750cded..17c273d2c0 100644 --- a/patches/server/0748-Consolidate-flush-calls-for-entity-tracker-packets.patch +++ b/patches/server/0747-Consolidate-flush-calls-for-entity-tracker-packets.patch @@ -22,7 +22,7 @@ With this change I could get all 200 on at 0ms ping. So in general this patch should reduce Netty I/O thread load. diff --git a/src/main/java/net/minecraft/server/level/ServerChunkCache.java b/src/main/java/net/minecraft/server/level/ServerChunkCache.java -index cc57efc087268d7639544dd12765082909db827a..87334390b65e996d2366519442286d9880174d2b 100644 +index 7524d9cf7184b345cbd7f0bd1d85601b75c29087..96a232f22b1c270b91635ce9c7c6cacc63b026cc 100644 --- a/src/main/java/net/minecraft/server/level/ServerChunkCache.java +++ b/src/main/java/net/minecraft/server/level/ServerChunkCache.java @@ -1070,7 +1070,24 @@ public class ServerChunkCache extends ChunkSource { diff --git a/patches/server/0749-Don-t-lookup-fluid-state-when-raytracing.patch b/patches/server/0748-Don-t-lookup-fluid-state-when-raytracing.patch similarity index 100% rename from patches/server/0749-Don-t-lookup-fluid-state-when-raytracing.patch rename to patches/server/0748-Don-t-lookup-fluid-state-when-raytracing.patch diff --git a/patches/server/0750-Time-scoreboard-search.patch b/patches/server/0749-Time-scoreboard-search.patch similarity index 90% rename from patches/server/0750-Time-scoreboard-search.patch rename to patches/server/0749-Time-scoreboard-search.patch index 48469b83af..6cdcc11346 100644 --- a/patches/server/0750-Time-scoreboard-search.patch +++ b/patches/server/0749-Time-scoreboard-search.patch @@ -7,10 +7,10 @@ Plugins leaking scoreboards will make this very expensive, let server owners debug it easily diff --git a/src/main/java/co/aikar/timings/MinecraftTimings.java b/src/main/java/co/aikar/timings/MinecraftTimings.java -index a977f7483f37df473096b2234dc1308bbaa6a8b6..bb5f079a10b15d7b9f2ab5a8af67c559ffa5b371 100644 +index 4567ddf1cef02405b44a9e217a72b326fadb19ab..8f109e667f09d58f6bc7ce1a8b44e8e70d191579 100644 --- a/src/main/java/co/aikar/timings/MinecraftTimings.java +++ b/src/main/java/co/aikar/timings/MinecraftTimings.java -@@ -45,6 +45,7 @@ public final class MinecraftTimings { +@@ -46,6 +46,7 @@ public final class MinecraftTimings { public static final Timing antiXrayUpdateTimer = Timings.ofSafe("anti-xray - update"); public static final Timing antiXrayObfuscateTimer = Timings.ofSafe("anti-xray - obfuscate"); public static final Timing distanceManagerTick = Timings.ofSafe("Distance Manager Tick"); // Paper - add timings for distance manager @@ -19,7 +19,7 @@ index a977f7483f37df473096b2234dc1308bbaa6a8b6..bb5f079a10b15d7b9f2ab5a8af67c559 public static final Timing midTickChunkTasks = Timings.ofSafe("Mid Tick Chunk Tasks"); diff --git a/src/main/java/org/bukkit/craftbukkit/scoreboard/CraftScoreboardManager.java b/src/main/java/org/bukkit/craftbukkit/scoreboard/CraftScoreboardManager.java -index 8ccfe9488db44d7d2cf4040a5b4cead33da1d5f4..1a3b1eb7b70b9a668aa33ea943c13890eaa23a05 100644 +index 60d5564b5eb9f91db6b02bd4fb037a11fc6dfeb3..c74ac9cf5db4d8adfe781cf066258011da469717 100644 --- a/src/main/java/org/bukkit/craftbukkit/scoreboard/CraftScoreboardManager.java +++ b/src/main/java/org/bukkit/craftbukkit/scoreboard/CraftScoreboardManager.java @@ -113,9 +113,18 @@ public final class CraftScoreboardManager implements ScoreboardManager { diff --git a/patches/server/0751-Send-full-pos-packets-for-hard-colliding-entities.patch b/patches/server/0750-Send-full-pos-packets-for-hard-colliding-entities.patch similarity index 59% rename from patches/server/0751-Send-full-pos-packets-for-hard-colliding-entities.patch rename to patches/server/0750-Send-full-pos-packets-for-hard-colliding-entities.patch index 7db05b696e..350a67a866 100644 --- a/patches/server/0751-Send-full-pos-packets-for-hard-colliding-entities.patch +++ b/patches/server/0750-Send-full-pos-packets-for-hard-colliding-entities.patch @@ -8,23 +8,8 @@ Prevent collision problems due to desync (i.e boats) Configurable under `send-full-pos-for-hard-colliding-entities` -diff --git a/src/main/java/com/destroystokyo/paper/PaperConfig.java b/src/main/java/com/destroystokyo/paper/PaperConfig.java -index 96d5b89d67f0904c0a6f68a7bbffc48457e850de..4b828da7f8dbadb8af66ffc04d631273cfccdf36 100644 ---- a/src/main/java/com/destroystokyo/paper/PaperConfig.java -+++ b/src/main/java/com/destroystokyo/paper/PaperConfig.java -@@ -615,4 +615,10 @@ public class PaperConfig { - } - } - } -+ -+ public static boolean sendFullPosForHardCollidingEntities; -+ -+ private static void sendFullPosForHardCollidingEntities() { -+ sendFullPosForHardCollidingEntities = getBoolean("settings.send-full-pos-for-hard-colliding-entities", true); -+ } - } diff --git a/src/main/java/net/minecraft/server/level/ServerEntity.java b/src/main/java/net/minecraft/server/level/ServerEntity.java -index 66df9492004ae648c5a5db8d1e76931284297ec1..2abfc5c801cd58223986d6c5012fc381e66f0d9a 100644 +index 4d5abfd4fdb0fb0d00840c8a6ef601e78b090888..4bfe42e8a829d7ea11e086822050b43f20ef7b42 100644 --- a/src/main/java/net/minecraft/server/level/ServerEntity.java +++ b/src/main/java/net/minecraft/server/level/ServerEntity.java @@ -158,7 +158,7 @@ public class ServerEntity { @@ -32,7 +17,7 @@ index 66df9492004ae648c5a5db8d1e76931284297ec1..2abfc5c801cd58223986d6c5012fc381 boolean flag4 = k < -32768L || k > 32767L || l < -32768L || l > 32767L || i1 < -32768L || i1 > 32767L; - if (!flag4 && this.teleportDelay <= 400 && !this.wasRiding && this.wasOnGround == this.entity.isOnGround()) { -+ if (!flag4 && this.teleportDelay <= 400 && !this.wasRiding && this.wasOnGround == this.entity.isOnGround() && !(com.destroystokyo.paper.PaperConfig.sendFullPosForHardCollidingEntities && this.entity.hardCollides())) { // Paper - send full pos for hard colliding entities to prevent collision problems due to desync ++ if (!flag4 && this.teleportDelay <= 400 && !this.wasRiding && this.wasOnGround == this.entity.isOnGround() && !(io.papermc.paper.configuration.GlobalConfiguration.get().collisions.sendFullPosForHardCollidingEntities && this.entity.hardCollides())) { // Paper - send full pos for hard colliding entities to prevent collision problems due to desync if ((!flag2 || !flag3) && !(this.entity instanceof AbstractArrow)) { if (flag2) { packet1 = new ClientboundMoveEntityPacket.Pos(this.entity.getId(), (short) ((int) k), (short) ((int) l), (short) ((int) i1), this.entity.isOnGround()); diff --git a/patches/server/0752-Do-not-run-raytrace-logic-for-AIR.patch b/patches/server/0751-Do-not-run-raytrace-logic-for-AIR.patch similarity index 100% rename from patches/server/0752-Do-not-run-raytrace-logic-for-AIR.patch rename to patches/server/0751-Do-not-run-raytrace-logic-for-AIR.patch diff --git a/patches/server/0753-Oprimise-map-impl-for-tracked-players.patch b/patches/server/0752-Oprimise-map-impl-for-tracked-players.patch similarity index 85% rename from patches/server/0753-Oprimise-map-impl-for-tracked-players.patch rename to patches/server/0752-Oprimise-map-impl-for-tracked-players.patch index c015028293..a3a91cf599 100644 --- a/patches/server/0753-Oprimise-map-impl-for-tracked-players.patch +++ b/patches/server/0752-Oprimise-map-impl-for-tracked-players.patch @@ -7,10 +7,10 @@ Reference2BooleanOpenHashMap is going to have better lookups than HashMap. diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java -index 66a627a6b58ef5b420aceb0a3a1bcf90aec13198..a32b5c194da4983ac21c88695f036689809c2133 100644 +index 667ccb6c75010a07fea5c0fa001f553814a1804a..d2227b40aa6a5e49e30c1f33e407d8f25cf2be4e 100644 --- a/src/main/java/net/minecraft/server/level/ChunkMap.java +++ b/src/main/java/net/minecraft/server/level/ChunkMap.java -@@ -113,6 +113,7 @@ import org.apache.commons.lang3.mutable.MutableObject; +@@ -112,6 +112,7 @@ import org.apache.commons.lang3.mutable.MutableObject; import org.slf4j.Logger; import org.bukkit.entity.Player; // CraftBukkit end @@ -18,7 +18,7 @@ index 66a627a6b58ef5b420aceb0a3a1bcf90aec13198..a32b5c194da4983ac21c88695f036689 public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider { -@@ -2198,7 +2199,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider +@@ -2197,7 +2198,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider final Entity entity; private final int range; SectionPos lastSectionPos; diff --git a/patches/server/0754-Optimise-BlockSoil-nearby-water-lookup.patch b/patches/server/0753-Optimise-BlockSoil-nearby-water-lookup.patch similarity index 100% rename from patches/server/0754-Optimise-BlockSoil-nearby-water-lookup.patch rename to patches/server/0753-Optimise-BlockSoil-nearby-water-lookup.patch diff --git a/patches/server/0755-Allow-removal-addition-of-entities-to-entity-ticklis.patch b/patches/server/0754-Allow-removal-addition-of-entities-to-entity-ticklis.patch similarity index 100% rename from patches/server/0755-Allow-removal-addition-of-entities-to-entity-ticklis.patch rename to patches/server/0754-Allow-removal-addition-of-entities-to-entity-ticklis.patch diff --git a/patches/server/0756-Optimise-random-block-ticking.patch b/patches/server/0755-Optimise-random-block-ticking.patch similarity index 96% rename from patches/server/0756-Optimise-random-block-ticking.patch rename to patches/server/0755-Optimise-random-block-ticking.patch index 41ce896e17..6e42fccec5 100644 --- a/patches/server/0756-Optimise-random-block-ticking.patch +++ b/patches/server/0755-Optimise-random-block-ticking.patch @@ -120,7 +120,7 @@ index 0000000000000000000000000000000000000000..16ca915c33e31b50d33336408b041e40 + } +} diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java -index 4566c7b0cd5551f2e348e532911e77c62d3de2f2..6f0b2a6a79dfeb1c61cd0b316841f902d3377bdd 100644 +index 6d1489332681d938a1c3db832ab967ba494f3b97..3ef55cb31b8d9a308fab3ac1e463e98a7dce726e 100644 --- a/src/main/java/net/minecraft/server/level/ServerLevel.java +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java @@ -662,6 +662,10 @@ public class ServerLevel extends Level implements WorldGenLevel { @@ -141,16 +141,16 @@ index 4566c7b0cd5551f2e348e532911e77c62d3de2f2..6f0b2a6a79dfeb1c61cd0b316841f902 - BlockPos blockposition; + final BlockPos.MutableBlockPos blockposition = this.chunkTickMutablePosition; // Paper - use mutable to reduce allocation rate, final to force compile fail on change - if (!this.paperConfig.disableThunder && flag && this.isThundering() && this.spigotConfig.thunderChance > 0 && this.random.nextInt(this.spigotConfig.thunderChance) == 0) { // Spigot // Paper - disable thunder + if (!this.paperConfig().environment.disableThunder && flag && this.isThundering() && this.spigotConfig.thunderChance > 0 && this.random.nextInt(this.spigotConfig.thunderChance) == 0) { // Spigot // Paper - disable thunder - blockposition = this.findLightningTargetAround(this.getBlockRandomPos(j, 0, k, 15)); + blockposition.set(this.findLightningTargetAround(this.getBlockRandomPos(j, 0, k, 15))); // Paper if (this.isRainingAt(blockposition)) { DifficultyInstance difficultydamagescaler = this.getCurrentDifficultyAt(blockposition); - boolean flag1 = this.getGameRules().getBoolean(GameRules.RULE_DOMOBSPAWNING) && this.random.nextDouble() < (double) difficultydamagescaler.getEffectiveDifficulty() * paperConfig.skeleHorseSpawnChance && !this.getBlockState(blockposition.below()).is(Blocks.LIGHTNING_ROD); // Paper + boolean flag1 = this.getGameRules().getBoolean(GameRules.RULE_DOMOBSPAWNING) && this.random.nextDouble() < (double) difficultydamagescaler.getEffectiveDifficulty() * this.paperConfig().entities.spawning.skeletonHorseThunderSpawnChance.or(0.01D) && !this.getBlockState(blockposition.below()).is(Blocks.LIGHTNING_ROD); // Paper @@ -698,64 +702,75 @@ public class ServerLevel extends Level implements WorldGenLevel { gameprofilerfiller.popPush("iceandsnow"); - if (!this.paperConfig.disableIceAndSnow && this.random.nextInt(16) == 0) { // Paper - Disable ice and snow + if (!this.paperConfig().environment.disableIceAndSnow && this.random.nextInt(16) == 0) { // Paper - Disable ice and snow - blockposition = this.getHeightmapPos(Heightmap.Types.MOTION_BLOCKING, this.getBlockRandomPos(j, 0, k, 15)); - BlockPos blockposition1 = blockposition.below(); + // Paper start - optimise chunk ticking @@ -342,10 +342,10 @@ index 69c98c2cb2fd8f149a39bbddcbfe0c5c5adc3904..5575730aa6f77a91467c394fa8465c33 public BlockPos getHomePos() { diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java -index f0721f2311769cff31ffb83a6c1cfeb9927f32a4..ef873ee044113719ee3d25dc51385e98017dd1c0 100644 +index e07b094cf19bc94a4e3ef726f37973eaff7aaf6d..03f7eb8a56fd4e609bc7b1a00d18cad5586a41dd 100644 --- a/src/main/java/net/minecraft/world/level/Level.java +++ b/src/main/java/net/minecraft/world/level/Level.java -@@ -1297,10 +1297,18 @@ public abstract class Level implements LevelAccessor, AutoCloseable { +@@ -1302,10 +1302,18 @@ public abstract class Level implements LevelAccessor, AutoCloseable { public abstract RecipeManager getRecipeManager(); public BlockPos getBlockRandomPos(int x, int y, int z, int l) { diff --git a/patches/server/0757-Optimise-non-flush-packet-sending.patch b/patches/server/0756-Optimise-non-flush-packet-sending.patch similarity index 92% rename from patches/server/0757-Optimise-non-flush-packet-sending.patch rename to patches/server/0756-Optimise-non-flush-packet-sending.patch index c35453b80b..771add7791 100644 --- a/patches/server/0757-Optimise-non-flush-packet-sending.patch +++ b/patches/server/0756-Optimise-non-flush-packet-sending.patch @@ -20,10 +20,10 @@ up on this optimisation before he came along. Locally this patch drops the entity tracker tick by a full 1.5x. diff --git a/src/main/java/net/minecraft/network/Connection.java b/src/main/java/net/minecraft/network/Connection.java -index 094366b2c44992cbd41dceb5d71eb9f4edf3dd05..1e4b75ab79a1d63a82498907d72932d644552635 100644 +index f13c93764d6026b7e53123a8f6f123d986ded3a5..dffeba1eda35026ea23012ecd47053ca43c6f0d5 100644 --- a/src/main/java/net/minecraft/network/Connection.java +++ b/src/main/java/net/minecraft/network/Connection.java -@@ -51,6 +51,8 @@ import org.slf4j.Logger; +@@ -50,6 +50,8 @@ import org.slf4j.Logger; import org.slf4j.Marker; import org.slf4j.MarkerFactory; @@ -32,7 +32,7 @@ index 094366b2c44992cbd41dceb5d71eb9f4edf3dd05..1e4b75ab79a1d63a82498907d72932d6 public class Connection extends SimpleChannelInboundHandler> { private static final float AVERAGE_PACKETS_SMOOTHING = 0.75F; -@@ -401,9 +403,19 @@ public class Connection extends SimpleChannelInboundHandler> { +@@ -400,9 +402,19 @@ public class Connection extends SimpleChannelInboundHandler> { if (this.channel.eventLoop().inEventLoop()) { this.doSendPacket(packet, callback, enumprotocol, enumprotocol1, flush); // Paper - add flush parameter } else { diff --git a/patches/server/0758-Optimise-nearby-player-lookups.patch b/patches/server/0757-Optimise-nearby-player-lookups.patch similarity index 95% rename from patches/server/0758-Optimise-nearby-player-lookups.patch rename to patches/server/0757-Optimise-nearby-player-lookups.patch index 77db7a45e8..ee47eea597 100644 --- a/patches/server/0758-Optimise-nearby-player-lookups.patch +++ b/patches/server/0757-Optimise-nearby-player-lookups.patch @@ -9,7 +9,7 @@ since the penalty of a map lookup could outweigh the benefits of searching less players (as it basically did in the outside range patch). diff --git a/src/main/java/net/minecraft/server/level/ChunkHolder.java b/src/main/java/net/minecraft/server/level/ChunkHolder.java -index 020617ec8e5e77920d36380f019e430286006f89..7471e5e94b9b4a4f9100b445ca85c74875007330 100644 +index 8bea90cb57f38f33e8b3162e24e353993a98ebbf..5b4c3ca92dffff876af18db106310cb14e8612b1 100644 --- a/src/main/java/net/minecraft/server/level/ChunkHolder.java +++ b/src/main/java/net/minecraft/server/level/ChunkHolder.java @@ -91,6 +91,12 @@ public class ChunkHolder { @@ -39,10 +39,10 @@ index 020617ec8e5e77920d36380f019e430286006f89..7471e5e94b9b4a4f9100b445ca85c748 // Paper end - optimise anyPlayerCloseEnoughForSpawning long lastAutoSaveTime; // Paper - incremental autosave diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java -index a32b5c194da4983ac21c88695f036689809c2133..0df9da8773a32b4c7d21325c42635cd233cf8c46 100644 +index d2227b40aa6a5e49e30c1f33e407d8f25cf2be4e..1c5137be8c0935ae371d0b9e6a8f3d8bccd85d31 100644 --- a/src/main/java/net/minecraft/server/level/ChunkMap.java +++ b/src/main/java/net/minecraft/server/level/ChunkMap.java -@@ -168,6 +168,13 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider +@@ -167,6 +167,13 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider public final com.destroystokyo.paper.util.misc.PlayerAreaMap playerMobDistanceMap; // Paper public final ReferenceOpenHashSet needsChangeBroadcasting = new ReferenceOpenHashSet<>(); @@ -56,7 +56,7 @@ index a32b5c194da4983ac21c88695f036689809c2133..0df9da8773a32b4c7d21325c42635cd2 // CraftBukkit start - recursion-safe executor for Chunk loadCallback() and unloadCallback() public final CallbackExecutor callbackExecutor = new CallbackExecutor(); public static final class CallbackExecutor implements java.util.concurrent.Executor, Runnable { -@@ -245,6 +252,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider +@@ -244,6 +251,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider // Paper end - use distance map to optimise entity tracker // Note: players need to be explicitly added to distance maps before they can be updated this.playerChunkTickRangeMap.add(player, chunkX, chunkZ, DistanceManager.MOB_SPAWN_RANGE); // Paper - optimise ChunkMap#anyPlayerCloseEnoughForSpawning @@ -64,7 +64,7 @@ index a32b5c194da4983ac21c88695f036689809c2133..0df9da8773a32b4c7d21325c42635cd2 // Paper start - per player mob spawning if (this.playerMobDistanceMap != null) { this.playerMobDistanceMap.add(player, chunkX, chunkZ, this.distanceManager.getSimulationDistance()); -@@ -263,6 +271,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider +@@ -262,6 +270,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider this.playerMobSpawnMap.remove(player); this.playerChunkTickRangeMap.remove(player); // Paper end - optimise ChunkMap#anyPlayerCloseEnoughForSpawning @@ -72,7 +72,7 @@ index a32b5c194da4983ac21c88695f036689809c2133..0df9da8773a32b4c7d21325c42635cd2 // Paper start - per player mob spawning if (this.playerMobDistanceMap != null) { this.playerMobDistanceMap.remove(player); -@@ -283,6 +292,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider +@@ -282,6 +291,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider } // Paper end - use distance map to optimise entity tracker this.playerChunkTickRangeMap.update(player, chunkX, chunkZ, DistanceManager.MOB_SPAWN_RANGE); // Paper - optimise ChunkMap#anyPlayerCloseEnoughForSpawning @@ -80,7 +80,7 @@ index a32b5c194da4983ac21c88695f036689809c2133..0df9da8773a32b4c7d21325c42635cd2 // Paper start - per player mob spawning if (this.playerMobDistanceMap != null) { this.playerMobDistanceMap.update(player, chunkX, chunkZ, this.distanceManager.getSimulationDistance()); -@@ -452,6 +462,23 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider +@@ -451,6 +461,23 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider } }); // Paper end - optimise ChunkMap#anyPlayerCloseEnoughForSpawning @@ -105,7 +105,7 @@ index a32b5c194da4983ac21c88695f036689809c2133..0df9da8773a32b4c7d21325c42635cd2 protected ChunkGenerator generator() { diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java -index 6f0b2a6a79dfeb1c61cd0b316841f902d3377bdd..0e6405763ea40ca3f122130abb84b56e9bf92e73 100644 +index 3ef55cb31b8d9a308fab3ac1e463e98a7dce726e..d292e4775cdf936bb294bba7c0320c8b97ad14a6 100644 --- a/src/main/java/net/minecraft/server/level/ServerLevel.java +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java @@ -404,6 +404,83 @@ public class ServerLevel extends Level implements WorldGenLevel { @@ -208,7 +208,7 @@ index 6f0b2a6a79dfeb1c61cd0b316841f902d3377bdd..0e6405763ea40ca3f122130abb84b56e this.handlingTick = true; diff --git a/src/main/java/net/minecraft/world/entity/Mob.java b/src/main/java/net/minecraft/world/entity/Mob.java -index 11f3a492748d291c9c58c09d6ed62188f0868438..a55c30d86793bf224b536a7ceefce75c70b618c7 100644 +index a49dfe4f81d449c5dd7ba5b8f9af7fec5c54f5de..3646b969fa51b9683ab4137e530c3a6f6fc6c465 100644 --- a/src/main/java/net/minecraft/world/entity/Mob.java +++ b/src/main/java/net/minecraft/world/entity/Mob.java @@ -802,7 +802,12 @@ public abstract class Mob extends LivingEntity { @@ -217,7 +217,7 @@ index 11f3a492748d291c9c58c09d6ed62188f0868438..a55c30d86793bf224b536a7ceefce75c } else if (!this.isPersistenceRequired() && !this.requiresCustomPersistence()) { - Player entityhuman = this.level.findNearbyPlayer(this, -1.0D, EntitySelector.affectsSpawning); // Paper + // Paper start - optimise checkDespawn -+ Player entityhuman = this.level.findNearbyPlayer(this, level.paperConfig.hardDespawnDistances.getInt(this.getType().getCategory()) + 1, EntitySelector.affectsSpawning); // Paper ++ Player entityhuman = this.level.findNearbyPlayer(this, level.paperConfig().entities.spawning.despawnRanges.get(this.getType().getCategory()).hard() + 1, EntitySelector.affectsSpawning); // Paper + if (entityhuman == null) { + entityhuman = ((ServerLevel)this.level).playersAffectingSpawning.isEmpty() ? null : ((ServerLevel)this.level).playersAffectingSpawning.get(0); + } @@ -226,10 +226,10 @@ index 11f3a492748d291c9c58c09d6ed62188f0868438..a55c30d86793bf224b536a7ceefce75c if (entityhuman != null) { double d0 = entityhuman.distanceToSqr((Entity) this); diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java -index ef873ee044113719ee3d25dc51385e98017dd1c0..e3052c32624538d5394bf098c3b5db84e4cdb9b4 100644 +index 03f7eb8a56fd4e609bc7b1a00d18cad5586a41dd..aba8e748123f70d48de638ea18afbbf5dfede504 100644 --- a/src/main/java/net/minecraft/world/level/Level.java +++ b/src/main/java/net/minecraft/world/level/Level.java -@@ -201,6 +201,69 @@ public abstract class Level implements LevelAccessor, AutoCloseable { +@@ -206,6 +206,69 @@ public abstract class Level implements LevelAccessor, AutoCloseable { return this.getChunkIfLoaded(chunkX, chunkZ) != null; } // Paper end @@ -300,7 +300,7 @@ index ef873ee044113719ee3d25dc51385e98017dd1c0..e3052c32624538d5394bf098c3b5db84 public abstract ResourceKey getTypeKey(); diff --git a/src/main/java/net/minecraft/world/level/NaturalSpawner.java b/src/main/java/net/minecraft/world/level/NaturalSpawner.java -index a04b8eeb9b4cbd700b95552c46fdf0da4c03b3eb..15cac62aa2901168e8cc0ba07981d9b8624b26f6 100644 +index 4150e8cd7197eac53042d56f0a53a4951f8824ce..e31a2eea9a62ab2c0bed1a97dab6bae231b8cd8b 100644 --- a/src/main/java/net/minecraft/world/level/NaturalSpawner.java +++ b/src/main/java/net/minecraft/world/level/NaturalSpawner.java @@ -259,7 +259,7 @@ public final class NaturalSpawner { @@ -322,7 +322,7 @@ index a04b8eeb9b4cbd700b95552c46fdf0da4c03b3eb..15cac62aa2901168e8cc0ba07981d9b8 private static Boolean isValidSpawnPostitionForType(ServerLevel world, MobCategory group, StructureManager structureAccessor, ChunkGenerator chunkGenerator, MobSpawnSettings.SpawnerData spawnEntry, BlockPos.MutableBlockPos pos, double squaredDistance) { // Paper diff --git a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java -index 25132e88c08335e0cbd85d948d0863c9cbb28d3e..b57e8e21d75fae24a31effedce2e3c53d9e7d66f 100644 +index 3591ac3b7823e109e01ebfa54ac70aa4deabd4f6..1a64558f8ebedbc4c47ad34787a45c0d89159360 100644 --- a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java +++ b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java @@ -235,6 +235,98 @@ public class LevelChunk extends ChunkAccess { diff --git a/patches/server/0759-Optimise-WorldServer-notify.patch b/patches/server/0758-Optimise-WorldServer-notify.patch similarity index 96% rename from patches/server/0759-Optimise-WorldServer-notify.patch rename to patches/server/0758-Optimise-WorldServer-notify.patch index 9fe3a45ea0..78aef1773b 100644 --- a/patches/server/0759-Optimise-WorldServer-notify.patch +++ b/patches/server/0758-Optimise-WorldServer-notify.patch @@ -8,10 +8,10 @@ Instead, only iterate over navigators in the current region that are eligible for repathing. diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java -index 0df9da8773a32b4c7d21325c42635cd233cf8c46..3dd3ed91e702858f07c811afdcfa6c111f9e3d61 100644 +index 1c5137be8c0935ae371d0b9e6a8f3d8bccd85d31..8939d15bd413a2b743303d137fc797be6d97b9e8 100644 --- a/src/main/java/net/minecraft/server/level/ChunkMap.java +++ b/src/main/java/net/minecraft/server/level/ChunkMap.java -@@ -305,15 +305,81 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider +@@ -304,15 +304,81 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider public final io.papermc.paper.chunk.SingleThreadChunkRegionManager dataRegionManager; public static final class DataRegionData implements io.papermc.paper.chunk.SingleThreadChunkRegionManager.RegionData { @@ -93,7 +93,7 @@ index 0df9da8773a32b4c7d21325c42635cd233cf8c46..3dd3ed91e702858f07c811afdcfa6c11 } @Override -@@ -323,6 +389,15 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider +@@ -322,6 +388,15 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider final DataRegionSectionData sectionData = (DataRegionSectionData)section.sectionData; final DataRegionData oldRegionData = oldRegion == null ? null : (DataRegionData)oldRegion.regionData; final DataRegionData newRegionData = (DataRegionData)newRegion.regionData; @@ -110,7 +110,7 @@ index 0df9da8773a32b4c7d21325c42635cd233cf8c46..3dd3ed91e702858f07c811afdcfa6c11 } diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java -index 0e6405763ea40ca3f122130abb84b56e9bf92e73..d5585e1723eebce14c47c4a92ce339915cd936db 100644 +index d292e4775cdf936bb294bba7c0320c8b97ad14a6..7e7edaebf146d8042e9b75f6088990069ca9021a 100644 --- a/src/main/java/net/minecraft/server/level/ServerLevel.java +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java @@ -1113,6 +1113,7 @@ public class ServerLevel extends Level implements WorldGenLevel { @@ -180,7 +180,7 @@ index 0e6405763ea40ca3f122130abb84b56e9bf92e73..d5585e1723eebce14c47c4a92ce33991 ServerLevel.this.entityTickList.remove(entity); + ServerLevel.this.entityManager.removeNavigatorsFromData(entity); // Paper - optimise notify // Paper start - Reset pearls when they stop being ticked - if (paperConfig.disableEnderpearlExploit && entity instanceof net.minecraft.world.entity.projectile.ThrownEnderpearl pearl) { + if (paperConfig().fixes.disableUnloadedChunkEnderpearlExploit && entity instanceof net.minecraft.world.entity.projectile.ThrownEnderpearl pearl) { pearl.cachedOwner = null; diff --git a/src/main/java/net/minecraft/world/entity/ai/navigation/PathNavigation.java b/src/main/java/net/minecraft/world/entity/ai/navigation/PathNavigation.java index af53372391d05dd6aa3757556418e8723b8b6d80..3f672d7c2377fca16a6d8d31cf7aaae4f009fdce 100644 @@ -226,7 +226,7 @@ index af53372391d05dd6aa3757556418e8723b8b6d80..3f672d7c2377fca16a6d8d31cf7aaae4 + // Paper end } diff --git a/src/main/java/net/minecraft/world/level/entity/PersistentEntitySectionManager.java b/src/main/java/net/minecraft/world/level/entity/PersistentEntitySectionManager.java -index 3019646ae30ce7f89e1e1f3eb39eaa69e58a0f50..90dff6b5786933577cf070fe723872041e050738 100644 +index 8ad1c6f8147cfbd4677252a0d76f147786babe59..af37b1fcf8459af41482713a9e977599ae6da556 100644 --- a/src/main/java/net/minecraft/world/level/entity/PersistentEntitySectionManager.java +++ b/src/main/java/net/minecraft/world/level/entity/PersistentEntitySectionManager.java @@ -71,6 +71,65 @@ public class PersistentEntitySectionManager implements A diff --git a/patches/server/0760-Remove-streams-for-villager-AI.patch b/patches/server/0759-Remove-streams-for-villager-AI.patch similarity index 100% rename from patches/server/0760-Remove-streams-for-villager-AI.patch rename to patches/server/0759-Remove-streams-for-villager-AI.patch diff --git a/patches/server/0761-Rewrite-dataconverter-system.patch b/patches/server/0760-Rewrite-dataconverter-system.patch similarity index 99% rename from patches/server/0761-Rewrite-dataconverter-system.patch rename to patches/server/0760-Rewrite-dataconverter-system.patch index 8b71236380..8f349f74d1 100644 --- a/patches/server/0761-Rewrite-dataconverter-system.patch +++ b/patches/server/0760-Rewrite-dataconverter-system.patch @@ -22869,7 +22869,7 @@ index fee9a8e74bfcc94942991b56799debf67b551f43..b230a3d475357d2ffd340f9a89934ea7 nbttagcompound.putInt("DataVersion", SharedConstants.getCurrentVersion().getWorldVersion()); } diff --git a/src/main/java/net/minecraft/world/level/chunk/storage/EntityStorage.java b/src/main/java/net/minecraft/world/level/chunk/storage/EntityStorage.java -index 6408eeb7434f07c30b5e9207ab5f905a593fec79..84152df1dadd7fe6927eaed96dc0998ab15f608d 100644 +index de7afc737b1ab099edc29a4ef94baa76329c2947..2bc0384728f89b7c64a8beec78a1b77dc063d37b 100644 --- a/src/main/java/net/minecraft/world/level/chunk/storage/EntityStorage.java +++ b/src/main/java/net/minecraft/world/level/chunk/storage/EntityStorage.java @@ -128,7 +128,7 @@ public class EntityStorage implements EntityPersistentStorage { @@ -22882,7 +22882,7 @@ index 6408eeb7434f07c30b5e9207ab5f905a593fec79..84152df1dadd7fe6927eaed96dc0998a public static int getVersion(CompoundTag chunkNbt) { diff --git a/src/main/java/net/minecraft/world/level/chunk/storage/SectionStorage.java b/src/main/java/net/minecraft/world/level/chunk/storage/SectionStorage.java -index 80a7a1340908ae783a029912487485f7596bec5b..72be000b43c0026bc3b9236171f00a73cc4078e9 100644 +index 678bd36581ead3a225e3a6e24b78e5db4e42657b..ff6b25fd21836a080d63f1051b6645ec3d262658 100644 --- a/src/main/java/net/minecraft/world/level/chunk/storage/SectionStorage.java +++ b/src/main/java/net/minecraft/world/level/chunk/storage/SectionStorage.java @@ -148,7 +148,14 @@ public class SectionStorage extends RegionFileStorage implements AutoCloseabl diff --git a/patches/server/0762-Use-Velocity-compression-and-cipher-natives.patch b/patches/server/0761-Use-Velocity-compression-and-cipher-natives.patch similarity index 95% rename from patches/server/0762-Use-Velocity-compression-and-cipher-natives.patch rename to patches/server/0761-Use-Velocity-compression-and-cipher-natives.patch index 94e1ccf61f..e1d6b83110 100644 --- a/patches/server/0762-Use-Velocity-compression-and-cipher-natives.patch +++ b/patches/server/0761-Use-Velocity-compression-and-cipher-natives.patch @@ -5,21 +5,21 @@ Subject: [PATCH] Use Velocity compression and cipher natives diff --git a/build.gradle.kts b/build.gradle.kts -index 8c597c2671746ecf89d53704fba4d85d61dc316c..a7c7d450f22f9642fadeac9cb601214cfa9a2b02 100644 +index fab25a3e505a9f978ef91b2d7316a7c2b41d08d3..1c350424d0903f0caa9ef688abf8a6c51f22fdbd 100644 --- a/build.gradle.kts +++ b/build.gradle.kts -@@ -36,6 +36,11 @@ dependencies { - runtimeOnly("org.apache.maven.resolver:maven-resolver-transport-http:1.7.3") - +@@ -29,6 +29,11 @@ dependencies { + implementation("org.spongepowered:configurate-yaml:4.1.2") // Paper - config files + implementation("commons-lang:commons-lang:2.6") implementation("net.fabricmc:mapping-io:0.3.0") // Paper - needed to read mappings for stacktrace deobfuscation + // Paper start - Use Velocity cipher + implementation("com.velocitypowered:velocity-native:1.1.0-SNAPSHOT") { + isTransitive = false + } + // Paper end - - testImplementation("io.github.classgraph:classgraph:4.8.47") // Paper - mob goal test - testImplementation("junit:junit:4.13.2") + runtimeOnly("org.xerial:sqlite-jdbc:3.36.0.3") + runtimeOnly("mysql:mysql-connector-java:8.0.29") + runtimeOnly("com.lmax:disruptor:3.4.4") // Paper diff --git a/src/main/java/net/minecraft/network/CipherDecoder.java b/src/main/java/net/minecraft/network/CipherDecoder.java index 778beb445eac5769b9e4e07b4d1294c50ae2602b..c712fb8193115e1ab71b5e40fb0ccb9413062b03 100644 --- a/src/main/java/net/minecraft/network/CipherDecoder.java @@ -268,10 +268,10 @@ index 792883afe53d2b7989c25a81c2f9a639d5e21d20..c04379ca8a4db0f4de46ad2b3b338431 return this.threshold; } diff --git a/src/main/java/net/minecraft/network/Connection.java b/src/main/java/net/minecraft/network/Connection.java -index 1e4b75ab79a1d63a82498907d72932d644552635..7030c38980dbebfd374c2369294555650cf7880b 100644 +index dffeba1eda35026ea23012ecd47053ca43c6f0d5..f76c52e4661ef740dc924b0704a9ce28982294f1 100644 --- a/src/main/java/net/minecraft/network/Connection.java +++ b/src/main/java/net/minecraft/network/Connection.java -@@ -642,11 +642,28 @@ public class Connection extends SimpleChannelInboundHandler> { +@@ -641,11 +641,28 @@ public class Connection extends SimpleChannelInboundHandler> { return networkmanager; } @@ -304,7 +304,7 @@ index 1e4b75ab79a1d63a82498907d72932d644552635..7030c38980dbebfd374c236929455565 public boolean isEncrypted() { return this.encrypted; -@@ -675,16 +692,17 @@ public class Connection extends SimpleChannelInboundHandler> { +@@ -674,16 +691,17 @@ public class Connection extends SimpleChannelInboundHandler> { public void setupCompression(int compressionThreshold, boolean rejectsBadPackets) { if (compressionThreshold >= 0) { @@ -341,10 +341,10 @@ index 9e7154c9df96d5a0577886d43a98a73626a8f189..af3e70920221b6bd127bb3aed7f1e0a7 protected void initChannel(Channel channel) { try { diff --git a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java -index ffbd711375c400c9faaa4c984463a24af2f4993f..b146fc81ebd4adb8c15b10ed05c92db202a2c89e 100644 +index 71614fb07ba771ec9a00772074b031b77210d425..0a54be0ae91d95505896da6363f256161acfb6f8 100644 --- a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java -@@ -339,12 +339,14 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener +@@ -338,12 +338,14 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener } SecretKey secretkey = packet.getSecretKey(privatekey); diff --git a/patches/server/0763-Reduce-worldgen-thread-worker-count-for-low-core-cou.patch b/patches/server/0762-Reduce-worldgen-thread-worker-count-for-low-core-cou.patch similarity index 100% rename from patches/server/0763-Reduce-worldgen-thread-worker-count-for-low-core-cou.patch rename to patches/server/0762-Reduce-worldgen-thread-worker-count-for-low-core-cou.patch diff --git a/patches/server/0764-Do-not-process-entity-loads-in-CraftChunk-getEntitie.patch b/patches/server/0763-Do-not-process-entity-loads-in-CraftChunk-getEntitie.patch similarity index 97% rename from patches/server/0764-Do-not-process-entity-loads-in-CraftChunk-getEntitie.patch rename to patches/server/0763-Do-not-process-entity-loads-in-CraftChunk-getEntitie.patch index cf30363447..d601eb8884 100644 --- a/patches/server/0764-Do-not-process-entity-loads-in-CraftChunk-getEntitie.patch +++ b/patches/server/0763-Do-not-process-entity-loads-in-CraftChunk-getEntitie.patch @@ -16,7 +16,7 @@ of a chance that we're about to eat a dirtload of chunk load callbacks, thus making this issue much more of an issue diff --git a/src/main/java/org/bukkit/craftbukkit/CraftChunk.java b/src/main/java/org/bukkit/craftbukkit/CraftChunk.java -index 4a9b20e0dae3d502738e71e0f6119bdb3e0e2f16..7fd9f20d60339270d5e4adbf098ac38a832fb224 100644 +index e86b3ee5c8225d9f789cf426cc1418fde0fa12f0..f0b41e4d08691f2f97b0a4396b5d6c8fd75b2c86 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftChunk.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftChunk.java @@ -130,46 +130,6 @@ public class CraftChunk implements Chunk { diff --git a/patches/server/0765-Async-catch-modifications-to-critical-entity-state.patch b/patches/server/0764-Async-catch-modifications-to-critical-entity-state.patch similarity index 98% rename from patches/server/0765-Async-catch-modifications-to-critical-entity-state.patch rename to patches/server/0764-Async-catch-modifications-to-critical-entity-state.patch index b1d608ada3..3b0091079e 100644 --- a/patches/server/0765-Async-catch-modifications-to-critical-entity-state.patch +++ b/patches/server/0764-Async-catch-modifications-to-critical-entity-state.patch @@ -8,7 +8,7 @@ Now in 1.17, this state is _even more_ critical than it was before, so these must exist to catch stupid plugins. diff --git a/src/main/java/net/minecraft/world/level/entity/PersistentEntitySectionManager.java b/src/main/java/net/minecraft/world/level/entity/PersistentEntitySectionManager.java -index 90dff6b5786933577cf070fe723872041e050738..9a3364241a6f96b16644bf598fa2afd7bcd7972b 100644 +index af37b1fcf8459af41482713a9e977599ae6da556..30c4974b4019d67cffabd3e686c782659def3ba6 100644 --- a/src/main/java/net/minecraft/world/level/entity/PersistentEntitySectionManager.java +++ b/src/main/java/net/minecraft/world/level/entity/PersistentEntitySectionManager.java @@ -138,6 +138,7 @@ public class PersistentEntitySectionManager implements A diff --git a/patches/server/0766-Fix-Bukkit-NamespacedKey-shenanigans.patch b/patches/server/0765-Fix-Bukkit-NamespacedKey-shenanigans.patch similarity index 100% rename from patches/server/0766-Fix-Bukkit-NamespacedKey-shenanigans.patch rename to patches/server/0765-Fix-Bukkit-NamespacedKey-shenanigans.patch diff --git a/patches/server/0767-Fix-merchant-inventory-not-closing-on-entity-removal.patch b/patches/server/0766-Fix-merchant-inventory-not-closing-on-entity-removal.patch similarity index 94% rename from patches/server/0767-Fix-merchant-inventory-not-closing-on-entity-removal.patch rename to patches/server/0766-Fix-merchant-inventory-not-closing-on-entity-removal.patch index b9b239ff61..702b407484 100644 --- a/patches/server/0767-Fix-merchant-inventory-not-closing-on-entity-removal.patch +++ b/patches/server/0766-Fix-merchant-inventory-not-closing-on-entity-removal.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Fix merchant inventory not closing on entity removal diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java -index d5585e1723eebce14c47c4a92ce339915cd936db..fb5c42755703ade855ab727c55c8d72456b59141 100644 +index 7e7edaebf146d8042e9b75f6088990069ca9021a..0179e519c01897e373f6f9ed4af17dcf4469b762 100644 --- a/src/main/java/net/minecraft/server/level/ServerLevel.java +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java @@ -2569,6 +2569,11 @@ public class ServerLevel extends Level implements WorldGenLevel { diff --git a/patches/server/0768-Check-requirement-before-suggesting-root-nodes.patch b/patches/server/0767-Check-requirement-before-suggesting-root-nodes.patch similarity index 100% rename from patches/server/0768-Check-requirement-before-suggesting-root-nodes.patch rename to patches/server/0767-Check-requirement-before-suggesting-root-nodes.patch diff --git a/patches/server/0769-Don-t-respond-to-ServerboundCommandSuggestionPacket-.patch b/patches/server/0768-Don-t-respond-to-ServerboundCommandSuggestionPacket-.patch similarity index 91% rename from patches/server/0769-Don-t-respond-to-ServerboundCommandSuggestionPacket-.patch rename to patches/server/0768-Don-t-respond-to-ServerboundCommandSuggestionPacket-.patch index cd37a8fd84..5aae7f6031 100644 --- a/patches/server/0769-Don-t-respond-to-ServerboundCommandSuggestionPacket-.patch +++ b/patches/server/0768-Don-t-respond-to-ServerboundCommandSuggestionPacket-.patch @@ -6,7 +6,7 @@ Subject: [PATCH] Don't respond to ServerboundCommandSuggestionPacket when diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index 8ceae524899d6aa739f358b8c88968fb4df56481..9c7d1ce759e119b21e942add5e42ad203226d72b 100644 +index f77926fa842d681be3c6a0bcfa3d4fbaf42dc85a..522d6e59038db276238720d828e8949bbeba88d2 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java @@ -801,6 +801,11 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser diff --git a/patches/server/0770-Fix-setPatternColor-on-tropical-fish-bucket-meta.patch b/patches/server/0769-Fix-setPatternColor-on-tropical-fish-bucket-meta.patch similarity index 100% rename from patches/server/0770-Fix-setPatternColor-on-tropical-fish-bucket-meta.patch rename to patches/server/0769-Fix-setPatternColor-on-tropical-fish-bucket-meta.patch diff --git a/patches/server/0771-Ensure-valid-vehicle-status.patch b/patches/server/0770-Ensure-valid-vehicle-status.patch similarity index 90% rename from patches/server/0771-Ensure-valid-vehicle-status.patch rename to patches/server/0770-Ensure-valid-vehicle-status.patch index e6645e4390..372e7884c1 100644 --- a/patches/server/0771-Ensure-valid-vehicle-status.patch +++ b/patches/server/0770-Ensure-valid-vehicle-status.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Ensure valid vehicle status diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java -index 866e4aa0080363976861fcbfe6aedc380bbc5e53..0a4934cabf5d04b0561d33f5e777f38b2e721608 100644 +index b98574dd173630e976177080613899400bef3552..c0f876bb11f8620390e6c38d9090eac73a28ad09 100644 --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java @@ -511,7 +511,7 @@ public class ServerPlayer extends Player { diff --git a/patches/server/0772-Prevent-softlocked-end-exit-portal-generation.patch b/patches/server/0771-Prevent-softlocked-end-exit-portal-generation.patch similarity index 91% rename from patches/server/0772-Prevent-softlocked-end-exit-portal-generation.patch rename to patches/server/0771-Prevent-softlocked-end-exit-portal-generation.patch index 6f764a27ec..2286afa5f2 100644 --- a/patches/server/0772-Prevent-softlocked-end-exit-portal-generation.patch +++ b/patches/server/0771-Prevent-softlocked-end-exit-portal-generation.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Prevent softlocked end exit portal generation diff --git a/src/main/java/net/minecraft/world/level/dimension/end/EndDragonFight.java b/src/main/java/net/minecraft/world/level/dimension/end/EndDragonFight.java -index ad5b20fb16b19bb2099c2fd840e8f5c20f345577..d0c864277886d67362d5389e71095020f69abfc3 100644 +index 99b175625c79fe5c4d944810e3fe11be5eed997f..f8d846345c1cc3c78f9ac14635b26f2affc77190 100644 --- a/src/main/java/net/minecraft/world/level/dimension/end/EndDragonFight.java +++ b/src/main/java/net/minecraft/world/level/dimension/end/EndDragonFight.java @@ -413,6 +413,11 @@ public class EndDragonFight { diff --git a/patches/server/0773-Fix-CocaoDecorator-causing-a-crash-when-trying-to-ge.patch b/patches/server/0772-Fix-CocaoDecorator-causing-a-crash-when-trying-to-ge.patch similarity index 100% rename from patches/server/0773-Fix-CocaoDecorator-causing-a-crash-when-trying-to-ge.patch rename to patches/server/0772-Fix-CocaoDecorator-causing-a-crash-when-trying-to-ge.patch diff --git a/patches/server/0774-Don-t-log-debug-logging-being-disabled.patch b/patches/server/0773-Don-t-log-debug-logging-being-disabled.patch similarity index 88% rename from patches/server/0774-Don-t-log-debug-logging-being-disabled.patch rename to patches/server/0773-Don-t-log-debug-logging-being-disabled.patch index 5bec880eb8..2748ca04c9 100644 --- a/patches/server/0774-Don-t-log-debug-logging-being-disabled.patch +++ b/patches/server/0773-Don-t-log-debug-logging-being-disabled.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Don't log debug logging being disabled diff --git a/src/main/java/org/spigotmc/SpigotConfig.java b/src/main/java/org/spigotmc/SpigotConfig.java -index 6f7b34f03e0d151e4da652b9ad73e0d7930fe5d3..d509187ca63963fdd7f1a44d89d2aa1a1b1ce3bd 100644 +index 0a53abd88f392fbb33485077aa24df825819d1f2..cd1228e1fbd2434b42df0fd6887d00b9bdb21516 100644 --- a/src/main/java/org/spigotmc/SpigotConfig.java +++ b/src/main/java/org/spigotmc/SpigotConfig.java @@ -382,7 +382,7 @@ public class SpigotConfig diff --git a/patches/server/0775-fix-various-menus-with-empty-level-accesses.patch b/patches/server/0774-fix-various-menus-with-empty-level-accesses.patch similarity index 100% rename from patches/server/0775-fix-various-menus-with-empty-level-accesses.patch rename to patches/server/0774-fix-various-menus-with-empty-level-accesses.patch diff --git a/patches/server/0776-Do-not-overload-I-O-threads-with-chunk-data-while-fl.patch b/patches/server/0775-Do-not-overload-I-O-threads-with-chunk-data-while-fl.patch similarity index 90% rename from patches/server/0776-Do-not-overload-I-O-threads-with-chunk-data-while-fl.patch rename to patches/server/0775-Do-not-overload-I-O-threads-with-chunk-data-while-fl.patch index 2ef119c552..b07c7d13d9 100644 --- a/patches/server/0776-Do-not-overload-I-O-threads-with-chunk-data-while-fl.patch +++ b/patches/server/0775-Do-not-overload-I-O-threads-with-chunk-data-while-fl.patch @@ -12,10 +12,10 @@ time to save, as flush saving performs a full flush at the end anyways. diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java -index 3dd3ed91e702858f07c811afdcfa6c111f9e3d61..85c0d3f07b4ede0864f6ab54ad9392b4708330cb 100644 +index 8939d15bd413a2b743303d137fc797be6d97b9e8..a0318ed330d3dc5d98169d076d9eb94b485bba52 100644 --- a/src/main/java/net/minecraft/server/level/ChunkMap.java +++ b/src/main/java/net/minecraft/server/level/ChunkMap.java -@@ -944,6 +944,16 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider +@@ -943,6 +943,16 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider // Paper end protected void saveAllChunks(boolean flush) { @@ -32,7 +32,7 @@ index 3dd3ed91e702858f07c811afdcfa6c111f9e3d61..85c0d3f07b4ede0864f6ab54ad9392b4 if (flush) { List list = (List) this.updatingChunks.getVisibleValuesCopy().stream().filter(ChunkHolder::wasAccessibleSinceLastSave).peek(ChunkHolder::refreshAccessibility).collect(Collectors.toList()); // Paper MutableBoolean mutableboolean = new MutableBoolean(); -@@ -966,6 +976,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider +@@ -965,6 +975,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider }).filter((ichunkaccess) -> { return ichunkaccess instanceof ImposterProtoChunk || ichunkaccess instanceof LevelChunk; }).filter(this::save).forEach((ichunkaccess) -> { diff --git a/patches/server/0777-Preserve-overstacked-loot.patch b/patches/server/0776-Preserve-overstacked-loot.patch similarity index 75% rename from patches/server/0777-Preserve-overstacked-loot.patch rename to patches/server/0776-Preserve-overstacked-loot.patch index 6e9c5374e9..e39eb87bbc 100644 --- a/patches/server/0777-Preserve-overstacked-loot.patch +++ b/patches/server/0776-Preserve-overstacked-loot.patch @@ -9,24 +9,8 @@ chunk bans via the large amount of NBT created by unstacking the items. Fixes GH-5140 and GH-4748. -diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -index f3a28661841a194cc3a952cc54e036ff6845080b..5c43fe70f8c87b0a83f10f9608ddca556e99e634 100644 ---- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -@@ -970,6 +970,11 @@ public class PaperWorldConfig { - allowPlayerCrammingDamage = getBoolean("allow-player-cramming-damage", allowPlayerCrammingDamage); - } - -+ public boolean splitOverstackedLoot = true; -+ private void splitOverstackedLoot() { -+ splitOverstackedLoot = getBoolean("split-overstacked-loot", splitOverstackedLoot); -+ } -+ - private com.google.common.collect.Table sensorTickRates; - private com.google.common.collect.Table behaviorTickRates; - private void tickRates() { diff --git a/src/main/java/net/minecraft/world/level/storage/loot/LootTable.java b/src/main/java/net/minecraft/world/level/storage/loot/LootTable.java -index 9459b912615c692de7d0ceb6cf5a1cd3516d438b..c115bb501e971c6479455dd68e85ebdd180b024a 100644 +index 9459b912615c692de7d0ceb6cf5a1cd3516d438b..375d26ac2453f637bac3fa89873b6760095916b7 100644 --- a/src/main/java/net/minecraft/world/level/storage/loot/LootTable.java +++ b/src/main/java/net/minecraft/world/level/storage/loot/LootTable.java @@ -56,9 +56,17 @@ public class LootTable { @@ -40,7 +24,7 @@ index 9459b912615c692de7d0ceb6cf5a1cd3516d438b..c115bb501e971c6479455dd68e85ebdd + } + + public static Consumer createStackSplitter(Consumer lootConsumer, @org.jetbrains.annotations.Nullable net.minecraft.server.level.ServerLevel world) { -+ boolean skipSplitter = world != null && !world.paperConfig.splitOverstackedLoot; ++ boolean skipSplitter = world != null && !world.paperConfig().fixes.splitOverstackedLoot; + // Paper end return (itemstack) -> { - if (itemstack.getCount() < itemstack.getMaxStackSize()) { diff --git a/patches/server/0778-Update-head-rotation-in-missing-places.patch b/patches/server/0777-Update-head-rotation-in-missing-places.patch similarity index 93% rename from patches/server/0778-Update-head-rotation-in-missing-places.patch rename to patches/server/0777-Update-head-rotation-in-missing-places.patch index 6d6675c119..85d614b930 100644 --- a/patches/server/0778-Update-head-rotation-in-missing-places.patch +++ b/patches/server/0777-Update-head-rotation-in-missing-places.patch @@ -8,7 +8,7 @@ This is because bukkit uses a separate head rotation field for yaw. This issue only applies to players. diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java -index e7af0e4fc239a247019271c2901f804b558addf7..67eec506b4decd90d9d1558465ea14982328c93c 100644 +index 85b55badc57ce6c062b87d87cc730d20bb9e27c0..e107df89c2c645e93bf6c7fced3cf84c51490ef2 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java @@ -1748,6 +1748,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource { diff --git a/patches/server/0779-prevent-unintended-light-block-manipulation.patch b/patches/server/0778-prevent-unintended-light-block-manipulation.patch similarity index 100% rename from patches/server/0779-prevent-unintended-light-block-manipulation.patch rename to patches/server/0778-prevent-unintended-light-block-manipulation.patch diff --git a/patches/server/0780-Fix-CraftCriteria-defaults-map.patch b/patches/server/0779-Fix-CraftCriteria-defaults-map.patch similarity index 100% rename from patches/server/0780-Fix-CraftCriteria-defaults-map.patch rename to patches/server/0779-Fix-CraftCriteria-defaults-map.patch diff --git a/patches/server/0781-Fix-upstreams-block-state-factories.patch b/patches/server/0780-Fix-upstreams-block-state-factories.patch similarity index 100% rename from patches/server/0781-Fix-upstreams-block-state-factories.patch rename to patches/server/0780-Fix-upstreams-block-state-factories.patch diff --git a/patches/server/0782-Add-config-option-for-logging-player-ip-addresses.patch b/patches/server/0781-Add-config-option-for-logging-player-ip-addresses.patch similarity index 69% rename from patches/server/0782-Add-config-option-for-logging-player-ip-addresses.patch rename to patches/server/0781-Add-config-option-for-logging-player-ip-addresses.patch index 8c262f6c18..9491892c73 100644 --- a/patches/server/0782-Add-config-option-for-logging-player-ip-addresses.patch +++ b/patches/server/0781-Add-config-option-for-logging-player-ip-addresses.patch @@ -4,31 +4,15 @@ Date: Tue, 5 Oct 2021 20:04:21 +0200 Subject: [PATCH] Add config option for logging player ip addresses -diff --git a/src/main/java/com/destroystokyo/paper/PaperConfig.java b/src/main/java/com/destroystokyo/paper/PaperConfig.java -index 4b828da7f8dbadb8af66ffc04d631273cfccdf36..a98cd0aecc034038d81194fd87c4f8df65b86095 100644 ---- a/src/main/java/com/destroystokyo/paper/PaperConfig.java -+++ b/src/main/java/com/destroystokyo/paper/PaperConfig.java -@@ -91,6 +91,11 @@ public class PaperConfig { - } - } - -+ public static boolean logPlayerIpAddresses = true; -+ private static void playerIpAddresses() { -+ logPlayerIpAddresses = getBoolean("settings.log-player-ip-addresses", logPlayerIpAddresses); -+ } -+ - public static int maxJoinsPerTick; - private static void maxJoinsPerTick() { - maxJoinsPerTick = getInt("settings.max-joins-per-tick", 3); diff --git a/src/main/java/net/minecraft/network/protocol/PacketUtils.java b/src/main/java/net/minecraft/network/protocol/PacketUtils.java -index c8012de68b997d6270ba4a5d79bc93c09ff4354f..2c593125f74c4ffe2b8bf542311cd5525f600f4b 100644 +index c8012de68b997d6270ba4a5d79bc93c09ff4354f..1429f938c36d5a3a33e71837f440b2303d60cfe7 100644 --- a/src/main/java/net/minecraft/network/protocol/PacketUtils.java +++ b/src/main/java/net/minecraft/network/protocol/PacketUtils.java @@ -51,10 +51,11 @@ public class PacketUtils { packet.handle(listener); } catch (Exception exception) { net.minecraft.network.Connection networkmanager = listener.getConnection(); -+ String playerIP = com.destroystokyo.paper.PaperConfig.logPlayerIpAddresses ? String.valueOf(networkmanager.getRemoteAddress()) : ""; // Paper ++ String playerIP = io.papermc.paper.configuration.GlobalConfiguration.get().logging.logPlayerIpAddresses ? String.valueOf(networkmanager.getRemoteAddress()) : ""; // Paper if (networkmanager.getPlayer() != null) { - LOGGER.error("Error whilst processing packet {} for {}[{}]", packet, networkmanager.getPlayer().getScoreboardName(), networkmanager.getRemoteAddress(), exception); + LOGGER.error("Error whilst processing packet {} for {}[{}]", packet, networkmanager.getPlayer().getScoreboardName(), playerIP, exception); // Paper @@ -39,7 +23,7 @@ index c8012de68b997d6270ba4a5d79bc93c09ff4354f..2c593125f74c4ffe2b8bf542311cd552 net.minecraft.network.chat.Component error = net.minecraft.network.chat.Component.literal("Packet processing error"); networkmanager.send(new net.minecraft.network.protocol.game.ClientboundDisconnectPacket(error), (future) -> { diff --git a/src/main/java/net/minecraft/server/network/LegacyQueryHandler.java b/src/main/java/net/minecraft/server/network/LegacyQueryHandler.java -index 53e87ea23dacd123cc47bd8ca43d0f19e69acaf2..a03cb44f2296b7df60fa39879e54a5c56b22a3d5 100644 +index 53e87ea23dacd123cc47bd8ca43d0f19e69acaf2..7f0f50e9ce17747a235b0f5450ca2e8ba5c632ef 100644 --- a/src/main/java/net/minecraft/server/network/LegacyQueryHandler.java +++ b/src/main/java/net/minecraft/server/network/LegacyQueryHandler.java @@ -183,7 +183,7 @@ public class LegacyQueryHandler extends ChannelInboundHandlerAdapter { @@ -47,12 +31,12 @@ index 53e87ea23dacd123cc47bd8ca43d0f19e69acaf2..a03cb44f2296b7df60fa39879e54a5c5 this.buf = null; - LOGGER.debug("Ping: (1.6) from {}", ctx.channel().remoteAddress()); -+ LOGGER.debug("Ping: (1.6) from {}", com.destroystokyo.paper.PaperConfig.logPlayerIpAddresses ? ctx.channel().remoteAddress() : ""); // Paper ++ LOGGER.debug("Ping: (1.6) from {}", io.papermc.paper.configuration.GlobalConfiguration.get().logging.logPlayerIpAddresses ? ctx.channel().remoteAddress() : ""); // Paper InetSocketAddress virtualHost = com.destroystokyo.paper.network.PaperNetworkClient.prepareVirtualHost(host, port); com.destroystokyo.paper.event.server.PaperServerListPingEvent event = com.destroystokyo.paper.network.PaperLegacyStatusClient.processRequest( diff --git a/src/main/java/net/minecraft/server/network/ServerConnectionListener.java b/src/main/java/net/minecraft/server/network/ServerConnectionListener.java -index af3e70920221b6bd127bb3aed7f1e0a7e9e4c322..510a1fc4e315483809035b1e5c28b441f18a7c14 100644 +index af3e70920221b6bd127bb3aed7f1e0a7e9e4c322..597c7660bd517322d8bc9c5acef6956c40067405 100644 --- a/src/main/java/net/minecraft/server/network/ServerConnectionListener.java +++ b/src/main/java/net/minecraft/server/network/ServerConnectionListener.java @@ -205,7 +205,7 @@ public class ServerConnectionListener { @@ -60,28 +44,28 @@ index af3e70920221b6bd127bb3aed7f1e0a7e9e4c322..510a1fc4e315483809035b1e5c28b441 } - ServerConnectionListener.LOGGER.warn("Failed to handle packet for {}", networkmanager.getRemoteAddress(), exception); -+ ServerConnectionListener.LOGGER.warn("Failed to handle packet for {}", com.destroystokyo.paper.PaperConfig.logPlayerIpAddresses ? String.valueOf(networkmanager.getRemoteAddress()) : "", exception); // Paper ++ ServerConnectionListener.LOGGER.warn("Failed to handle packet for {}", io.papermc.paper.configuration.GlobalConfiguration.get().logging.logPlayerIpAddresses ? String.valueOf(networkmanager.getRemoteAddress()) : "", exception); // Paper MutableComponent ichatmutablecomponent = Component.literal("Internal server error"); networkmanager.send(new ClientboundDisconnectPacket(ichatmutablecomponent), (future) -> { diff --git a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java -index b146fc81ebd4adb8c15b10ed05c92db202a2c89e..38521660c6fa7c1a19c5268dac05928b5ec983f4 100644 +index 0a54be0ae91d95505896da6363f256161acfb6f8..dcabb783bed9160f7d602d551cf7e8d004abbca1 100644 --- a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java -@@ -230,7 +230,10 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener +@@ -229,7 +229,10 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener } public String getUserName() { - return this.gameProfile != null ? this.gameProfile + " (" + this.connection.getRemoteAddress() + ")" : String.valueOf(this.connection.getRemoteAddress()); + // Paper start -+ String ip = com.destroystokyo.paper.PaperConfig.logPlayerIpAddresses ? String.valueOf(this.connection.getRemoteAddress()) : ""; ++ String ip = io.papermc.paper.configuration.GlobalConfiguration.get().logging.logPlayerIpAddresses ? String.valueOf(this.connection.getRemoteAddress()) : ""; + return this.gameProfile != null ? this.gameProfile + " (" + ip + ")" : String.valueOf(ip); + // Paper end } @Nullable diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java -index ed0e162c39f1f1ed9b02cdb2fc353a3fcbe79182..082a16f49c07faadce68fc118b2fff859da422d0 100644 +index bf2888b678567ace5959d989e5dd119c65a9500d..d74d6669005d0669503253787636756a0c6590f4 100644 --- a/src/main/java/net/minecraft/server/players/PlayerList.java +++ b/src/main/java/net/minecraft/server/players/PlayerList.java @@ -240,7 +240,7 @@ public abstract class PlayerList { @@ -89,7 +73,7 @@ index ed0e162c39f1f1ed9b02cdb2fc353a3fcbe79182..082a16f49c07faadce68fc118b2fff85 if (connection.getRemoteAddress() != null) { - s1 = connection.getRemoteAddress().toString(); -+ s1 = com.destroystokyo.paper.PaperConfig.logPlayerIpAddresses ? connection.getRemoteAddress().toString() : ""; // Paper ++ s1 = io.papermc.paper.configuration.GlobalConfiguration.get().logging.logPlayerIpAddresses ? connection.getRemoteAddress().toString() : ""; // Paper } else { s1 = "local"; } diff --git a/patches/server/0782-Configurable-feature-seeds.patch b/patches/server/0782-Configurable-feature-seeds.patch new file mode 100644 index 0000000000..f766be82c6 --- /dev/null +++ b/patches/server/0782-Configurable-feature-seeds.patch @@ -0,0 +1,50 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Nassim Jahnke +Date: Tue, 31 Aug 2021 17:05:27 +0200 +Subject: [PATCH] Configurable feature seeds + +Co-authored-by: Thonk <30448663+ExcessiveAmountsOfZombies@users.noreply.github.com> + +diff --git a/src/main/java/co/aikar/timings/TimingsExport.java b/src/main/java/co/aikar/timings/TimingsExport.java +index 46297ac0a19fd2398ab777a381eff4d0a256161e..78280fb3bcd8d792a58ece6d735e0824ea4be536 100644 +--- a/src/main/java/co/aikar/timings/TimingsExport.java ++++ b/src/main/java/co/aikar/timings/TimingsExport.java +@@ -283,7 +283,7 @@ public class TimingsExport extends Thread { + JSONObject object = new JSONObject(); + for (String key : config.getKeys(false)) { + String fullKey = (parentKey != null ? parentKey + "." + key : key); +- if (fullKey.equals("database") || fullKey.equals("settings.bungeecord-addresses") || TimingsManager.hiddenConfigs.contains(fullKey) || key.startsWith("seed-") || key.equals("worldeditregentempworld")) { ++ if (fullKey.equals("database") || fullKey.equals("settings.bungeecord-addresses") || TimingsManager.hiddenConfigs.contains(fullKey) || key.startsWith("seed-") || key.equals("worldeditregentempworld") || key.equals("feature-seeds")) { + continue; + } + final Object val = config.get(key); +diff --git a/src/main/java/net/minecraft/world/level/chunk/ChunkGenerator.java b/src/main/java/net/minecraft/world/level/chunk/ChunkGenerator.java +index a4e2ee3efde40c902555f982ffa546c24bc31377..ec7343c7acb438781026b25390528889209fe97a 100644 +--- a/src/main/java/net/minecraft/world/level/chunk/ChunkGenerator.java ++++ b/src/main/java/net/minecraft/world/level/chunk/ChunkGenerator.java +@@ -530,7 +530,7 @@ public abstract class ChunkGenerator { + int j = list.size(); + + try { +- Registry iregistry1 = generatoraccessseed.registryAccess().registryOrThrow(Registry.PLACED_FEATURE_REGISTRY); ++ Registry iregistry1 = generatoraccessseed.registryAccess().registryOrThrow(Registry.PLACED_FEATURE_REGISTRY); // Paper - diff on change + int k = Math.max(GenerationStep.Decoration.values().length, j); + + for (int l = 0; l < k; ++l) { +@@ -603,7 +603,15 @@ public abstract class ChunkGenerator { + return (String) optional.orElseGet(placedfeature::toString); + }; + +- seededrandom.setFeatureSeed(i, l1, l); ++ // Paper start - change populationSeed used in random ++ long featurePopulationSeed = i; ++ final net.minecraft.resources.ResourceLocation location = iregistry1.getKey(placedfeature); ++ final long configFeatureSeed = generatoraccessseed.getMinecraftWorld().paperConfig().featureSeeds.features.getLong(location); // TODO this wont work ++ if (configFeatureSeed != -1) { ++ featurePopulationSeed = seededrandom.setDecorationSeed(configFeatureSeed, blockposition.getX(), blockposition.getZ()); // See seededrandom.setDecorationSeed from above ++ } ++ seededrandom.setFeatureSeed(featurePopulationSeed, l1, l); ++ // Paper end + + try { + generatoraccessseed.setCurrentlyGenerating(supplier1); diff --git a/patches/server/0783-Configurable-feature-seeds.patch b/patches/server/0783-Configurable-feature-seeds.patch deleted file mode 100644 index d27aeebcce..0000000000 --- a/patches/server/0783-Configurable-feature-seeds.patch +++ /dev/null @@ -1,110 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Nassim Jahnke -Date: Tue, 31 Aug 2021 17:05:27 +0200 -Subject: [PATCH] Configurable feature seeds - -Co-authored-by: Thonk <30448663+ExcessiveAmountsOfZombies@users.noreply.github.com> - -diff --git a/src/main/java/co/aikar/timings/TimingsExport.java b/src/main/java/co/aikar/timings/TimingsExport.java -index 46297ac0a19fd2398ab777a381eff4d0a256161e..78280fb3bcd8d792a58ece6d735e0824ea4be536 100644 ---- a/src/main/java/co/aikar/timings/TimingsExport.java -+++ b/src/main/java/co/aikar/timings/TimingsExport.java -@@ -283,7 +283,7 @@ public class TimingsExport extends Thread { - JSONObject object = new JSONObject(); - for (String key : config.getKeys(false)) { - String fullKey = (parentKey != null ? parentKey + "." + key : key); -- if (fullKey.equals("database") || fullKey.equals("settings.bungeecord-addresses") || TimingsManager.hiddenConfigs.contains(fullKey) || key.startsWith("seed-") || key.equals("worldeditregentempworld")) { -+ if (fullKey.equals("database") || fullKey.equals("settings.bungeecord-addresses") || TimingsManager.hiddenConfigs.contains(fullKey) || key.startsWith("seed-") || key.equals("worldeditregentempworld") || key.equals("feature-seeds")) { - continue; - } - final Object val = config.get(key); -diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -index 5c43fe70f8c87b0a83f10f9608ddca556e99e634..28b4188cd15d297e4b89ab98f78cecd7a5a95c52 100644 ---- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -@@ -1015,6 +1015,55 @@ public class PaperWorldConfig { - return table; - } - -+ public it.unimi.dsi.fastutil.objects.Object2LongOpenHashMap featureSeeds = new it.unimi.dsi.fastutil.objects.Object2LongOpenHashMap<>(); -+ private void featureSeeds() { -+ featureSeeds.defaultReturnValue(-1); -+ final boolean randomise = getBoolean("feature-seeds.generate-random-seeds-for-all", false); -+ final ConfigurationSection defaultSection = config.getConfigurationSection("world-settings.default.feature-seeds"); -+ final ConfigurationSection section = config.getConfigurationSection("world-settings." + worldName + ".feature-seeds"); -+ final net.minecraft.core.Registry> registry -+ = net.minecraft.server.MinecraftServer.getServer().registryAccess().registryOrThrow(net.minecraft.core.Registry.CONFIGURED_FEATURE_REGISTRY); -+ if (section != null) { -+ loadFeatureSeeds(section, registry); -+ } -+ -+ // Also use default set seeds if not already set per world -+ loadFeatureSeeds(defaultSection, registry); -+ -+ if (randomise) { -+ final Map randomisedSeeds = new HashMap<>(); -+ final java.util.Random random = new java.security.SecureRandom(); -+ for (final net.minecraft.resources.ResourceLocation resourceLocation : registry.keySet()) { -+ if (featureSeeds.containsKey(resourceLocation)) { -+ continue; -+ } -+ -+ final long seed = random.nextLong(); -+ randomisedSeeds.put("world-settings." + worldName + ".feature-seeds." + resourceLocation.getPath(), seed); -+ featureSeeds.put(resourceLocation, seed); -+ } -+ if (!randomisedSeeds.isEmpty()) { -+ config.addDefaults(randomisedSeeds); -+ } -+ } -+ } -+ -+ private void loadFeatureSeeds(final ConfigurationSection section, final net.minecraft.core.Registry> registry) { -+ for (final String key : section.getKeys(false)) { -+ if (!(section.get(key) instanceof Number)) { -+ continue; -+ } -+ -+ final net.minecraft.resources.ResourceLocation location = new net.minecraft.resources.ResourceLocation(key); -+ if (!registry.containsKey(location)) { -+ logError("Invalid feature resource location: " + location); -+ continue; -+ } -+ -+ featureSeeds.putIfAbsent(location, section.getLong(key)); -+ } -+ } -+ - public int getBehaviorTickRate(String typeName, String entityType, int def) { - return getIntOrDefault(behaviorTickRates, typeName, entityType, def); - } -diff --git a/src/main/java/net/minecraft/world/level/chunk/ChunkGenerator.java b/src/main/java/net/minecraft/world/level/chunk/ChunkGenerator.java -index a4e2ee3efde40c902555f982ffa546c24bc31377..094846cebffd209535e436ab0269cfed11deb277 100644 ---- a/src/main/java/net/minecraft/world/level/chunk/ChunkGenerator.java -+++ b/src/main/java/net/minecraft/world/level/chunk/ChunkGenerator.java -@@ -530,7 +530,7 @@ public abstract class ChunkGenerator { - int j = list.size(); - - try { -- Registry iregistry1 = generatoraccessseed.registryAccess().registryOrThrow(Registry.PLACED_FEATURE_REGISTRY); -+ Registry iregistry1 = generatoraccessseed.registryAccess().registryOrThrow(Registry.PLACED_FEATURE_REGISTRY); // Paper - diff on change - int k = Math.max(GenerationStep.Decoration.values().length, j); - - for (int l = 0; l < k; ++l) { -@@ -603,7 +603,15 @@ public abstract class ChunkGenerator { - return (String) optional.orElseGet(placedfeature::toString); - }; - -- seededrandom.setFeatureSeed(i, l1, l); -+ // Paper start - change populationSeed used in random -+ long featurePopulationSeed = i; -+ final net.minecraft.resources.ResourceLocation location = iregistry1.getKey(placedfeature); -+ final long configFeatureSeed = generatoraccessseed.getMinecraftWorld().paperConfig.featureSeeds.getLong(location); -+ if (configFeatureSeed != -1) { -+ featurePopulationSeed = seededrandom.setDecorationSeed(configFeatureSeed, blockposition.getX(), blockposition.getZ()); // See seededrandom.setDecorationSeed from above -+ } -+ seededrandom.setFeatureSeed(featurePopulationSeed, l1, l); -+ // Paper end - - try { - generatoraccessseed.setCurrentlyGenerating(supplier1); diff --git a/patches/server/0784-VanillaCommandWrapper-didnt-account-for-entity-sende.patch b/patches/server/0783-VanillaCommandWrapper-didnt-account-for-entity-sende.patch similarity index 100% rename from patches/server/0784-VanillaCommandWrapper-didnt-account-for-entity-sende.patch rename to patches/server/0783-VanillaCommandWrapper-didnt-account-for-entity-sende.patch diff --git a/patches/server/0785-Add-root-admin-user-detection.patch b/patches/server/0784-Add-root-admin-user-detection.patch similarity index 97% rename from patches/server/0785-Add-root-admin-user-detection.patch rename to patches/server/0784-Add-root-admin-user-detection.patch index 8627b3890f..9708f83e8b 100644 --- a/patches/server/0785-Add-root-admin-user-detection.patch +++ b/patches/server/0784-Add-root-admin-user-detection.patch @@ -57,7 +57,7 @@ index 0000000000000000000000000000000000000000..6bd0afddbcc461149dfe9a5c7a86fff6 + } +} diff --git a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java -index 5cc3a55b90135f0aa97c5faaf6c1b6f4d6fe9a0e..1236c3ce776ad6bea9a3a5156e89b0e9c0b9afb5 100644 +index 3fc342502ca24165ea5dcf0cc6e9867d0378d69f..c96bc85b8de905c1f8112a26dca644775c619a64 100644 --- a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java +++ b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java @@ -184,6 +184,16 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface diff --git a/patches/server/0786-Always-allow-item-changing-in-Fireball.patch b/patches/server/0785-Always-allow-item-changing-in-Fireball.patch similarity index 100% rename from patches/server/0786-Always-allow-item-changing-in-Fireball.patch rename to patches/server/0785-Always-allow-item-changing-in-Fireball.patch diff --git a/patches/server/0787-don-t-attempt-to-teleport-dead-entities.patch b/patches/server/0786-don-t-attempt-to-teleport-dead-entities.patch similarity index 91% rename from patches/server/0787-don-t-attempt-to-teleport-dead-entities.patch rename to patches/server/0786-don-t-attempt-to-teleport-dead-entities.patch index 20df6e0033..9a0a0b284c 100644 --- a/patches/server/0787-don-t-attempt-to-teleport-dead-entities.patch +++ b/patches/server/0786-don-t-attempt-to-teleport-dead-entities.patch @@ -5,7 +5,7 @@ Subject: [PATCH] don't attempt to teleport dead entities diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java -index 67eec506b4decd90d9d1558465ea14982328c93c..8013e54f44922f04404c38693fc4d8f4c011c2ff 100644 +index e107df89c2c645e93bf6c7fced3cf84c51490ef2..1faaf2ffc7ba32e13f2d1c60d26ddfd8e5648df6 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java @@ -773,7 +773,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource { diff --git a/patches/server/0788-Prevent-excessive-velocity-through-repeated-crits.patch b/patches/server/0787-Prevent-excessive-velocity-through-repeated-crits.patch similarity index 94% rename from patches/server/0788-Prevent-excessive-velocity-through-repeated-crits.patch rename to patches/server/0787-Prevent-excessive-velocity-through-repeated-crits.patch index 93fa9450ba..b787bb9da8 100644 --- a/patches/server/0788-Prevent-excessive-velocity-through-repeated-crits.patch +++ b/patches/server/0787-Prevent-excessive-velocity-through-repeated-crits.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Prevent excessive velocity through repeated crits diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java -index a32aa337c890eabeb400903df153aff323bc8645..abae967b466ed64c2c995130589320c8a58128d2 100644 +index 84d8edf3afe0a2a41092d8d2a0b940d1b949da8b..b093d6552c0b0262414ac3e14a99f2d2eea6ce0e 100644 --- a/src/main/java/net/minecraft/world/entity/LivingEntity.java +++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java @@ -2626,14 +2626,27 @@ public abstract class LivingEntity extends Entity { diff --git a/patches/server/0789-Remove-client-side-code-using-deprecated-for-removal.patch b/patches/server/0788-Remove-client-side-code-using-deprecated-for-removal.patch similarity index 100% rename from patches/server/0789-Remove-client-side-code-using-deprecated-for-removal.patch rename to patches/server/0788-Remove-client-side-code-using-deprecated-for-removal.patch diff --git a/patches/server/0790-Rewrite-the-light-engine.patch b/patches/server/0789-Rewrite-the-light-engine.patch similarity index 99% rename from patches/server/0790-Rewrite-the-light-engine.patch rename to patches/server/0789-Rewrite-the-light-engine.patch index 0bb5f529f9..e0f61ab596 100644 --- a/patches/server/0790-Rewrite-the-light-engine.patch +++ b/patches/server/0789-Rewrite-the-light-engine.patch @@ -4353,10 +4353,10 @@ index 0000000000000000000000000000000000000000..dd995e25ae620ae36cd5eecb2fe10ad0 + +} diff --git a/src/main/java/com/destroystokyo/paper/PaperCommand.java b/src/main/java/com/destroystokyo/paper/PaperCommand.java -index dcda01dd8668c7ef7c63709179135deafb83eee5..5f079cf06b0d1505bfb3fda5c326b2d7fd4f0e48 100644 +index d0ef7380d5a325cf8950422b8ee5167da7ac6e0a..f7e223ddf21a90407f61351b89a98ac823932af7 100644 --- a/src/main/java/com/destroystokyo/paper/PaperCommand.java +++ b/src/main/java/com/destroystokyo/paper/PaperCommand.java -@@ -715,6 +715,46 @@ public class PaperCommand extends Command { +@@ -712,6 +712,46 @@ public class PaperCommand extends Command { } } @@ -4403,7 +4403,7 @@ index dcda01dd8668c7ef7c63709179135deafb83eee5..5f079cf06b0d1505bfb3fda5c326b2d7 private void doFixLight(CommandSender sender, String[] args) { if (!(sender instanceof Player)) { sender.sendMessage("Only players can use this command"); -@@ -723,7 +763,7 @@ public class PaperCommand extends Command { +@@ -720,7 +760,7 @@ public class PaperCommand extends Command { int radius = 2; if (args.length > 1) { try { @@ -4412,7 +4412,7 @@ index dcda01dd8668c7ef7c63709179135deafb83eee5..5f079cf06b0d1505bfb3fda5c326b2d7 } catch (Exception e) { sender.sendMessage("Not a number"); return; -@@ -736,6 +776,13 @@ public class PaperCommand extends Command { +@@ -733,6 +773,13 @@ public class PaperCommand extends Command { ServerLevel world = (ServerLevel) handle.level; ThreadedLevelLightEngine lightengine = world.getChunkSource().getLightEngine(); @@ -4427,7 +4427,7 @@ index dcda01dd8668c7ef7c63709179135deafb83eee5..5f079cf06b0d1505bfb3fda5c326b2d7 Deque queue = new ArrayDeque<>(MCUtil.getSpiralOutChunks(center, radius)); updateLight(sender, world, lightengine, queue); diff --git a/src/main/java/net/minecraft/server/level/ChunkHolder.java b/src/main/java/net/minecraft/server/level/ChunkHolder.java -index 7471e5e94b9b4a4f9100b445ca85c74875007330..100c33b8c96c9e0b20a641e31f671147c04df94e 100644 +index 5b4c3ca92dffff876af18db106310cb14e8612b1..5482be03a667939ff009b6810d5cc90c8601e983 100644 --- a/src/main/java/net/minecraft/server/level/ChunkHolder.java +++ b/src/main/java/net/minecraft/server/level/ChunkHolder.java @@ -55,7 +55,7 @@ public class ChunkHolder { @@ -4440,10 +4440,10 @@ index 7471e5e94b9b4a4f9100b445ca85c74875007330..100c33b8c96c9e0b20a641e31f671147 private final DebugBuffer chunkToSaveHistory; public int oldTicketLevel; diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java -index 85c0d3f07b4ede0864f6ab54ad9392b4708330cb..6bae8378c14aa1ae35cf31f284bda2fcc61f1322 100644 +index a0318ed330d3dc5d98169d076d9eb94b485bba52..169e2514c5d6942fe28f0deb84540bd4a50f0ece 100644 --- a/src/main/java/net/minecraft/server/level/ChunkMap.java +++ b/src/main/java/net/minecraft/server/level/ChunkMap.java -@@ -136,7 +136,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider +@@ -135,7 +135,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider public final LongSet entitiesInLevel; public final ServerLevel level; private final ThreadedLevelLightEngine lightEngine; @@ -4453,7 +4453,7 @@ index 85c0d3f07b4ede0864f6ab54ad9392b4708330cb..6bae8378c14aa1ae35cf31f284bda2fc public ChunkGenerator generator; private RandomState randomState; diff --git a/src/main/java/net/minecraft/server/level/DistanceManager.java b/src/main/java/net/minecraft/server/level/DistanceManager.java -index ea4e46c113d3f0a5db6c891021e2e4c5eb275cd4..b22c771ca35466574d5a73f2da3fc8762cb29487 100644 +index 537d34a0325a985948c744929b90144a66a35ee3..06e4d3a02e0d1326b7029157856476db4ef3575e 100644 --- a/src/main/java/net/minecraft/server/level/DistanceManager.java +++ b/src/main/java/net/minecraft/server/level/DistanceManager.java @@ -545,7 +545,7 @@ public abstract class DistanceManager { @@ -4982,7 +4982,7 @@ index ca46ed27fdc1eef979829d19b9e90db6d5c59e09..c37bb3125334a3a4c6c05e57289d758f super(wrapped.getPos(), UpgradeData.EMPTY, wrapped.levelHeightAccessor, wrapped.getLevel().registryAccess().registryOrThrow(Registry.BIOME_REGISTRY), wrapped.getBlendingData()); this.wrapped = wrapped; diff --git a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java -index b57e8e21d75fae24a31effedce2e3c53d9e7d66f..9cce218623a71955687817a6317ed519f3300368 100644 +index 1a64558f8ebedbc4c47ad34787a45c0d89159360..0de0519c01886a39399233b275db44b95e2f3d96 100644 --- a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java +++ b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java @@ -100,6 +100,10 @@ public class LevelChunk extends ChunkAccess { diff --git a/patches/server/0791-Always-parse-protochunk-light-sources-unless-it-is-m.patch b/patches/server/0790-Always-parse-protochunk-light-sources-unless-it-is-m.patch similarity index 100% rename from patches/server/0791-Always-parse-protochunk-light-sources-unless-it-is-m.patch rename to patches/server/0790-Always-parse-protochunk-light-sources-unless-it-is-m.patch diff --git a/patches/server/0792-Fix-removing-recipes-from-RecipeIterator.patch b/patches/server/0791-Fix-removing-recipes-from-RecipeIterator.patch similarity index 100% rename from patches/server/0792-Fix-removing-recipes-from-RecipeIterator.patch rename to patches/server/0791-Fix-removing-recipes-from-RecipeIterator.patch diff --git a/patches/server/0793-Prevent-sending-oversized-item-data-in-equipment-and.patch b/patches/server/0792-Prevent-sending-oversized-item-data-in-equipment-and.patch similarity index 95% rename from patches/server/0793-Prevent-sending-oversized-item-data-in-equipment-and.patch rename to patches/server/0792-Prevent-sending-oversized-item-data-in-equipment-and.patch index dbf8b97120..7781ede3b9 100644 --- a/patches/server/0793-Prevent-sending-oversized-item-data-in-equipment-and.patch +++ b/patches/server/0792-Prevent-sending-oversized-item-data-in-equipment-and.patch @@ -18,7 +18,7 @@ index 0c79613597e9ed1fbeeb36e9cb60a70bbda17bb9..79593d42ef881aa96eab7ea1e50683fa @Override diff --git a/src/main/java/net/minecraft/server/level/ServerEntity.java b/src/main/java/net/minecraft/server/level/ServerEntity.java -index 2abfc5c801cd58223986d6c5012fc381e66f0d9a..5d30612fbb5e9edc7301b3bae31c1764fc6630c6 100644 +index 4bfe42e8a829d7ea11e086822050b43f20ef7b42..28e73bba054c05c82873cb20eae53e93f99ae2de 100644 --- a/src/main/java/net/minecraft/server/level/ServerEntity.java +++ b/src/main/java/net/minecraft/server/level/ServerEntity.java @@ -303,7 +303,10 @@ public class ServerEntity { @@ -34,7 +34,7 @@ index 2abfc5c801cd58223986d6c5012fc381e66f0d9a..5d30612fbb5e9edc7301b3bae31c1764 } diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java -index abae967b466ed64c2c995130589320c8a58128d2..522d4ca03bf539dcb38ddf8cf97a1627a7698bc3 100644 +index b093d6552c0b0262414ac3e14a99f2d2eea6ce0e..0e4dcab5d77c60bfe7f3bc35c95c4da1f7f06800 100644 --- a/src/main/java/net/minecraft/world/entity/LivingEntity.java +++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java @@ -3109,7 +3109,10 @@ public abstract class LivingEntity extends Entity { diff --git a/patches/server/0794-Hide-unnecessary-itemmeta-from-clients.patch b/patches/server/0793-Hide-unnecessary-itemmeta-from-clients.patch similarity index 76% rename from patches/server/0794-Hide-unnecessary-itemmeta-from-clients.patch rename to patches/server/0793-Hide-unnecessary-itemmeta-from-clients.patch index 005e8e673b..c6cbb7c5b1 100644 --- a/patches/server/0794-Hide-unnecessary-itemmeta-from-clients.patch +++ b/patches/server/0793-Hide-unnecessary-itemmeta-from-clients.patch @@ -4,26 +4,8 @@ Date: Tue, 3 Aug 2021 17:28:27 +0200 Subject: [PATCH] Hide unnecessary itemmeta from clients -diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -index 28b4188cd15d297e4b89ab98f78cecd7a5a95c52..d618afa4dc54d0abff18e90121663e14e0416c2b 100644 ---- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -@@ -985,6 +985,13 @@ public class PaperWorldConfig { - behaviorTickRates = loadTickRates("behavior"); - } - -+ public boolean hideItemmetaFromClients = false; -+ public boolean hideDurabilityFromClients = false; -+ private void getHideItemmetaFromClients() { -+ hideItemmetaFromClients = getBoolean("anticheat.obfuscation.items.hide-itemmeta", hideItemmetaFromClients); -+ hideDurabilityFromClients = getBoolean("anticheat.obfuscation.items.hide-durability", hideDurabilityFromClients); -+ } -+ - private com.google.common.collect.Table loadTickRates(String type) { - log(" " + type + ":"); - com.google.common.collect.Table table = com.google.common.collect.HashBasedTable.create(); diff --git a/src/main/java/net/minecraft/server/level/ServerEntity.java b/src/main/java/net/minecraft/server/level/ServerEntity.java -index 5d30612fbb5e9edc7301b3bae31c1764fc6630c6..a482cc1c4d7eab531cd3f5cf42f7d3a43470ef6b 100644 +index 28e73bba054c05c82873cb20eae53e93f99ae2de..c476c4f16edfb0d5c1d94c86f13b35a428d6137a 100644 --- a/src/main/java/net/minecraft/server/level/ServerEntity.java +++ b/src/main/java/net/minecraft/server/level/ServerEntity.java @@ -305,7 +305,7 @@ public class ServerEntity { @@ -36,7 +18,7 @@ index 5d30612fbb5e9edc7301b3bae31c1764fc6630c6..a482cc1c4d7eab531cd3f5cf42f7d3a4 } } diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java -index 522d4ca03bf539dcb38ddf8cf97a1627a7698bc3..7bd5c41c08d198c4278486a245872d2f31162627 100644 +index 0e4dcab5d77c60bfe7f3bc35c95c4da1f7f06800..cca07ef0100749a12aa86b0d97bbc61adc0db7f5 100644 --- a/src/main/java/net/minecraft/world/entity/LivingEntity.java +++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java @@ -3111,7 +3111,7 @@ public abstract class LivingEntity extends Entity { @@ -59,14 +41,14 @@ index 522d4ca03bf539dcb38ddf8cf97a1627a7698bc3..7bd5c41c08d198c4278486a245872d2f + } + + final ItemStack copy = copyItemStack ? itemStack.copy() : itemStack; -+ if (level.paperConfig.hideDurabilityFromClients) { ++ if (level.paperConfig().anticheat.obfuscation.items.hideDurability) { + // Only show damage values for elytra's, since they show a different texture when broken. + if (!copy.is(Items.ELYTRA) || copy.getDamageValue() < copy.getMaxDamage() - 1) { + copy.setDamageValue(0); + } + } + -+ if (level.paperConfig.hideItemmetaFromClients) { ++ if (level.paperConfig().anticheat.obfuscation.items.hideItemmeta) { + // Some resource packs show different textures when there is more than one item. Since this shouldn't provide a big advantage, + // we'll tell the client if there's one or (more than) two items. + copy.setCount(copy.getCount() > 1 ? 2 : 1); diff --git a/patches/server/0795-Fix-kelp-modifier-changing-growth-for-other-crops.patch b/patches/server/0794-Fix-kelp-modifier-changing-growth-for-other-crops.patch similarity index 100% rename from patches/server/0795-Fix-kelp-modifier-changing-growth-for-other-crops.patch rename to patches/server/0794-Fix-kelp-modifier-changing-growth-for-other-crops.patch diff --git a/patches/server/0796-Prevent-ContainerOpenersCounter-openCount-from-going.patch b/patches/server/0795-Prevent-ContainerOpenersCounter-openCount-from-going.patch similarity index 100% rename from patches/server/0796-Prevent-ContainerOpenersCounter-openCount-from-going.patch rename to patches/server/0795-Prevent-ContainerOpenersCounter-openCount-from-going.patch diff --git a/patches/server/0797-Add-PlayerItemFrameChangeEvent.patch b/patches/server/0796-Add-PlayerItemFrameChangeEvent.patch similarity index 100% rename from patches/server/0797-Add-PlayerItemFrameChangeEvent.patch rename to patches/server/0796-Add-PlayerItemFrameChangeEvent.patch diff --git a/patches/server/0798-Add-player-health-update-API.patch b/patches/server/0797-Add-player-health-update-API.patch similarity index 95% rename from patches/server/0798-Add-player-health-update-API.patch rename to patches/server/0797-Add-player-health-update-API.patch index 0703d96a7b..08c961dbc9 100644 --- a/patches/server/0798-Add-player-health-update-API.patch +++ b/patches/server/0797-Add-player-health-update-API.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Add player health update API diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -index e1cb5c8cc3acc1596328808df3f6938776ab9b17..ec42e6394a1a2f669ab52923c04500722ef9908e 100644 +index c27b099fb6636666612044935b598763df7c9251..bf36699c7844b78d63eb252acd5006f4f06a5ec4 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java @@ -2133,9 +2133,11 @@ public class CraftPlayer extends CraftHumanEntity implements Player { diff --git a/patches/server/0799-Optimize-HashMapPalette.patch b/patches/server/0798-Optimize-HashMapPalette.patch similarity index 100% rename from patches/server/0799-Optimize-HashMapPalette.patch rename to patches/server/0798-Optimize-HashMapPalette.patch diff --git a/patches/server/0800-Allow-delegation-to-vanilla-chunk-gen.patch b/patches/server/0799-Allow-delegation-to-vanilla-chunk-gen.patch similarity index 97% rename from patches/server/0800-Allow-delegation-to-vanilla-chunk-gen.patch rename to patches/server/0799-Allow-delegation-to-vanilla-chunk-gen.patch index cf203fb93c..db9aa8e225 100644 --- a/patches/server/0800-Allow-delegation-to-vanilla-chunk-gen.patch +++ b/patches/server/0799-Allow-delegation-to-vanilla-chunk-gen.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Allow delegation to vanilla chunk gen diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -index a97565735bf6005b77859e8453171cd8eaefab81..46ff259c64560ac7371e138627bf1b71227d308b 100644 +index efaaa74878ad18082a0b95ce2697b3638bc1284b..745f8a167976633d1d26e530412dacf3ec469197 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -@@ -2299,6 +2299,90 @@ public final class CraftServer implements Server { +@@ -2298,6 +2298,90 @@ public final class CraftServer implements Server { return new OldCraftChunkData(world.getMinHeight(), world.getMaxHeight(), handle.registryAccess().registryOrThrow(Registry.BIOME_REGISTRY), world); // Paper - Anti-Xray - Add parameters } diff --git a/patches/server/0801-Highly-optimise-single-and-multi-AABB-VoxelShapes-an.patch b/patches/server/0800-Highly-optimise-single-and-multi-AABB-VoxelShapes-an.patch similarity index 99% rename from patches/server/0801-Highly-optimise-single-and-multi-AABB-VoxelShapes-an.patch rename to patches/server/0800-Highly-optimise-single-and-multi-AABB-VoxelShapes-an.patch index c4ad226ed3..025b005c0a 100644 --- a/patches/server/0801-Highly-optimise-single-and-multi-AABB-VoxelShapes-an.patch +++ b/patches/server/0800-Highly-optimise-single-and-multi-AABB-VoxelShapes-an.patch @@ -1180,7 +1180,7 @@ index 0000000000000000000000000000000000000000..d67a40e7be030142443680c89e1763fc + } +} diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java -index 0a4934cabf5d04b0561d33f5e777f38b2e721608..1f8282ab903293a4221bce48b5d4d5f4284fe781 100644 +index c0f876bb11f8620390e6c38d9090eac73a28ad09..b0213404e1fb78dccfd3735f128032c0ac4988c8 100644 --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java @@ -421,7 +421,7 @@ public class ServerPlayer extends Player { @@ -1202,7 +1202,7 @@ index 0a4934cabf5d04b0561d33f5e777f38b2e721608..1f8282ab903293a4221bce48b5d4d5f4 } } diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java -index 082a16f49c07faadce68fc118b2fff859da422d0..ac9ee7f574f9b6c5e9c9368e54928e47ca62fb24 100644 +index d74d6669005d0669503253787636756a0c6590f4..6d013360d35c54d1493849b22c9d65b18147cc33 100644 --- a/src/main/java/net/minecraft/server/players/PlayerList.java +++ b/src/main/java/net/minecraft/server/players/PlayerList.java @@ -936,7 +936,7 @@ public abstract class PlayerList { @@ -1215,7 +1215,7 @@ index 082a16f49c07faadce68fc118b2fff859da422d0..ac9ee7f574f9b6c5e9c9368e54928e47 } // CraftBukkit start diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java -index 8013e54f44922f04404c38693fc4d8f4c011c2ff..bb9b35649ddc8d28e920b3dbfe760d275eabbb04 100644 +index 1faaf2ffc7ba32e13f2d1c60d26ddfd8e5648df6..82e22e1ad1059630547f16e405e5c553ace29a80 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java @@ -1154,9 +1154,44 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource { @@ -1402,7 +1402,7 @@ index 8013e54f44922f04404c38693fc4d8f4c011c2ff..bb9b35649ddc8d28e920b3dbfe760d27 } diff --git a/src/main/java/net/minecraft/world/level/BlockCollisions.java b/src/main/java/net/minecraft/world/level/BlockCollisions.java -index a733c91700a38634806e9155c693b227e6aa16b6..120e1778f2bdd64ca19ee21dc5c5f2f382895470 100644 +index 95e22c91bc701785f4804e5d4e0a6b420b9830fd..2528291e00532c95690c4d7fb4cc0691cfb8c857 100644 --- a/src/main/java/net/minecraft/world/level/BlockCollisions.java +++ b/src/main/java/net/minecraft/world/level/BlockCollisions.java @@ -106,7 +106,7 @@ public class BlockCollisions extends AbstractIterator { diff --git a/patches/server/0802-Optimise-collision-checking-in-player-move-packet-ha.patch b/patches/server/0801-Optimise-collision-checking-in-player-move-packet-ha.patch similarity index 99% rename from patches/server/0802-Optimise-collision-checking-in-player-move-packet-ha.patch rename to patches/server/0801-Optimise-collision-checking-in-player-move-packet-ha.patch index 0e06591eac..7a7e537d21 100644 --- a/patches/server/0802-Optimise-collision-checking-in-player-move-packet-ha.patch +++ b/patches/server/0801-Optimise-collision-checking-in-player-move-packet-ha.patch @@ -6,7 +6,7 @@ Subject: [PATCH] Optimise collision checking in player move packet handling Move collision logic to just the hasNewCollision call instead of getCubes + hasNewCollision diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index 9c7d1ce759e119b21e942add5e42ad203226d72b..8b033cdd65402950e597efab7b2407f5baf4c3aa 100644 +index 522d6e59038db276238720d828e8949bbeba88d2..b93e6c14141f3ed3bc74c786eb56cf462510218a 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java @@ -613,7 +613,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser diff --git a/patches/server/0803-Actually-unload-POI-data.patch b/patches/server/0802-Actually-unload-POI-data.patch similarity index 96% rename from patches/server/0803-Actually-unload-POI-data.patch rename to patches/server/0802-Actually-unload-POI-data.patch index e06abf0508..e9eadfe65d 100644 --- a/patches/server/0803-Actually-unload-POI-data.patch +++ b/patches/server/0802-Actually-unload-POI-data.patch @@ -10,10 +10,10 @@ This patch also prevents the saving/unloading of POI data when world saving is disabled. diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java -index 6bae8378c14aa1ae35cf31f284bda2fcc61f1322..1794893cab3f26faa58745a95cb50d239f8a1484 100644 +index 169e2514c5d6942fe28f0deb84540bd4a50f0ece..e25423b46ced54dd6b270d45a3c4502a01b2e227 100644 --- a/src/main/java/net/minecraft/server/level/ChunkMap.java +++ b/src/main/java/net/minecraft/server/level/ChunkMap.java -@@ -864,6 +864,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider +@@ -863,6 +863,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider } // Paper end } @@ -21,7 +21,7 @@ index 6bae8378c14aa1ae35cf31f284bda2fcc61f1322..1794893cab3f26faa58745a95cb50d23 this.updatingChunks.queueUpdate(pos, holder); // Paper - Don't copy this.modified = true; -@@ -1015,7 +1016,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider +@@ -1014,7 +1015,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider private void processUnloads(BooleanSupplier shouldKeepTicking) { LongIterator longiterator = this.toDrop.iterator(); @@ -30,7 +30,7 @@ index 6bae8378c14aa1ae35cf31f284bda2fcc61f1322..1794893cab3f26faa58745a95cb50d23 long j = longiterator.nextLong(); ChunkHolder playerchunk = this.updatingChunks.queueRemove(j); // Paper - Don't copy -@@ -1063,6 +1064,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider +@@ -1062,6 +1063,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider this.regionManagers.get(index).removeChunk(holder.pos.x, holder.pos.z); } // Paper end @@ -38,7 +38,7 @@ index 6bae8378c14aa1ae35cf31f284bda2fcc61f1322..1794893cab3f26faa58745a95cb50d23 if (ichunkaccess instanceof LevelChunk) { ((LevelChunk) ichunkaccess).setLoaded(false); } -@@ -1092,6 +1094,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider +@@ -1091,6 +1093,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider for (int index = 0, len = this.regionManagers.size(); index < len; ++index) { this.regionManagers.get(index).removeChunk(holder.pos.x, holder.pos.z); } @@ -46,7 +46,7 @@ index 6bae8378c14aa1ae35cf31f284bda2fcc61f1322..1794893cab3f26faa58745a95cb50d23 } // Paper end } finally { this.unloadingPlayerChunk = unloadingBefore; } // Paper - do not allow ticket level changes while unloading chunks -@@ -1167,6 +1170,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider +@@ -1166,6 +1169,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider } this.poiManager.loadInData(pos, chunkHolder.poiData); chunkHolder.tasks.forEach(Runnable::run); @@ -271,7 +271,7 @@ index ab9bb440c8e91ecb49c1e14a427d35087a87ac80..400732788820a94acebccb1ad64789e0 @Override diff --git a/src/main/java/net/minecraft/world/level/chunk/storage/SectionStorage.java b/src/main/java/net/minecraft/world/level/chunk/storage/SectionStorage.java -index 72be000b43c0026bc3b9236171f00a73cc4078e9..0f0718f0ee729715afcc4ba48307f5768a1a088d 100644 +index ff6b25fd21836a080d63f1051b6645ec3d262658..2646c420cb049ead697e1a973f7d023378903afa 100644 --- a/src/main/java/net/minecraft/world/level/chunk/storage/SectionStorage.java +++ b/src/main/java/net/minecraft/world/level/chunk/storage/SectionStorage.java @@ -58,6 +58,40 @@ public class SectionStorage extends RegionFileStorage implements AutoCloseabl diff --git a/patches/server/0804-Fix-ChunkSnapshot-isSectionEmpty-int-and-optimize-Pa.patch b/patches/server/0803-Fix-ChunkSnapshot-isSectionEmpty-int-and-optimize-Pa.patch similarity index 96% rename from patches/server/0804-Fix-ChunkSnapshot-isSectionEmpty-int-and-optimize-Pa.patch rename to patches/server/0803-Fix-ChunkSnapshot-isSectionEmpty-int-and-optimize-Pa.patch index 02a8c9d2a5..4eb953eb31 100644 --- a/patches/server/0804-Fix-ChunkSnapshot-isSectionEmpty-int-and-optimize-Pa.patch +++ b/patches/server/0803-Fix-ChunkSnapshot-isSectionEmpty-int-and-optimize-Pa.patch @@ -6,7 +6,7 @@ Subject: [PATCH] Fix ChunkSnapshot#isSectionEmpty(int) and optimize diff --git a/src/main/java/org/bukkit/craftbukkit/CraftChunk.java b/src/main/java/org/bukkit/craftbukkit/CraftChunk.java -index 7fd9f20d60339270d5e4adbf098ac38a832fb224..77b88eec2b6ba88605cdd5f4a60c2e2eda88288e 100644 +index f0b41e4d08691f2f97b0a4396b5d6c8fd75b2c86..947b0b10fb965f30513fd0df5bc0910fb9cb9a71 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftChunk.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftChunk.java @@ -283,13 +283,17 @@ public class CraftChunk implements Chunk { diff --git a/patches/server/0805-Update-Log4j.patch b/patches/server/0804-Update-Log4j.patch similarity index 86% rename from patches/server/0805-Update-Log4j.patch rename to patches/server/0804-Update-Log4j.patch index 87cc534a77..8f1c4403e3 100644 --- a/patches/server/0805-Update-Log4j.patch +++ b/patches/server/0804-Update-Log4j.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Update Log4j diff --git a/build.gradle.kts b/build.gradle.kts -index a7c7d450f22f9642fadeac9cb601214cfa9a2b02..3ff7814add16834c70494afb76d8a7788545d009 100644 +index 1c350424d0903f0caa9ef688abf8a6c51f22fdbd..16998a864e1c82bf4c1e1e08c0ebeb820ff33e59 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -20,10 +20,11 @@ dependencies { @@ -21,4 +21,4 @@ index a7c7d450f22f9642fadeac9cb601214cfa9a2b02..3ff7814add16834c70494afb76d8a778 + implementation("org.apache.logging.log4j:log4j-slf4j18-impl:2.17.1") // Paper implementation("org.ow2.asm:asm:9.3") implementation("org.ow2.asm:asm-commons:9.3") // Paper - ASM event executor generation - implementation("commons-lang:commons-lang:2.6") + implementation("org.spongepowered:configurate-yaml:4.1.2") // Paper - config files diff --git a/patches/server/0806-Add-more-Campfire-API.patch b/patches/server/0805-Add-more-Campfire-API.patch similarity index 100% rename from patches/server/0806-Add-more-Campfire-API.patch rename to patches/server/0805-Add-more-Campfire-API.patch diff --git a/patches/server/0807-Only-write-chunk-data-to-disk-if-it-serializes-witho.patch b/patches/server/0806-Only-write-chunk-data-to-disk-if-it-serializes-witho.patch similarity index 97% rename from patches/server/0807-Only-write-chunk-data-to-disk-if-it-serializes-witho.patch rename to patches/server/0806-Only-write-chunk-data-to-disk-if-it-serializes-witho.patch index 324e828c7c..7c333b5f55 100644 --- a/patches/server/0807-Only-write-chunk-data-to-disk-if-it-serializes-witho.patch +++ b/patches/server/0806-Only-write-chunk-data-to-disk-if-it-serializes-witho.patch @@ -37,7 +37,7 @@ index 8ff8855c5267379b3a5f5d8baa4a275ffee2c4bf..6704ae5c2ee01f8b319f4d425fe08c16 ByteBuffer bytebuffer = ByteBuffer.wrap(this.buf, 0, this.count); diff --git a/src/main/java/net/minecraft/world/level/chunk/storage/RegionFileStorage.java b/src/main/java/net/minecraft/world/level/chunk/storage/RegionFileStorage.java -index e5b444c6f2e45c50b4f7ab49c0dad801938f6cd9..303b70f0433ff49a3bee2a0d92c41f01aec38bee 100644 +index 6986a170f37f70e8eb89d79d5d2615a06a5e0f0c..c31b9a6b1d4548d507ecb60d42ca9f96f49f6c4b 100644 --- a/src/main/java/net/minecraft/world/level/chunk/storage/RegionFileStorage.java +++ b/src/main/java/net/minecraft/world/level/chunk/storage/RegionFileStorage.java @@ -298,10 +298,17 @@ public class RegionFileStorage implements AutoCloseable { diff --git a/patches/server/0808-Fix-tripwire-state-inconsistency.patch b/patches/server/0807-Fix-tripwire-state-inconsistency.patch similarity index 100% rename from patches/server/0808-Fix-tripwire-state-inconsistency.patch rename to patches/server/0807-Fix-tripwire-state-inconsistency.patch diff --git a/patches/server/0809-Fix-fluid-logging-on-Block-breakNaturally.patch b/patches/server/0808-Fix-fluid-logging-on-Block-breakNaturally.patch similarity index 100% rename from patches/server/0809-Fix-fluid-logging-on-Block-breakNaturally.patch rename to patches/server/0808-Fix-fluid-logging-on-Block-breakNaturally.patch diff --git a/patches/server/0810-Forward-CraftEntity-in-teleport-command.patch b/patches/server/0809-Forward-CraftEntity-in-teleport-command.patch similarity index 95% rename from patches/server/0810-Forward-CraftEntity-in-teleport-command.patch rename to patches/server/0809-Forward-CraftEntity-in-teleport-command.patch index d6afebd3f3..8eeff80392 100644 --- a/patches/server/0810-Forward-CraftEntity-in-teleport-command.patch +++ b/patches/server/0809-Forward-CraftEntity-in-teleport-command.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Forward CraftEntity in teleport command diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java -index bb9b35649ddc8d28e920b3dbfe760d275eabbb04..0d8ff9f36073afd92eee815af0c0e04332b60c91 100644 +index 82e22e1ad1059630547f16e405e5c553ace29a80..71702c915e9519f85904af0e652e692bb1ba596f 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java @@ -3259,6 +3259,13 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource { diff --git a/patches/server/0811-Improve-scoreboard-entries.patch b/patches/server/0810-Improve-scoreboard-entries.patch similarity index 100% rename from patches/server/0811-Improve-scoreboard-entries.patch rename to patches/server/0810-Improve-scoreboard-entries.patch diff --git a/patches/server/0812-Entity-powdered-snow-API.patch b/patches/server/0811-Entity-powdered-snow-API.patch similarity index 100% rename from patches/server/0812-Entity-powdered-snow-API.patch rename to patches/server/0811-Entity-powdered-snow-API.patch diff --git a/patches/server/0813-Add-API-for-item-entity-health.patch b/patches/server/0812-Add-API-for-item-entity-health.patch similarity index 100% rename from patches/server/0813-Add-API-for-item-entity-health.patch rename to patches/server/0812-Add-API-for-item-entity-health.patch diff --git a/patches/server/0814-Fix-entity-type-tags-suggestions-in-selectors.patch b/patches/server/0813-Fix-entity-type-tags-suggestions-in-selectors.patch similarity index 83% rename from patches/server/0814-Fix-entity-type-tags-suggestions-in-selectors.patch rename to patches/server/0813-Fix-entity-type-tags-suggestions-in-selectors.patch index e04d1bb663..c0d3ac45aa 100644 --- a/patches/server/0814-Fix-entity-type-tags-suggestions-in-selectors.patch +++ b/patches/server/0813-Fix-entity-type-tags-suggestions-in-selectors.patch @@ -9,24 +9,8 @@ when if this was fixed on the client, that wouldn't be needed. Mojira Issue: https://bugs.mojang.com/browse/MC-235045 -diff --git a/src/main/java/com/destroystokyo/paper/PaperConfig.java b/src/main/java/com/destroystokyo/paper/PaperConfig.java -index a98cd0aecc034038d81194fd87c4f8df65b86095..a1e36435187a51d2fe100945b90f409b8f9305c1 100644 ---- a/src/main/java/com/destroystokyo/paper/PaperConfig.java -+++ b/src/main/java/com/destroystokyo/paper/PaperConfig.java -@@ -523,6 +523,11 @@ public class PaperConfig { - itemValidationBookPageLength = getInt("settings.item-validation.book.page", itemValidationBookPageLength); - } - -+ public static boolean fixTargetSelectorTagCompletion = true; -+ private static void fixTargetSelectorTagCompletion() { -+ fixTargetSelectorTagCompletion = getBoolean("settings.fix-target-selector-tag-completion", fixTargetSelectorTagCompletion); -+ } -+ - public static final class PacketLimit { - public final double packetLimitInterval; - public final double maxPacketRate; diff --git a/src/main/java/net/minecraft/commands/CommandSourceStack.java b/src/main/java/net/minecraft/commands/CommandSourceStack.java -index 3ad9f1327cd99e16e8eca86d72cb8a57f28b245e..e6c254cfa83b218ad2a0e957306d8019adf0aaa7 100644 +index 3ad9f1327cd99e16e8eca86d72cb8a57f28b245e..0148cadbeb41a882a05d982f0b34770b2829a04a 100644 --- a/src/main/java/net/minecraft/commands/CommandSourceStack.java +++ b/src/main/java/net/minecraft/commands/CommandSourceStack.java @@ -366,4 +366,20 @@ public class CommandSourceStack implements SharedSuggestionProvider, com.destroy @@ -36,7 +20,7 @@ index 3ad9f1327cd99e16e8eca86d72cb8a57f28b245e..e6c254cfa83b218ad2a0e957306d8019 + // Paper start - override getSelectedEntities + @Override + public Collection getSelectedEntities() { -+ if (com.destroystokyo.paper.PaperConfig.fixTargetSelectorTagCompletion && this.source instanceof ServerPlayer player) { ++ if (io.papermc.paper.configuration.GlobalConfiguration.get().commands.fixTargetSelectorTagCompletion && this.source instanceof ServerPlayer player) { + double pickDistance = player.gameMode.getGameModeForPlayer().isCreative() ? 5.0F : 4.5F; + Vec3 min = player.getEyePosition(1.0F); + Vec3 viewVector = player.getViewVector(1.0F); @@ -51,7 +35,7 @@ index 3ad9f1327cd99e16e8eca86d72cb8a57f28b245e..e6c254cfa83b218ad2a0e957306d8019 + // Paper end } diff --git a/src/main/java/net/minecraft/commands/Commands.java b/src/main/java/net/minecraft/commands/Commands.java -index af00f7dcbc1c4fb8da25128d5603b3ef041db7da..a51040aec86c0be2b124619d8fea2111778ad684 100644 +index af00f7dcbc1c4fb8da25128d5603b3ef041db7da..ea5f0600d47b0f7c08b96eed91e5de255114637b 100644 --- a/src/main/java/net/minecraft/commands/Commands.java +++ b/src/main/java/net/minecraft/commands/Commands.java @@ -411,6 +411,7 @@ public class Commands { @@ -68,7 +52,7 @@ index af00f7dcbc1c4fb8da25128d5603b3ef041db7da..a51040aec86c0be2b124619d8fea2111 requiredargumentbuilder.suggests(SuggestionProviders.safelySwap(requiredargumentbuilder.getSuggestionsProvider())); + // Paper start - tell clients to ask server for suggestions for EntityArguments + registeredAskServerSuggestionsForTree = requiredargumentbuilder.getSuggestionsProvider() == net.minecraft.commands.synchronization.SuggestionProviders.ASK_SERVER; -+ } else if (com.destroystokyo.paper.PaperConfig.fixTargetSelectorTagCompletion && !registeredAskServerSuggestionsForTree && requiredargumentbuilder.getType() instanceof net.minecraft.commands.arguments.EntityArgument) { ++ } else if (io.papermc.paper.configuration.GlobalConfiguration.get().commands.fixTargetSelectorTagCompletion && !registeredAskServerSuggestionsForTree && requiredargumentbuilder.getType() instanceof net.minecraft.commands.arguments.EntityArgument) { + requiredargumentbuilder.suggests(requiredargumentbuilder.getType()::listSuggestions); + registeredAskServerSuggestionsForTree = true; // You can only + // Paper end - tell clients to ask server for suggestions for EntityArguments @@ -113,7 +97,7 @@ index ad99d67af92cda03beb1142b02082ee1bfc8a64a..a57ae219d57ed47baedfb73b3d815f39 this.level = MinMaxBounds.Ints.ANY; this.rotX = WrappedMinMaxBounds.ANY; diff --git a/src/main/java/net/minecraft/commands/arguments/selector/options/EntitySelectorOptions.java b/src/main/java/net/minecraft/commands/arguments/selector/options/EntitySelectorOptions.java -index c2b26a089c423e5df9a5cbfd1c70efbd1acb0e7a..f15e6fd9b9d35554044bf9f713b60d4c549d9b5e 100644 +index c2b26a089c423e5df9a5cbfd1c70efbd1acb0e7a..4200ce431e07aa3e6d05702d184ad85b4fef01a8 100644 --- a/src/main/java/net/minecraft/commands/arguments/selector/options/EntitySelectorOptions.java +++ b/src/main/java/net/minecraft/commands/arguments/selector/options/EntitySelectorOptions.java @@ -67,6 +67,19 @@ public class EntitySelectorOptions { @@ -141,7 +125,7 @@ index c2b26a089c423e5df9a5cbfd1c70efbd1acb0e7a..f15e6fd9b9d35554044bf9f713b60d4c if (reader.isTag()) { TagKey> tagKey = TagKey.create(Registry.ENTITY_TYPE_REGISTRY, ResourceLocation.read(reader.getReader())); + // Paper start - throw error if invalid entity tag (only on suggestions to keep cmd success behavior) -+ if (com.destroystokyo.paper.PaperConfig.fixTargetSelectorTagCompletion && reader.parsingEntityArgumentSuggestions && !Registry.ENTITY_TYPE.isKnownTagName(tagKey)) { ++ if (io.papermc.paper.configuration.GlobalConfiguration.get().commands.fixTargetSelectorTagCompletion && reader.parsingEntityArgumentSuggestions && !Registry.ENTITY_TYPE.isKnownTagName(tagKey)) { + reader.getReader().setCursor(i); + throw ERROR_ENTITY_TAG_INVALID.createWithContext(reader.getReader(), tagKey); + } diff --git a/patches/server/0814-Configurable-max-block-light-for-monster-spawning.patch b/patches/server/0814-Configurable-max-block-light-for-monster-spawning.patch new file mode 100644 index 0000000000..3430e3062a --- /dev/null +++ b/patches/server/0814-Configurable-max-block-light-for-monster-spawning.patch @@ -0,0 +1,19 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Nassim Jahnke +Date: Thu, 16 Dec 2021 09:40:39 +0100 +Subject: [PATCH] Configurable max block light for monster spawning + + +diff --git a/src/main/java/net/minecraft/world/entity/monster/Monster.java b/src/main/java/net/minecraft/world/entity/monster/Monster.java +index 6e0bd0eab0b06a4ac3042496bbb91292544e9f3c..55c245d0dfa369dc6de2197ae37335fba4fae4ae 100644 +--- a/src/main/java/net/minecraft/world/entity/monster/Monster.java ++++ b/src/main/java/net/minecraft/world/entity/monster/Monster.java +@@ -93,7 +93,7 @@ public abstract class Monster extends PathfinderMob implements Enemy { + return false; + } else { + DimensionType dimensionType = world.dimensionType(); +- int i = dimensionType.monsterSpawnBlockLightLimit(); ++ int i = world.getLevel().paperConfig().entities.spawning.monsterSpawnMaxLightLevel >= 0 ? world.getLevel().paperConfig().entities.spawning.monsterSpawnMaxLightLevel : dimensionType.monsterSpawnBlockLightLimit(); // Paper + if (i < 15 && world.getBrightness(LightLayer.BLOCK, pos) > i) { + return false; + } else { diff --git a/patches/server/0815-Configurable-max-block-light-for-monster-spawning.patch b/patches/server/0815-Configurable-max-block-light-for-monster-spawning.patch deleted file mode 100644 index 4602b1752a..0000000000 --- a/patches/server/0815-Configurable-max-block-light-for-monster-spawning.patch +++ /dev/null @@ -1,33 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Nassim Jahnke -Date: Thu, 16 Dec 2021 09:40:39 +0100 -Subject: [PATCH] Configurable max block light for monster spawning - - -diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -index d618afa4dc54d0abff18e90121663e14e0416c2b..4933961ab8bc29749c053c6c54c5d2138f2c1742 100644 ---- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -@@ -1083,4 +1083,9 @@ public class PaperWorldConfig { - Integer rate = table.get(columnKey, rowKey); - return rate != null && rate > -1 ? rate : def; - } -+ -+ public int maxBlockLightForMonsterSpawning = -1; -+ private void minBlockLightForMobSpawning() { -+ this.maxBlockLightForMonsterSpawning = getInt("monster-spawn-max-light-level", maxBlockLightForMonsterSpawning); -+ } - } -diff --git a/src/main/java/net/minecraft/world/entity/monster/Monster.java b/src/main/java/net/minecraft/world/entity/monster/Monster.java -index 6e0bd0eab0b06a4ac3042496bbb91292544e9f3c..37539f7680013ab99ed3313b82f9829617d17a71 100644 ---- a/src/main/java/net/minecraft/world/entity/monster/Monster.java -+++ b/src/main/java/net/minecraft/world/entity/monster/Monster.java -@@ -93,7 +93,7 @@ public abstract class Monster extends PathfinderMob implements Enemy { - return false; - } else { - DimensionType dimensionType = world.dimensionType(); -- int i = dimensionType.monsterSpawnBlockLightLimit(); -+ int i = world.getLevel().paperConfig.maxBlockLightForMonsterSpawning >= 0 ? world.getLevel().paperConfig.maxBlockLightForMonsterSpawning : dimensionType.monsterSpawnBlockLightLimit(); // Paper - if (i < 15 && world.getBrightness(LightLayer.BLOCK, pos) > i) { - return false; - } else { diff --git a/patches/server/0816-Fix-sticky-pistons-and-BlockPistonRetractEvent.patch b/patches/server/0815-Fix-sticky-pistons-and-BlockPistonRetractEvent.patch similarity index 98% rename from patches/server/0816-Fix-sticky-pistons-and-BlockPistonRetractEvent.patch rename to patches/server/0815-Fix-sticky-pistons-and-BlockPistonRetractEvent.patch index 279d1a693c..698fbc2d5e 100644 --- a/patches/server/0816-Fix-sticky-pistons-and-BlockPistonRetractEvent.patch +++ b/patches/server/0815-Fix-sticky-pistons-and-BlockPistonRetractEvent.patch @@ -27,7 +27,7 @@ Co-authored-by: Zach Brown Co-authored-by: Madeline Miller diff --git a/src/main/java/net/minecraft/world/level/block/piston/PistonBaseBlock.java b/src/main/java/net/minecraft/world/level/block/piston/PistonBaseBlock.java -index 6d3c9d6c75897af52bbcce50bf23f28269a3ff5c..4d4d28377e5766432d3fd18192bbc1d795fbd69c 100644 +index 24a822ade17849a083161216c184f02c30b5cb1f..f456ad8a74464414f69b616a48ee9a2c1cee4d90 100644 --- a/src/main/java/net/minecraft/world/level/block/piston/PistonBaseBlock.java +++ b/src/main/java/net/minecraft/world/level/block/piston/PistonBaseBlock.java @@ -146,15 +146,15 @@ public class PistonBaseBlock extends DirectionalBlock { diff --git a/patches/server/0817-Load-effect-amplifiers-greater-than-127-correctly.patch b/patches/server/0816-Load-effect-amplifiers-greater-than-127-correctly.patch similarity index 100% rename from patches/server/0817-Load-effect-amplifiers-greater-than-127-correctly.patch rename to patches/server/0816-Load-effect-amplifiers-greater-than-127-correctly.patch diff --git a/patches/server/0818-Expose-isFuel-and-canSmelt-methods-to-FurnaceInvento.patch b/patches/server/0817-Expose-isFuel-and-canSmelt-methods-to-FurnaceInvento.patch similarity index 100% rename from patches/server/0818-Expose-isFuel-and-canSmelt-methods-to-FurnaceInvento.patch rename to patches/server/0817-Expose-isFuel-and-canSmelt-methods-to-FurnaceInvento.patch diff --git a/patches/server/0819-Fix-bees-aging-inside-hives.patch b/patches/server/0818-Fix-bees-aging-inside-hives.patch similarity index 100% rename from patches/server/0819-Fix-bees-aging-inside-hives.patch rename to patches/server/0818-Fix-bees-aging-inside-hives.patch diff --git a/patches/server/0820-Bucketable-API.patch b/patches/server/0819-Bucketable-API.patch similarity index 100% rename from patches/server/0820-Bucketable-API.patch rename to patches/server/0819-Bucketable-API.patch diff --git a/patches/server/0821-Check-player-world-in-endPortalSoundRadius.patch b/patches/server/0820-Check-player-world-in-endPortalSoundRadius.patch similarity index 100% rename from patches/server/0821-Check-player-world-in-endPortalSoundRadius.patch rename to patches/server/0820-Check-player-world-in-endPortalSoundRadius.patch diff --git a/patches/server/0822-Validate-usernames.patch b/patches/server/0821-Validate-usernames.patch similarity index 67% rename from patches/server/0822-Validate-usernames.patch rename to patches/server/0821-Validate-usernames.patch index eee4e6e84e..42d80bb826 100644 --- a/patches/server/0822-Validate-usernames.patch +++ b/patches/server/0821-Validate-usernames.patch @@ -4,28 +4,11 @@ Date: Sat, 1 Jan 2022 05:19:37 -0800 Subject: [PATCH] Validate usernames -diff --git a/src/main/java/com/destroystokyo/paper/PaperConfig.java b/src/main/java/com/destroystokyo/paper/PaperConfig.java -index a1e36435187a51d2fe100945b90f409b8f9305c1..6706e502a068766e2eff3f790bbca004698932d1 100644 ---- a/src/main/java/com/destroystokyo/paper/PaperConfig.java -+++ b/src/main/java/com/destroystokyo/paper/PaperConfig.java -@@ -491,6 +491,12 @@ public class PaperConfig { - set("settings.unsupported-settings.allow-tnt-duplication", null); - } - -+ public static boolean performUsernameValidation; -+ private static void performUsernameValidation() { -+ performUsernameValidation = getBoolean("settings.unsupported-settings.perform-username-validation", true); -+ } -+ -+ - public static int playerAutoSaveRate = -1; - public static int maxPlayerAutoSavePerTick = 10; - private static void playerAutoSaveRate() { diff --git a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java -index 38521660c6fa7c1a19c5268dac05928b5ec983f4..221f32e034ccb57907f79bae4ecec324e9cdb14e 100644 +index dcabb783bed9160f7d602d551cf7e8d004abbca1..e581656c4450be708f1a91a42b5b1da9105df6f3 100644 --- a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java -@@ -71,6 +71,7 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener +@@ -70,6 +70,7 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener private ProfilePublicKey playerProfilePublicKey; public String hostname = ""; // CraftBukkit - add field private int velocityLoginMessageId = -1; // Paper - Velocity support @@ -33,7 +16,7 @@ index 38521660c6fa7c1a19c5268dac05928b5ec983f4..221f32e034ccb57907f79bae4ecec324 public ServerLoginPacketListenerImpl(MinecraftServer server, Connection connection) { this.state = ServerLoginPacketListenerImpl.State.HELLO; -@@ -263,10 +264,38 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener +@@ -262,10 +263,38 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener } } @@ -62,7 +45,7 @@ index 38521660c6fa7c1a19c5268dac05928b5ec983f4..221f32e034ccb57907f79bae4ecec324 Validate.validState(this.state == ServerLoginPacketListenerImpl.State.HELLO, "Unexpected hello packet", new Object[0]); Validate.validState(ServerLoginPacketListenerImpl.isValidUsername(packet.name()), "Invalid characters in username", new Object[0]); + // Paper start - validate usernames -+ if (com.destroystokyo.paper.PaperConfig.isProxyOnlineMode() && com.destroystokyo.paper.PaperConfig.performUsernameValidation) { ++ if (io.papermc.paper.configuration.GlobalConfiguration.get().proxies.isProxyOnlineMode() && io.papermc.paper.configuration.GlobalConfiguration.get().unsupportedSettings.performUsernameValidation) { + if (!this.iKnowThisMayNotBeTheBestIdeaButPleaseDisableUsernameValidation && !validateUsername(packet.name())) { + ServerLoginPacketListenerImpl.this.disconnect("Failed to verify username!"); + return; @@ -73,7 +56,7 @@ index 38521660c6fa7c1a19c5268dac05928b5ec983f4..221f32e034ccb57907f79bae4ecec324 try { this.playerProfilePublicKey = ServerLoginPacketListenerImpl.validatePublicKey(packet, this.server.getServiceSignatureValidator(), this.server.enforceSecureProfile()); diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java -index ac9ee7f574f9b6c5e9c9368e54928e47ca62fb24..6951b8e320dcea2c2ce4271ed03a20c729ff503b 100644 +index 6d013360d35c54d1493849b22c9d65b18147cc33..c0ed1103e649e619c58f59c7bedd6a18a58f71ea 100644 --- a/src/main/java/net/minecraft/server/players/PlayerList.java +++ b/src/main/java/net/minecraft/server/players/PlayerList.java @@ -707,7 +707,7 @@ public abstract class PlayerList { @@ -81,7 +64,7 @@ index ac9ee7f574f9b6c5e9c9368e54928e47ca62fb24..6951b8e320dcea2c2ce4271ed03a20c7 for (int i = 0; i < this.players.size(); ++i) { entityplayer = (ServerPlayer) this.players.get(i); - if (entityplayer.getUUID().equals(uuid)) { -+ if (entityplayer.getUUID().equals(uuid) || (com.destroystokyo.paper.PaperConfig.isProxyOnlineMode() && entityplayer.getGameProfile().getName().equalsIgnoreCase(gameprofile.getName()))) { // Paper - validate usernames ++ if (entityplayer.getUUID().equals(uuid) || (io.papermc.paper.configuration.GlobalConfiguration.get().proxies.isProxyOnlineMode() && entityplayer.getGameProfile().getName().equalsIgnoreCase(gameprofile.getName()))) { // Paper - validate usernames list.add(entityplayer); } } diff --git a/patches/server/0823-Fix-saving-configs-with-more-long-comments.patch b/patches/server/0822-Fix-saving-configs-with-more-long-comments.patch similarity index 100% rename from patches/server/0823-Fix-saving-configs-with-more-long-comments.patch rename to patches/server/0822-Fix-saving-configs-with-more-long-comments.patch diff --git a/patches/server/0823-Make-water-animal-spawn-height-configurable.patch b/patches/server/0823-Make-water-animal-spawn-height-configurable.patch new file mode 100644 index 0000000000..dea45f0b70 --- /dev/null +++ b/patches/server/0823-Make-water-animal-spawn-height-configurable.patch @@ -0,0 +1,21 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Brokkonaut +Date: Sat, 18 Dec 2021 08:26:55 +0100 +Subject: [PATCH] Make water animal spawn height configurable + + +diff --git a/src/main/java/net/minecraft/world/entity/animal/WaterAnimal.java b/src/main/java/net/minecraft/world/entity/animal/WaterAnimal.java +index 522abd880c1e7f7c9026f0ab6457bc649f11802c..18389f46902bb9879ac6d734723e9a720724dc48 100644 +--- a/src/main/java/net/minecraft/world/entity/animal/WaterAnimal.java ++++ b/src/main/java/net/minecraft/world/entity/animal/WaterAnimal.java +@@ -79,6 +79,10 @@ public abstract class WaterAnimal extends PathfinderMob { + public static boolean checkSurfaceWaterAnimalSpawnRules(EntityType type, LevelAccessor world, MobSpawnType reason, BlockPos pos, RandomSource random) { + int i = world.getSeaLevel(); + int j = i - 13; ++ // Paper start ++ i = world.getMinecraftWorld().paperConfig().entities.spawning.wateranimalSpawnHeight.maximum.or(i); ++ j = world.getMinecraftWorld().paperConfig().entities.spawning.wateranimalSpawnHeight.minimum.or(j); ++ // Paper end + return pos.getY() >= j && pos.getY() <= i && world.getFluidState(pos.below()).is(FluidTags.WATER) && world.getBlockState(pos.above()).is(Blocks.WATER); + } + } diff --git a/patches/server/0825-Expose-vanilla-BiomeProvider-from-WorldInfo.patch b/patches/server/0824-Expose-vanilla-BiomeProvider-from-WorldInfo.patch similarity index 95% rename from patches/server/0825-Expose-vanilla-BiomeProvider-from-WorldInfo.patch rename to patches/server/0824-Expose-vanilla-BiomeProvider-from-WorldInfo.patch index f483c21363..c0756dcefd 100644 --- a/patches/server/0825-Expose-vanilla-BiomeProvider-from-WorldInfo.patch +++ b/patches/server/0824-Expose-vanilla-BiomeProvider-from-WorldInfo.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Expose vanilla BiomeProvider from WorldInfo diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index 6279b843ad04769b202b74913e328c86f256ee13..6d86f794228bf3617563f2096877957bf2d0e764 100644 +index 79153def3866e9761fcd6eca7d81574fe64f2895..89c92a626df832b2be41064ab48b10b981c06016 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java -@@ -558,7 +558,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop iregistry = worlddata.worldGenSettings().dimensions(); LevelStem worlddimension = (LevelStem) iregistry.get(actualDimension); @@ -31,7 +31,7 @@ index 46ff259c64560ac7371e138627bf1b71227d308b..1cde2ce9cf081f28ec93cd4d79d8d725 biomeProvider = generator.getDefaultBiomeProvider(worldInfo); } diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java -index 58f6348b04d776d510c0ede4e36a202e2fcb765c..17828c924fa20ebc1d72f73adf62f1c0cb078a68 100644 +index c4913fd3efb52669645d2d71bce1bdf71d4fa063..335bf78d95418fbc7718177f012c71c392ab554c 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java @@ -195,6 +195,30 @@ public class CraftWorld extends CraftRegionAccessor implements World { diff --git a/patches/server/0824-Make-water-animal-spawn-height-configurable.patch b/patches/server/0824-Make-water-animal-spawn-height-configurable.patch deleted file mode 100644 index 7fdc96c597..0000000000 --- a/patches/server/0824-Make-water-animal-spawn-height-configurable.patch +++ /dev/null @@ -1,50 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Brokkonaut -Date: Sat, 18 Dec 2021 08:26:55 +0100 -Subject: [PATCH] Make water animal spawn height configurable - - -diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -index 4933961ab8bc29749c053c6c54c5d2138f2c1742..88938b54b504b10c5cb0d22f2daa5fcb4075e12c 100644 ---- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -@@ -426,6 +426,24 @@ public class PaperWorldConfig { - mobSpawnerTickRate = getInt("mob-spawner-tick-rate", 1); - } - -+ public Integer waterAnimalMaxSpawnHeight; -+ private void waterAnimalMaxSpawnHeight() { -+ String v = getString("wateranimal-spawn-height.maximum", "default"); -+ try { -+ waterAnimalMaxSpawnHeight = Integer.parseInt(v); -+ } catch (NumberFormatException ignored) { -+ } -+ } -+ -+ public Integer waterAnimalMinSpawnHeight; -+ private void waterAnimalMinSpawnHeight() { -+ String v = getString("wateranimal-spawn-height.minimum", "default"); -+ try { -+ waterAnimalMinSpawnHeight = Integer.parseInt(v); -+ } catch (NumberFormatException ignored) { -+ } -+ } -+ - public int containerUpdateTickRate; - private void containerUpdateTickRate() { - containerUpdateTickRate = getInt("container-update-tick-rate", 1); -diff --git a/src/main/java/net/minecraft/world/entity/animal/WaterAnimal.java b/src/main/java/net/minecraft/world/entity/animal/WaterAnimal.java -index 522abd880c1e7f7c9026f0ab6457bc649f11802c..1b6d426b44e200b3634c0a9ac7c3a315841ada40 100644 ---- a/src/main/java/net/minecraft/world/entity/animal/WaterAnimal.java -+++ b/src/main/java/net/minecraft/world/entity/animal/WaterAnimal.java -@@ -79,6 +79,10 @@ public abstract class WaterAnimal extends PathfinderMob { - public static boolean checkSurfaceWaterAnimalSpawnRules(EntityType type, LevelAccessor world, MobSpawnType reason, BlockPos pos, RandomSource random) { - int i = world.getSeaLevel(); - int j = i - 13; -+ // Paper start -+ i = world.getMinecraftWorld().paperConfig.waterAnimalMaxSpawnHeight != null ? world.getMinecraftWorld().paperConfig.waterAnimalMaxSpawnHeight : i; -+ j = world.getMinecraftWorld().paperConfig.waterAnimalMinSpawnHeight != null ? world.getMinecraftWorld().paperConfig.waterAnimalMinSpawnHeight : j; -+ // Paper end - return pos.getY() >= j && pos.getY() <= i && world.getFluidState(pos.below()).is(FluidTags.WATER) && world.getBlockState(pos.above()).is(Blocks.WATER); - } - } diff --git a/patches/server/0825-Add-config-option-for-worlds-affected-by-time-cmd.patch b/patches/server/0825-Add-config-option-for-worlds-affected-by-time-cmd.patch new file mode 100644 index 0000000000..de155852d0 --- /dev/null +++ b/patches/server/0825-Add-config-option-for-worlds-affected-by-time-cmd.patch @@ -0,0 +1,28 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Jake Potrebic +Date: Sun, 2 Jan 2022 22:34:51 -0800 +Subject: [PATCH] Add config option for worlds affected by time cmd + + +diff --git a/src/main/java/net/minecraft/server/commands/TimeCommand.java b/src/main/java/net/minecraft/server/commands/TimeCommand.java +index e1908c2fcad3d1505bdcd65ba7ceb3dfa42c5c39..f0a7a8df3caa2ea765bb0a87cfede71d0995d276 100644 +--- a/src/main/java/net/minecraft/server/commands/TimeCommand.java ++++ b/src/main/java/net/minecraft/server/commands/TimeCommand.java +@@ -51,7 +51,7 @@ public class TimeCommand { + } + + public static int setTime(CommandSourceStack source, int time) { +- Iterator iterator = com.google.common.collect.Iterators.singletonIterator(source.getLevel()); // CraftBukkit - SPIGOT-6496: Only set the time for the world the command originates in ++ Iterator iterator = io.papermc.paper.configuration.GlobalConfiguration.get().commands.timeCommandAffectsAllWorlds ? source.getServer().getAllLevels().iterator() : com.google.common.collect.Iterators.singletonIterator(source.getLevel()); // CraftBukkit - SPIGOT-6496: Only set the time for the world the command originates in // Paper - add config option for spigot's change + + while (iterator.hasNext()) { + ServerLevel worldserver = (ServerLevel) iterator.next(); +@@ -70,7 +70,7 @@ public class TimeCommand { + } + + public static int addTime(CommandSourceStack source, int time) { +- Iterator iterator = com.google.common.collect.Iterators.singletonIterator(source.getLevel()); // CraftBukkit - SPIGOT-6496: Only set the time for the world the command originates in ++ Iterator iterator = io.papermc.paper.configuration.GlobalConfiguration.get().commands.timeCommandAffectsAllWorlds ? source.getServer().getAllLevels().iterator() : com.google.common.collect.Iterators.singletonIterator(source.getLevel()); // CraftBukkit - SPIGOT-6496: Only set the time for the world the command originates in // Paper - add config option for spigot's change + + while (iterator.hasNext()) { + ServerLevel worldserver = (ServerLevel) iterator.next(); diff --git a/patches/server/0826-Add-config-option-for-worlds-affected-by-time-cmd.patch b/patches/server/0826-Add-config-option-for-worlds-affected-by-time-cmd.patch deleted file mode 100644 index 8a883d44a8..0000000000 --- a/patches/server/0826-Add-config-option-for-worlds-affected-by-time-cmd.patch +++ /dev/null @@ -1,42 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Jake Potrebic -Date: Sun, 2 Jan 2022 22:34:51 -0800 -Subject: [PATCH] Add config option for worlds affected by time cmd - - -diff --git a/src/main/java/com/destroystokyo/paper/PaperConfig.java b/src/main/java/com/destroystokyo/paper/PaperConfig.java -index 6706e502a068766e2eff3f790bbca004698932d1..8fff289a02234cbe5e808fe6e736788a2ed1e5c2 100644 ---- a/src/main/java/com/destroystokyo/paper/PaperConfig.java -+++ b/src/main/java/com/destroystokyo/paper/PaperConfig.java -@@ -637,4 +637,9 @@ public class PaperConfig { - private static void sendFullPosForHardCollidingEntities() { - sendFullPosForHardCollidingEntities = getBoolean("settings.send-full-pos-for-hard-colliding-entities", true); - } -+ -+ public static boolean timeCommandAffectsAllWorlds = false; // See https://hub.spigotmc.org/stash/projects/SPIGOT/repos/craftbukkit/commits/aeaeb359317e6ba25b7c45cf6d70ff945a3777cf -+ private static void timeCommandAffectsAllWorlds() { -+ timeCommandAffectsAllWorlds = getBoolean("settings.time-command-affects-all-worlds", timeCommandAffectsAllWorlds); -+ } - } -diff --git a/src/main/java/net/minecraft/server/commands/TimeCommand.java b/src/main/java/net/minecraft/server/commands/TimeCommand.java -index e1908c2fcad3d1505bdcd65ba7ceb3dfa42c5c39..b462a2ea6150bf749e8632d0abda11c0aa84247c 100644 ---- a/src/main/java/net/minecraft/server/commands/TimeCommand.java -+++ b/src/main/java/net/minecraft/server/commands/TimeCommand.java -@@ -51,7 +51,7 @@ public class TimeCommand { - } - - public static int setTime(CommandSourceStack source, int time) { -- Iterator iterator = com.google.common.collect.Iterators.singletonIterator(source.getLevel()); // CraftBukkit - SPIGOT-6496: Only set the time for the world the command originates in -+ Iterator iterator = com.destroystokyo.paper.PaperConfig.timeCommandAffectsAllWorlds ? source.getServer().getAllLevels().iterator() : com.google.common.collect.Iterators.singletonIterator(source.getLevel()); // CraftBukkit - SPIGOT-6496: Only set the time for the world the command originates in // Paper - add config option for spigot's change - - while (iterator.hasNext()) { - ServerLevel worldserver = (ServerLevel) iterator.next(); -@@ -70,7 +70,7 @@ public class TimeCommand { - } - - public static int addTime(CommandSourceStack source, int time) { -- Iterator iterator = com.google.common.collect.Iterators.singletonIterator(source.getLevel()); // CraftBukkit - SPIGOT-6496: Only set the time for the world the command originates in -+ Iterator iterator = com.destroystokyo.paper.PaperConfig.timeCommandAffectsAllWorlds ? source.getServer().getAllLevels().iterator() : com.google.common.collect.Iterators.singletonIterator(source.getLevel()); // CraftBukkit - SPIGOT-6496: Only set the time for the world the command originates in // Paper - add config option for spigot's change - - while (iterator.hasNext()) { - ServerLevel worldserver = (ServerLevel) iterator.next(); diff --git a/patches/server/0827-Add-new-overload-to-PersistentDataContainer-has.patch b/patches/server/0826-Add-new-overload-to-PersistentDataContainer-has.patch similarity index 100% rename from patches/server/0827-Add-new-overload-to-PersistentDataContainer-has.patch rename to patches/server/0826-Add-new-overload-to-PersistentDataContainer-has.patch diff --git a/patches/server/0828-Multiple-Entries-with-Scoreboards.patch b/patches/server/0827-Multiple-Entries-with-Scoreboards.patch similarity index 98% rename from patches/server/0828-Multiple-Entries-with-Scoreboards.patch rename to patches/server/0827-Multiple-Entries-with-Scoreboards.patch index 7a237549c3..b644176ac9 100644 --- a/patches/server/0828-Multiple-Entries-with-Scoreboards.patch +++ b/patches/server/0827-Multiple-Entries-with-Scoreboards.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Multiple Entries with Scoreboards diff --git a/src/main/java/net/minecraft/network/protocol/game/ClientboundSetPlayerTeamPacket.java b/src/main/java/net/minecraft/network/protocol/game/ClientboundSetPlayerTeamPacket.java -index c5339618c195507c1d1482e4e77e262e8db240a5..fe01daf9f78dff51b97337af8cfd43f19bc4678e 100644 +index ee37ec0de1ca969144824427ae42b0c81434a1b4..4ebe22ac20f1a98694cc3bec570ef5bbf06f00aa 100644 --- a/src/main/java/net/minecraft/network/protocol/game/ClientboundSetPlayerTeamPacket.java +++ b/src/main/java/net/minecraft/network/protocol/game/ClientboundSetPlayerTeamPacket.java @@ -42,6 +42,12 @@ public class ClientboundSetPlayerTeamPacket implements Packet 50 && pos.getY() < 70 && random.nextFloat() < 0.5F && random.nextFloat() < world.getMoonBrightness() && world.getMaxLocalRawBrightness(pos) <= random.nextInt(8)) { + // Paper start - Replace rules for Height in Swamp Biome -+ final double maxHeightSwamp = world.getMinecraftWorld().paperConfig.slimeMaxSpawnHeightInSwamp; -+ final double minHeightSwamp = world.getMinecraftWorld().paperConfig.slimeMinSpawnHeightInSwamp; ++ final double maxHeightSwamp = world.getMinecraftWorld().paperConfig().entities.spawning.slimeSpawnHeight.swampBiome.maximum; ++ final double minHeightSwamp = world.getMinecraftWorld().paperConfig().entities.spawning.slimeSpawnHeight.swampBiome.minimum; + if (world.getBiome(pos).is(net.minecraft.world.level.biome.Biomes.SWAMP) && pos.getY() > minHeightSwamp && pos.getY() < maxHeightSwamp && random.nextFloat() < 0.5F && random.nextFloat() < world.getMoonBrightness() && world.getMaxLocalRawBrightness(pos) <= random.nextInt(8)) { + // Paper end return checkMobSpawnRules(type, world, spawnReason, pos, random); @@ -44,11 +23,11 @@ index bdc6a7e6a9fcd467f653d53afd7ca2e33776fb06..7c17954fbd5ff4b8e6e57a5fd587f6e2 @@ -331,7 +335,10 @@ public class Slime extends Mob implements Enemy { ChunkPos chunkcoordintpair = new ChunkPos(pos); - boolean flag = world.getMinecraftWorld().paperConfig.allChunksAreSlimeChunks || WorldgenRandom.seedSlimeChunk(chunkcoordintpair.x, chunkcoordintpair.z, ((WorldGenLevel) world).getSeed(), world.getMinecraftWorld().spigotConfig.slimeSeed).nextInt(10) == 0; // Spigot // Paper + boolean flag = world.getMinecraftWorld().paperConfig().entities.spawning.allChunksAreSlimeChunks || WorldgenRandom.seedSlimeChunk(chunkcoordintpair.x, chunkcoordintpair.z, ((WorldGenLevel) world).getSeed(), world.getMinecraftWorld().spigotConfig.slimeSeed).nextInt(10) == 0; // Spigot // Paper - if (random.nextInt(10) == 0 && flag && pos.getY() < 40) { + // Paper start - Replace rules for Height in Slime Chunks -+ final double maxHeightSlimeChunk = world.getMinecraftWorld().paperConfig.slimeMaxSpawnHeightInSlimeChunks; ++ final double maxHeightSlimeChunk = world.getMinecraftWorld().paperConfig().entities.spawning.slimeSpawnHeight.slimeChunk.maximum; + if (random.nextInt(10) == 0 && flag && pos.getY() < maxHeightSlimeChunk) { + // Paper end return checkMobSpawnRules(type, world, spawnReason, pos, random); diff --git a/patches/server/0831-Added-getHostname-to-AsyncPlayerPreLoginEvent.patch b/patches/server/0830-Added-getHostname-to-AsyncPlayerPreLoginEvent.patch similarity index 89% rename from patches/server/0831-Added-getHostname-to-AsyncPlayerPreLoginEvent.patch rename to patches/server/0830-Added-getHostname-to-AsyncPlayerPreLoginEvent.patch index f587edffcd..df4a1e9af8 100644 --- a/patches/server/0831-Added-getHostname-to-AsyncPlayerPreLoginEvent.patch +++ b/patches/server/0830-Added-getHostname-to-AsyncPlayerPreLoginEvent.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Added getHostname to AsyncPlayerPreLoginEvent diff --git a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java -index 221f32e034ccb57907f79bae4ecec324e9cdb14e..9311130b5401cda69c62b5b5c23718554b94ab84 100644 +index e581656c4450be708f1a91a42b5b1da9105df6f3..5f46bdcb109ec4af7e1241a278737b3dc41299f5 100644 --- a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java -@@ -455,7 +455,7 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener +@@ -454,7 +454,7 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener // Paper start com.destroystokyo.paper.profile.PlayerProfile profile = com.destroystokyo.paper.profile.CraftPlayerProfile.asBukkitMirror(ServerLoginPacketListenerImpl.this.gameProfile); diff --git a/patches/server/0832-Fix-xp-reward-for-baby-zombies.patch b/patches/server/0831-Fix-xp-reward-for-baby-zombies.patch similarity index 88% rename from patches/server/0832-Fix-xp-reward-for-baby-zombies.patch rename to patches/server/0831-Fix-xp-reward-for-baby-zombies.patch index 77ad44ff96..42920471c5 100644 --- a/patches/server/0832-Fix-xp-reward-for-baby-zombies.patch +++ b/patches/server/0831-Fix-xp-reward-for-baby-zombies.patch @@ -9,10 +9,10 @@ so this resets it after each call to Zombie#getExperienceReward diff --git a/src/main/java/net/minecraft/world/entity/monster/Zombie.java b/src/main/java/net/minecraft/world/entity/monster/Zombie.java -index 4e348ea70ecc3836befcffcaa27c12a104f29c2a..7b01bd1409dcb64c097badbbd73110d40e712751 100644 +index 3e1fa4336cc18eaeb048d0a1d592cf74820ff3b2..97b3082dc020043fa38d9e5e4591102f97519ed3 100644 --- a/src/main/java/net/minecraft/world/entity/monster/Zombie.java +++ b/src/main/java/net/minecraft/world/entity/monster/Zombie.java -@@ -172,11 +172,16 @@ public class Zombie extends Monster { +@@ -173,11 +173,16 @@ public class Zombie extends Monster { @Override public int getExperienceReward() { diff --git a/patches/server/0833-Kick-on-main-for-illegal-chars.patch b/patches/server/0832-Kick-on-main-for-illegal-chars.patch similarity index 95% rename from patches/server/0833-Kick-on-main-for-illegal-chars.patch rename to patches/server/0832-Kick-on-main-for-illegal-chars.patch index 56aa81cdcc..b44ee58b7d 100644 --- a/patches/server/0833-Kick-on-main-for-illegal-chars.patch +++ b/patches/server/0832-Kick-on-main-for-illegal-chars.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Kick on main for illegal chars diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index 8b033cdd65402950e597efab7b2407f5baf4c3aa..56208159d46a25de26ab6ce4b65eae27c93297e7 100644 +index b93e6c14141f3ed3bc74c786eb56cf462510218a..fa4a5dc33887e403330933c2d00adb0220e5cc2d 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java @@ -2104,7 +2104,9 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser diff --git a/patches/server/0834-Multi-Block-Change-API-Implementation.patch b/patches/server/0833-Multi-Block-Change-API-Implementation.patch similarity index 97% rename from patches/server/0834-Multi-Block-Change-API-Implementation.patch rename to patches/server/0833-Multi-Block-Change-API-Implementation.patch index 68af38205f..155b70e6c6 100644 --- a/patches/server/0834-Multi-Block-Change-API-Implementation.patch +++ b/patches/server/0833-Multi-Block-Change-API-Implementation.patch @@ -25,7 +25,7 @@ index 82ea4fabd5732052a286d50bcff8bbcc2c4aa7d7..652bea6868a03a5315965f79c76172fb public void write(FriendlyByteBuf buf) { buf.writeLong(this.sectionPos.asLong()); diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -index ec42e6394a1a2f669ab52923c04500722ef9908e..9bda669683a3062f99e798ea0a60d76373d46f4f 100644 +index bf36699c7844b78d63eb252acd5006f4f06a5ec4..bcc13411b91850f594838e77e04448b49c875b07 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java @@ -29,6 +29,7 @@ import java.util.logging.Logger; diff --git a/patches/server/0835-Fix-NotePlayEvent.patch b/patches/server/0834-Fix-NotePlayEvent.patch similarity index 100% rename from patches/server/0835-Fix-NotePlayEvent.patch rename to patches/server/0834-Fix-NotePlayEvent.patch diff --git a/patches/server/0836-Freeze-Tick-Lock-API.patch b/patches/server/0835-Freeze-Tick-Lock-API.patch similarity index 95% rename from patches/server/0836-Freeze-Tick-Lock-API.patch rename to patches/server/0835-Freeze-Tick-Lock-API.patch index 5d19547221..d09d17ad30 100644 --- a/patches/server/0836-Freeze-Tick-Lock-API.patch +++ b/patches/server/0835-Freeze-Tick-Lock-API.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Freeze Tick Lock API diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java -index 0d8ff9f36073afd92eee815af0c0e04332b60c91..5f5c62e53fc656e3b239bcea06081b22e5bf923e 100644 +index 71702c915e9519f85904af0e652e692bb1ba596f..ef40762094cc862716e1f8219cdbbf53bfde97b5 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java @@ -391,6 +391,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource { @@ -46,7 +46,7 @@ index 0d8ff9f36073afd92eee815af0c0e04332b60c91..5f5c62e53fc656e3b239bcea06081b22 } catch (Throwable throwable) { diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java -index 7bd5c41c08d198c4278486a245872d2f31162627..f2ac92cdd718d351e0cea7fd1d05008a4b5734b7 100644 +index cca07ef0100749a12aa86b0d97bbc61adc0db7f5..c4e164fd5ae03f5a7f2965c2011b71451afdadc8 100644 --- a/src/main/java/net/minecraft/world/entity/LivingEntity.java +++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java @@ -3351,7 +3351,7 @@ public abstract class LivingEntity extends Entity { diff --git a/patches/server/0837-Dolphin-API.patch b/patches/server/0836-Dolphin-API.patch similarity index 100% rename from patches/server/0837-Dolphin-API.patch rename to patches/server/0836-Dolphin-API.patch diff --git a/patches/server/0838-More-PotionEffectType-API.patch b/patches/server/0837-More-PotionEffectType-API.patch similarity index 100% rename from patches/server/0838-More-PotionEffectType-API.patch rename to patches/server/0837-More-PotionEffectType-API.patch diff --git a/patches/server/0839-Use-a-CHM-for-StructureTemplate.Pallete-cache.patch b/patches/server/0838-Use-a-CHM-for-StructureTemplate.Pallete-cache.patch similarity index 100% rename from patches/server/0839-Use-a-CHM-for-StructureTemplate.Pallete-cache.patch rename to patches/server/0838-Use-a-CHM-for-StructureTemplate.Pallete-cache.patch diff --git a/patches/server/0840-API-for-creating-command-sender-which-forwards-feedb.patch b/patches/server/0839-API-for-creating-command-sender-which-forwards-feedb.patch similarity index 97% rename from patches/server/0840-API-for-creating-command-sender-which-forwards-feedb.patch rename to patches/server/0839-API-for-creating-command-sender-which-forwards-feedb.patch index a14c960f96..e67db46bf9 100644 --- a/patches/server/0840-API-for-creating-command-sender-which-forwards-feedb.patch +++ b/patches/server/0839-API-for-creating-command-sender-which-forwards-feedb.patch @@ -122,10 +122,10 @@ index 0000000000000000000000000000000000000000..e3a5f1ec376319bdfda87fa27ae217bf + } +} diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -index 1cde2ce9cf081f28ec93cd4d79d8d72500e641a7..08599184848a95884545cdc5a2a5cf1c08c53715 100644 +index b54a924734145a307dfa46c88bc01d548b479671..4a3810037e5d56e1d279a715d5e16c377740b481 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -@@ -1970,6 +1970,13 @@ public final class CraftServer implements Server { +@@ -1969,6 +1969,13 @@ public final class CraftServer implements Server { return console.console; } diff --git a/patches/server/0841-Add-config-for-stronghold-seed.patch b/patches/server/0840-Add-config-for-stronghold-seed.patch similarity index 96% rename from patches/server/0841-Add-config-for-stronghold-seed.patch rename to patches/server/0840-Add-config-for-stronghold-seed.patch index e0b55d4fdc..ba72abba3e 100644 --- a/patches/server/0841-Add-config-for-stronghold-seed.patch +++ b/patches/server/0840-Add-config-for-stronghold-seed.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Add config for stronghold seed diff --git a/src/main/java/net/minecraft/world/level/chunk/ChunkGenerator.java b/src/main/java/net/minecraft/world/level/chunk/ChunkGenerator.java -index 05c8b3f54ecb4221dcbf37574240401d93e14e7a..1af3570d080e8d2203434a52634e1eab86a7bf36 100644 +index ec7343c7acb438781026b25390528889209fe97a..13e67cd49ce37c76325ddb2277fde44c871a1901 100644 --- a/src/main/java/net/minecraft/world/level/chunk/ChunkGenerator.java +++ b/src/main/java/net/minecraft/world/level/chunk/ChunkGenerator.java @@ -236,7 +236,13 @@ public abstract class ChunkGenerator { diff --git a/patches/server/0842-Implement-regenerateChunk.patch b/patches/server/0841-Implement-regenerateChunk.patch similarity index 98% rename from patches/server/0842-Implement-regenerateChunk.patch rename to patches/server/0841-Implement-regenerateChunk.patch index 7e8b25af65..81b580c897 100644 --- a/patches/server/0842-Implement-regenerateChunk.patch +++ b/patches/server/0841-Implement-regenerateChunk.patch @@ -6,7 +6,7 @@ Subject: [PATCH] Implement regenerateChunk Co-authored-by: Jason Penilla <11360596+jpenilla@users.noreply.github.com> diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java -index 17828c924fa20ebc1d72f73adf62f1c0cb078a68..2e9b782e34ae25e982b45011a36c3b08ab298648 100644 +index 335bf78d95418fbc7718177f012c71c392ab554c..d908eb6b1208cf69f2f1282ddf1c20dc04d092d1 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java @@ -133,6 +133,7 @@ import org.bukkit.util.Vector; diff --git a/patches/server/0843-Log-exceptions-thrown-during-chat-processing.patch b/patches/server/0842-Log-exceptions-thrown-during-chat-processing.patch similarity index 100% rename from patches/server/0843-Log-exceptions-thrown-during-chat-processing.patch rename to patches/server/0842-Log-exceptions-thrown-during-chat-processing.patch diff --git a/patches/server/0844-Fix-cancelled-powdered-snow-bucket-placement.patch b/patches/server/0843-Fix-cancelled-powdered-snow-bucket-placement.patch similarity index 100% rename from patches/server/0844-Fix-cancelled-powdered-snow-bucket-placement.patch rename to patches/server/0843-Fix-cancelled-powdered-snow-bucket-placement.patch diff --git a/patches/server/0845-Add-missing-Validate-calls-to-CraftServer-getSpawnLi.patch b/patches/server/0844-Add-missing-Validate-calls-to-CraftServer-getSpawnLi.patch similarity index 86% rename from patches/server/0845-Add-missing-Validate-calls-to-CraftServer-getSpawnLi.patch rename to patches/server/0844-Add-missing-Validate-calls-to-CraftServer-getSpawnLi.patch index 5f470d4ad8..47573f9c8c 100644 --- a/patches/server/0845-Add-missing-Validate-calls-to-CraftServer-getSpawnLi.patch +++ b/patches/server/0844-Add-missing-Validate-calls-to-CraftServer-getSpawnLi.patch @@ -6,10 +6,10 @@ Subject: [PATCH] Add missing Validate calls to CraftServer#getSpawnLimit Copies appropriate checks from CraftWorld#getSpawnLimit diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -index 08599184848a95884545cdc5a2a5cf1c08c53715..feca9ee02e4b8fc30e9e29a36c7e6225c82f4bab 100644 +index 4a3810037e5d56e1d279a715d5e16c377740b481..5765039cfd016732ca20fa656cdf76b478765421 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -@@ -2139,6 +2139,8 @@ public final class CraftServer implements Server { +@@ -2138,6 +2138,8 @@ public final class CraftServer implements Server { @Override public int getSpawnLimit(SpawnCategory spawnCategory) { // Paper start diff --git a/patches/server/0846-Add-GameEvent-tags.patch b/patches/server/0845-Add-GameEvent-tags.patch similarity index 94% rename from patches/server/0846-Add-GameEvent-tags.patch rename to patches/server/0845-Add-GameEvent-tags.patch index 6b61237c17..c1dd1233c6 100644 --- a/patches/server/0846-Add-GameEvent-tags.patch +++ b/patches/server/0845-Add-GameEvent-tags.patch @@ -45,10 +45,10 @@ index 0000000000000000000000000000000000000000..cb78a3d4e21376ea24347187478525d5 + } +} diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -index feca9ee02e4b8fc30e9e29a36c7e6225c82f4bab..303385d6c05102f56b696023cc1bd3d364f448f8 100644 +index 5765039cfd016732ca20fa656cdf76b478765421..cf0cb900b71eb2369795b51350be828b219613f5 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -@@ -2545,6 +2545,15 @@ public final class CraftServer implements Server { +@@ -2544,6 +2544,15 @@ public final class CraftServer implements Server { return (org.bukkit.Tag) new CraftEntityTag(Registry.ENTITY_TYPE, entityTagKey); } } @@ -64,7 +64,7 @@ index feca9ee02e4b8fc30e9e29a36c7e6225c82f4bab..303385d6c05102f56b696023cc1bd3d3 default -> throw new IllegalArgumentException(); } -@@ -2577,6 +2586,13 @@ public final class CraftServer implements Server { +@@ -2576,6 +2585,13 @@ public final class CraftServer implements Server { Registry> entityTags = Registry.ENTITY_TYPE; return entityTags.getTags().map(pair -> (org.bukkit.Tag) new CraftEntityTag(entityTags, pair.getFirst())).collect(ImmutableList.toImmutableList()); } diff --git a/patches/server/0847-Execute-chunk-tasks-fairly-for-worlds-while-waiting-.patch b/patches/server/0846-Execute-chunk-tasks-fairly-for-worlds-while-waiting-.patch similarity index 94% rename from patches/server/0847-Execute-chunk-tasks-fairly-for-worlds-while-waiting-.patch rename to patches/server/0846-Execute-chunk-tasks-fairly-for-worlds-while-waiting-.patch index ae9a89b362..095d993b1a 100644 --- a/patches/server/0847-Execute-chunk-tasks-fairly-for-worlds-while-waiting-.patch +++ b/patches/server/0846-Execute-chunk-tasks-fairly-for-worlds-while-waiting-.patch @@ -9,7 +9,7 @@ This might result in chunks loading far slower in the nether, for example. diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index 6d86f794228bf3617563f2096877957bf2d0e764..90a06ecb242bb5222eccf3839d6d1bcbfde6f680 100644 +index 89c92a626df832b2be41064ab48b10b981c06016..8b6b0c3998e57551b1fc6e2918edfde0abea8f35 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java @@ -1312,6 +1312,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop spawners; -+ if (com.destroystokyo.paper.PaperConfig.useDimensionTypeForCustomSpawners && this.registryHolder.registryOrThrow(Registry.DIMENSION_TYPE_REGISTRY).getResourceKey(worlddimension.typeHolder().value()).orElseThrow() == net.minecraft.world.level.dimension.BuiltinDimensionTypes.OVERWORLD) { ++ if (io.papermc.paper.configuration.GlobalConfiguration.get().misc.useDimensionTypeForCustomSpawners && this.registryHolder.registryOrThrow(Registry.DIMENSION_TYPE_REGISTRY).getResourceKey(worlddimension.typeHolder().value()).orElseThrow() == net.minecraft.world.level.dimension.BuiltinDimensionTypes.OVERWORLD) { + spawners = list; + } else { + spawners = Collections.emptyList(); diff --git a/patches/server/0852-Put-world-into-worldlist-before-initing-the-world.patch b/patches/server/0851-Put-world-into-worldlist-before-initing-the-world.patch similarity index 85% rename from patches/server/0852-Put-world-into-worldlist-before-initing-the-world.patch rename to patches/server/0851-Put-world-into-worldlist-before-initing-the-world.patch index e3a6d31d8d..28f16deada 100644 --- a/patches/server/0852-Put-world-into-worldlist-before-initing-the-world.patch +++ b/patches/server/0851-Put-world-into-worldlist-before-initing-the-world.patch @@ -7,10 +7,10 @@ Some parts of legacy conversion will need the overworld to get the legacy structure data storage diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index b4bb70dd7f0275c04d64d7f4f4c2133a1d1f13aa..c13e9eab1f25f0a59f775186f1b1d6f3fde301da 100644 +index bde42c164acaf823e1de658b16eb4c999de65b2d..c91d6458bba97ae35c4c1ddc641f48e969986d39 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java -@@ -597,9 +597,10 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop 0 ? new RateKickingConnection(j) : new Connection(PacketFlow.SERVERBOUND); + // Paper start - Add support for Proxy Protocol -+ if (com.destroystokyo.paper.PaperConfig.useProxyProtocol) { ++ if (io.papermc.paper.configuration.GlobalConfiguration.get().proxies.proxyProtocol) { + channel.pipeline().addAfter("timeout", "haproxy-decoder", new io.netty.handler.codec.haproxy.HAProxyMessageDecoder()); + channel.pipeline().addAfter("haproxy-decoder", "haproxy-handler", new ChannelInboundHandlerAdapter() { + @Override diff --git a/patches/server/0896-Fix-OfflinePlayer-getBedSpawnLocation.patch b/patches/server/0895-Fix-OfflinePlayer-getBedSpawnLocation.patch similarity index 100% rename from patches/server/0896-Fix-OfflinePlayer-getBedSpawnLocation.patch rename to patches/server/0895-Fix-OfflinePlayer-getBedSpawnLocation.patch diff --git a/patches/server/0897-Fix-FurnaceInventory-for-smokers-and-blast-furnaces.patch b/patches/server/0896-Fix-FurnaceInventory-for-smokers-and-blast-furnaces.patch similarity index 100% rename from patches/server/0897-Fix-FurnaceInventory-for-smokers-and-blast-furnaces.patch rename to patches/server/0896-Fix-FurnaceInventory-for-smokers-and-blast-furnaces.patch diff --git a/patches/server/0898-Sanitize-Sent-BlockEntity-NBT.patch b/patches/server/0897-Sanitize-Sent-BlockEntity-NBT.patch similarity index 100% rename from patches/server/0898-Sanitize-Sent-BlockEntity-NBT.patch rename to patches/server/0897-Sanitize-Sent-BlockEntity-NBT.patch diff --git a/patches/server/0899-Prevent-entity-loading-causing-async-lookups.patch b/patches/server/0898-Prevent-entity-loading-causing-async-lookups.patch similarity index 96% rename from patches/server/0899-Prevent-entity-loading-causing-async-lookups.patch rename to patches/server/0898-Prevent-entity-loading-causing-async-lookups.patch index 1abd898d55..7ee45303d4 100644 --- a/patches/server/0899-Prevent-entity-loading-causing-async-lookups.patch +++ b/patches/server/0898-Prevent-entity-loading-causing-async-lookups.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Prevent entity loading causing async lookups diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java -index e28c48d4e000eec335cd25555d1723147f28a043..0473a4d80f58538ea3cabcd38684339b27c1d29c 100644 +index 87644f9f8e7ee1f0e2745f0d1344b78e26581fe5..ade1e37d20ef3021f73da6d1905cea76d3ff0aa7 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java @@ -782,6 +782,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource { diff --git a/patches/server/0899-Disable-component-selector-resolving-in-books-by-def.patch b/patches/server/0899-Disable-component-selector-resolving-in-books-by-def.patch new file mode 100644 index 0000000000..d79b7fb1b1 --- /dev/null +++ b/patches/server/0899-Disable-component-selector-resolving-in-books-by-def.patch @@ -0,0 +1,19 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Nassim Jahnke +Date: Thu, 2 Jun 2022 20:35:58 +0200 +Subject: [PATCH] Disable component selector resolving in books by default + + +diff --git a/src/main/java/net/minecraft/world/item/WrittenBookItem.java b/src/main/java/net/minecraft/world/item/WrittenBookItem.java +index a324df312d9bb87d9e0962f8028d900933e70c07..31911c09fe15753ae32fa39417bdc9e9de552a88 100644 +--- a/src/main/java/net/minecraft/world/item/WrittenBookItem.java ++++ b/src/main/java/net/minecraft/world/item/WrittenBookItem.java +@@ -111,7 +111,7 @@ public class WrittenBookItem extends Item { + + public static boolean resolveBookComponents(ItemStack book, @Nullable CommandSourceStack commandSource, @Nullable Player player) { + CompoundTag compoundTag = book.getTag(); +- if (compoundTag != null && !compoundTag.getBoolean("resolved")) { ++ if (io.papermc.paper.configuration.GlobalConfiguration.get().itemValidation.resolveSelectorsInBooks && compoundTag != null && !compoundTag.getBoolean("resolved")) { // Paper + compoundTag.putBoolean("resolved", true); + if (!makeSureTagIsValid(compoundTag)) { + return false; diff --git a/patches/server/0900-Disable-component-selector-resolving-in-books-by-def.patch b/patches/server/0900-Disable-component-selector-resolving-in-books-by-def.patch deleted file mode 100644 index 0096c73958..0000000000 --- a/patches/server/0900-Disable-component-selector-resolving-in-books-by-def.patch +++ /dev/null @@ -1,33 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Nassim Jahnke -Date: Thu, 2 Jun 2022 20:35:58 +0200 -Subject: [PATCH] Disable component selector resolving in books by default - - -diff --git a/src/main/java/com/destroystokyo/paper/PaperConfig.java b/src/main/java/com/destroystokyo/paper/PaperConfig.java -index d4ff14b9e6028259c27ea9cb2b4be587ebabfb41..83121be2274a33d4188ff6fe37752432dd4e6b22 100644 ---- a/src/main/java/com/destroystokyo/paper/PaperConfig.java -+++ b/src/main/java/com/destroystokyo/paper/PaperConfig.java -@@ -652,4 +652,9 @@ public class PaperConfig { - private static void useProxyProtocol() { - useProxyProtocol = getBoolean("settings.proxy-protocol", false); - } -+ -+ public static boolean resolveSelectorsInBooks; -+ private static void resolveSelectorsInBooks() { -+ resolveSelectorsInBooks = getBoolean("settings.resolve-selectors-in-books", false); -+ } - } -diff --git a/src/main/java/net/minecraft/world/item/WrittenBookItem.java b/src/main/java/net/minecraft/world/item/WrittenBookItem.java -index a324df312d9bb87d9e0962f8028d900933e70c07..de72b4abf38782061f5635dd679a20ba66f09cd5 100644 ---- a/src/main/java/net/minecraft/world/item/WrittenBookItem.java -+++ b/src/main/java/net/minecraft/world/item/WrittenBookItem.java -@@ -111,7 +111,7 @@ public class WrittenBookItem extends Item { - - public static boolean resolveBookComponents(ItemStack book, @Nullable CommandSourceStack commandSource, @Nullable Player player) { - CompoundTag compoundTag = book.getTag(); -- if (compoundTag != null && !compoundTag.getBoolean("resolved")) { -+ if (com.destroystokyo.paper.PaperConfig.resolveSelectorsInBooks && compoundTag != null && !compoundTag.getBoolean("resolved")) { // Paper - compoundTag.putBoolean("resolved", true); - if (!makeSureTagIsValid(compoundTag)) { - return false; diff --git a/patches/server/0901-Throw-exception-on-world-create-while-being-ticked.patch b/patches/server/0900-Throw-exception-on-world-create-while-being-ticked.patch similarity index 91% rename from patches/server/0901-Throw-exception-on-world-create-while-being-ticked.patch rename to patches/server/0900-Throw-exception-on-world-create-while-being-ticked.patch index 0ae7a16bd6..7c8e4bac19 100644 --- a/patches/server/0901-Throw-exception-on-world-create-while-being-ticked.patch +++ b/patches/server/0900-Throw-exception-on-world-create-while-being-ticked.patch @@ -7,7 +7,7 @@ There are no plans to support creating worlds while worlds are being ticked themselvess. diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index 7c311e4db66952e5389900160a27e9db30269f68..a06b1fb0eaba5ed91db4cf34240c1544662b5e97 100644 +index 7afc45a9dd0bdf343f5a9703027772017b716d8c..c3ca919ed60f027d6116a85cb79e3b6cd3bf1619 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java @@ -294,6 +294,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop