Updated Upstream (Paper & Purpur)

This commit is contained in:
AlphaKR93
2023-03-27 12:35:18 +09:00
parent 187067c505
commit b46915c9b2
32 changed files with 275 additions and 1079 deletions

View File

@@ -1,7 +1,7 @@
group = org.plazmamc.plazma
version = 1.19.4-R0.1-SNAPSHOT
paperCommit = d5abb94e69ceed6e73116c13e7634b57b5ad84cf
paperCommit = fbf74ba0ac016c408bbec28e7da317b68a81e2e1
org.gradle.caching = true
org.gradle.parallel = true

View File

@@ -1,6 +1,6 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: AlphaKR93 <dev@alpha93.kr>
Date: Thu, 23 Mar 2023 10:28:40 +0900
Date: Mon, 27 Mar 2023 02:50:22 +0000
Subject: [PATCH] Pufferfish API Changes
Original: Kevin Raneri <kevin.raneri@gmail.com>
@@ -47,7 +47,7 @@ index cad12a2632b9ebb569280441c42869685db1f31a..b83e2c5a0a094002d12aee55ec0cf8d1
into("META-INF/maven/${project.group}/${project.name}")
diff --git a/src/main/java/gg/pufferfish/pufferfish/sentry/SentryContext.java b/src/main/java/gg/pufferfish/pufferfish/sentry/SentryContext.java
new file mode 100644
index 0000000000000000000000000000000000000000..10310fdd53de28efb8a8250f6d3b0c8eb08fb68a
index 0000000000000000000000000000000000000000..6fbaf2a232745db0a41394b1c2cc0cc90cefc4ee
--- /dev/null
+++ b/src/main/java/gg/pufferfish/pufferfish/sentry/SentryContext.java
@@ -0,0 +1,161 @@
@@ -214,7 +214,7 @@ index 0000000000000000000000000000000000000000..10310fdd53de28efb8a8250f6d3b0c8e
+}
diff --git a/src/main/java/gg/pufferfish/pufferfish/simd/SIMDChecker.java b/src/main/java/gg/pufferfish/pufferfish/simd/SIMDChecker.java
new file mode 100644
index 0000000000000000000000000000000000000000..ab5fea0b03224bf249352ce340e94704ff713345
index 0000000000000000000000000000000000000000..6d266ebf5e52745ad13e90e5754b524383fa9b29
--- /dev/null
+++ b/src/main/java/gg/pufferfish/pufferfish/simd/SIMDChecker.java
@@ -0,0 +1,40 @@
@@ -260,7 +260,7 @@ index 0000000000000000000000000000000000000000..ab5fea0b03224bf249352ce340e94704
+}
diff --git a/src/main/java/gg/pufferfish/pufferfish/simd/SIMDDetection.java b/src/main/java/gg/pufferfish/pufferfish/simd/SIMDDetection.java
new file mode 100644
index 0000000000000000000000000000000000000000..a84889d3e9cfc4d7ab5f867820a6484c6070711b
index 0000000000000000000000000000000000000000..fd708554d6dab2ddcd24c3024330b8ebf9462111
--- /dev/null
+++ b/src/main/java/gg/pufferfish/pufferfish/simd/SIMDDetection.java
@@ -0,0 +1,35 @@
@@ -301,7 +301,7 @@ index 0000000000000000000000000000000000000000..a84889d3e9cfc4d7ab5f867820a6484c
+}
diff --git a/src/main/java/gg/pufferfish/pufferfish/simd/VectorMapPalette.java b/src/main/java/gg/pufferfish/pufferfish/simd/VectorMapPalette.java
new file mode 100644
index 0000000000000000000000000000000000000000..ae2464920c9412ac90b819a540ee58be0741465f
index 0000000000000000000000000000000000000000..20ec3b29b0cb4061cc89d635b3929ffe71008e22
--- /dev/null
+++ b/src/main/java/gg/pufferfish/pufferfish/simd/VectorMapPalette.java
@@ -0,0 +1,83 @@

View File

@@ -1,6 +1,6 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: AlphaKR93 <dev@alpha93.kr>
Date: Thu, 23 Mar 2023 10:35:54 +0900
Date: Mon, 27 Mar 2023 02:52:12 +0000
Subject: [PATCH] Purpur API Changes
Original: PurpurMC

View File

@@ -1,6 +1,6 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: AlphaKR93 <dev@alpha93.kr>
Date: Thu, 23 Mar 2023 10:28:40 +0900
Date: Mon, 27 Mar 2023 02:50:22 +0000
Subject: [PATCH] Pufferfish Server Changes
Original: Kevin Raneri <kevin.raneri@gmail.com>
@@ -20,7 +20,7 @@ You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
diff --git a/build.gradle.kts b/build.gradle.kts
index 9cf389defdaeb887e9cad4f0fed3f3b95667b238..3c8293f002f11b430083502362fdc801f44aa138 100644
index 9cf389defdaeb887e9cad4f0fed3f3b95667b238..b41b186397d013c19436c345be98b785d4bd0295 100644
--- a/build.gradle.kts
+++ b/build.gradle.kts
@@ -7,8 +7,12 @@ plugins {
@@ -38,7 +38,7 @@ index 9cf389defdaeb887e9cad4f0fed3f3b95667b238..3c8293f002f11b430083502362fdc801
// Paper start
implementation("org.jline:jline-terminal-jansi:3.21.0")
implementation("net.minecrell:terminalconsoleappender:1.3.0")
@@ -42,6 +46,14 @@ dependencies {
@@ -42,6 +46,13 @@ dependencies {
runtimeOnly("org.apache.maven.resolver:maven-resolver-connector-basic:1.7.3")
runtimeOnly("org.apache.maven.resolver:maven-resolver-transport-http:1.7.3")
@@ -48,12 +48,11 @@ index 9cf389defdaeb887e9cad4f0fed3f3b95667b238..3c8293f002f11b430083502362fdc801
+ exclude(group="org.yaml", module="snakeyaml")
+ }
+ // Pufferfish end
+ implementation("com.github.technove:Flare:34637f3f87") // Pufferfish - flare
+
testImplementation("io.github.classgraph:classgraph:4.8.47") // Paper - mob goal test
testImplementation("junit:junit:4.13.2")
testImplementation("org.hamcrest:hamcrest-library:1.3")
@@ -50,6 +62,14 @@ dependencies {
@@ -50,6 +61,14 @@ dependencies {
}
val craftbukkitPackageVersion = "1_19_R3" // Paper
@@ -68,7 +67,7 @@ index 9cf389defdaeb887e9cad4f0fed3f3b95667b238..3c8293f002f11b430083502362fdc801
tasks.jar {
archiveClassifier.set("dev")
@@ -62,7 +82,7 @@ tasks.jar {
@@ -62,7 +81,7 @@ tasks.jar {
attributes(
"Main-Class" to "org.bukkit.craftbukkit.Main",
"Implementation-Title" to "CraftBukkit",
@@ -543,7 +542,7 @@ index 0000000000000000000000000000000000000000..a7f297ebb569f7c1f205e967ca485be7
+}
diff --git a/src/main/java/gg/pufferfish/pufferfish/PufferfishCommand.java b/src/main/java/gg/pufferfish/pufferfish/PufferfishCommand.java
new file mode 100644
index 0000000000000000000000000000000000000000..020368da69b9a492155f6de6297f74732f4ab6ea
index 0000000000000000000000000000000000000000..e164237e749bcc43466d4ed7aeada5ab9fddf8a6
--- /dev/null
+++ b/src/main/java/gg/pufferfish/pufferfish/PufferfishCommand.java
@@ -0,0 +1,68 @@
@@ -617,10 +616,10 @@ index 0000000000000000000000000000000000000000..020368da69b9a492155f6de6297f7473
+}
diff --git a/src/main/java/gg/pufferfish/pufferfish/PufferfishConfig.java b/src/main/java/gg/pufferfish/pufferfish/PufferfishConfig.java
new file mode 100644
index 0000000000000000000000000000000000000000..e0076044d0a29e33ee297fe6180a041436075297
index 0000000000000000000000000000000000000000..a8cead500186142115d4dc029c942fdfc68f7fe5
--- /dev/null
+++ b/src/main/java/gg/pufferfish/pufferfish/PufferfishConfig.java
@@ -0,0 +1,317 @@
@@ -0,0 +1,285 @@
+package gg.pufferfish.pufferfish;
+
+import gg.pufferfish.pufferfish.simd.SIMDDetection;
@@ -638,7 +637,6 @@ index 0000000000000000000000000000000000000000..e0076044d0a29e33ee297fe6180a0414
+import java.lang.reflect.Method;
+import java.lang.reflect.Modifier;
+import java.util.List;
+import gg.pufferfish.pufferfish.flare.FlareCommand;
+import net.minecraft.server.MinecraftServer;
+import org.apache.logging.log4j.Level;
+import org.bukkit.configuration.ConfigurationSection;
@@ -647,13 +645,6 @@ index 0000000000000000000000000000000000000000..e0076044d0a29e33ee297fe6180a0414
+import org.simpleyaml.configuration.comments.CommentType;
+import org.simpleyaml.configuration.file.YamlFile;
+import org.simpleyaml.exceptions.InvalidConfigurationException;
+import org.bukkit.command.SimpleCommandMap;
+
+import java.lang.reflect.Method;
+import java.lang.reflect.Modifier;
+import java.util.List;
+import java.net.URI;
+import java.util.Collections;
+
+public class PufferfishConfig {
+
@@ -904,30 +895,6 @@ index 0000000000000000000000000000000000000000..e0076044d0a29e33ee297fe6180a0414
+ "This can improve performance by a few percent, but has minor gameplay implications.");
+ }
+
+ public static URI profileWebUrl;
+ private static void profilerOptions() {
+ profileWebUrl = URI.create(getString("flare.url", "https://flare.airplane.gg", "Sets the server to use for profiles."));
+
+ setComment("flare", "Configures Flare, the built-in profiler");
+ }
+
+
+ public static String accessToken;
+ private static void airplaneWebServices() {
+ accessToken = getString("web-services.token", "");
+ // todo lookup token (off-thread) and let users know if their token is valid
+ if (accessToken.length() > 0) {
+ gg.pufferfish.pufferfish.flare.FlareSetup.init(); // Pufferfish
+ SimpleCommandMap commandMap = MinecraftServer.getServer().server.getCommandMap();
+ if (commandMap.getCommand("flare") == null) {
+ commandMap.register("flare", "Pufferfish", new FlareCommand());
+ }
+ }
+
+ setComment("web-services", "Options for connecting to Pufferfish/Airplane's online utilities");
+
+ }
+
+
+ public static boolean disableMethodProfiler;
+ public static boolean disableOutOfOrderChat;
@@ -962,7 +929,7 @@ index 0000000000000000000000000000000000000000..53f2df00c6809618a9ee3d2ea72e85e8
+}
diff --git a/src/main/java/gg/pufferfish/pufferfish/PufferfishVersionFetcher.java b/src/main/java/gg/pufferfish/pufferfish/PufferfishVersionFetcher.java
new file mode 100644
index 0000000000000000000000000000000000000000..e877921370f6009a4bd204d9b17d2d58834b8822
index 0000000000000000000000000000000000000000..1adc3de7cdb5b5f309df45f463e4697d6ec2c245
--- /dev/null
+++ b/src/main/java/gg/pufferfish/pufferfish/PufferfishVersionFetcher.java
@@ -0,0 +1,136 @@
@@ -1103,702 +1070,9 @@ index 0000000000000000000000000000000000000000..e877921370f6009a4bd204d9b17d2d58
+ }
+}
\ No newline at end of file
diff --git a/src/main/java/gg/pufferfish/pufferfish/compat/ServerConfigurations.java b/src/main/java/gg/pufferfish/pufferfish/compat/ServerConfigurations.java
new file mode 100644
index 0000000000000000000000000000000000000000..4ad189d52b27560424ddb311d0817a334637dc95
--- /dev/null
+++ b/src/main/java/gg/pufferfish/pufferfish/compat/ServerConfigurations.java
@@ -0,0 +1,78 @@
+package gg.pufferfish.pufferfish.compat;
+
+import co.aikar.timings.TimingsManager;
+import com.google.common.io.Files;
+import org.bukkit.configuration.InvalidConfigurationException;
+import org.bukkit.configuration.file.YamlConfiguration;
+
+import java.io.ByteArrayOutputStream;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.nio.charset.StandardCharsets;
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Properties;
+import java.util.stream.Collectors;
+
+public class ServerConfigurations {
+
+ public static final String[] configurationFiles = new String[]{
+ "server.properties",
+ "bukkit.yml",
+ "spigot.yml",
+ // "paper.yml", // TODO: Figure out what to do with this.
+ "pufferfish.yml"
+ };
+
+ public static Map<String, String> getCleanCopies() throws IOException {
+ Map<String, String> files = new HashMap<>(configurationFiles.length);
+ for (String file : configurationFiles) {
+ files.put(file, getCleanCopy(file));
+ }
+ return files;
+ }
+
+ public static String getCleanCopy(String configName) throws IOException {
+ File file = new File(configName);
+ List<String> hiddenConfigs = TimingsManager.hiddenConfigs;
+
+ switch (Files.getFileExtension(configName)) {
+ case "properties": {
+ Properties properties = new Properties();
+ try (FileInputStream inputStream = new FileInputStream(file)) {
+ properties.load(inputStream);
+ }
+ for (String hiddenConfig : hiddenConfigs) {
+ properties.remove(hiddenConfig);
+ }
+ ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
+ properties.store(outputStream, "");
+ return Arrays.stream(outputStream.toString()
+ .split("\n"))
+ .filter(line -> !line.startsWith("#"))
+ .collect(Collectors.joining("\n"));
+ }
+ case "yml": {
+ YamlConfiguration configuration = new YamlConfiguration();
+ try {
+ configuration.load(file);
+ } catch (InvalidConfigurationException e) {
+ throw new IOException(e);
+ }
+ configuration.options().header(null);
+ for (String key : configuration.getKeys(true)) {
+ if (hiddenConfigs.contains(key)) {
+ configuration.set(key, null);
+ }
+ }
+ return configuration.saveToString();
+ }
+ default:
+ throw new IllegalArgumentException("Bad file type " + configName);
+ }
+ }
+
+}
diff --git a/src/main/java/gg/pufferfish/pufferfish/flare/CustomCategories.java b/src/main/java/gg/pufferfish/pufferfish/flare/CustomCategories.java
new file mode 100644
index 0000000000000000000000000000000000000000..401b42e29bccb5251684062f10b2e0f8b091bc95
--- /dev/null
+++ b/src/main/java/gg/pufferfish/pufferfish/flare/CustomCategories.java
@@ -0,0 +1,8 @@
+package gg.pufferfish.pufferfish.flare;
+
+import co.technove.flare.live.category.GraphCategory;
+
+public class CustomCategories {
+ public static final GraphCategory MC_PERF = new GraphCategory("MC Performance");
+ public static final GraphCategory ENTITIES_AND_CHUNKS = new GraphCategory("Entities & Chunks");
+}
diff --git a/src/main/java/gg/pufferfish/pufferfish/flare/FlareCommand.java b/src/main/java/gg/pufferfish/pufferfish/flare/FlareCommand.java
new file mode 100644
index 0000000000000000000000000000000000000000..3785d1512eb650f91d58903672c059e7449598fc
--- /dev/null
+++ b/src/main/java/gg/pufferfish/pufferfish/flare/FlareCommand.java
@@ -0,0 +1,136 @@
+package gg.pufferfish.pufferfish.flare;
+
+import co.technove.flare.exceptions.UserReportableException;
+import co.technove.flare.internal.profiling.ProfileType;
+import gg.pufferfish.pufferfish.PufferfishConfig;
+import net.kyori.adventure.text.Component;
+import net.kyori.adventure.text.event.ClickEvent;
+import net.kyori.adventure.text.format.NamedTextColor;
+import net.kyori.adventure.text.format.TextColor;
+import net.kyori.adventure.text.format.TextDecoration;
+import net.minecraft.server.MinecraftServer;
+import org.apache.logging.log4j.Level;
+import org.bukkit.Bukkit;
+import org.bukkit.command.Command;
+import org.bukkit.command.CommandSender;
+import org.bukkit.command.ConsoleCommandSender;
+import org.bukkit.craftbukkit.scheduler.MinecraftInternalPlugin;
+import org.bukkit.util.StringUtil;
+import org.jetbrains.annotations.NotNull;
+
+import java.time.Duration;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+public class FlareCommand extends Command {
+
+ private static final String BASE_URL = "https://blog.airplane.gg/flare-tutorial/#setting-the-access-token";
+ private static final TextColor HEX = TextColor.fromHexString("#e3eaea");
+ private static final Component PREFIX = Component.text()
+ .append(Component.text("Flare ✈")
+ .color(TextColor.fromHexString("#6a7eda"))
+ .decoration(TextDecoration.BOLD, true)
+ .append(Component.text(" ", HEX)
+ .decoration(TextDecoration.BOLD, false)))
+ .asComponent();
+
+ public FlareCommand() {
+ super("flare", "Profile your server with Flare", "/flare", Collections.singletonList("profile"));
+ this.setPermission("airplane.flare");
+ }
+
+ @Override
+ public boolean execute(@NotNull CommandSender sender, @NotNull String commandLabel, String @NotNull [] args) {
+ if (!testPermission(sender)) return true;
+ if (PufferfishConfig.accessToken.length() == 0) {
+ Component clickable = Component.text(BASE_URL, HEX, TextDecoration.UNDERLINED).clickEvent(ClickEvent.clickEvent(ClickEvent.Action.OPEN_URL, BASE_URL));
+
+ sender.sendMessage(PREFIX.append(Component.text("Flare currently requires an access token to use. To learn more, visit ").color(HEX).append(clickable)));
+ return true;
+ }
+
+ if (!FlareSetup.isSupported()) {
+ sender.sendMessage(PREFIX.append(
+ Component.text("Profiling is not supported in this environment, check your startup logs for the error.", NamedTextColor.RED)));
+ return true;
+ }
+ if (ProfilingManager.isProfiling()) {
+ if (args.length == 1 && args[0].equalsIgnoreCase("status")) {
+ sender.sendMessage(PREFIX.append(Component.text("Current profile has been ran for " + ProfilingManager.getTimeRan().toString(), HEX)));
+ return true;
+ }
+ if (ProfilingManager.stop()) {
+ if (!(sender instanceof ConsoleCommandSender)) {
+ sender.sendMessage(PREFIX.append(Component.text("Profiling has been stopped.", HEX)));
+ }
+ } else {
+ sender.sendMessage(PREFIX.append(Component.text("Profiling has already been stopped.", HEX)));
+ }
+ } else {
+ ProfileType profileType = ProfileType.ITIMER;
+ if (args.length > 0) {
+ try {
+ profileType = ProfileType.valueOf(args[0].toUpperCase());
+ } catch (Exception e) {
+ sender.sendMessage(PREFIX.append(Component
+ .text("Invalid profile type ", HEX)
+ .append(Component.text(args[0], HEX, TextDecoration.BOLD)
+ .append(Component.text("!", HEX)))
+ ));
+ }
+ }
+ ProfileType finalProfileType = profileType;
+ Bukkit.getScheduler().runTaskAsynchronously(new MinecraftInternalPlugin(), () -> {
+ try {
+ if (ProfilingManager.start(finalProfileType)) {
+ if (!(sender instanceof ConsoleCommandSender)) {
+ sender.sendMessage(PREFIX.append(Component
+ .text("Flare has been started: " + ProfilingManager.getProfilingUri(), HEX)
+ .clickEvent(ClickEvent.openUrl(ProfilingManager.getProfilingUri()))
+ ));
+ sender.sendMessage(PREFIX.append(Component.text(" Run /" + commandLabel + " to stop the Flare.", HEX)));
+ }
+ } else {
+ sender.sendMessage(PREFIX.append(Component
+ .text("Flare has already been started: " + ProfilingManager.getProfilingUri(), HEX)
+ .clickEvent(ClickEvent.openUrl(ProfilingManager.getProfilingUri()))
+ ));
+ }
+ } catch (UserReportableException e) {
+ sender.sendMessage(Component.text("Flare failed to start: " + e.getUserError(), NamedTextColor.RED));
+ if (e.getCause() != null) {
+ MinecraftServer.LOGGER.warn("Flare failed to start", e);
+ }
+ }
+ });
+ }
+ return true;
+ }
+
+ @Override
+ public @NotNull List<String> tabComplete(@NotNull CommandSender sender, @NotNull String alias, String @NotNull [] args) throws IllegalArgumentException {
+ List<String> list = new ArrayList<>();
+ if (ProfilingManager.isProfiling()) {
+ if (args.length == 1) {
+ String lastWord = args[0];
+ if (StringUtil.startsWithIgnoreCase("status", lastWord)) {
+ list.add("status");
+ }
+ if (StringUtil.startsWithIgnoreCase("stop", lastWord)) {
+ list.add("stop");
+ }
+ }
+ } else {
+ if (args.length <= 1) {
+ String lastWord = args.length == 0 ? "" : args[0];
+ for (ProfileType value : ProfileType.values()) {
+ if (StringUtil.startsWithIgnoreCase(value.getInternalName(), lastWord)) {
+ list.add(value.name().toLowerCase());
+ }
+ }
+ }
+ }
+ return list;
+ }
+}
diff --git a/src/main/java/gg/pufferfish/pufferfish/flare/FlareSetup.java b/src/main/java/gg/pufferfish/pufferfish/flare/FlareSetup.java
new file mode 100644
index 0000000000000000000000000000000000000000..cd22e4dcc8b7b57b10a95ef084637249a98e524f
--- /dev/null
+++ b/src/main/java/gg/pufferfish/pufferfish/flare/FlareSetup.java
@@ -0,0 +1,33 @@
+package gg.pufferfish.pufferfish.flare;
+
+import co.technove.flare.FlareInitializer;
+import co.technove.flare.internal.profiling.InitializationException;
+import net.minecraft.server.MinecraftServer;
+import org.apache.logging.log4j.Level;
+
+public class FlareSetup {
+
+ private static boolean initialized = false;
+ private static boolean supported = false;
+
+ public static void init() {
+ if (initialized) {
+ return;
+ }
+
+ initialized = true;
+ try {
+ for (String warning : FlareInitializer.initialize()) {
+ MinecraftServer.LOGGER.warn("Flare warning: " + warning);
+ }
+ supported = true;
+ } catch (InitializationException e) {
+ MinecraftServer.LOGGER.warn("Failed to enable Flare:", e);
+ }
+ }
+
+ public static boolean isSupported() {
+ return supported;
+ }
+
+}
diff --git a/src/main/java/gg/pufferfish/pufferfish/flare/PluginLookup.java b/src/main/java/gg/pufferfish/pufferfish/flare/PluginLookup.java
new file mode 100644
index 0000000000000000000000000000000000000000..74aab5eb4b54ffbaf19b8976ffb8ca4a64584006
--- /dev/null
+++ b/src/main/java/gg/pufferfish/pufferfish/flare/PluginLookup.java
@@ -0,0 +1,44 @@
+package gg.pufferfish.pufferfish.flare;
+
+import com.google.common.cache.Cache;
+import com.google.common.cache.CacheBuilder;
+import org.bukkit.Bukkit;
+import org.bukkit.plugin.Plugin;
+import org.bukkit.plugin.java.PluginClassLoader;
+
+import java.util.Optional;
+import java.util.concurrent.TimeUnit;
+
+public class PluginLookup {
+ private static final Cache<String, String> pluginNameCache = CacheBuilder.newBuilder()
+ .expireAfterAccess(1, TimeUnit.MINUTES)
+ .maximumSize(1024)
+ .build();
+
+ public static Optional<String> getPluginForClass(String name) {
+ if (name.startsWith("net.minecraft") || name.startsWith("java.") || name.startsWith("com.mojang") ||
+ name.startsWith("com.google") || name.startsWith("it.unimi") || name.startsWith("sun")) {
+ return Optional.empty();
+ }
+
+ String existing = pluginNameCache.getIfPresent(name);
+ if (existing != null) {
+ return Optional.ofNullable(existing.isEmpty() ? null : existing);
+ }
+
+ String newValue = "";
+
+ for (Plugin plugin : Bukkit.getPluginManager().getPlugins()) {
+ ClassLoader classLoader = plugin.getClass().getClassLoader();
+ if (classLoader instanceof PluginClassLoader) {
+ if (((PluginClassLoader) classLoader)._airplane_hasClass(name)) {
+ newValue = plugin.getName();
+ break;
+ }
+ }
+ }
+
+ pluginNameCache.put(name, newValue);
+ return Optional.ofNullable(newValue.isEmpty() ? null : newValue);
+ }
+}
diff --git a/src/main/java/gg/pufferfish/pufferfish/flare/ProfilingManager.java b/src/main/java/gg/pufferfish/pufferfish/flare/ProfilingManager.java
new file mode 100644
index 0000000000000000000000000000000000000000..e3f76eb11a261c3347f0cd89b5da309bc2dc82f9
--- /dev/null
+++ b/src/main/java/gg/pufferfish/pufferfish/flare/ProfilingManager.java
@@ -0,0 +1,151 @@
+package gg.pufferfish.pufferfish.flare;
+
+import co.technove.flare.Flare;
+import co.technove.flare.FlareAuth;
+import co.technove.flare.FlareBuilder;
+import co.technove.flare.exceptions.UserReportableException;
+import co.technove.flare.internal.profiling.ProfileType;
+import gg.pufferfish.pufferfish.PufferfishConfig;
+import gg.pufferfish.pufferfish.PufferfishLogger;
+import gg.pufferfish.pufferfish.compat.ServerConfigurations;
+import gg.pufferfish.pufferfish.flare.collectors.GCEventCollector;
+import gg.pufferfish.pufferfish.flare.collectors.StatCollector;
+import gg.pufferfish.pufferfish.flare.collectors.TPSCollector;
+import gg.pufferfish.pufferfish.flare.collectors.WorldCountCollector;
+import org.bukkit.Bukkit;
+import org.bukkit.craftbukkit.scheduler.MinecraftInternalPlugin;
+import org.bukkit.scheduler.BukkitTask;
+import oshi.SystemInfo;
+import oshi.hardware.CentralProcessor;
+import oshi.hardware.GlobalMemory;
+import oshi.hardware.HardwareAbstractionLayer;
+import oshi.hardware.VirtualMemory;
+import oshi.software.os.OperatingSystem;
+
+import java.io.IOException;
+import java.net.URI;
+import java.time.Duration;
+import java.util.Objects;
+import java.util.logging.Level;
+
+public class ProfilingManager {
+
+ private static Flare currentFlare;
+ private static BukkitTask currentTask = null;
+
+ public static synchronized boolean isProfiling() {
+ return currentFlare != null && currentFlare.isRunning();
+ }
+
+ public static synchronized String getProfilingUri() {
+ return Objects.requireNonNull(currentFlare).getURI().map(URI::toString).orElse("Flare is not running");
+ }
+
+ public static Duration getTimeRan() {
+ Flare flare = currentFlare; // copy reference so no need to sync
+ if (flare == null) {
+ return Duration.ofMillis(0);
+ }
+ return flare.getCurrentDuration();
+ }
+
+ public static synchronized boolean start(ProfileType profileType) throws UserReportableException {
+ if (currentFlare != null && !currentFlare.isRunning()) {
+ currentFlare = null; // errored out
+ }
+ if (isProfiling()) {
+ return false;
+ }
+ if (Bukkit.isPrimaryThread()) {
+ throw new UserReportableException("Profiles should be started off-thread");
+ }
+
+ try {
+ OperatingSystem os = new SystemInfo().getOperatingSystem();
+
+ SystemInfo systemInfo = new SystemInfo();
+ HardwareAbstractionLayer hardware = systemInfo.getHardware();
+
+ CentralProcessor processor = hardware.getProcessor();
+ CentralProcessor.ProcessorIdentifier processorIdentifier = processor.getProcessorIdentifier();
+
+ GlobalMemory memory = hardware.getMemory();
+ VirtualMemory virtualMemory = memory.getVirtualMemory();
+
+ FlareBuilder builder = new FlareBuilder()
+ .withProfileType(profileType)
+ .withMemoryProfiling(true)
+ .withAuth(FlareAuth.fromTokenAndUrl(PufferfishConfig.accessToken, PufferfishConfig.profileWebUrl))
+
+ .withFiles(ServerConfigurations.getCleanCopies())
+ .withVersion("Primary Version", Bukkit.getVersion())
+ .withVersion("Bukkit Version", Bukkit.getBukkitVersion())
+ .withVersion("Minecraft Version", Bukkit.getMinecraftVersion())
+
+ .withGraphCategories(CustomCategories.ENTITIES_AND_CHUNKS, CustomCategories.MC_PERF)
+ .withCollectors(new TPSCollector(), new WorldCountCollector(), new GCEventCollector(), new StatCollector())
+ .withClassIdentifier(PluginLookup::getPluginForClass)
+
+ .withHardware(new FlareBuilder.HardwareBuilder()
+ .setCoreCount(processor.getPhysicalProcessorCount())
+ .setThreadCount(processor.getLogicalProcessorCount())
+ .setCpuModel(processorIdentifier.getName())
+ .setCpuFrequency(processor.getMaxFreq())
+
+ .setTotalMemory(memory.getTotal())
+ .setTotalSwap(virtualMemory.getSwapTotal())
+ .setTotalVirtual(virtualMemory.getVirtualMax())
+ )
+
+ .withOperatingSystem(new FlareBuilder.OperatingSystemBuilder()
+ .setManufacturer(os.getManufacturer())
+ .setFamily(os.getFamily())
+ .setVersion(os.getVersionInfo().toString())
+ .setBitness(os.getBitness())
+ );
+
+ currentFlare = builder.build();
+ } catch (IOException e) {
+ PufferfishLogger.LOGGER.log(Level.WARNING, "Failed to read configuration files:", e);
+ throw new UserReportableException("Failed to load configuration files, check logs for further details.");
+ }
+
+ try {
+ currentFlare.start();
+ } catch (IllegalStateException e) {
+ PufferfishLogger.LOGGER.log(Level.WARNING, "Error starting Flare:", e);
+ throw new UserReportableException("Failed to start Flare, check logs for further details.");
+ }
+
+ currentTask = Bukkit.getScheduler().runTaskLater(new MinecraftInternalPlugin(), ProfilingManager::stop, 20 * 60 * 15);
+ PufferfishLogger.LOGGER.log(Level.INFO, "Flare has been started: " + getProfilingUri());
+ return true;
+ }
+
+ public static synchronized boolean stop() {
+ if (!isProfiling()) {
+ return false;
+ }
+ if (!currentFlare.isRunning()) {
+ currentFlare = null;
+ return true;
+ }
+ PufferfishLogger.LOGGER.log(Level.INFO, "Flare has been stopped: " + getProfilingUri());
+ try {
+ currentFlare.stop();
+ } catch (IllegalStateException e) {
+ PufferfishLogger.LOGGER.log(Level.WARNING, "Error occurred stopping Flare", e);
+ }
+ currentFlare = null;
+
+ try {
+ currentTask.cancel();
+ } catch (Throwable t) {
+ PufferfishLogger.LOGGER.log(Level.WARNING, "Error occurred stopping Flare", t);
+ }
+
+ currentTask = null;
+ return true;
+ }
+
+}
diff --git a/src/main/java/gg/pufferfish/pufferfish/flare/collectors/GCEventCollector.java b/src/main/java/gg/pufferfish/pufferfish/flare/collectors/GCEventCollector.java
new file mode 100644
index 0000000000000000000000000000000000000000..d426575c669020f369960107da1e2de2f11f082f
--- /dev/null
+++ b/src/main/java/gg/pufferfish/pufferfish/flare/collectors/GCEventCollector.java
@@ -0,0 +1,66 @@
+package gg.pufferfish.pufferfish.flare.collectors;
+
+import co.technove.flare.Flare;
+import co.technove.flare.internal.FlareInternal;
+import co.technove.flare.live.CollectorData;
+import co.technove.flare.live.EventCollector;
+import co.technove.flare.live.LiveEvent;
+import co.technove.flare.live.category.GraphCategory;
+import co.technove.flare.live.formatter.DataFormatter;
+import com.google.common.collect.ImmutableMap;
+import com.sun.management.GarbageCollectionNotificationInfo;
+
+import javax.management.ListenerNotFoundException;
+import javax.management.Notification;
+import javax.management.NotificationEmitter;
+import javax.management.NotificationListener;
+import javax.management.openmbean.CompositeData;
+import java.lang.management.GarbageCollectorMXBean;
+import java.lang.management.ManagementFactory;
+
+public class GCEventCollector extends EventCollector implements NotificationListener {
+
+ private static final CollectorData MINOR_GC = new CollectorData("builtin:gc:minor", "Minor GC", "A small pause in the program to allow Garbage Collection to run.", DataFormatter.MILLISECONDS, GraphCategory.SYSTEM);
+ private static final CollectorData MAJOR_GC = new CollectorData("builtin:gc:major", "Major GC", "A large pause in the program to allow Garbage Collection to run.", DataFormatter.MILLISECONDS, GraphCategory.SYSTEM);
+ private static final CollectorData UNKNOWN_GC = new CollectorData("builtin:gc:generic", "Major GC", "A run of the Garbage Collection.", DataFormatter.MILLISECONDS, GraphCategory.SYSTEM);
+
+ public GCEventCollector() {
+ super(MINOR_GC, MAJOR_GC, UNKNOWN_GC);
+ }
+
+ private static CollectorData fromString(String string) {
+ if (string.endsWith("minor GC")) {
+ return MINOR_GC;
+ } else if (string.endsWith("major GC")) {
+ return MAJOR_GC;
+ }
+ return UNKNOWN_GC;
+ }
+
+ @Override
+ public void start(Flare flare) {
+ for (GarbageCollectorMXBean garbageCollectorBean : ManagementFactory.getGarbageCollectorMXBeans()) {
+ NotificationEmitter notificationEmitter = (NotificationEmitter) garbageCollectorBean;
+ notificationEmitter.addNotificationListener(this, null, null);
+ }
+ }
+
+ @Override
+ public void stop(Flare flare) {
+ for (GarbageCollectorMXBean garbageCollectorBean : ManagementFactory.getGarbageCollectorMXBeans()) {
+ NotificationEmitter notificationEmitter = (NotificationEmitter) garbageCollectorBean;
+ try {
+ notificationEmitter.removeNotificationListener(this);
+ } catch (ListenerNotFoundException e) {
+ }
+ }
+ }
+
+ @Override
+ public void handleNotification(Notification notification, Object o) {
+ if (notification.getType().equals(GarbageCollectionNotificationInfo.GARBAGE_COLLECTION_NOTIFICATION)) {
+ GarbageCollectionNotificationInfo gcInfo = GarbageCollectionNotificationInfo.from((CompositeData) notification.getUserData());
+ reportEvent(new LiveEvent(fromString(gcInfo.getGcAction()), System.currentTimeMillis(), (int) gcInfo.getGcInfo().getDuration(), ImmutableMap.of()));
+ }
+ }
+}
diff --git a/src/main/java/gg/pufferfish/pufferfish/flare/collectors/StatCollector.java b/src/main/java/gg/pufferfish/pufferfish/flare/collectors/StatCollector.java
new file mode 100644
index 0000000000000000000000000000000000000000..a22c6dbae53667e4c72464fa27153aee30c7946e
--- /dev/null
+++ b/src/main/java/gg/pufferfish/pufferfish/flare/collectors/StatCollector.java
@@ -0,0 +1,41 @@
+package gg.pufferfish.pufferfish.flare.collectors;
+
+import co.technove.flare.live.CollectorData;
+import co.technove.flare.live.LiveCollector;
+import co.technove.flare.live.category.GraphCategory;
+import co.technove.flare.live.formatter.DataFormatter;
+import com.sun.management.OperatingSystemMXBean;
+import oshi.SystemInfo;
+import oshi.hardware.CentralProcessor;
+
+import java.lang.management.ManagementFactory;
+import java.time.Duration;
+
+public class StatCollector extends LiveCollector {
+
+ private static final CollectorData CPU = new CollectorData("builtin:stat:cpu", "CPU Load", "The total amount of CPU usage across all cores.", DataFormatter.PERCENT, GraphCategory.SYSTEM);
+ private static final CollectorData CPU_PROCESS = new CollectorData("builtin:stat:cpu_process", "Process CPU", "The amount of CPU being used by this process.", DataFormatter.PERCENT, GraphCategory.SYSTEM);
+ private static final CollectorData MEMORY = new CollectorData("builtin:stat:memory_used", "Memory", "The amount of memory being used currently.", DataFormatter.BYTES, GraphCategory.SYSTEM);
+ private static final CollectorData MEMORY_TOTAL = new CollectorData("builtin:stat:memory_total", "Memory Total", "The total amount of memory allocated.", DataFormatter.BYTES, GraphCategory.SYSTEM);
+
+ private final OperatingSystemMXBean bean;
+ private final CentralProcessor processor;
+
+ public StatCollector() {
+ super(CPU, CPU_PROCESS, MEMORY, MEMORY_TOTAL);
+ this.interval = Duration.ofSeconds(5);
+
+ this.bean = (OperatingSystemMXBean) ManagementFactory.getOperatingSystemMXBean();
+ this.processor = new SystemInfo().getHardware().getProcessor();
+ }
+
+ @Override
+ public void run() {
+ Runtime runtime = Runtime.getRuntime();
+
+ this.report(CPU, this.processor.getSystemLoadAverage(1)[0] / 100); // percentage
+ this.report(CPU_PROCESS, this.bean.getProcessCpuLoad());
+ this.report(MEMORY, runtime.totalMemory() - runtime.freeMemory());
+ this.report(MEMORY_TOTAL, runtime.totalMemory());
+ }
+}
diff --git a/src/main/java/gg/pufferfish/pufferfish/flare/collectors/TPSCollector.java b/src/main/java/gg/pufferfish/pufferfish/flare/collectors/TPSCollector.java
new file mode 100644
index 0000000000000000000000000000000000000000..40447d00aefb5ffedb8a2ee87155a04088f0649f
--- /dev/null
+++ b/src/main/java/gg/pufferfish/pufferfish/flare/collectors/TPSCollector.java
@@ -0,0 +1,31 @@
+package gg.pufferfish.pufferfish.flare.collectors;
+
+import co.technove.flare.live.CollectorData;
+import co.technove.flare.live.LiveCollector;
+import co.technove.flare.live.formatter.SuffixFormatter;
+import gg.pufferfish.pufferfish.flare.CustomCategories;
+import net.minecraft.server.MinecraftServer;
+import org.bukkit.Bukkit;
+
+import java.time.Duration;
+import java.util.Arrays;
+
+public class TPSCollector extends LiveCollector {
+ private static final CollectorData TPS = new CollectorData("airplane:tps", "TPS", "Ticks per second, or how fast the server updates. For a smooth server this should be a constant 20TPS.", SuffixFormatter.of("TPS"), CustomCategories.MC_PERF);
+ private static final CollectorData MSPT = new CollectorData("airplane:mspt", "MSPT", "Milliseconds per tick, which can show how well your server is performing. This value should always be under 50mspt.", SuffixFormatter.of("mspt"), CustomCategories.MC_PERF);
+
+ public TPSCollector() {
+ super(TPS, MSPT);
+
+ this.interval = Duration.ofSeconds(5);
+ }
+
+ @Override
+ public void run() {
+ long[] times = MinecraftServer.getServer().tickTimes5s.getTimes();
+ double mspt = ((double) Arrays.stream(times).sum() / (double) times.length) * 1.0E-6D;
+
+ this.report(TPS, Math.min(20D, Math.round(Bukkit.getServer().getTPS()[0] * 100d) / 100d));
+ this.report(MSPT, (double) Math.round(mspt * 100d) / 100d);
+ }
+}
diff --git a/src/main/java/gg/pufferfish/pufferfish/flare/collectors/WorldCountCollector.java b/src/main/java/gg/pufferfish/pufferfish/flare/collectors/WorldCountCollector.java
new file mode 100644
index 0000000000000000000000000000000000000000..029d840e28d67d26d3c0dd6785e25dbf15f9226c
--- /dev/null
+++ b/src/main/java/gg/pufferfish/pufferfish/flare/collectors/WorldCountCollector.java
@@ -0,0 +1,45 @@
+package gg.pufferfish.pufferfish.flare.collectors;
+
+import co.technove.flare.live.CollectorData;
+import co.technove.flare.live.LiveCollector;
+import co.technove.flare.live.formatter.SuffixFormatter;
+import gg.pufferfish.pufferfish.flare.CustomCategories;
+import org.bukkit.Bukkit;
+import org.bukkit.World;
+
+import java.time.Duration;
+
+public class WorldCountCollector extends LiveCollector {
+
+ private static final CollectorData PLAYER_COUNT = new CollectorData("airplane:world:playercount", "Player Count", "The number of players currently on the server.", new SuffixFormatter(" Player", " Players"), CustomCategories.ENTITIES_AND_CHUNKS);
+ private static final CollectorData ENTITY_COUNT = new CollectorData("airplane:world:entitycount", "Entity Count", "The number of entities in all worlds", new SuffixFormatter(" Entity", " Entities"), CustomCategories.ENTITIES_AND_CHUNKS);
+ private static final CollectorData CHUNK_COUNT = new CollectorData("airplane:world:chunkcount", "Chunk Count", "The number of chunks currently loaded.", new SuffixFormatter(" Chunk", " Chunks"), CustomCategories.ENTITIES_AND_CHUNKS);
+ private static final CollectorData TILE_ENTITY_COUNT = new CollectorData("airplane:world:blockentitycount", "Block Entity Count", "The number of block entities currently loaded.", new SuffixFormatter(" Block Entity", " Block Entities"), CustomCategories.ENTITIES_AND_CHUNKS);
+
+ public WorldCountCollector() {
+ super(PLAYER_COUNT, ENTITY_COUNT, CHUNK_COUNT, TILE_ENTITY_COUNT);
+
+ this.interval = Duration.ofSeconds(5);
+ }
+
+ @Override
+ public void run() {
+ if (true) return; // This doesn't work, and it's not worth fixing at the moment.
+ int entities = 0;
+ int chunkCount = 0;
+ int tileEntityCount = 0;
+
+ if (!Bukkit.isStopping()) {
+ for (World world : Bukkit.getWorlds()) {
+ world.getEntityCount();
+ chunkCount += world.getChunkCount();
+ tileEntityCount += world.getTileEntityCount();
+ }
+ }
+
+ this.report(PLAYER_COUNT, Bukkit.getOnlinePlayers().size());
+ this.report(ENTITY_COUNT, entities);
+ this.report(CHUNK_COUNT, chunkCount);
+ this.report(TILE_ENTITY_COUNT, tileEntityCount);
+ }
+}
diff --git a/src/main/java/gg/pufferfish/pufferfish/sentry/PufferfishSentryAppender.java b/src/main/java/gg/pufferfish/pufferfish/sentry/PufferfishSentryAppender.java
new file mode 100644
index 0000000000000000000000000000000000000000..731ef11c7a025ae95ed8a757b530d834733d0621
index 0000000000000000000000000000000000000000..d04a8a4336566dbe6e1b9ec0d574cff43e003fa8
--- /dev/null
+++ b/src/main/java/gg/pufferfish/pufferfish/sentry/PufferfishSentryAppender.java
@@ -0,0 +1,135 @@
@@ -1939,7 +1213,7 @@ index 0000000000000000000000000000000000000000..731ef11c7a025ae95ed8a757b530d834
+}
diff --git a/src/main/java/gg/pufferfish/pufferfish/sentry/SentryManager.java b/src/main/java/gg/pufferfish/pufferfish/sentry/SentryManager.java
new file mode 100644
index 0000000000000000000000000000000000000000..1b29210ad0bbb4ada150f23357f0c80d331c996d
index 0000000000000000000000000000000000000000..b011abbeb80b42de6be3785e47c7ba3c0f6dc161
--- /dev/null
+++ b/src/main/java/gg/pufferfish/pufferfish/sentry/SentryManager.java
@@ -0,0 +1,40 @@
@@ -1985,7 +1259,7 @@ index 0000000000000000000000000000000000000000..1b29210ad0bbb4ada150f23357f0c80d
+}
diff --git a/src/main/java/gg/pufferfish/pufferfish/util/AsyncExecutor.java b/src/main/java/gg/pufferfish/pufferfish/util/AsyncExecutor.java
new file mode 100644
index 0000000000000000000000000000000000000000..8e5323d5d9af25c8a85c4b34a6be76cfc54384cf
index 0000000000000000000000000000000000000000..0fe6243ea01f39fc43c4ca8897a70feddb7fb11d
--- /dev/null
+++ b/src/main/java/gg/pufferfish/pufferfish/util/AsyncExecutor.java
@@ -0,0 +1,73 @@
@@ -2064,7 +1338,7 @@ index 0000000000000000000000000000000000000000..8e5323d5d9af25c8a85c4b34a6be76cf
+}
diff --git a/src/main/java/gg/pufferfish/pufferfish/util/AsyncPlayerAreaMap.java b/src/main/java/gg/pufferfish/pufferfish/util/AsyncPlayerAreaMap.java
new file mode 100644
index 0000000000000000000000000000000000000000..fdcb62d12164024a5f354d60cc863821a18d1b2a
index 0000000000000000000000000000000000000000..a93ee99c2399def1e221260547a3e6bce2d621fa
--- /dev/null
+++ b/src/main/java/gg/pufferfish/pufferfish/util/AsyncPlayerAreaMap.java
@@ -0,0 +1,31 @@
@@ -2127,7 +1401,7 @@ index 0000000000000000000000000000000000000000..c1929840254a3e6d721816f4a20415be
+}
diff --git a/src/main/java/gg/pufferfish/pufferfish/util/Long2ObjectOpenHashMapWrapper.java b/src/main/java/gg/pufferfish/pufferfish/util/Long2ObjectOpenHashMapWrapper.java
new file mode 100644
index 0000000000000000000000000000000000000000..facd55463d44cb7e3d2ca6892982f5497b8dded1
index 0000000000000000000000000000000000000000..42cdc43d6b739973a0944f502089757247ee6c61
--- /dev/null
+++ b/src/main/java/gg/pufferfish/pufferfish/util/Long2ObjectOpenHashMapWrapper.java
@@ -0,0 +1,40 @@
@@ -2228,18 +1502,18 @@ index 6efb8b10f17c70b05128039376d254e6beda3841..57e8c6673c7cfe447a75f15506e80000
public static long getCoordinateKey(final ChunkPos pair) {
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index 4450d825a5474da211f0e83f845d8c7129fa08aa..6d5e9400892b86562519a893349ca55e566bfb24 100644
index 4450d825a5474da211f0e83f845d8c7129fa08aa..a4c64b1cc11955fb279b8ed0fb7d2668a7b90d2b 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -312,6 +312,8 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
public volatile Thread shutdownThread; // Paper
@@ -313,6 +313,8 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
public volatile boolean abnormalExit = false; // Paper
public boolean isIteratingOverLevels = false; // Paper
+
+ public gg.pufferfish.pufferfish.util.AsyncExecutor mobSpawnExecutor = new gg.pufferfish.pufferfish.util.AsyncExecutor("MobSpawning"); // Pufferfish - optimize mob spawning
+ public gg.pufferfish.pufferfish.util.AsyncExecutor mobSpawnExecutor = new gg.pufferfish.pufferfish.util.AsyncExecutor("MobSpawning"); // Pufferfish - optimize mob spawning
+
public static <S extends MinecraftServer> S spin(Function<Thread, S> serverFactory) {
AtomicReference<S> atomicreference = new AtomicReference();
Thread thread = new io.papermc.paper.util.TickThread(() -> { // Paper - rewrite chunk system
@@ -1681,7 +1683,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@DontObfuscate
@@ -2331,19 +1605,19 @@ index fbe209a66c77c47935ad026dd3e45e682af91fd8..3ce4dbf4eed442d89d6bbc8e4c6a0001
return this.scaledRange(i);
}
diff --git a/src/main/java/net/minecraft/server/level/ServerChunkCache.java b/src/main/java/net/minecraft/server/level/ServerChunkCache.java
index ca84eddbdb1e198b899750e5f6b3eafd25ce970f..c6f5d6756fa0e068a462d9c0ded12e0771abba37 100644
index ca84eddbdb1e198b899750e5f6b3eafd25ce970f..8438354e482b6f892c3344eceff1abd23cfa128a 100644
--- a/src/main/java/net/minecraft/server/level/ServerChunkCache.java
+++ b/src/main/java/net/minecraft/server/level/ServerChunkCache.java
@@ -76,6 +76,9 @@ public class ServerChunkCache extends ChunkSource {
final it.unimi.dsi.fastutil.longs.Long2ObjectOpenHashMap<LevelChunk> loadedChunkMap = new it.unimi.dsi.fastutil.longs.Long2ObjectOpenHashMap<>(8192, 0.5f);
@@ -77,6 +77,9 @@ public class ServerChunkCache extends ChunkSource {
private final LevelChunk[] lastLoadedChunks = new LevelChunk[4 * 4];
+
+ public boolean firstRunSpawnCounts = true; // Pufferfish
+ public final java.util.concurrent.atomic.AtomicBoolean _pufferfish_spawnCountsReady = new java.util.concurrent.atomic.AtomicBoolean(false); // Pufferfish - optimize countmobs
+
private static int getChunkCacheKey(int x, int z) {
return x & 3 | ((z & 3) << 2);
}
@@ -703,6 +706,7 @@ public class ServerChunkCache extends ChunkSource {
ProfilerFiller gameprofilerfiller = this.level.getProfiler();
@@ -2644,7 +1918,7 @@ index 04b1531572e8fff1e46fe1c94e7fc863841e0f66..47ddc42f2b63d9d3fae5ae6ea93d4183
int LARGE_MAX_STACK_SIZE = 64;
int DEFAULT_DISTANCE_LIMIT = 8;
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
index 4705d7066207250c03a5f98eef61554c901f2e35..e25be74ef0a88541884ad62a4b84219400d5a142 100644
index 4705d7066207250c03a5f98eef61554c901f2e35..548133e399b5abc4aa83045af87c135a3455b722 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -291,7 +291,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
@@ -4295,43 +3569,6 @@ index f7ea77dd82d978ad307f99c743efacfb34478b3d..009ab06182359862b8f543030ec4fe4e
+ MinecraftServer.getServer().getRecipeManager().addRecipe(new net.minecraft.world.item.crafting.ShapelessRecipe(CraftNamespacedKey.toMinecraft(this.getKey()), this.getGroup(), CraftRecipe.getCategory(this.getCategory()), CraftItemStack.asNMSCopy(this.getResult()), data, true));
}
}
diff --git a/src/main/java/org/bukkit/craftbukkit/scheduler/MinecraftInternalPlugin.java b/src/main/java/org/bukkit/craftbukkit/scheduler/MinecraftInternalPlugin.java
index d96399e9bf1a58db5a4a22e58abb99e7660e0694..eb19f679ee498e51d02fe9a961cf02699cf75848 100644
--- a/src/main/java/org/bukkit/craftbukkit/scheduler/MinecraftInternalPlugin.java
+++ b/src/main/java/org/bukkit/craftbukkit/scheduler/MinecraftInternalPlugin.java
@@ -22,7 +22,8 @@ public class MinecraftInternalPlugin extends PluginBase {
private boolean enabled = true;
private final String pluginName;
- private PluginDescriptionFile pdf;
+ private org.bukkit.plugin.PluginLogger logger;
+ private PluginDescriptionFile pdf; // Pufferfish
public MinecraftInternalPlugin() {
this.pluginName = "Minecraft";
@@ -81,7 +82,12 @@ public class MinecraftInternalPlugin extends PluginBase {
@Override
public PluginLogger getLogger() {
- throw new UnsupportedOperationException("Not supported.");
+ // Pufferfish start
+ if (this.logger == null) {
+ this.logger = new org.bukkit.plugin.PluginLogger(this); // Pufferfish
+ }
+ return this.logger;
+ // Pufferfish end
}
@Override
@@ -91,7 +97,7 @@ public class MinecraftInternalPlugin extends PluginBase {
@Override
public Server getServer() {
- throw new UnsupportedOperationException("Not supported.");
+ return org.bukkit.Bukkit.getServer(); // Pufferfish - impl
}
@Override
diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
index 64c50c52c11214740de7903e5592b8b6b2c170b3..d4f62940504e3ef7a70e13b1f4a7726f23b4c637 100644
--- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
@@ -4345,18 +3582,6 @@ index 64c50c52c11214740de7903e5592b8b6b2c170b3..d4f62940504e3ef7a70e13b1f4a7726f
}
@Override
diff --git a/src/main/java/org/bukkit/craftbukkit/util/ServerShutdownThread.java b/src/main/java/org/bukkit/craftbukkit/util/ServerShutdownThread.java
index e948ec5a573b22645664eb53bc3e9932246544e4..e3845dc3357bbb74885ae3a1a08525adde581235 100644
--- a/src/main/java/org/bukkit/craftbukkit/util/ServerShutdownThread.java
+++ b/src/main/java/org/bukkit/craftbukkit/util/ServerShutdownThread.java
@@ -11,6 +11,7 @@ public class ServerShutdownThread extends Thread {
@Override
public void run() {
+ try { gg.pufferfish.pufferfish.flare.ProfilingManager.stop(); } catch (Throwable t) {} // Pufferfish - shut down Flare if it's running
try {
// Paper start - try to shutdown on main
server.safeShutdown(false, false);
diff --git a/src/main/java/org/bukkit/craftbukkit/util/Versioning.java b/src/main/java/org/bukkit/craftbukkit/util/Versioning.java
index 774556a62eb240da42e84db4502e2ed43495be17..80553face9c70c2a3d897681e7761df85b22d464 100644
--- a/src/main/java/org/bukkit/craftbukkit/util/Versioning.java

View File

@@ -1,6 +1,6 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: AlphaKR93 <dev@alpha93.kr>
Date: Thu, 23 Mar 2023 10:35:36 +0900
Date: Mon, 27 Mar 2023 02:52:12 +0000
Subject: [PATCH] Purpur Server Changes
Original: PurpurMC
@@ -25,7 +25,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
diff --git a/build.gradle.kts b/build.gradle.kts
index 3c8293f002f11b430083502362fdc801f44aa138..6c5b3f6a2c4f7b20e3388b63c36b7c4bc4cf179f 100644
index b41b186397d013c19436c345be98b785d4bd0295..22470f0ab8354a9f31a0f195f3fe80f2f5ee2f0e 100644
--- a/build.gradle.kts
+++ b/build.gradle.kts
@@ -7,12 +7,8 @@ plugins {
@@ -54,7 +54,7 @@ index 3c8293f002f11b430083502362fdc801f44aa138..6c5b3f6a2c4f7b20e3388b63c36b7c4b
runtimeOnly("org.apache.maven:maven-resolver-provider:3.8.5")
runtimeOnly("org.apache.maven.resolver:maven-resolver-connector-basic:1.7.3")
runtimeOnly("org.apache.maven.resolver:maven-resolver-transport-http:1.7.3")
@@ -82,7 +82,7 @@ tasks.jar {
@@ -81,7 +81,7 @@ tasks.jar {
attributes(
"Main-Class" to "org.bukkit.craftbukkit.Main",
"Implementation-Title" to "CraftBukkit",
@@ -63,7 +63,7 @@ index 3c8293f002f11b430083502362fdc801f44aa138..6c5b3f6a2c4f7b20e3388b63c36b7c4b
"Implementation-Vendor" to date, // Paper
"Specification-Title" to "Bukkit",
"Specification-Version" to project.version,
@@ -154,7 +154,7 @@ fun TaskContainer.registerRunTask(
@@ -153,7 +153,7 @@ fun TaskContainer.registerRunTask(
name: String,
block: JavaExec.() -> Unit
): TaskProvider<JavaExec> = register<JavaExec>(name) {
@@ -261,10 +261,10 @@ index 39844531b03eb8a6c70700b4ecbf0ff1a557424d..632ae75cb3bbc7a3955872d14ad0fbc2
public void removeCommand(String name) {
this.children.remove(name);
diff --git a/src/main/java/gg/pufferfish/pufferfish/PufferfishConfig.java b/src/main/java/gg/pufferfish/pufferfish/PufferfishConfig.java
index e0076044d0a29e33ee297fe6180a041436075297..c0f44f0593aab16d5ceab493f4075772f454732e 100644
index a8cead500186142115d4dc029c942fdfc68f7fe5..62b2a3a44929b80b813bc24a33cd1f5049fecbb2 100644
--- a/src/main/java/gg/pufferfish/pufferfish/PufferfishConfig.java
+++ b/src/main/java/gg/pufferfish/pufferfish/PufferfishConfig.java
@@ -36,6 +36,7 @@ public class PufferfishConfig {
@@ -28,6 +28,7 @@ public class PufferfishConfig {
private static final YamlFile config = new YamlFile();
private static int updates = 0;
@@ -272,7 +272,7 @@ index e0076044d0a29e33ee297fe6180a041436075297..c0f44f0593aab16d5ceab493f4075772
private static ConfigurationSection convertToBukkit(org.simpleyaml.configuration.ConfigurationSection section) {
ConfigurationSection newSection = new MemoryConfiguration();
@@ -58,7 +59,7 @@ public class PufferfishConfig {
@@ -50,7 +51,7 @@ public class PufferfishConfig {
}
public static void load() throws IOException {
@@ -281,7 +281,7 @@ index e0076044d0a29e33ee297fe6180a041436075297..c0f44f0593aab16d5ceab493f4075772
if (configFile.exists()) {
try {
@@ -232,7 +233,7 @@ public class PufferfishConfig {
@@ -224,7 +225,7 @@ public class PufferfishConfig {
public static int activationDistanceMod;
private static void dynamicActivationOfBrains() throws IOException {
@@ -290,7 +290,7 @@ index e0076044d0a29e33ee297fe6180a041436075297..c0f44f0593aab16d5ceab493f4075772
startDistance = getInt("dab.start-distance", "activation-range.start-distance", 12,
"This value determines how far away an entity has to be",
"from the player to start being effected by DEAR.");
@@ -276,7 +277,7 @@ public class PufferfishConfig {
@@ -268,7 +269,7 @@ public class PufferfishConfig {
public static boolean throttleInactiveGoalSelectorTick;
private static void inactiveGoalSelectorThrottle() {
@@ -1049,7 +1049,7 @@ index 9ec6145fe04ec64bbee8ec6a837719caebdbc6f5..358d610ad020cada1bb83e393deeeaae
public ClientboundSetTimePacket(long time, long timeOfDay, boolean doDaylightCycle) {
this.gameTime = time;
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index 6d5e9400892b86562519a893349ca55e566bfb24..5416b64c3000c9b17a78991218e068bf5ef33db7 100644
index a4c64b1cc11955fb279b8ed0fb7d2668a7b90d2b..2cc20cc768bbbd386972c426d3a131af33612294 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -249,7 +249,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -1927,7 +1927,7 @@ index 3ce4dbf4eed442d89d6bbc8e4c6a000172041da5..57fdef8b16e1ed9a4693356144b4685b
}
diff --git a/src/main/java/net/minecraft/server/level/ServerChunkCache.java b/src/main/java/net/minecraft/server/level/ServerChunkCache.java
index c6f5d6756fa0e068a462d9c0ded12e0771abba37..0ae45cf5a084fd412305e8b2f5dabe608b4eb1c1 100644
index 8438354e482b6f892c3344eceff1abd23cfa128a..30d364b385da21544a810a76f436f06879d39b14 100644
--- a/src/main/java/net/minecraft/server/level/ServerChunkCache.java
+++ b/src/main/java/net/minecraft/server/level/ServerChunkCache.java
@@ -431,16 +431,16 @@ public class ServerChunkCache extends ChunkSource {
@@ -2627,10 +2627,10 @@ index ff2862bf1f511196d1e911e2584262ed728e9a81..43bf3285729ec5cedb3de84f2b606739
}
// Paper end
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java
index a399de32d5f2f932d41fbb552780979950844a05..e5cf1bf76094b9b4e2ee9608276e0361b48ef1b4 100644
index 1d4d02f26391ac55c7631817f09d05e2769b0d29..8a4be66f967dfd6b57ab542ae9b06c840647486d 100644
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
@@ -274,6 +274,11 @@ public class ServerPlayer extends Player {
@@ -275,6 +275,11 @@ public class ServerPlayer extends Player {
public final com.destroystokyo.paper.util.misc.PooledLinkedHashSets.PooledObjectLinkedOpenHashSet<ServerPlayer> cachedSingleHashSet; // Paper
public PlayerNaturallySpawnCreaturesEvent playerNaturallySpawnedEvent; // Paper
public org.bukkit.event.player.PlayerQuitEvent.QuitReason quitReason = null; // Paper - there are a lot of changes to do if we change all methods leading to the event
@@ -2642,7 +2642,7 @@ index a399de32d5f2f932d41fbb552780979950844a05..e5cf1bf76094b9b4e2ee9608276e0361
public ServerPlayer(MinecraftServer server, ServerLevel world, GameProfile profile) {
super(world, world.getSharedSpawnPos(), world.getSharedSpawnAngle(), profile);
@@ -373,6 +378,7 @@ public class ServerPlayer extends Player {
@@ -374,6 +379,7 @@ public class ServerPlayer extends Player {
this.bukkitPickUpLoot = true;
this.maxHealthCache = this.getMaxHealth();
this.cachedSingleMobDistanceMap = new com.destroystokyo.paper.util.PooledHashSets.PooledObjectLinkedOpenHashSet<>(this); // Paper
@@ -2650,7 +2650,7 @@ index a399de32d5f2f932d41fbb552780979950844a05..e5cf1bf76094b9b4e2ee9608276e0361
}
// Yes, this doesn't match Vanilla, but it's the best we can do for now.
@@ -512,6 +518,9 @@ public class ServerPlayer extends Player {
@@ -513,6 +519,9 @@ public class ServerPlayer extends Player {
}
}
@@ -2660,7 +2660,7 @@ index a399de32d5f2f932d41fbb552780979950844a05..e5cf1bf76094b9b4e2ee9608276e0361
}
@Override
@@ -578,6 +587,9 @@ public class ServerPlayer extends Player {
@@ -579,6 +588,9 @@ public class ServerPlayer extends Player {
}
this.getBukkitEntity().setExtraData(nbt); // CraftBukkit
@@ -2670,7 +2670,7 @@ index a399de32d5f2f932d41fbb552780979950844a05..e5cf1bf76094b9b4e2ee9608276e0361
}
// CraftBukkit start - World fallback code, either respawn location or global spawn
@@ -706,6 +718,15 @@ public class ServerPlayer extends Player {
@@ -707,6 +719,15 @@ public class ServerPlayer extends Player {
this.trackStartFallingPosition();
this.trackEnteredOrExitedLavaOnVehicle();
this.advancements.flushDirty(this);
@@ -2686,7 +2686,7 @@ index a399de32d5f2f932d41fbb552780979950844a05..e5cf1bf76094b9b4e2ee9608276e0361
}
public void doTick() {
@@ -944,6 +965,7 @@ public class ServerPlayer extends Player {
@@ -945,6 +966,7 @@ public class ServerPlayer extends Player {
}));
Team scoreboardteambase = this.getTeam();
@@ -2694,7 +2694,7 @@ index a399de32d5f2f932d41fbb552780979950844a05..e5cf1bf76094b9b4e2ee9608276e0361
if (scoreboardteambase != null && scoreboardteambase.getDeathMessageVisibility() != Team.Visibility.ALWAYS) {
if (scoreboardteambase.getDeathMessageVisibility() == Team.Visibility.HIDE_FOR_OTHER_TEAMS) {
this.server.getPlayerList().broadcastSystemToTeam(this, ichatbasecomponent);
@@ -1045,14 +1067,30 @@ public class ServerPlayer extends Player {
@@ -1046,14 +1068,30 @@ public class ServerPlayer extends Player {
}
@@ -2726,7 +2726,7 @@ index a399de32d5f2f932d41fbb552780979950844a05..e5cf1bf76094b9b4e2ee9608276e0361
return false;
} else {
Entity entity = source.getEntity();
@@ -1161,7 +1199,7 @@ public class ServerPlayer extends Player {
@@ -1162,7 +1200,7 @@ public class ServerPlayer extends Player {
PortalInfo shapedetectorshape = this.findDimensionEntryPoint(worldserver);
if (shapedetectorshape != null) {
@@ -2735,7 +2735,7 @@ index a399de32d5f2f932d41fbb552780979950844a05..e5cf1bf76094b9b4e2ee9608276e0361
worldserver = shapedetectorshape.world; // CraftBukkit
if (worldserver == null) { } else // CraftBukkit - empty to fall through to null to event
if (resourcekey == LevelStem.OVERWORLD && worldserver.getTypeKey() == LevelStem.NETHER) { // CraftBukkit
@@ -1184,8 +1222,8 @@ public class ServerPlayer extends Player {
@@ -1185,8 +1223,8 @@ public class ServerPlayer extends Player {
worldserver = ((CraftWorld) exit.getWorld()).getHandle();
// CraftBukkit end
@@ -2746,7 +2746,7 @@ index a399de32d5f2f932d41fbb552780979950844a05..e5cf1bf76094b9b4e2ee9608276e0361
if (true) { // CraftBukkit
this.isChangingDimension = true; // CraftBukkit - Set teleport invulnerability only if player changing worlds
@@ -1196,6 +1234,7 @@ public class ServerPlayer extends Player {
@@ -1197,6 +1235,7 @@ public class ServerPlayer extends Player {
playerlist.sendPlayerPermissionLevel(this);
worldserver1.removePlayerImmediately(this, Entity.RemovalReason.CHANGED_DIMENSION);
this.unsetRemoved();
@@ -2754,7 +2754,7 @@ index a399de32d5f2f932d41fbb552780979950844a05..e5cf1bf76094b9b4e2ee9608276e0361
// CraftBukkit end
this.setLevel(worldserver);
@@ -1203,7 +1242,7 @@ public class ServerPlayer extends Player {
@@ -1204,7 +1243,7 @@ public class ServerPlayer extends Player {
this.connection.teleport(exit); // CraftBukkit - use internal teleport without event
this.connection.resetPosition();
worldserver.addDuringPortalTeleport(this);
@@ -2763,7 +2763,7 @@ index a399de32d5f2f932d41fbb552780979950844a05..e5cf1bf76094b9b4e2ee9608276e0361
this.triggerDimensionChangeTriggers(worldserver1);
this.connection.send(new ClientboundPlayerAbilitiesPacket(this.getAbilities()));
playerlist.sendLevelInfo(this, worldserver);
@@ -1232,6 +1271,7 @@ public class ServerPlayer extends Player {
@@ -1233,6 +1272,7 @@ public class ServerPlayer extends Player {
}
// Paper end
@@ -2771,7 +2771,7 @@ index a399de32d5f2f932d41fbb552780979950844a05..e5cf1bf76094b9b4e2ee9608276e0361
return this;
}
}
@@ -1353,7 +1393,7 @@ public class ServerPlayer extends Player {
@@ -1354,7 +1394,7 @@ public class ServerPlayer extends Player {
return entitymonster.isPreventingPlayerRest(this);
});
@@ -2780,7 +2780,7 @@ index a399de32d5f2f932d41fbb552780979950844a05..e5cf1bf76094b9b4e2ee9608276e0361
return Either.left(Player.BedSleepingProblem.NOT_SAFE);
}
}
@@ -1489,6 +1529,7 @@ public class ServerPlayer extends Player {
@@ -1490,6 +1530,7 @@ public class ServerPlayer extends Player {
@Override
public void openTextEdit(SignBlockEntity sign) {
@@ -2788,7 +2788,7 @@ index a399de32d5f2f932d41fbb552780979950844a05..e5cf1bf76094b9b4e2ee9608276e0361
sign.setAllowedPlayerEditor(this.getUUID());
this.connection.send(new ClientboundBlockUpdatePacket(this.level, sign.getBlockPos()));
this.connection.send(new ClientboundOpenSignEditorPacket(sign.getBlockPos()));
@@ -1715,6 +1756,26 @@ public class ServerPlayer extends Player {
@@ -1726,6 +1767,26 @@ public class ServerPlayer extends Player {
this.lastSentExp = -1; // CraftBukkit - Added to reset
}
@@ -2815,7 +2815,7 @@ index a399de32d5f2f932d41fbb552780979950844a05..e5cf1bf76094b9b4e2ee9608276e0361
@Override
public void displayClientMessage(Component message, boolean overlay) {
this.sendSystemMessage(message, overlay);
@@ -2014,6 +2075,7 @@ public class ServerPlayer extends Player {
@@ -2025,6 +2086,7 @@ public class ServerPlayer extends Player {
}
public void sendTexturePack(String url, String hash, boolean required, @Nullable Component resourcePackPrompt) {
@@ -2823,7 +2823,7 @@ index a399de32d5f2f932d41fbb552780979950844a05..e5cf1bf76094b9b4e2ee9608276e0361
this.connection.send(new ClientboundResourcePackPacket(url, hash, required, resourcePackPrompt));
}
@@ -2028,8 +2090,63 @@ public class ServerPlayer extends Player {
@@ -2039,8 +2101,63 @@ public class ServerPlayer extends Player {
public void resetLastActionTime() {
this.lastActionTime = Util.getMillis();
@@ -2887,7 +2887,7 @@ index a399de32d5f2f932d41fbb552780979950844a05..e5cf1bf76094b9b4e2ee9608276e0361
public ServerStatsCounter getStats() {
return this.stats;
}
@@ -2490,8 +2607,16 @@ public class ServerPlayer extends Player {
@@ -2501,8 +2618,16 @@ public class ServerPlayer extends Player {
@Override
public boolean isImmobile() {
@@ -2905,7 +2905,7 @@ index a399de32d5f2f932d41fbb552780979950844a05..e5cf1bf76094b9b4e2ee9608276e0361
@Override
public Scoreboard getScoreboard() {
@@ -2540,4 +2665,50 @@ public class ServerPlayer extends Player {
@@ -2551,4 +2676,50 @@ public class ServerPlayer extends Player {
return (CraftPlayer) super.getBukkitEntity();
}
// CraftBukkit end
@@ -4049,7 +4049,7 @@ index 14fab63346d56c72cd7534a04760efd10eef4295..745e792482f61c571e2efbd4200dd1bd
@Override
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
index e25be74ef0a88541884ad62a4b84219400d5a142..b2ee73a2ef6042694ca84c27d592e5fb13b4a0fe 100644
index 548133e399b5abc4aa83045af87c135a3455b722..3c10c719f6172161a2dcc6592a0a1492e9b3d7c1 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -155,7 +155,7 @@ import org.bukkit.plugin.PluginManager;
@@ -5071,7 +5071,7 @@ index 791f672b30f2a4d3b329e2ce0f4fb9c2ca627b01..8d7c33e16f9eaec2120c5aad75172ff6
});
}
diff --git a/src/main/java/net/minecraft/world/entity/Mob.java b/src/main/java/net/minecraft/world/entity/Mob.java
index 636e601b004a412d02e5be86e97d489b52c28e1b..141b25060905f598208cb1a39f4c2b2e9f3ef766 100644
index 636e601b004a412d02e5be86e97d489b52c28e1b..8e2274f7dce34e0997356205cf96e46f8d41cca1 100644
--- a/src/main/java/net/minecraft/world/entity/Mob.java
+++ b/src/main/java/net/minecraft/world/entity/Mob.java
@@ -65,6 +65,7 @@ import net.minecraft.world.item.ProjectileWeaponItem;
@@ -5212,7 +5212,8 @@ index 636e601b004a412d02e5be86e97d489b52c28e1b..141b25060905f598208cb1a39f4c2b2e
- this.level.getProfiler().pop();
+ //this.level.getProfiler().pop(); // Purpur
} else {
this.level.getProfiler().push("targetSelector");
- this.level.getProfiler().push("targetSelector");
+ //this.level.getProfiler().push("targetSelector"); // Purpur
if (this.targetSelector.inactiveTick(this.activatedPriority, false)) // Pufferfish - use this to alternate ticking
this.targetSelector.tick();
- this.level.getProfiler().pop();
@@ -15118,7 +15119,7 @@ index 5d199fe497bd852827d3d18fb7566a09e70331a3..6cd8a50289a6404441e9e5e08d82d2eb
if (NaturalSpawner.isSpawnPositionOk(SpawnPlacements.Type.ON_GROUND, world, blockposition2, EntityType.WANDERING_TRADER)) {
blockposition1 = blockposition2;
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 2b02800666b358159c8ecb63208a14855f90657b..f96524c4a5d3c51b1ab6d990b30055ad5d8bfaac 100644
index 0629c471d38a77c44fc1c86ccdfcb0690f61ca17..d055cfc257cc7282170ba67c848af3e6c5f2ec1f 100644
--- a/src/main/java/net/minecraft/world/entity/player/Player.java
+++ b/src/main/java/net/minecraft/world/entity/player/Player.java
@@ -186,6 +186,8 @@ public abstract class Player extends LivingEntity {
@@ -15198,7 +15199,7 @@ index 2b02800666b358159c8ecb63208a14855f90657b..f96524c4a5d3c51b1ab6d990b30055ad
}
@Override
@@ -584,7 +624,7 @@ public abstract class Player extends LivingEntity {
@@ -590,7 +630,7 @@ public abstract class Player extends LivingEntity {
for (int i = 0; i < list.size(); ++i) {
Entity entity = (Entity) list.get(i);
@@ -15207,7 +15208,7 @@ index 2b02800666b358159c8ecb63208a14855f90657b..f96524c4a5d3c51b1ab6d990b30055ad
list1.add(entity);
} else if (!entity.isRemoved()) {
this.touch(entity);
@@ -1275,7 +1315,7 @@ public abstract class Player extends LivingEntity {
@@ -1281,7 +1321,7 @@ public abstract class Player extends LivingEntity {
flag2 = flag2 && !level.paperConfig().entities.behavior.disablePlayerCrits; // Paper
flag2 = flag2 && !this.isSprinting();
if (flag2) {
@@ -15216,7 +15217,7 @@ index 2b02800666b358159c8ecb63208a14855f90657b..f96524c4a5d3c51b1ab6d990b30055ad
}
f += f1;
@@ -1944,9 +1984,19 @@ public abstract class Player extends LivingEntity {
@@ -1950,9 +1990,19 @@ public abstract class Player extends LivingEntity {
@Override
public int getExperienceReward() {
if (!this.level.getGameRules().getBoolean(GameRules.RULE_KEEPINVENTORY) && !this.isSpectator()) {
@@ -15239,7 +15240,7 @@ index 2b02800666b358159c8ecb63208a14855f90657b..f96524c4a5d3c51b1ab6d990b30055ad
} else {
return 0;
}
@@ -2022,6 +2072,11 @@ public abstract class Player extends LivingEntity {
@@ -2028,6 +2078,11 @@ public abstract class Player extends LivingEntity {
return this.inventory.armor;
}
@@ -15251,7 +15252,7 @@ index 2b02800666b358159c8ecb63208a14855f90657b..f96524c4a5d3c51b1ab6d990b30055ad
public boolean setEntityOnShoulder(CompoundTag entityNbt) {
if (!this.isPassenger() && this.onGround && !this.isInWater() && !this.isInPowderSnow) {
if (this.getShoulderEntityLeft().isEmpty()) {
@@ -2305,7 +2360,7 @@ public abstract class Player extends LivingEntity {
@@ -2311,7 +2366,7 @@ public abstract class Player extends LivingEntity {
public ItemStack eat(Level world, ItemStack stack) {
this.getFoodData().eat(stack.getItem(), stack);
this.awardStat(Stats.ITEM_USED.get(stack.getItem()));
@@ -16659,7 +16660,7 @@ index 180aec596110309aade13d2080f8824d152b07cb..c4aec1e5135a79837918b692e75a7b55
return InteractionResult.PASS;
}
diff --git a/src/main/java/net/minecraft/world/item/ItemStack.java b/src/main/java/net/minecraft/world/item/ItemStack.java
index a6253272205337b3b855679b3057c2519a807a4c..234d992206f34febc7aff24b78cb3e526254e35f 100644
index d690b8d0c1da1f56b226376df8c76c34375e3c73..0c0a0639cd9c85d4332a6fa85e3143510f3c7448 100644
--- a/src/main/java/net/minecraft/world/item/ItemStack.java
+++ b/src/main/java/net/minecraft/world/item/ItemStack.java
@@ -109,6 +109,7 @@ import org.bukkit.event.world.StructureGrowEvent;
@@ -16670,7 +16671,7 @@ index a6253272205337b3b855679b3057c2519a807a4c..234d992206f34febc7aff24b78cb3e52
public static final Codec<ItemStack> CODEC = RecordCodecBuilder.create((instance) -> {
return instance.group(BuiltInRegistries.ITEM.byNameCodec().fieldOf("id").forGetter((itemstack) -> {
return itemstack.item;
@@ -414,6 +415,7 @@ public final class ItemStack {
@@ -415,6 +416,7 @@ public final class ItemStack {
world.preventPoiUpdated = true; // CraftBukkit - SPIGOT-5710
for (BlockState blockstate : blocks) {
blockstate.update(true, false);
@@ -16678,7 +16679,7 @@ index a6253272205337b3b855679b3057c2519a807a4c..234d992206f34febc7aff24b78cb3e52
}
world.preventPoiUpdated = false;
@@ -443,6 +445,7 @@ public final class ItemStack {
@@ -444,6 +446,7 @@ public final class ItemStack {
if (!(block.getBlock() instanceof BaseEntityBlock)) { // Containers get placed automatically
block.getBlock().onPlace(block, world, newblockposition, oldBlock, true, itemactioncontext); // Paper - pass itemactioncontext
}
@@ -16686,7 +16687,7 @@ index a6253272205337b3b855679b3057c2519a807a4c..234d992206f34febc7aff24b78cb3e52
world.notifyAndUpdatePhysics(newblockposition, null, oldBlock, block, world.getBlockState(newblockposition), updateFlag, 512); // send null chunk as chunk.k() returns false by this point
}
@@ -558,6 +561,16 @@ public final class ItemStack {
@@ -559,6 +562,16 @@ public final class ItemStack {
return this.isDamageableItem() && this.getDamageValue() > 0;
}
@@ -16703,7 +16704,7 @@ index a6253272205337b3b855679b3057c2519a807a4c..234d992206f34febc7aff24b78cb3e52
public int getDamageValue() {
return this.tag == null ? 0 : this.tag.getInt("Damage");
}
@@ -577,7 +590,7 @@ public final class ItemStack {
@@ -578,7 +591,7 @@ public final class ItemStack {
int j;
if (amount > 0) {
@@ -16712,7 +16713,7 @@ index a6253272205337b3b855679b3057c2519a807a4c..234d992206f34febc7aff24b78cb3e52
int k = 0;
for (int l = 0; j > 0 && l < amount; ++l) {
@@ -632,6 +645,12 @@ public final class ItemStack {
@@ -633,6 +646,12 @@ public final class ItemStack {
if (this.hurt(amount, entity.getRandom(), entity /*instanceof ServerPlayer ? (ServerPlayer) entity : null*/)) { // Paper - pass LivingEntity for EntityItemDamageEvent
breakCallback.accept(entity);
Item item = this.getItem();
@@ -16725,7 +16726,7 @@ index a6253272205337b3b855679b3057c2519a807a4c..234d992206f34febc7aff24b78cb3e52
// CraftBukkit start - Check for item breaking
if (this.count == 1 && entity instanceof net.minecraft.world.entity.player.Player) {
org.bukkit.craftbukkit.event.CraftEventFactory.callPlayerItemBreakEvent((net.minecraft.world.entity.player.Player) entity, this);
@@ -1164,7 +1183,7 @@ public final class ItemStack {
@@ -1165,7 +1184,7 @@ public final class ItemStack {
ListTag nbttaglist = this.tag.getList("Enchantments", 10);
@@ -16734,7 +16735,7 @@ index a6253272205337b3b855679b3057c2519a807a4c..234d992206f34febc7aff24b78cb3e52
processEnchantOrder(this.tag); // Paper
}
@@ -1172,6 +1191,12 @@ public final class ItemStack {
@@ -1173,6 +1192,12 @@ public final class ItemStack {
return this.tag != null && this.tag.contains("Enchantments", 9) ? !this.tag.getList("Enchantments", 10).isEmpty() : false;
}
@@ -17513,7 +17514,7 @@ index 3d2b34c5a7c9b00c1164b4f89c2cbff81fc460eb..b5505e926e5cdb447de68e8eb8e46c97
return true;
} else {
diff --git a/src/main/java/net/minecraft/world/level/block/BedBlock.java b/src/main/java/net/minecraft/world/level/block/BedBlock.java
index 96434f14525a2159f335b94aad95081f488fadf3..d56bbd43b127a1d663a398b1da7090ff64ab6a6c 100644
index 3aa79a441ac4bd6b4d87d19bdb3011455210fd41..4de8e77ef7574a0febf9c89258e4aeb26f4af6fc 100644
--- a/src/main/java/net/minecraft/world/level/block/BedBlock.java
+++ b/src/main/java/net/minecraft/world/level/block/BedBlock.java
@@ -97,7 +97,7 @@ public class BedBlock extends HorizontalDirectionalBlock implements EntityBlock
@@ -20681,7 +20682,7 @@ index 4d7a2c4c1001aefe9fcd4be8dbcb414f721bfff9..2c7716a9d65ebda209a144b82c2126b6
+ // Purpur end
}
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
index 1bada55af5d16437da4d16f9ded55f88a6121eb4..2b647aeb75e2207186bf9506fba0d92a745cfae8 100644
index 0ae1fce0c1a2e3bfbbab756a088fc76545e263fa..f81b320ef330d03b68cf8b4af04b7c991ce9636b 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
@@ -525,10 +525,15 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
@@ -20712,7 +20713,7 @@ index 1bada55af5d16437da4d16f9ded55f88a6121eb4..2b647aeb75e2207186bf9506fba0d92a
return false;
}
@@ -2356,6 +2365,28 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
@@ -2366,6 +2375,28 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
return this.getHandle().getAbilities().walkingSpeed * 2f;
}
@@ -20741,7 +20742,7 @@ index 1bada55af5d16437da4d16f9ded55f88a6121eb4..2b647aeb75e2207186bf9506fba0d92a
private void validateSpeed(float value) {
if (value < 0) {
if (value < -1f) {
@@ -3148,4 +3179,97 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
@@ -3158,4 +3189,97 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
return this.spigot;
}
// Spigot end
@@ -21921,7 +21922,7 @@ index 0000000000000000000000000000000000000000..0bcbe1f07ff8e552d2abd6e432af5710
+}
diff --git a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
new file mode 100644
index 0000000000000000000000000000000000000000..fe903b1e1bd211651e3808becd34a2d28dc57f34
index 0000000000000000000000000000000000000000..d3f2002759ac4788feca1e62c90c2e64596eb2f2
--- /dev/null
+++ b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
@@ -0,0 +1,3189 @@
@@ -22050,7 +22051,7 @@ index 0000000000000000000000000000000000000000..fe903b1e1bd211651e3808becd34a2d2
+ public boolean useBetterMending = false;
+ public boolean alwaysTameInCreative = false;
+ public boolean boatEjectPlayersOnLand = false;
+ public boolean boatsDoFallDamage = true;
+ public boolean boatsDoFallDamage = false;
+ public boolean disableDropsOnCrammingDeath = false;
+ public boolean entitiesCanUsePortals = true;
+ public boolean entitiesPickUpLootBypassMobGriefing = false;

View File

@@ -1,19 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: AlphaKR93 <dev@alpha93.kr>
Date: Thu, 23 Mar 2023 12:08:57 +0900
Subject: [PATCH] Build Fix
diff --git a/src/main/java/net/minecraft/world/entity/Mob.java b/src/main/java/net/minecraft/world/entity/Mob.java
index 141b25060905f598208cb1a39f4c2b2e9f3ef766..d67bc2abe9590b1b0b86e450c9fabe5e2237be6c 100644
--- a/src/main/java/net/minecraft/world/entity/Mob.java
+++ b/src/main/java/net/minecraft/world/entity/Mob.java
@@ -946,7 +946,7 @@ public abstract class Mob extends LivingEntity implements Targeting {
this.goalSelector.tickRunningGoals(false);
//this.level.getProfiler().pop(); // Purpur
} else {
- this.level.getProfiler().push("targetSelector");
+ //this.level.getProfiler().push("targetSelector"); // Plazma - build fix
if (this.targetSelector.inactiveTick(this.activatedPriority, false)) // Pufferfish - use this to alternate ticking
this.targetSelector.tick();
//this.level.getProfiler().pop(); // Purpur

View File

@@ -5,7 +5,7 @@ Subject: [PATCH] Rebrand
diff --git a/build.gradle.kts b/build.gradle.kts
index 6c5b3f6a2c4f7b20e3388b63c36b7c4bc4cf179f..e4de94641d33b3deadc44bbb5f23f666d79737ea 100644
index 22470f0ab8354a9f31a0f195f3fe80f2f5ee2f0e..dc89b3a8956af69fa71a2bfa17c22aee6c5e9edf 100644
--- a/build.gradle.kts
+++ b/build.gradle.kts
@@ -7,7 +7,7 @@ plugins {
@@ -17,7 +17,7 @@ index 6c5b3f6a2c4f7b20e3388b63c36b7c4bc4cf179f..e4de94641d33b3deadc44bbb5f23f666
implementation("io.papermc.paper:paper-mojangapi:1.19.4-R0.1-SNAPSHOT") // Purpur
// Paper start
implementation("org.jline:jline-terminal-jansi:3.21.0")
@@ -82,7 +82,7 @@ tasks.jar {
@@ -81,7 +81,7 @@ tasks.jar {
attributes(
"Main-Class" to "org.bukkit.craftbukkit.Main",
"Implementation-Title" to "CraftBukkit",
@@ -175,7 +175,7 @@ index c6fa6bcd66d61359124a8426b919493c6ec43f06..e0eaa847526431ac58d00f18f0fca6b1
/* CraftBukkit start - Replace everything
OptionParser optionparser = new OptionParser();
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index 5416b64c3000c9b17a78991218e068bf5ef33db7..180ea5edb002856f975c074e319998b68b67a7af 100644
index 2cc20cc768bbbd386972c426d3a131af33612294..b81f8207348992761eac2aca8bae370c9b39f0f3 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -929,7 +929,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa

View File

@@ -169,7 +169,7 @@ index f6b9d216c24d8858802f85209fe1a869e5a9be31..746fdd880862e7dd8b53dec99b07ae62
+ // Plazma end
}
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index 180ea5edb002856f975c074e319998b68b67a7af..6d2d1d99977d33fdd8c9a34b65bbca189852d1c0 100644
index b81f8207348992761eac2aca8bae370c9b39f0f3..9ba8bf1cc91494651a1855d12415f4ac3586cf9d 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -308,6 +308,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa

View File

@@ -7,56 +7,45 @@ Original: YouHaveTrouble/minecraft-optimization, AkiraDevelopment/SimplyMC
Copyright (C) 2023 YouHaveTrouble, AkiraDevelopment
diff --git a/src/main/java/gg/pufferfish/pufferfish/PufferfishConfig.java b/src/main/java/gg/pufferfish/pufferfish/PufferfishConfig.java
index c0f44f0593aab16d5ceab493f4075772f454732e..7aa260293a12c0b9b9efcd2d8bc470fb06a32cf1 100644
index 62b2a3a44929b80b813bc24a33cd1f5049fecbb2..cea33db916f9fd828f3cb131a4b2ebdd16866649 100644
--- a/src/main/java/gg/pufferfish/pufferfish/PufferfishConfig.java
+++ b/src/main/java/gg/pufferfish/pufferfish/PufferfishConfig.java
@@ -72,7 +72,7 @@ public class PufferfishConfig {
getString("info.version", "1.0");
setComment("info",
"Pufferfish Configuration",
- "Check out Pufferfish Host for maximum performance server hosting: https://pufferfish.host",
+ //"Check out Pufferfish Host for maximum performance server hosting: https://pufferfish.host", // Plazma
"Join our Discord for support: https://discord.gg/reZw4vQV9H",
"Download new builds at https://ci.pufferfish.host/job/Pufferfish");
@@ -220,7 +220,7 @@ public class PufferfishConfig {
@@ -211,7 +211,7 @@ public class PufferfishConfig {
public static int maxProjectileLoadsPerTick;
public static int maxProjectileLoadsPerProjectile;
private static void projectileLoading() {
maxProjectileLoadsPerTick = getInt("projectile.max-loads-per-tick", 10, "Controls how many chunks are allowed", "to be sync loaded by projectiles in a tick.");
- maxProjectileLoadsPerProjectile = getInt("projectile.max-loads-per-projectile", 10, "Controls how many chunks a projectile", "can load in its lifetime before it gets", "automatically removed.");
+ maxProjectileLoadsPerProjectile = getInt("projectile.max-loads-per-projectile", Boolean.getBoolean("Plazma.disableConfigOptimization") ? 10 : 8, "Controls how many chunks a projectile", "can load in its lifetime before it gets", "automatically removed."); // Plazma - Optimize Default Configurations
- maxProjectileLoadsPerTick = getInt("projectile.max-loads-per-tick", 10, "Controls how many chunks are allowed", "to be sync loaded by projectiles in a tick.");
+ maxProjectileLoadsPerTick = getInt("projectile.max-loads-per-tick", Boolean.getBoolean("Plazma.disableConfigOptimization") ? 10 : 8, "Controls how many chunks are allowed", "to be sync loaded by projectiles in a tick."); // Plazma
maxProjectileLoadsPerProjectile = getInt("projectile.max-loads-per-projectile", 10, "Controls how many chunks a projectile", "can load in its lifetime before it gets", "automatically removed.");
setComment("projectile", "Optimizes projectile settings");
}
@@ -233,7 +233,7 @@ public class PufferfishConfig {
@@ -225,7 +225,7 @@ public class PufferfishConfig {
public static int activationDistanceMod;
private static void dynamicActivationOfBrains() throws IOException {
- dearEnabled = getBoolean("dab.enabled", "activation-range.enabled", false); // Purpur
+ dearEnabled = getBoolean("dab.enabled", "activation-range.enabled", !Boolean.getBoolean("Plazma.disableConfigOptimization")); // Purpur // Plazma - Optimize Default Configurations
+ dearEnabled = getBoolean("dab.enabled", "activation-range.enabled", !Boolean.getBoolean("Plazma.disableConfigOptimization")); // Purpur // Plazma
startDistance = getInt("dab.start-distance", "activation-range.start-distance", 12,
"This value determines how far away an entity has to be",
"from the player to start being effected by DEAR.");
@@ -241,7 +241,7 @@ public class PufferfishConfig {
@@ -233,7 +233,7 @@ public class PufferfishConfig {
maximumActivationPrio = getInt("dab.max-tick-freq", "activation-range.max-tick-freq", 20,
"This value defines how often in ticks, the furthest entity",
"will get their pathfinders and behaviors ticked. 20 = 1s");
- activationDistanceMod = getInt("dab.activation-dist-mod", "activation-range.activation-dist-mod", 8,
+ activationDistanceMod = getInt("dab.activation-dist-mod", "activation-range.activation-dist-mod", Boolean.getBoolean("Plazma.disableConfigOptimization") ? 8 : 7, // Plazma - Optimize Default Configurations
+ activationDistanceMod = getInt("dab.activation-dist-mod", "activation-range.activation-dist-mod", Boolean.getBoolean("Plazma.disableConfigOptimization") ? 8 : 7, // Plazma
"This value defines how much distance modifies an entity's",
"tick frequency. freq = (distanceToPlayer^2) / (2^value)",
"If you want further away entities to tick less often, use 7.",
@@ -277,7 +277,7 @@ public class PufferfishConfig {
@@ -269,16 +269,16 @@ public class PufferfishConfig {
public static boolean throttleInactiveGoalSelectorTick;
private static void inactiveGoalSelectorThrottle() {
- getBoolean("inactive-goal-selector-throttle", "inactive-goal-selector-disable", false, // Purpur
+ getBoolean("inactive-goal-selector-throttle", "inactive-goal-selector-disable", !Boolean.getBoolean("Plazma.disableConfigOptimization"), // Purpur // Plazma - Optimize Default Configurations
+ getBoolean("inactive-goal-selector-throttle", "inactive-goal-selector-disable", !Boolean.getBoolean("Plazma.disableConfigOptimization"), // Purpur // Plazma
"Throttles the AI goal selector in entity inactive ticks.",
"This can improve performance by a few percent, but has minor gameplay implications.");
}
@@ -307,10 +307,10 @@ public class PufferfishConfig {
}
- public static boolean disableMethodProfiler;
@@ -339,7 +328,7 @@ index ac238eeea791180b66677870401c0b756f0db07b..ce960bc620d84e56c4e7fc9b721fd45c
useAlternateKeepAlive = getBoolean("settings.use-alternate-keepalive", useAlternateKeepAlive);
}
diff --git a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
index fe903b1e1bd211651e3808becd34a2d28dc57f34..bd87af1ebde124ba405d3e1d1698b78724e112c4 100644
index d3f2002759ac4788feca1e62c90c2e64596eb2f2..47f2c8f23e318b89324bfcb1342dadc325f53afc 100644
--- a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
+++ b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
@@ -425,7 +425,7 @@ public class PurpurWorldConfig {

View File

@@ -33,10 +33,10 @@ index 904fcdeb7937d36208cc9a8d5eca9ef3a5b2cd9e..7f749579fe056a8436e6625204ae31f1
}
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java
index 74238a87d1ff3391aac5812b24b84af228baeaa4..3d900e323e1e11b56ad2a7d8f8ebcb71c069cfe0 100644
index 8a4be66f967dfd6b57ab542ae9b06c840647486d..29c46144de1aad31b997ee5000114e6f33f1a1f7 100644
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
@@ -727,8 +727,36 @@ public class ServerPlayer extends Player {
@@ -728,8 +728,36 @@ public class ServerPlayer extends Player {
}
}
// Purpur end
@@ -73,7 +73,7 @@ index 74238a87d1ff3391aac5812b24b84af228baeaa4..3d900e323e1e11b56ad2a7d8f8ebcb71
public void doTick() {
try {
if (valid && !this.isSpectator() || !this.touchingUnloadedChunk()) { // Paper - don't tick dead players that are not in the world currently (pending respawn)
@@ -2345,7 +2373,14 @@ public class ServerPlayer extends Player {
@@ -2356,7 +2384,14 @@ public class ServerPlayer extends Player {
return true; // Paper
}

View File

@@ -117,7 +117,7 @@ index aadc6743deb195ac3368548a75be641ffd3da404..90314f86e17ac7756f8211519fc5cde5
protected PathNavigation createNavigation(Level world) {
return new WaterBoundPathNavigation(this, world);
diff --git a/src/main/java/net/minecraft/world/entity/animal/sniffer/Sniffer.java b/src/main/java/net/minecraft/world/entity/animal/sniffer/Sniffer.java
index 0c5efd0b364e4c1f510d30094757ddb7dc979a68..304de4844e822431e41ce685ed94e5307612482b 100644
index 6e7c0e95b27c41bf12da1beb3458830ce27c6029..24de1e98661541f36715c59de1487959fb53b4db 100644
--- a/src/main/java/net/minecraft/world/entity/animal/sniffer/Sniffer.java
+++ b/src/main/java/net/minecraft/world/entity/animal/sniffer/Sniffer.java
@@ -108,6 +108,18 @@ public class Sniffer extends Animal {
@@ -210,7 +210,7 @@ index ce960bc620d84e56c4e7fc9b721fd45c4cfc4dac..57534bdf23b8373078a5f39c930cdb1d
org.bukkit.event.inventory.InventoryType.ENDER_CHEST.setDefaultSize(enderChestSixRows ? 54 : 27);
enderChestPermissionRows = getBoolean("settings.blocks.ender_chest.use-permissions-for-rows", enderChestPermissionRows);
diff --git a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
index bd87af1ebde124ba405d3e1d1698b78724e112c4..26db2140458405eb93997c784b3a47b161804007 100644
index 47f2c8f23e318b89324bfcb1342dadc325f53afc..eae616d7b0a318253725ef5bd3891f34b9d9b493 100644
--- a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
+++ b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
@@ -1084,7 +1084,15 @@ public class PurpurWorldConfig {

View File

@@ -18,10 +18,10 @@ index 591163d8f8300b084ac734800efee902c4def958..d74401ca3182145d136ad668704f5c04
double d1 = (double) (center.y - maxRange);
double d2 = (double) (center.x + maxRange);
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java
index c79e2b5160c41ce77ebd5355aebcefb3cb9151ca..735655847f75584a985c896637f47c2481b0cae6 100644
index 29c46144de1aad31b997ee5000114e6f33f1a1f7..c6d860687f6a1c286c286bb64ac4eed75a88f0c4 100644
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
@@ -402,7 +402,7 @@ public class ServerPlayer extends Player {
@@ -403,7 +403,7 @@ public class ServerPlayer extends Player {
long l = k * k;
int i1 = l > 2147483647L ? Integer.MAX_VALUE : (int) l;
int j1 = this.getCoprime(i1);
@@ -30,7 +30,7 @@ index c79e2b5160c41ce77ebd5355aebcefb3cb9151ca..735655847f75584a985c896637f47c24
for (int l1 = 0; l1 < i1; ++l1) {
int i2 = (k1 + j1 * l1) % i1;
@@ -439,7 +439,7 @@ public class ServerPlayer extends Player {
@@ -440,7 +440,7 @@ public class ServerPlayer extends Player {
long l = k * k;
int i1 = l > 2147483647L ? Integer.MAX_VALUE : (int) l;
int j1 = this.getCoprime(i1);

View File

@@ -10,7 +10,7 @@ Subject: [PATCH] Various Optimizations
0011 - Swaps the predicate order of collision (Akarin)
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
index b2ee73a2ef6042694ca84c27d592e5fb13b4a0fe..d6e20ebb1e07da767f6571bbaf0dc882cdf4503f 100644
index 3c10c719f6172161a2dcc6592a0a1492e9b3d7c1..d64f188257c135e2a4af07e28ff8f912c80eac03 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -1991,8 +1991,9 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {

View File

@@ -18,7 +18,7 @@ index e5ea9f27a1936ed9e329e74317c91c5df89b9fbd..7e7a4d872983cd2efdc575bc33353f94
private long lastFill = -1;
private long nextRefill = -1;
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index 6d2d1d99977d33fdd8c9a34b65bbca189852d1c0..6e2713a2f3c30a09f54bab4d0746d84dad66be2e 100644
index 9ba8bf1cc91494651a1855d12415f4ac3586cf9d..17cd928af104d74704d61ca26084bd60014af800 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -693,7 +693,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa