diff --git a/.upstream-data b/.upstream-data index efee68a..9c7e58d 100644 --- a/.upstream-data +++ b/.upstream-data @@ -1,2 +1,2 @@ -purpurCommit = 285f9f683d611c151582f94745f4be3e5b52f81e -pufferfishCommit = c09a1548516bb8b61c2a80367fdbdb5abe977a29 +purpurCommit = f952106e1ba20e799dbe0e67c1d241e3f286b5f4 +pufferfishCommit = b7781634b0800476107ed4a0b38fb24c13da6bf8 diff --git a/build.gradle.kts b/build.gradle.kts index d4b2303..5e52228 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -1,4 +1,3 @@ -import io.papermc.paperweight.patcher.* import io.papermc.paperweight.util.* import io.papermc.paperweight.util.constants.PAPERCLIP_CONFIG @@ -20,7 +19,7 @@ repositories { dependencies { remapper("net.fabricmc:tiny-remapper:0.8.6:fat") - decompiler("net.minecraftforge:forgeflower:2.0.605.2") + decompiler("net.minecraftforge:forgeflower:2.0.627.2") paperclip("io.papermc:paperclip:3.0.3") } diff --git a/gradle.properties b/gradle.properties index 1709496..cb427e6 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,7 +1,7 @@ group = org.plazmamc.plazma version = 1.19.4-R0.1-SNAPSHOT -paperCommit = 497b91939cf2972bac5337487f9f71770044fbc8 +paperCommit = 8d040fad9b4ddcc49a7b70c15b80b63c479eac95 org.gradle.caching = true org.gradle.parallel = true diff --git a/patches/api/0001-Pufferfish-API-Changes.patch b/patches/api/0001-Pufferfish-API-Changes.patch index 1efb452..009c88c 100644 --- a/patches/api/0001-Pufferfish-API-Changes.patch +++ b/patches/api/0001-Pufferfish-API-Changes.patch @@ -20,7 +20,7 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . diff --git a/build.gradle.kts b/build.gradle.kts -index cad12a2632b9ebb569280441c42869685db1f31a..b83e2c5a0a094002d12aee55ec0cf8d12bf33f3e 100644 +index 279a666e8ea2c07f41ee3f28b768e95dca5f0a10..a93b900889ddb56a2943c54a7fff6f60f42a78f1 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -42,6 +42,7 @@ dependencies { @@ -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..6fbaf2a232745db0a41394b1c2cc0cc90cefc4ee +index 0000000000000000000000000000000000000000..10310fdd53de28efb8a8250f6d3b0c8eb08fb68a --- /dev/null +++ b/src/main/java/gg/pufferfish/pufferfish/sentry/SentryContext.java @@ -0,0 +1,161 @@ @@ -69,21 +69,21 @@ index 0000000000000000000000000000000000000000..6fbaf2a232745db0a41394b1c2cc0cc9 +import org.jetbrains.annotations.Nullable; + +public class SentryContext { -+ ++ + private static final Gson GSON = new Gson(); -+ ++ + public static void setPluginContext(@Nullable Plugin plugin) { + if (plugin != null) { + ThreadContext.put("pufferfishsentry_pluginname", plugin.getName()); + ThreadContext.put("pufferfishsentry_pluginversion", plugin.getDescription().getVersion()); + } + } -+ ++ + public static void removePluginContext() { + ThreadContext.remove("pufferfishsentry_pluginname"); + ThreadContext.remove("pufferfishsentry_pluginversion"); + } -+ ++ + public static void setSenderContext(@Nullable CommandSender sender) { + if (sender != null) { + ThreadContext.put("pufferfishsentry_playername", sender.getName()); @@ -92,15 +92,15 @@ index 0000000000000000000000000000000000000000..6fbaf2a232745db0a41394b1c2cc0cc9 + } + } + } -+ ++ + public static void removeSenderContext() { + ThreadContext.remove("pufferfishsentry_playername"); + ThreadContext.remove("pufferfishsentry_playerid"); + } -+ ++ + public static void setEventContext(Event event, RegisteredListener registration) { + setPluginContext(registration.getPlugin()); -+ ++ + try { + // Find the player that was involved with this event + Player player = null; @@ -108,36 +108,36 @@ index 0000000000000000000000000000000000000000..6fbaf2a232745db0a41394b1c2cc0cc9 + player = ((PlayerEvent) event).getPlayer(); + } else { + Class eventClass = event.getClass(); -+ ++ + Field playerField = null; -+ ++ + for (Field field : eventClass.getDeclaredFields()) { + if (field.getType().equals(Player.class)) { + playerField = field; + break; + } + } -+ ++ + if (playerField != null) { + playerField.setAccessible(true); + player = (Player) playerField.get(event); + } + } -+ ++ + if (player != null) { + setSenderContext(player); + } + } catch (Exception e) {} // We can't really safely log exceptions. -+ ++ + ThreadContext.put("pufferfishsentry_eventdata", GSON.toJson(serializeFields(event))); + } -+ ++ + public static void removeEventContext() { + removePluginContext(); + removeSenderContext(); + ThreadContext.remove("pufferfishsentry_eventdata"); + } -+ ++ + private static Map serializeFields(Object object) { + Map fields = new TreeMap<>(); + fields.put("_class", object.getClass().getName()); @@ -146,7 +146,7 @@ index 0000000000000000000000000000000000000000..6fbaf2a232745db0a41394b1c2cc0cc9 + if (Modifier.isStatic(declaredField.getModifiers())) { + continue; + } -+ ++ + String fieldName = declaredField.getName(); + if (fieldName.equals("handlers")) { + continue; @@ -162,51 +162,51 @@ index 0000000000000000000000000000000000000000..6fbaf2a232745db0a41394b1c2cc0cc9 + } + return fields; + } -+ ++ + public static class State { -+ ++ + private Plugin plugin; + private Command command; + private String commandLine; + private Event event; + private RegisteredListener registeredListener; -+ ++ + public Plugin getPlugin() { + return plugin; + } -+ ++ + public void setPlugin(Plugin plugin) { + this.plugin = plugin; + } -+ ++ + public Command getCommand() { + return command; + } -+ ++ + public void setCommand(Command command) { + this.command = command; + } -+ ++ + public String getCommandLine() { + return commandLine; + } -+ ++ + public void setCommandLine(String commandLine) { + this.commandLine = commandLine; + } -+ ++ + public Event getEvent() { + return event; + } -+ ++ + public void setEvent(Event event) { + this.event = event; + } -+ ++ + public RegisteredListener getRegisteredListener() { + return registeredListener; + } -+ ++ + public void setRegisteredListener(RegisteredListener registeredListener) { + this.registeredListener = registeredListener; + } @@ -214,7 +214,7 @@ index 0000000000000000000000000000000000000000..6fbaf2a232745db0a41394b1c2cc0cc9 +} 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..6d266ebf5e52745ad13e90e5754b524383fa9b29 +index 0000000000000000000000000000000000000000..ab5fea0b03224bf249352ce340e94704ff713345 --- /dev/null +++ b/src/main/java/gg/pufferfish/pufferfish/simd/SIMDChecker.java @@ -0,0 +1,40 @@ @@ -231,7 +231,7 @@ index 0000000000000000000000000000000000000000..6d266ebf5e52745ad13e90e5754b5243 + */ +@Deprecated +public class SIMDChecker { -+ ++ + @Deprecated + public static boolean canEnable(Logger logger) { + try { @@ -239,13 +239,13 @@ index 0000000000000000000000000000000000000000..6d266ebf5e52745ad13e90e5754b5243 + return false; + } else { + SIMDDetection.testRun = true; -+ ++ + VectorSpecies ISPEC = IntVector.SPECIES_PREFERRED; + VectorSpecies FSPEC = FloatVector.SPECIES_PREFERRED; -+ ++ + logger.log(Level.INFO, "Max SIMD vector size on this system is " + ISPEC.vectorBitSize() + " bits (int)"); + logger.log(Level.INFO, "Max SIMD vector size on this system is " + FSPEC.vectorBitSize() + " bits (float)"); -+ ++ + if (ISPEC.elementSize() < 2 || FSPEC.elementSize() < 2) { + logger.log(Level.WARNING, "SIMD is not properly supported on this system!"); + return false; @@ -256,11 +256,11 @@ index 0000000000000000000000000000000000000000..6d266ebf5e52745ad13e90e5754b5243 + } catch (NoClassDefFoundError | Exception ignored) {} // Basically, we don't do anything. This lets us detect if it's not functional and disable it. + return false; + } -+ ++ +} 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..fd708554d6dab2ddcd24c3024330b8ebf9462111 +index 0000000000000000000000000000000000000000..a84889d3e9cfc4d7ab5f867820a6484c6070711b --- /dev/null +++ b/src/main/java/gg/pufferfish/pufferfish/simd/SIMDDetection.java @@ -0,0 +1,35 @@ @@ -270,11 +270,11 @@ index 0000000000000000000000000000000000000000..fd708554d6dab2ddcd24c3024330b8eb + +@Deprecated +public class SIMDDetection { -+ ++ + public static boolean isEnabled = false; + public static boolean versionLimited = false; + public static boolean testRun = false; -+ ++ + @Deprecated + public static boolean canEnable(Logger logger) { + try { @@ -283,7 +283,7 @@ index 0000000000000000000000000000000000000000..fd708554d6dab2ddcd24c3024330b8eb + return false; + } + } -+ ++ + @Deprecated + public static int getJavaVersion() { + // https://stackoverflow.com/a/2591122 @@ -297,11 +297,11 @@ index 0000000000000000000000000000000000000000..fd708554d6dab2ddcd24c3024330b8eb + version = version.split("-")[0]; // Azul is stupid + return Integer.parseInt(version); + } -+ ++ +} 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..20ec3b29b0cb4061cc89d635b3929ffe71008e22 +index 0000000000000000000000000000000000000000..ae2464920c9412ac90b819a540ee58be0741465f --- /dev/null +++ b/src/main/java/gg/pufferfish/pufferfish/simd/VectorMapPalette.java @@ -0,0 +1,83 @@ @@ -316,10 +316,10 @@ index 0000000000000000000000000000000000000000..20ec3b29b0cb4061cc89d635b3929ffe + +@Deprecated +public class VectorMapPalette { -+ ++ + private static final VectorSpecies I_SPEC = IntVector.SPECIES_PREFERRED; + private static final VectorSpecies F_SPEC = FloatVector.SPECIES_PREFERRED; -+ ++ + @Deprecated + public static void matchColorVectorized(int[] in, byte[] out) { + int speciesLength = I_SPEC.length(); @@ -329,64 +329,64 @@ index 0000000000000000000000000000000000000000..20ec3b29b0cb4061cc89d635b3929ffe + float[] bluesArr = new float[speciesLength]; + float[] greensArr = new float[speciesLength]; + int[] alphasArr = new int[speciesLength]; -+ ++ + for (int j = 0; j < speciesLength; j++) { + alphasArr[j] = (in[i + j] >> 24) & 0xFF; + redsArr[j] = (in[i + j] >> 16) & 0xFF; + greensArr[j] = (in[i + j] >> 8) & 0xFF; + bluesArr[j] = (in[i + j] >> 0) & 0xFF; + } -+ ++ + IntVector alphas = IntVector.fromArray(I_SPEC, alphasArr, 0); + FloatVector reds = FloatVector.fromArray(F_SPEC, redsArr, 0); + FloatVector greens = FloatVector.fromArray(F_SPEC, greensArr, 0); + FloatVector blues = FloatVector.fromArray(F_SPEC, bluesArr, 0); + IntVector resultIndex = IntVector.zero(I_SPEC); + VectorMask modificationMask = VectorMask.fromLong(I_SPEC, 0xffffffff); -+ ++ + modificationMask = modificationMask.and(alphas.lt(128).not()); + FloatVector bestDistances = FloatVector.broadcast(F_SPEC, Float.MAX_VALUE); -+ ++ + for (int c = 4; c < MapPalette.colors.length; c++) { + // We're using 32-bit floats here because it's 2x faster and nobody will know the difference. + // For correctness, the original algorithm uses 64-bit floats instead. Completely unnecessary. + FloatVector compReds = FloatVector.broadcast(F_SPEC, MapPalette.colors[c].getRed()); + FloatVector compGreens = FloatVector.broadcast(F_SPEC, MapPalette.colors[c].getGreen()); + FloatVector compBlues = FloatVector.broadcast(F_SPEC, MapPalette.colors[c].getBlue()); -+ ++ + FloatVector rMean = reds.add(compReds).div(2.0f); + FloatVector rDiff = reds.sub(compReds); + FloatVector gDiff = greens.sub(compGreens); + FloatVector bDiff = blues.sub(compBlues); -+ ++ + FloatVector weightR = rMean.div(256.0f).add(2); + FloatVector weightG = FloatVector.broadcast(F_SPEC, 4.0f); + FloatVector weightB = FloatVector.broadcast(F_SPEC, 255.0f).sub(rMean).div(256.0f).add(2.0f); -+ ++ + FloatVector distance = weightR.mul(rDiff).mul(rDiff).add(weightG.mul(gDiff).mul(gDiff)).add(weightB.mul(bDiff).mul(bDiff)); -+ ++ + // Now we compare to the best distance we've found. + // This mask contains a "1" if better, and a "0" otherwise. + VectorMask bestDistanceMask = distance.lt(bestDistances); + bestDistances = bestDistances.blend(distance, bestDistanceMask); // Update the best distances -+ ++ + // Update the result array + // We also AND with the modification mask because we don't want to interfere if the alpha value isn't large enough. + resultIndex = resultIndex.blend(c, bestDistanceMask.cast(I_SPEC).and(modificationMask)); // Update the results + } -+ ++ + for (int j = 0; j < speciesLength; j++) { + int index = resultIndex.lane(j); + out[i + j] = (byte) (index < 128 ? index : -129 + (index - 127)); + } + } -+ ++ + // For the final ones, fall back to the regular method + for (; i < in.length; i++) { + out[i] = MapPalette.matchColor(new Color(in[i], true)); + } + } -+ ++ +} diff --git a/src/main/java/org/bukkit/map/MapPalette.java b/src/main/java/org/bukkit/map/MapPalette.java index 3a9aaca2e76411a9c27f9f5e0f22d060d5a66d06..9584e245144b561b4f6745b2f26a4f69a6f92891 100644 diff --git a/patches/api/0002-Purpur-API-Changes.patch b/patches/api/0002-Purpur-API-Changes.patch index 4bedc6f..7a87a81 100644 --- a/patches/api/0002-Purpur-API-Changes.patch +++ b/patches/api/0002-Purpur-API-Changes.patch @@ -1,6 +1,6 @@ From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: AlphaKR93 -Date: Tue, 4 Apr 2023 22:23:38 +0000 +From: BillyGalbreath +Date: Tue, 4 Jan 2022 23:05:41 -0600 Subject: [PATCH] Purpur API 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 b83e2c5a0a094002d12aee55ec0cf8d12bf33f3e..b5835fa536f90b7f88a5ee4df78733cf43e1cb23 100644 +index a93b900889ddb56a2943c54a7fff6f60f42a78f1..417c4324af22c870de669e338a1eee5d540184a4 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -105,6 +105,8 @@ tasks.jar { @@ -416,10 +416,10 @@ index ea4ceb643239c26851bacbf45fc3f2efef3bb4be..3b8395dcb73e3fb251adf7438cbc7e95 + // Purpur end } diff --git a/src/main/java/org/bukkit/Material.java b/src/main/java/org/bukkit/Material.java -index 3c5e90f039f0d2991be442168703526405e18e3d..df992c41d736ee4e89773c2621d261d6afcb2148 100644 +index adb2416887cc3b544ec36c552bdf7105328c24a5..d334c963e16590c68ecd9d1d27434c7af6f7e21c 100644 --- a/src/main/java/org/bukkit/Material.java +++ b/src/main/java/org/bukkit/Material.java -@@ -11066,4 +11066,40 @@ public enum Material implements Keyed, Translatable, net.kyori.adventure.transla +@@ -11156,4 +11156,40 @@ public enum Material implements Keyed, Translatable, net.kyori.adventure.transla public String getItemTranslationKey() { return Bukkit.getUnsafe().getItemTranslationKey(this); } @@ -709,10 +709,10 @@ index 8621dba7f10ab822b5b99ce0d05da58823605cb6..730caafaf9629664ba125f3884559da7 + // Purpur end } diff --git a/src/main/java/org/bukkit/World.java b/src/main/java/org/bukkit/World.java -index 6716a1185e733f3ddf56b295f3153938f57d4229..ad00e30379df52575bf2697ccb32abb176ecd47a 100644 +index 0b8776355f724927ada826735d5e73f3fb6897d5..cf8b93aa5787e96f54e2ffe2a0f157b0e53e2c5c 100644 --- a/src/main/java/org/bukkit/World.java +++ b/src/main/java/org/bukkit/World.java -@@ -4007,6 +4007,86 @@ public interface World extends RegionAccessor, WorldInfo, PluginMessageRecipient +@@ -4018,6 +4018,86 @@ public interface World extends RegionAccessor, WorldInfo, PluginMessageRecipient @Nullable public DragonBattle getEnderDragonBattle(); @@ -933,10 +933,10 @@ index 138d2530de2410f4a9424dabd3e5ce0cd1c1dcd2..10a8d64ad2da0be2c14f34c3e7d1957c // Paper start /** diff --git a/src/main/java/org/bukkit/entity/Entity.java b/src/main/java/org/bukkit/entity/Entity.java -index 8c58018b155c52a7b2a139f784abceb6aa00a268..dc16fd3f342994dc3ea88b0980e4b3f56621ddf3 100644 +index a2a423d4e4c2702ba5967223cab0432dd7d04732..cc78ce7de88a9a404ed20d5bc61b98d3107f29b3 100644 --- a/src/main/java/org/bukkit/entity/Entity.java +++ b/src/main/java/org/bukkit/entity/Entity.java -@@ -953,4 +953,55 @@ public interface Entity extends Metadatable, CommandSender, Nameable, Persistent +@@ -954,4 +954,55 @@ public interface Entity extends Metadatable, CommandSender, Nameable, Persistent */ boolean wouldCollideUsing(@NotNull BoundingBox boundingBox); // Paper End - Collision API @@ -1156,10 +1156,10 @@ index bc84b892cae5fe7019a3ad481e9da79956efa1fe..48eb5b00c460cccde29d327cef1d63fc + // Purpur end } diff --git a/src/main/java/org/bukkit/entity/Player.java b/src/main/java/org/bukkit/entity/Player.java -index 8fe11fce80c3b29164b79ece8dc9ed8da6fc1790..85c5987758b1d5145843705205dc99164c5f9f44 100644 +index ee446bfb3e6c4b1d4428c00d6406bf9455c68ad5..43cef54d355c8a1b6a8cd6be89a6a805e9f88566 100644 --- a/src/main/java/org/bukkit/entity/Player.java +++ b/src/main/java/org/bukkit/entity/Player.java -@@ -3000,4 +3000,139 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM +@@ -3035,4 +3035,139 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM @Override Spigot spigot(); // Spigot end @@ -1411,10 +1411,10 @@ index c9f395064656dd0126410eb3c6e197baa450c063..13156a12e5df50cdc1e465dc0bd9d941 * When a player gets bad omen after killing a patrol captain. */ diff --git a/src/main/java/org/bukkit/event/inventory/InventoryType.java b/src/main/java/org/bukkit/event/inventory/InventoryType.java -index 94f127fd6ba69ca48d03acbc9886ee499e9be4f3..1f958facfed766c401144b840e4369154c71d3c2 100644 +index a8e631315f2da68895a258cf0ba9875bc88fc48c..d5648ec745e3530aecf18c3e1f3185a5f63f3d11 100644 --- a/src/main/java/org/bukkit/event/inventory/InventoryType.java +++ b/src/main/java/org/bukkit/event/inventory/InventoryType.java -@@ -152,7 +152,7 @@ public enum InventoryType { +@@ -155,7 +155,7 @@ public enum InventoryType { SMITHING_NEW(4, "Upgrade Gear"), ; diff --git a/patches/api/0005-Publish-Packages.patch b/patches/api/0005-Publish-Packages.patch index a070771..1957cea 100644 --- a/patches/api/0005-Publish-Packages.patch +++ b/patches/api/0005-Publish-Packages.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Publish Packages diff --git a/build.gradle.kts b/build.gradle.kts -index 42de5c470a2fbb1e0bc9b809c033e3afe30502fa..c2c506afd44c7f14de51bd93004aa8a32ff2103e 100644 +index 7b38042c32295ef7c5ea3c212170cc8fcdf0d7a0..1e300e51fa3413f9846c686545f2b7deb0ac5160 100644 --- a/build.gradle.kts +++ b/build.gradle.kts -@@ -155,3 +155,23 @@ tasks.check { +@@ -156,3 +156,23 @@ tasks.check { dependsOn(scanJar) } // Paper end diff --git a/patches/server/0001-Pufferfish-Server-Changes.patch b/patches/server/0001-Pufferfish-Server-Changes.patch index d8dee44..157653d 100644 --- a/patches/server/0001-Pufferfish-Server-Changes.patch +++ b/patches/server/0001-Pufferfish-Server-Changes.patch @@ -542,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..e164237e749bcc43466d4ed7aeada5ab9fddf8a6 +index 0000000000000000000000000000000000000000..020368da69b9a492155f6de6297f74732f4ab6ea --- /dev/null +++ b/src/main/java/gg/pufferfish/pufferfish/PufferfishCommand.java @@ -0,0 +1,68 @@ @@ -570,7 +570,7 @@ index 0000000000000000000000000000000000000000..e164237e749bcc43466d4ed7aeada5ab + this.usageMessage = "/pufferfish [reload | version]"; + this.setPermission("bukkit.command.pufferfish"); + } -+ ++ + public static void init() { + MinecraftServer.getServer().server.getCommandMap().register("pufferfish", "Pufferfish", new PufferfishCommand()); + } @@ -616,7 +616,7 @@ index 0000000000000000000000000000000000000000..e164237e749bcc43466d4ed7aeada5ab +} 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..a8cead500186142115d4dc029c942fdfc68f7fe5 +index 0000000000000000000000000000000000000000..6e441a1a28ba72a8b1cc09fe5fca71b3c70627d4 --- /dev/null +++ b/src/main/java/gg/pufferfish/pufferfish/PufferfishConfig.java @@ -0,0 +1,285 @@ @@ -647,10 +647,10 @@ index 0000000000000000000000000000000000000000..a8cead500186142115d4dc029c942fdf +import org.simpleyaml.exceptions.InvalidConfigurationException; + +public class PufferfishConfig { -+ ++ + private static final YamlFile config = new YamlFile(); + private static int updates = 0; -+ ++ + private static ConfigurationSection convertToBukkit(org.simpleyaml.configuration.ConfigurationSection section) { + ConfigurationSection newSection = new MemoryConfiguration(); + for (String key : section.getKeys(false)) { @@ -662,18 +662,18 @@ index 0000000000000000000000000000000000000000..a8cead500186142115d4dc029c942fdf + } + return newSection; + } -+ ++ + public static ConfigurationSection getConfigCopy() { + return convertToBukkit(config); + } -+ ++ + public static int getUpdates() { + return updates; + } -+ ++ + public static void load() throws IOException { + File configFile = new File("pufferfish.yml"); -+ ++ + if (configFile.exists()) { + try { + config.load(configFile); @@ -681,14 +681,14 @@ index 0000000000000000000000000000000000000000..a8cead500186142115d4dc029c942fdf + throw new IOException(e); + } + } -+ ++ + getString("info.version", "1.0"); + setComment("info", + "Pufferfish Configuration", + "Check out Pufferfish Host for maximum performance server hosting: https://pufferfish.host", + "Join our Discord for support: https://discord.gg/reZw4vQV9H", + "Download new builds at https://ci.pufferfish.host/job/Pufferfish"); -+ ++ + for (Method method : PufferfishConfig.class.getDeclaredMethods()) { + if (Modifier.isStatic(method.getModifiers()) && Modifier.isPrivate(method.getModifiers()) && method.getParameterCount() == 0 && + method.getReturnType() == Void.TYPE && !method.getName().startsWith("lambda")) { @@ -700,11 +700,11 @@ index 0000000000000000000000000000000000000000..a8cead500186142115d4dc029c942fdf + } + } + } -+ ++ + updates++; -+ ++ + config.save(configFile); -+ ++ + // Attempt to detect vectorization + try { + SIMDDetection.isEnabled = SIMDDetection.canEnable(PufferfishLogger.LOGGER); @@ -712,7 +712,7 @@ index 0000000000000000000000000000000000000000..a8cead500186142115d4dc029c942fdf + } catch (NoClassDefFoundError | Exception ignored) { + ignored.printStackTrace(); + } -+ ++ + if (SIMDDetection.isEnabled) { + PufferfishLogger.LOGGER.info("SIMD operations detected as functional. Will replace some operations with faster versions."); + } else if (SIMDDetection.versionLimited) { @@ -724,76 +724,76 @@ index 0000000000000000000000000000000000000000..a8cead500186142115d4dc029c942fdf + PufferfishLogger.LOGGER.warning("Debug: Java: " + System.getProperty("java.version") + ", test run: " + SIMDDetection.testRun); + } + } -+ ++ + private static void setComment(String key, String... comment) { + if (config.contains(key)) { + config.setComment(key, String.join("\n", comment), CommentType.BLOCK); + } + } -+ ++ + private static void ensureDefault(String key, Object defaultValue, String... comment) { + if (!config.contains(key)) { + config.set(key, defaultValue); + config.setComment(key, String.join("\n", comment), CommentType.BLOCK); + } + } -+ ++ + private static boolean getBoolean(String key, boolean defaultValue, String... comment) { + return getBoolean(key, null, defaultValue, comment); + } -+ ++ + private static boolean getBoolean(String key, @Nullable String oldKey, boolean defaultValue, String... comment) { + ensureDefault(key, defaultValue, comment); + return config.getBoolean(key, defaultValue); + } -+ ++ + private static int getInt(String key, int defaultValue, String... comment) { + return getInt(key, null, defaultValue, comment); + } -+ ++ + private static int getInt(String key, @Nullable String oldKey, int defaultValue, String... comment) { + ensureDefault(key, defaultValue, comment); + return config.getInt(key, defaultValue); + } -+ ++ + private static double getDouble(String key, double defaultValue, String... comment) { + return getDouble(key, null, defaultValue, comment); + } -+ ++ + private static double getDouble(String key, @Nullable String oldKey, double defaultValue, String... comment) { + ensureDefault(key, defaultValue, comment); + return config.getDouble(key, defaultValue); + } -+ ++ + private static String getString(String key, String defaultValue, String... comment) { + return getOldString(key, null, defaultValue, comment); + } -+ ++ + private static String getOldString(String key, @Nullable String oldKey, String defaultValue, String... comment) { + ensureDefault(key, defaultValue, comment); + return config.getString(key, defaultValue); + } -+ ++ + private static List getStringList(String key, List defaultValue, String... comment) { + return getStringList(key, null, defaultValue, comment); + } -+ ++ + private static List getStringList(String key, @Nullable String oldKey, List defaultValue, String... comment) { + ensureDefault(key, defaultValue, comment); + return config.getStringList(key); + } -+ ++ + public static String sentryDsn; + private static void sentry() { + String sentryEnvironment = System.getenv("SENTRY_DSN"); + String sentryConfig = getString("sentry-dsn", "", "Sentry DSN for improved error logging, leave blank to disable", "Obtain from https://sentry.io/"); -+ ++ + sentryDsn = sentryEnvironment == null ? sentryConfig : sentryEnvironment; + if (sentryDsn != null && !sentryDsn.isBlank()) { + gg.pufferfish.pufferfish.sentry.SentryManager.init(); + } + } -+ ++ + public static boolean enableBooks; + private static void books() { + enableBooks = getBoolean("enable-books", true, @@ -802,7 +802,7 @@ index 0000000000000000000000000000000000000000..a8cead500186142115d4dc029c942fdf + "disabling this option.", + "This can be overridden per-player with the permission pufferfish.usebooks"); + } -+ ++ + public static boolean enableSuffocationOptimization; + private static void suffocationOptimization() { + enableSuffocationOptimization = getBoolean("enable-suffocation-optimization", true, @@ -811,7 +811,7 @@ index 0000000000000000000000000000000000000000..a8cead500186142115d4dc029c942fdf + "be left enabled on most servers, but is provided as a", + "configuration option if the vanilla deviation is undesirable."); + } -+ ++ + public static boolean enableAsyncMobSpawning; + public static boolean asyncMobSpawningInitialized; + private static void asyncMobSpawning() { @@ -821,14 +821,14 @@ index 0000000000000000000000000000000000000000..a8cead500186142115d4dc029c942fdf + "paper's per-player-mob-spawns setting set to true for this to work.", + "One quick note - this does not actually spawn mobs async (that would be very unsafe).", + "This just offloads some expensive calculations that are required for mob spawning."); -+ ++ + // This prevents us from changing the value during a reload. + if (!asyncMobSpawningInitialized) { + asyncMobSpawningInitialized = true; + enableAsyncMobSpawning = temp; + } + } -+ ++ + public static int maxProjectileLoadsPerTick; + public static int maxProjectileLoadsPerProjectile; + private static void projectileLoading() { @@ -870,7 +870,7 @@ index 0000000000000000000000000000000000000000..a8cead500186142115d4dc029c942fdf + + setComment("dab", "Optimizes entity brains when", "they're far away from the player"); + } -+ ++ + public static Map projectileTimeouts; + private static void projectileTimeouts() { + // Set some defaults @@ -881,13 +881,13 @@ index 0000000000000000000000000000000000000000..a8cead500186142115d4dc029c942fdf + "entity is in this list and it has survived for longer than", + "that number of ticks, then it will be removed. Setting a value to", + "-1 disables this feature."); -+ ++ + for (EntityType entityType : BuiltInRegistries.ENTITY_TYPE) { + String type = EntityType.getKey(entityType).getPath().toUpperCase(Locale.ROOT); + entityType.ttl = config.getInt("entity_timeouts." + type, -1); + } + } -+ ++ + public static boolean throttleInactiveGoalSelectorTick; + private static void inactiveGoalSelectorThrottle() { + getBoolean("inactive-goal-selector-throttle", "inactive-goal-selector-disable", true, @@ -929,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..1adc3de7cdb5b5f309df45f463e4697d6ec2c245 +index 0000000000000000000000000000000000000000..e877921370f6009a4bd204d9b17d2d58834b8822 --- /dev/null +++ b/src/main/java/gg/pufferfish/pufferfish/PufferfishVersionFetcher.java @@ -0,0 +1,136 @@ @@ -961,46 +961,46 @@ index 0000000000000000000000000000000000000000..1adc3de7cdb5b5f309df45f463e4697d +import org.jetbrains.annotations.Nullable; + +public class PufferfishVersionFetcher implements VersionFetcher { -+ ++ + private static final Logger LOGGER = Logger.getLogger("PufferfishVersionFetcher"); + private static final HttpClient client = HttpClient.newHttpClient(); -+ ++ + private static final URI JENKINS_URI = URI.create("https://ci.pufferfish.host/job/Pufferfish-1.19/lastSuccessfulBuild/buildNumber"); + private static final String GITHUB_FORMAT = "https://api.github.com/repos/pufferfish-gg/Pufferfish/compare/ver/1.19...%s"; -+ ++ + private static final HttpResponse.BodyHandler JSON_OBJECT_BODY_HANDLER = responseInfo -> HttpResponse.BodySubscribers + .mapping( + HttpResponse.BodySubscribers.ofString(StandardCharsets.UTF_8), + string -> new Gson().fromJson(string, JsonObject.class) + ); -+ ++ + @Override + public long getCacheTime() { + return TimeUnit.MINUTES.toMillis(30); + } -+ ++ + @Override + public @NotNull Component getVersionMessage(final @NotNull String serverVersion) { + final String[] parts = CraftServer.class.getPackage().getImplementationVersion().split("-"); + @NotNull Component component; -+ ++ + if (parts.length != 3) { + component = text("Unknown server version.", RED); + } else { + final String versionString = parts[2]; -+ ++ + try { + component = this.fetchJenkinsVersion(Integer.parseInt(versionString)); + } catch (NumberFormatException e) { + component = this.fetchGithubVersion(versionString.substring(1, versionString.length() - 1)); + } + } -+ ++ + final @Nullable Component history = this.getHistory(); + return history != null ? Component + .join(JoinConfiguration.noSeparators(), component, Component.newline(), this.getHistory()) : component; + } -+ ++ + private @NotNull Component fetchJenkinsVersion(final int versionNumber) { + final HttpRequest request = HttpRequest.newBuilder(JENKINS_URI).build(); + try { @@ -1008,7 +1008,7 @@ index 0000000000000000000000000000000000000000..1adc3de7cdb5b5f309df45f463e4697d + if (response.statusCode() != 200) { + return text("Received invalid status code (" + response.statusCode() + ") from server.", RED); + } -+ ++ + int latestVersionNumber; + try { + latestVersionNumber = Integer.parseInt(response.body()); @@ -1016,7 +1016,7 @@ index 0000000000000000000000000000000000000000..1adc3de7cdb5b5f309df45f463e4697d + LOGGER.log(Level.WARNING, "Received invalid response from Jenkins \"" + response.body() + "\"."); + return text("Received invalid response from server.", RED); + } -+ ++ + final int versionDiff = latestVersionNumber - versionNumber; + return this.getResponseMessage(versionDiff); + } catch (IOException | InterruptedException e) { @@ -1024,7 +1024,7 @@ index 0000000000000000000000000000000000000000..1adc3de7cdb5b5f309df45f463e4697d + return text("Failed to retrieve version from server.", RED); + } + } -+ ++ + // Based off code contributed by Techcable in Paper/GH-65 + private @NotNull Component fetchGithubVersion(final @NotNull String hash) { + final URI uri = URI.create(String.format(GITHUB_FORMAT, hash)); @@ -1034,17 +1034,17 @@ index 0000000000000000000000000000000000000000..1adc3de7cdb5b5f309df45f463e4697d + if (response.statusCode() != 200) { + return text("Received invalid status code (" + response.statusCode() + ") from server.", RED); + } -+ ++ + final JsonObject obj = response.body(); + final int versionDiff = obj.get("behind_by").getAsInt(); -+ ++ + return this.getResponseMessage(versionDiff); + } catch (IOException | InterruptedException e) { + LOGGER.log(Level.WARNING, "Failed to look up version from GitHub", e); + return text("Failed to retrieve version from server.", RED); + } + } -+ ++ + private @NotNull Component getResponseMessage(final int versionDiff) { + return switch (Math.max(-1, Math.min(1, versionDiff))) { + case -1 -> text("You are running an unsupported version of Pufferfish.", RED); @@ -1054,25 +1054,25 @@ index 0000000000000000000000000000000000000000..1adc3de7cdb5b5f309df45f463e4697d + RED); + }; + } -+ ++ + private @Nullable Component getHistory() { + final VersionHistoryManager.VersionData data = VersionHistoryManager.INSTANCE.getVersionData(); + if (data == null) { + return null; + } -+ ++ + final String oldVersion = data.getOldVersion(); + if (oldVersion == null) { + return null; + } -+ ++ + return Component.text("Previous version: " + oldVersion, NamedTextColor.GRAY, TextDecoration.ITALIC); + } +} \ No newline at end of file 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..d04a8a4336566dbe6e1b9ec0d574cff43e003fa8 +index 0000000000000000000000000000000000000000..731ef11c7a025ae95ed8a757b530d834733d0621 --- /dev/null +++ b/src/main/java/gg/pufferfish/pufferfish/sentry/PufferfishSentryAppender.java @@ -0,0 +1,135 @@ @@ -1096,14 +1096,14 @@ index 0000000000000000000000000000000000000000..d04a8a4336566dbe6e1b9ec0d574cff4 +import org.apache.logging.log4j.core.filter.AbstractFilter; + +public class PufferfishSentryAppender extends AbstractAppender { -+ ++ + private static final org.apache.logging.log4j.Logger logger = LogManager.getLogger(PufferfishSentryAppender.class); + private static final Gson GSON = new Gson(); -+ ++ + public PufferfishSentryAppender() { + super("PufferfishSentryAdapter", new SentryFilter(), null); + } -+ ++ + @Override + public void append(LogEvent logEvent) { + if (logEvent.getThrown() != null && logEvent.getLevel().isMoreSpecificThan(Level.WARN)) { @@ -1120,55 +1120,55 @@ index 0000000000000000000000000000000000000000..d04a8a4336566dbe6e1b9ec0d574cff4 + } + } + } -+ ++ + private void logException(LogEvent e) { + SentryEvent event = new SentryEvent(e.getThrown()); -+ ++ + Message sentryMessage = new Message(); + sentryMessage.setMessage(e.getMessage().getFormattedMessage()); -+ ++ + event.setThrowable(e.getThrown()); + event.setLevel(getLevel(e.getLevel())); + event.setLogger(e.getLoggerName()); + event.setTransaction(e.getLoggerName()); + event.setExtra("thread_name", e.getThreadName()); -+ ++ + boolean hasContext = e.getContextData() != null; -+ ++ + if (hasContext && e.getContextData().containsKey("pufferfishsentry_playerid")) { + User user = new User(); + user.setId(e.getContextData().getValue("pufferfishsentry_playerid")); + user.setUsername(e.getContextData().getValue("pufferfishsentry_playername")); + event.setUser(user); + } -+ ++ + if (hasContext && e.getContextData().containsKey("pufferfishsentry_pluginname")) { + event.setExtra("plugin.name", e.getContextData().getValue("pufferfishsentry_pluginname")); + event.setExtra("plugin.version", e.getContextData().getValue("pufferfishsentry_pluginversion")); + event.setTransaction(e.getContextData().getValue("pufferfishsentry_pluginname")); + } -+ ++ + if (hasContext && e.getContextData().containsKey("pufferfishsentry_eventdata")) { + Map eventFields = GSON.fromJson((String) e.getContextData().getValue("pufferfishsentry_eventdata"), new TypeToken>() {}.getType()); + if (eventFields != null) { + event.setExtra("event", eventFields); + } + } -+ ++ + Sentry.captureEvent(event); + } -+ ++ + private void logBreadcrumb(LogEvent e) { + Breadcrumb breadcrumb = new Breadcrumb(); -+ ++ + breadcrumb.setLevel(getLevel(e.getLevel())); + breadcrumb.setCategory(e.getLoggerName()); + breadcrumb.setType(e.getLoggerName()); + breadcrumb.setMessage(e.getMessage().getFormattedMessage()); -+ ++ + Sentry.addBreadcrumb(breadcrumb); + } -+ ++ + private SentryLevel getLevel(Level level) { + switch (level.getStandardLevel()) { + case TRACE: @@ -1185,35 +1185,35 @@ index 0000000000000000000000000000000000000000..d04a8a4336566dbe6e1b9ec0d574cff4 + return SentryLevel.INFO; + } + } -+ ++ + private static class SentryFilter extends AbstractFilter { -+ ++ + @Override + public Result filter(Logger logger, org.apache.logging.log4j.Level level, Marker marker, String msg, + Object... params) { + return this.filter(logger.getName()); + } -+ ++ + @Override + public Result filter(Logger logger, org.apache.logging.log4j.Level level, Marker marker, Object msg, Throwable t) { + return this.filter(logger.getName()); + } -+ ++ + @Override + public Result filter(LogEvent event) { + return this.filter(event == null ? null : event.getLoggerName()); + } -+ ++ + private Result filter(String loggerName) { + return loggerName != null && loggerName.startsWith("gg.castaway.pufferfish.sentry") ? Result.DENY + : Result.NEUTRAL; + } -+ ++ + } +} 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..b011abbeb80b42de6be3785e47c7ba3c0f6dc161 +index 0000000000000000000000000000000000000000..1b29210ad0bbb4ada150f23357f0c80d331c996d --- /dev/null +++ b/src/main/java/gg/pufferfish/pufferfish/sentry/SentryManager.java @@ -0,0 +1,40 @@ @@ -1225,27 +1225,27 @@ index 0000000000000000000000000000000000000000..b011abbeb80b42de6be3785e47c7ba3c +import org.apache.logging.log4j.Logger; + +public class SentryManager { -+ ++ + private static final Logger logger = LogManager.getLogger(SentryManager.class); -+ ++ + private SentryManager() { -+ ++ + } -+ ++ + private static boolean initialized = false; -+ ++ + public static synchronized void init() { + if (initialized) { + return; + } + try { + initialized = true; -+ ++ + Sentry.init(options -> { + options.setDsn(PufferfishConfig.sentryDsn); + options.setMaxBreadcrumbs(100); + }); -+ ++ + PufferfishSentryAppender appender = new PufferfishSentryAppender(); + appender.start(); + ((org.apache.logging.log4j.core.Logger) LogManager.getRootLogger()).addAppender(appender); @@ -1255,11 +1255,11 @@ index 0000000000000000000000000000000000000000..b011abbeb80b42de6be3785e47c7ba3c + initialized = false; + } + } -+ ++ +} 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..0fe6243ea01f39fc43c4ca8897a70feddb7fb11d +index 0000000000000000000000000000000000000000..8e5323d5d9af25c8a85c4b34a6be76cfc54384cf --- /dev/null +++ b/src/main/java/gg/pufferfish/pufferfish/util/AsyncExecutor.java @@ -0,0 +1,73 @@ @@ -1274,26 +1274,26 @@ index 0000000000000000000000000000000000000000..0fe6243ea01f39fc43c4ca8897a70fed +import java.util.logging.Level; + +public class AsyncExecutor implements Runnable { -+ ++ + private final Queue jobs = Queues.newArrayDeque(); + private final Lock mutex = new ReentrantLock(); + private final Condition cond = mutex.newCondition(); + private final Thread thread; + private volatile boolean killswitch = false; -+ ++ + public AsyncExecutor(String threadName) { + this.thread = new Thread(this, threadName); + } -+ ++ + public void start() { + thread.start(); + } -+ ++ + public void kill() { + killswitch = true; + cond.signalAll(); + } -+ ++ + public void submit(Runnable runnable) { + mutex.lock(); + try { @@ -1303,7 +1303,7 @@ index 0000000000000000000000000000000000000000..0fe6243ea01f39fc43c4ca8897a70fed + mutex.unlock(); + } + } -+ ++ + @Override + public void run() { + while (!killswitch) { @@ -1319,26 +1319,26 @@ index 0000000000000000000000000000000000000000..0fe6243ea01f39fc43c4ca8897a70fed + } + } + } -+ ++ + private Runnable takeRunnable() throws InterruptedException { + mutex.lock(); + try { + while (jobs.isEmpty() && !killswitch) { + cond.await(); + } -+ ++ + if (jobs.isEmpty()) return null; // We've set killswitch -+ ++ + return jobs.remove(); + } finally { + mutex.unlock(); + } + } -+ ++ +} 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..a93ee99c2399def1e221260547a3e6bce2d621fa +index 0000000000000000000000000000000000000000..fdcb62d12164024a5f354d60cc863821a18d1b2a --- /dev/null +++ b/src/main/java/gg/pufferfish/pufferfish/util/AsyncPlayerAreaMap.java @@ -0,0 +1,31 @@ @@ -1350,22 +1350,22 @@ index 0000000000000000000000000000000000000000..a93ee99c2399def1e221260547a3e6bc +import net.minecraft.server.level.ServerPlayer; + +public final class AsyncPlayerAreaMap extends PlayerAreaMap { -+ ++ + public AsyncPlayerAreaMap() { + super(); + this.areaMap = new Long2ObjectOpenHashMapWrapper<>(new ConcurrentHashMap<>(1024, 0.7f)); + } -+ ++ + public AsyncPlayerAreaMap(final PooledLinkedHashSets pooledHashSets) { + super(pooledHashSets); + this.areaMap = new Long2ObjectOpenHashMapWrapper<>(new ConcurrentHashMap<>(1024, 0.7f)); + } -+ ++ + public AsyncPlayerAreaMap(final PooledLinkedHashSets pooledHashSets, final ChangeCallback addCallback, + final ChangeCallback removeCallback) { + this(pooledHashSets, addCallback, removeCallback, null); + } -+ ++ + public AsyncPlayerAreaMap(final PooledLinkedHashSets pooledHashSets, final ChangeCallback addCallback, + final ChangeCallback removeCallback, final ChangeSourceCallback changeSourceCallback) { + super(pooledHashSets, addCallback, removeCallback, changeSourceCallback); @@ -1401,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..42cdc43d6b739973a0944f502089757247ee6c61 +index 0000000000000000000000000000000000000000..facd55463d44cb7e3d2ca6892982f5497b8dded1 --- /dev/null +++ b/src/main/java/gg/pufferfish/pufferfish/util/Long2ObjectOpenHashMapWrapper.java @@ -0,0 +1,40 @@ @@ -1412,82 +1412,39 @@ index 0000000000000000000000000000000000000000..42cdc43d6b739973a0944f5020897572 +import org.jetbrains.annotations.Nullable; + +public class Long2ObjectOpenHashMapWrapper extends Long2ObjectOpenHashMap { -+ ++ + private final Map backingMap; -+ ++ + public Long2ObjectOpenHashMapWrapper(Map map) { + backingMap = map; + } -+ ++ + @Override + public V put(Long key, V value) { + return backingMap.put(key, value); + } -+ ++ + @Override + public V get(Object key) { + return backingMap.get(key); + } -+ ++ + @Override + public V remove(Object key) { + return backingMap.remove(key); + } -+ ++ + @Nullable + @Override + public V putIfAbsent(Long key, V value) { + return backingMap.putIfAbsent(key, value); + } -+ ++ + @Override + public int size() { + return backingMap.size(); + } +} -diff --git a/src/main/java/io/papermc/paper/configuration/GlobalConfiguration.java b/src/main/java/io/papermc/paper/configuration/GlobalConfiguration.java -index 8d442c5a498ecf288a0cc0c54889c6e2fda849ce..01bdf134fc21220ab7ecca51f2dcd51c0b466bba 100644 ---- a/src/main/java/io/papermc/paper/configuration/GlobalConfiguration.java -+++ b/src/main/java/io/papermc/paper/configuration/GlobalConfiguration.java -@@ -7,6 +7,7 @@ import net.kyori.adventure.text.Component; - import net.kyori.adventure.text.format.NamedTextColor; - import net.minecraft.network.protocol.Packet; - import net.minecraft.network.protocol.game.ServerboundPlaceRecipePacket; -+import org.bukkit.Bukkit; // Pufferfish - import org.checkerframework.checker.nullness.qual.Nullable; - import org.spongepowered.configurate.objectmapping.ConfigSerializable; - import org.spongepowered.configurate.objectmapping.meta.Comment; -@@ -16,6 +17,7 @@ import org.spongepowered.configurate.objectmapping.meta.Setting; - import java.util.List; - import java.util.Map; - import java.util.Objects; -+import java.util.logging.Level; // Pufferfish - - @SuppressWarnings({"CanBeFinal", "FieldCanBeLocal", "FieldMayBeFinal", "NotNullFieldNotInitialized", "InnerClassMayBeStatic"}) - public class GlobalConfiguration extends ConfigurationPart { -@@ -51,6 +53,7 @@ public class GlobalConfiguration extends ConfigurationPart { - - public class Timings extends ConfigurationPart.Post { - public boolean enabled = true; -+ public boolean reallyEnabled = false; - public boolean verbose = true; - public String url = "https://timings.aikar.co/"; - public boolean serverNamePrivacy = false; -@@ -64,6 +67,14 @@ public class GlobalConfiguration extends ConfigurationPart { - - @Override - public void postProcess() { -+ // Pufferfish start -+ if (enabled && !reallyEnabled) { -+ Bukkit.getLogger().log(Level.WARNING, "[Pufferfish] To improve performance, timings have been disabled by default"); -+ Bukkit.getLogger().log(Level.WARNING, "[Pufferfish] You can still use timings by using /timings on, but they will not start on server startup unless you set timings.really-enabled to true in paper.yml"); -+ Bukkit.getLogger().log(Level.WARNING, "[Pufferfish] If you would like to disable this message, either set timings.really-enabled to true or timings.enabled to false."); -+ } -+ enabled = reallyEnabled; -+ // Pufferfish end - MinecraftTimings.processConfig(this); - } - } diff --git a/src/main/java/io/papermc/paper/util/MCUtil.java b/src/main/java/io/papermc/paper/util/MCUtil.java index 6efb8b10f17c70b05128039376d254e6beda3841..57e8c6673c7cfe447a75f15506e8000062d813fe 100644 --- a/src/main/java/io/papermc/paper/util/MCUtil.java @@ -1502,18 +1459,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 9f15d9dbdfa74a0640b1a2b4ff695609d4758a4c..644a7f020afd26017543056fd9378868b1874fe8 100644 +index 9f15d9dbdfa74a0640b1a2b4ff695609d4758a4c..a29d92b3f2658b63545b25092bb3a1fea46ca36b 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java -@@ -314,6 +314,8 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop S spin(Function serverFactory) { AtomicReference atomicreference = new AtomicReference(); - Thread thread = new io.papermc.paper.util.TickThread(() -> { // Paper - rewrite chunk system @@ -1682,7 +1684,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop loadedChunkMap = new it.unimi.dsi.fastutil.longs.Long2ObjectOpenHashMap<>(8192, 0.5f); 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(); @@ -1673,7 +1630,7 @@ index ca84eddbdb1e198b899750e5f6b3eafd25ce970f..8438354e482b6f892c3344eceff1abd2 } // Paper end - controlled flush for entity tracker packets } -+ ++ + // Pufferfish start - optimize mob spawning + if (gg.pufferfish.pufferfish.PufferfishConfig.enableAsyncMobSpawning) { + for (ServerPlayer player : this.level.players) { @@ -1721,7 +1678,7 @@ index b7fd8e70413c38923d0719aff803449e392383ac..d5cb594f0b17ec9dc1a19cdb99bba553 this.wasOnGround = this.entity.isOnGround(); this.teleportDelay = 0; diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java -index 309ef1b2181eae609737212a50d037a1565daf86..17b1a891073521be51e7c6bf8f53cb4ed79983ce 100644 +index 3bb63a652aca3c23f5f1bbf9cb70fce6540f2e33..dda5e77f7d9fb2340d50997c0a17bc7f5e2bb961 100644 --- a/src/main/java/net/minecraft/server/level/ServerLevel.java +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java @@ -709,6 +709,7 @@ public class ServerLevel extends Level implements WorldGenLevel { @@ -1786,10 +1743,10 @@ index 309ef1b2181eae609737212a50d037a1565daf86..17b1a891073521be51e7c6bf8f53cb4e this.getRandomBlockPosition(j, 0, k, 15, blockposition); int normalY = chunk.getHeight(Heightmap.Types.MOTION_BLOCKING, blockposition.getX() & 15, blockposition.getZ() & 15) + 1; diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index 177aac1ab10189bb5a52217e86ba5c8a535b4197..b357953dedc2af39673ad4ef78fed14d5e7235bb 100644 +index 9c5754ac3b00d3f0cb80ec83a2beefadee6d0a14..cc7187c597337665d3cf3c3de4b53e3105b9e4c3 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -@@ -1214,6 +1214,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic +@@ -1215,6 +1215,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic @Override public void handleEditBook(ServerboundEditBookPacket packet) { @@ -1797,7 +1754,7 @@ index 177aac1ab10189bb5a52217e86ba5c8a535b4197..b357953dedc2af39673ad4ef78fed14d // Paper start if (!this.cserver.isPrimaryThread()) { List pageList = packet.getPages(); -@@ -2355,6 +2356,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic +@@ -2356,6 +2357,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic } private boolean updateChatOrder(Instant timestamp) { @@ -1918,7 +1875,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..548133e399b5abc4aa83045af87c135a3455b722 100644 +index 4705d7066207250c03a5f98eef61554c901f2e35..e25be74ef0a88541884ad62a4b84219400d5a142 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 { @@ -1939,7 +1896,7 @@ index 4705d7066207250c03a5f98eef61554c901f2e35..548133e399b5abc4aa83045af87c135a + public int activatedPriority = gg.pufferfish.pufferfish.PufferfishConfig.maximumActivationPrio; // golf score + public final BlockPos.MutableBlockPos cachedBlockPos = new BlockPos.MutableBlockPos(); // used where needed + // Pufferfish end -+ ++ public float getBukkitYaw() { return this.yRot; } @@ -2125,7 +2082,7 @@ index ceacc0d383e2ee674783d3c0a7df0a951595faca..8af0918d3a62de58a4b2af55022c812b private String descriptionId; @Nullable diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java -index dcfb71b5a53df789e366fea2080921d677549a2e..791f672b30f2a4d3b329e2ce0f4fb9c2ca627b01 100644 +index 95a27d28f73039693ca64601954af62028413634..f3d96caa83ef4a8083b78e3265282d4723e37d28 100644 --- a/src/main/java/net/minecraft/world/entity/LivingEntity.java +++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java @@ -141,7 +141,6 @@ import org.bukkit.event.entity.EntityTeleportEvent; @@ -2776,66 +2733,6 @@ index 2ee9e8e3c1a28c1823de8e1fe421cc1f3e72f384..cf4a8084158b10bf047d418dda375f8c // CraftBukkit start - moved block handling into separate method for use by Block#rayTrace default BlockHitResult clip(ClipContext raytrace1, BlockPos blockposition) { // Paper start - Prevent raytrace from loading chunks -diff --git a/src/main/java/net/minecraft/world/level/GameRules.java b/src/main/java/net/minecraft/world/level/GameRules.java -index edd2c9d0cf5a81c779011cb4215d496a8987b784..29d1f78dbc8410f9292f409b17705acde55979df 100644 ---- a/src/main/java/net/minecraft/world/level/GameRules.java -+++ b/src/main/java/net/minecraft/world/level/GameRules.java -@@ -100,6 +100,7 @@ public class GameRules { - public static final GameRules.Key RULE_GLOBAL_SOUND_EVENTS = GameRules.register("globalSoundEvents", GameRules.Category.MISC, GameRules.BooleanValue.create(true)); - public static final GameRules.Key RULE_DO_VINES_SPREAD = GameRules.register("doVinesSpread", GameRules.Category.UPDATES, GameRules.BooleanValue.create(true)); - private final Map, GameRules.Value> rules; -+ private final GameRules.Value[] gameruleArray; - - private static > GameRules.Key register(String name, GameRules.Category category, GameRules.Type type) { - GameRules.Key gamerules_gamerulekey = new GameRules.Key<>(name, category); -@@ -118,17 +119,33 @@ public class GameRules { - } - - public GameRules() { -- this.rules = (Map) GameRules.GAME_RULE_TYPES.entrySet().stream().collect(ImmutableMap.toImmutableMap(Entry::getKey, (entry) -> { -+ // Pufferfish start - use this to ensure gameruleArray is initialized -+ this((Map) GameRules.GAME_RULE_TYPES.entrySet().stream().collect(ImmutableMap.toImmutableMap(Entry::getKey, (entry) -> { - return ((GameRules.Type) entry.getValue()).createRule(); -- })); -+ }))); -+ // Pufferfish end - } - - private GameRules(Map, GameRules.Value> rules) { - this.rules = rules; -+ -+ // Pufferfish start -+ int arraySize = rules.keySet().stream().mapToInt(key -> key.gameRuleIndex).max().orElse(-1) + 1; -+ GameRules.Value[] values = new GameRules.Value[arraySize]; -+ -+ for (Entry, GameRules.Value> entry : rules.entrySet()) { -+ values[entry.getKey().gameRuleIndex] = entry.getValue(); -+ } -+ -+ this.gameruleArray = values; -+ // Pufferfish end - } - - public > T getRule(GameRules.Key key) { -- return (T) this.rules.get(key); // CraftBukkit - decompile error -+ // Pufferfish start -+ return key == null ? null : (T) this.gameruleArray[key.gameRuleIndex]; -+ //return (T) this.rules.get(key); // CraftBukkit - decompile error -+ // Pufferfish end - } - - public CompoundTag createTag() { -@@ -187,6 +204,10 @@ public class GameRules { - } - - public static final class Key> { -+ // Pufferfish start -+ private static int lastGameRuleIndex = 0; -+ public final int gameRuleIndex = lastGameRuleIndex++; -+ // Pufferfish end - - final String id; - private final GameRules.Category category; diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java index 973ecd50f9cb6b86c353586e84d15dcb118ccb60..6aec1983a0236d6aa0507a2b3ad1c08b3330f0fc 100644 --- a/src/main/java/net/minecraft/world/level/Level.java @@ -3137,7 +3034,7 @@ index a71414397bd45ee7bcacfeef0041d80dfa25f114..d66806565770cb03a21794f99e5c4b0f @Override 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 cba114f554644a37339c93026630c66c43f524b9..746b71ea96ecc441afd45cc779a1777c15d58ff2 100644 +index aac5572c1d40a10cd1d17f89c9eb836718837577..9b506bd2ec6e7fd1893dc7801592f011680028d7 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 @@ -47,7 +47,10 @@ public class HopperBlockEntity extends RandomizableContainerBlockEntity implemen @@ -3261,7 +3158,7 @@ index 79b01e32f89defb6b78f4764600d33d4945af592..6d62cc8fb347ccafd51df05896e61699 } 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 206dc04086a218b510930739a6c573f2653ab0fa..e7e2b0fc88c9320449bcd0e0929269c2508886e4 100644 +index d190bad5d287766ed4165ed827d9901a9d878687..13594b96cc8f451723c3598ef302ccee8e01bcac 100644 --- a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java +++ b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java @@ -88,6 +88,18 @@ public class LevelChunk extends ChunkAccess { @@ -3283,14 +3180,15 @@ index 206dc04086a218b510930739a6c573f2653ab0fa..e7e2b0fc88c9320449bcd0e0929269c2 public LevelChunk(Level world, ChunkPos pos) { this(world, pos, UpgradeData.EMPTY, new LevelChunkTicks<>(), new LevelChunkTicks<>(), 0L, (LevelChunkSection[]) null, (LevelChunk.PostLoadProcessor) null, (BlendingData) null); } -@@ -118,6 +130,7 @@ public class LevelChunk extends ChunkAccess { +@@ -116,6 +128,8 @@ public class LevelChunk extends ChunkAccess { + this.postLoad = entityLoader; + this.blockTicks = blockTickScheduler; this.fluidTicks = fluidTickScheduler; - // CraftBukkit start - this.bukkitChunk = new org.bukkit.craftbukkit.CraftChunk(this); ++ + this.lightningTick = this.level.getThreadUnsafeRandom().nextInt(100000) << 1; // Pufferfish - initialize lightning tick } - public org.bukkit.Chunk bukkitChunk; + // CraftBukkit start diff --git a/src/main/java/net/minecraft/world/level/chunk/LevelChunkSection.java b/src/main/java/net/minecraft/world/level/chunk/LevelChunkSection.java index 1b80a91fa36c59a31b57ef7ef4a68eacbb0f17f5..b5e118456af6421ae3f85cb8232dc97a8b2d46b7 100644 --- a/src/main/java/net/minecraft/world/level/chunk/LevelChunkSection.java @@ -3533,7 +3431,7 @@ index ebe65474a4a05ff1637d7f37ebcfe690af59def5..42142c512b12e5b269c19f1e821c50e7 @Nullable diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -index 4cd95134811fd65465681d159b2f30cf77455830..7672fe8e6d08370327bb7ad5fa5ac3292c49e3c4 100644 +index 0ba8446065def1b120fd73241de5bc14d60d3b82..58eaa1142bb0568bef439bba76903309914d3ae1 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java @@ -256,7 +256,7 @@ import javax.annotation.Nullable; // Paper diff --git a/patches/server/0002-Purpur-Server-Changes.patch b/patches/server/0002-Purpur-Server-Changes.patch index 6c4cfae..8bc5562 100644 --- a/patches/server/0002-Purpur-Server-Changes.patch +++ b/patches/server/0002-Purpur-Server-Changes.patch @@ -105,7 +105,7 @@ index 692c962193cf9fcc6801fc93f3220bdc673d527b..8cde30544e14f8fc2dac32966ae3c21f metrics.addCustomChart(new Metrics.DrilldownPie("java_version", () -> { Map> map = new HashMap<>(); diff --git a/src/main/java/com/destroystokyo/paper/PaperVersionFetcher.java b/src/main/java/com/destroystokyo/paper/PaperVersionFetcher.java -index bf42969859545a8a520923ef1836ffa4a5cc24a0..462a6eed350fd660ddaf25d567bb6e97b77d0b2b 100644 +index 9d687da5bdf398bb3f6c84cdf1249a7213d09f2e..462a6eed350fd660ddaf25d567bb6e97b77d0b2b 100644 --- a/src/main/java/com/destroystokyo/paper/PaperVersionFetcher.java +++ b/src/main/java/com/destroystokyo/paper/PaperVersionFetcher.java @@ -19,8 +19,10 @@ import java.util.stream.StreamSupport; @@ -113,7 +113,7 @@ index bf42969859545a8a520923ef1836ffa4a5cc24a0..462a6eed350fd660ddaf25d567bb6e97 public class PaperVersionFetcher implements VersionFetcher { private static final java.util.regex.Pattern VER_PATTERN = java.util.regex.Pattern.compile("^([0-9\\.]*)\\-.*R"); // R is an anchor, will always give '-R' at end - private static final String GITHUB_BRANCH_NAME = "master"; -- private static final String DOWNLOAD_PAGE = "https://papermc.io/downloads"; +- private static final String DOWNLOAD_PAGE = "https://papermc.io/downloads/paper"; + // Purpur start + private static final String DOWNLOAD_PAGE = "https://purpurmc.org/downloads"; + private static int distance = -2; public int distance() { return distance; } @@ -261,24 +261,24 @@ 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 a8cead500186142115d4dc029c942fdfc68f7fe5..62b2a3a44929b80b813bc24a33cd1f5049fecbb2 100644 +index 6e441a1a28ba72a8b1cc09fe5fca71b3c70627d4..47e77541e558e18758ae0fcc2aa4e47261e928b6 100644 --- a/src/main/java/gg/pufferfish/pufferfish/PufferfishConfig.java +++ b/src/main/java/gg/pufferfish/pufferfish/PufferfishConfig.java @@ -28,6 +28,7 @@ public class PufferfishConfig { - + private static final YamlFile config = new YamlFile(); private static int updates = 0; + public static File pufferfishFile; // Purpur - + private static ConfigurationSection convertToBukkit(org.simpleyaml.configuration.ConfigurationSection section) { ConfigurationSection newSection = new MemoryConfiguration(); @@ -50,7 +51,7 @@ public class PufferfishConfig { } - + public static void load() throws IOException { - File configFile = new File("pufferfish.yml"); + File configFile = pufferfishFile; // Purpur - + if (configFile.exists()) { try { @@ -224,7 +225,7 @@ public class PufferfishConfig { @@ -291,7 +291,7 @@ index a8cead500186142115d4dc029c942fdfc68f7fe5..62b2a3a44929b80b813bc24a33cd1f50 "This value determines how far away an entity has to be", "from the player to start being effected by DEAR."); @@ -268,7 +269,7 @@ public class PufferfishConfig { - + public static boolean throttleInactiveGoalSelectorTick; private static void inactiveGoalSelectorThrottle() { - getBoolean("inactive-goal-selector-throttle", "inactive-goal-selector-disable", true, @@ -460,27 +460,6 @@ index f0fce4113fb07c64adbec029d177c236cbdcbae8..e94224ed280247ee69dfdff8dc960f2b sender.sendMessage(component); } -diff --git a/src/main/java/io/papermc/paper/configuration/GlobalConfiguration.java b/src/main/java/io/papermc/paper/configuration/GlobalConfiguration.java -index 01bdf134fc21220ab7ecca51f2dcd51c0b466bba..6bf14183a3fcd2b3d166752ce33240d2ff1ffa7c 100644 ---- a/src/main/java/io/papermc/paper/configuration/GlobalConfiguration.java -+++ b/src/main/java/io/papermc/paper/configuration/GlobalConfiguration.java -@@ -67,14 +67,14 @@ public class GlobalConfiguration extends ConfigurationPart { - - @Override - public void postProcess() { -- // Pufferfish start -+ /*// Pufferfish start // Purpur - if (enabled && !reallyEnabled) { - Bukkit.getLogger().log(Level.WARNING, "[Pufferfish] To improve performance, timings have been disabled by default"); - Bukkit.getLogger().log(Level.WARNING, "[Pufferfish] You can still use timings by using /timings on, but they will not start on server startup unless you set timings.really-enabled to true in paper.yml"); - Bukkit.getLogger().log(Level.WARNING, "[Pufferfish] If you would like to disable this message, either set timings.really-enabled to true or timings.enabled to false."); - } - enabled = reallyEnabled; -- // Pufferfish end -+ */// Pufferfish end // Purpur - MinecraftTimings.processConfig(this); - } - } diff --git a/src/main/java/io/papermc/paper/console/HexFormattingConverter.java b/src/main/java/io/papermc/paper/console/HexFormattingConverter.java index b9922b07cb105618390187d98acdf89e728e1f5a..6a1eda942aa33fc0802066416f8bc64f5f15d011 100644 --- a/src/main/java/io/papermc/paper/console/HexFormattingConverter.java @@ -1049,7 +1028,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 644a7f020afd26017543056fd9378868b1874fe8..46b9aed8ab46bd4bfdcf44a392ffc34e26da0f5f 100644 +index a29d92b3f2658b63545b25092bb3a1fea46ca36b..beb05039926e1fb7a656dfcd0c503f82db67fc46 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java @@ -250,7 +250,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop> consumer, Set trackedPlayers) { this.trackedPlayers = trackedPlayers; diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java -index 17b1a891073521be51e7c6bf8f53cb4ed79983ce..06b0b78d16804b4bf8f6b5bb29b21b0eda57f0fc 100644 +index dda5e77f7d9fb2340d50997c0a17bc7f5e2bb961..10d602b947edaae6b78efe9d0773021bcb1c35bf 100644 --- a/src/main/java/net/minecraft/server/level/ServerLevel.java +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java @@ -212,6 +212,8 @@ public class ServerLevel extends Level implements WorldGenLevel { @@ -2617,7 +2596,7 @@ index 17b1a891073521be51e7c6bf8f53cb4ed79983ce..06b0b78d16804b4bf8f6b5bb29b21b0e // Paper - rewrite chunk system - entity saving moved into ChunkHolder } else if (close) { chunkproviderserver.close(false); } // Paper - rewrite chunk system -@@ -2614,7 +2681,7 @@ public class ServerLevel extends Level implements WorldGenLevel { +@@ -2619,7 +2686,7 @@ public class ServerLevel extends Level implements WorldGenLevel { // Spigot Start if (entity.getBukkitEntity() instanceof org.bukkit.inventory.InventoryHolder && (!(entity instanceof ServerPlayer) || entity.getRemovalReason() != Entity.RemovalReason.KILLED)) { // SPIGOT-6876: closeInventory clears death message // Paper start @@ -2627,7 +2606,7 @@ index 17b1a891073521be51e7c6bf8f53cb4ed79983ce..06b0b78d16804b4bf8f6b5bb29b21b0e } // 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 1d4d02f26391ac55c7631817f09d05e2769b0d29..8a4be66f967dfd6b57ab542ae9b06c840647486d 100644 +index 1d4d02f26391ac55c7631817f09d05e2769b0d29..be8bb3f48971e76a3637b9da0706281f352c318b 100644 --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java @@ -275,6 +275,11 @@ public class ServerPlayer extends Player { @@ -2927,7 +2906,7 @@ index 1d4d02f26391ac55c7631817f09d05e2769b0d29..8a4be66f967dfd6b57ab542ae9b06c84 + if (this.level == toLevel) { + this.connection.internalTeleport(to.getX(), to.getY(), to.getZ(), to.getYaw(), to.getPitch(), java.util.EnumSet.noneOf(net.minecraft.world.entity.RelativeMovement.class)); + } else { -+ this.server.getPlayerList().respawn(this, toLevel, true, to, !toLevel.paperConfig().environment.disableTeleportationSuffocationCheck); ++ this.server.getPlayerList().respawn(this, toLevel, true, to, !toLevel.paperConfig().environment.disableTeleportationSuffocationCheck, org.bukkit.event.player.PlayerRespawnEvent.RespawnReason.DEATH); + } + } + @@ -3026,10 +3005,10 @@ index 877498729c66de9aa6a27c9148f7494d7895615c..acd7468ee3c86d3456e96e4ec3d7e6a4 Util.logAndPauseIfInIde("Detected setBlock in a far chunk [" + i + ", " + j + "], pos: " + pos + ", status: " + this.generatingStatus + (this.currentlyGenerating == null ? "" : ", currently generating: " + (String) this.currentlyGenerating.get())); hasSetFarWarned = true; diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index b357953dedc2af39673ad4ef78fed14d5e7235bb..21211e2790cd667ec389353fb90fb700f33421cc 100644 +index cc7187c597337665d3cf3c3de4b53e3105b9e4c3..177090697e42fcca84dbfdf04ca5118a2c5e7be2 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -@@ -261,6 +261,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic +@@ -262,6 +262,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic private long keepAliveTime = Util.getMillis(); private boolean keepAlivePending; private long keepAliveChallenge; @@ -3037,7 +3016,7 @@ index b357953dedc2af39673ad4ef78fed14d5e7235bb..21211e2790cd667ec389353fb90fb700 // CraftBukkit start - multithreaded fields private final AtomicInteger chatSpamTickCount = new AtomicInteger(); private final java.util.concurrent.atomic.AtomicInteger tabSpamLimiter = new java.util.concurrent.atomic.AtomicInteger(); // Paper - configurable tab spam limits -@@ -338,6 +339,20 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic +@@ -339,6 +340,20 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic private boolean justTeleported = false; private boolean hasMoved; // Spigot @@ -3058,7 +3037,7 @@ index b357953dedc2af39673ad4ef78fed14d5e7235bb..21211e2790cd667ec389353fb90fb700 public CraftPlayer getCraftPlayer() { return (this.player == null) ? null : (CraftPlayer) this.player.getBukkitEntity(); } -@@ -393,12 +408,27 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic +@@ -394,12 +409,27 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic this.aboveGroundVehicleTickCount = 0; } @@ -3087,7 +3066,7 @@ index b357953dedc2af39673ad4ef78fed14d5e7235bb..21211e2790cd667ec389353fb90fb700 if (this.keepAlivePending) { if (!this.processedDisconnect && elapsedTime >= KEEPALIVE_LIMIT) { // check keepalive limit, don't fire if already disconnected ServerGamePacketListenerImpl.LOGGER.warn("{} was kicked due to keepalive timeout!", this.player.getScoreboardName()); // more info -@@ -414,7 +444,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic +@@ -415,7 +445,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic } // Paper end @@ -3096,7 +3075,7 @@ index b357953dedc2af39673ad4ef78fed14d5e7235bb..21211e2790cd667ec389353fb90fb700 // CraftBukkit start for (int spam; (spam = this.chatSpamTickCount.get()) > 0 && !this.chatSpamTickCount.compareAndSet(spam, spam - 1); ) ; if (tabSpamLimiter.get() > 0) tabSpamLimiter.getAndDecrement(); // Paper - split to seperate variable -@@ -431,6 +461,12 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic +@@ -432,6 +462,12 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic } if (this.player.getLastActionTime() > 0L && this.server.getPlayerIdleTimeout() > 0 && Util.getMillis() - this.player.getLastActionTime() > (long) (this.server.getPlayerIdleTimeout() * 1000 * 60) && !this.player.wonGame) { // Paper - Prevent AFK kick while watching end credits. @@ -3109,7 +3088,7 @@ index b357953dedc2af39673ad4ef78fed14d5e7235bb..21211e2790cd667ec389353fb90fb700 this.player.resetLastActionTime(); // CraftBukkit - SPIGOT-854 this.disconnect(Component.translatable("multiplayer.disconnect.idling"), org.bukkit.event.player.PlayerKickEvent.Cause.IDLING); // Paper - kick event cause } -@@ -742,6 +778,8 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic +@@ -743,6 +779,8 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic this.lastYaw = to.getYaw(); this.lastPitch = to.getPitch(); @@ -3118,7 +3097,7 @@ index b357953dedc2af39673ad4ef78fed14d5e7235bb..21211e2790cd667ec389353fb90fb700 // Skip the first time we do this if (true) { // Spigot - don't skip any move events Location oldTo = to.clone(); -@@ -818,6 +856,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic +@@ -819,6 +857,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic if (packet.getId() == this.awaitingTeleport) { if (this.awaitingPositionFromClient == null) { this.disconnect(Component.translatable("multiplayer.disconnect.invalid_player_movement"), org.bukkit.event.player.PlayerKickEvent.Cause.INVALID_PLAYER_MOVEMENT); // Paper - kick event cause @@ -3126,7 +3105,7 @@ index b357953dedc2af39673ad4ef78fed14d5e7235bb..21211e2790cd667ec389353fb90fb700 return; } -@@ -1222,10 +1261,12 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic +@@ -1223,10 +1262,12 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic 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; @@ -3139,7 +3118,7 @@ index b357953dedc2af39673ad4ef78fed14d5e7235bb..21211e2790cd667ec389353fb90fb700 server.scheduleOnMain(() -> this.disconnect("Book too large!", org.bukkit.event.player.PlayerKickEvent.Cause.ILLEGAL_ACTION)); // Paper - kick event cause return; } -@@ -1249,6 +1290,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic +@@ -1250,6 +1291,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic if (byteTotal > byteAllowed) { ServerGamePacketListenerImpl.LOGGER.warn(this.player.getScoreboardName() + " tried to send too large of a book. Book Size: " + byteTotal + " - Allowed: "+ byteAllowed + " - Pages: " + pageList.size()); @@ -3147,7 +3126,7 @@ index b357953dedc2af39673ad4ef78fed14d5e7235bb..21211e2790cd667ec389353fb90fb700 server.scheduleOnMain(() -> this.disconnect("Book too large!", org.bukkit.event.player.PlayerKickEvent.Cause.ILLEGAL_ACTION)); // Paper - kick event cause return; } -@@ -1302,13 +1344,16 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic +@@ -1303,13 +1345,16 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic itemstack1.setTag(nbttagcompound.copy()); } @@ -3167,7 +3146,7 @@ index b357953dedc2af39673ad4ef78fed14d5e7235bb..21211e2790cd667ec389353fb90fb700 this.updateBookPages(pages, (s) -> { return Component.Serializer.toJson(Component.literal(s)); -@@ -1320,10 +1365,13 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic +@@ -1321,10 +1366,13 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic private void updateBookPages(List list, UnaryOperator unaryoperator, ItemStack itemstack, int slot, ItemStack handItem) { // CraftBukkit ListTag nbttaglist = new ListTag(); @@ -3183,7 +3162,7 @@ index b357953dedc2af39673ad4ef78fed14d5e7235bb..21211e2790cd667ec389353fb90fb700 Objects.requireNonNull(nbttaglist); stream.forEach(nbttaglist::add); -@@ -1333,11 +1381,11 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic +@@ -1334,11 +1382,11 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic for (int j = list.size(); i < j; ++i) { FilteredText filteredtext = (FilteredText) list.get(i); @@ -3197,7 +3176,7 @@ index b357953dedc2af39673ad4ef78fed14d5e7235bb..21211e2790cd667ec389353fb90fb700 } } -@@ -1350,6 +1398,16 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic +@@ -1351,6 +1399,16 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic this.player.getInventory().setItem(slot, CraftEventFactory.handleEditBookEvent(player, slot, handItem, itemstack)); // CraftBukkit // Paper - Don't ignore result (see other callsite for handleEditBookEvent) } @@ -3214,7 +3193,7 @@ index b357953dedc2af39673ad4ef78fed14d5e7235bb..21211e2790cd667ec389353fb90fb700 @Override public void handleEntityTagQuery(ServerboundEntityTagQuery packet) { PacketUtils.ensureRunningOnSameThread(packet, this, this.player.getLevel()); -@@ -1379,8 +1437,16 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic +@@ -1380,8 +1438,16 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic @Override public void handleMovePlayer(ServerboundMovePlayerPacket packet) { PacketUtils.ensureRunningOnSameThread(packet, this, this.player.getLevel()); @@ -3232,7 +3211,7 @@ index b357953dedc2af39673ad4ef78fed14d5e7235bb..21211e2790cd667ec389353fb90fb700 } else { ServerLevel worldserver = this.player.getLevel(); -@@ -1546,7 +1612,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic +@@ -1547,7 +1613,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic if (!this.player.isChangingDimension() && d11 > org.spigotmc.SpigotConfig.movedWronglyThreshold && !this.player.isSleeping() && !this.player.gameMode.isCreative() && this.player.gameMode.getGameModeForPlayer() != GameType.SPECTATOR) { // Spigot flag2 = true; // Paper - diff on change, this should be moved wrongly @@ -3241,7 +3220,7 @@ index b357953dedc2af39673ad4ef78fed14d5e7235bb..21211e2790cd667ec389353fb90fb700 } this.player.absMoveTo(d0, d1, d2, f, f1); -@@ -1597,6 +1663,8 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic +@@ -1598,6 +1664,8 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic this.lastYaw = to.getYaw(); this.lastPitch = to.getPitch(); @@ -3250,7 +3229,7 @@ index b357953dedc2af39673ad4ef78fed14d5e7235bb..21211e2790cd667ec389353fb90fb700 // Skip the first time we do this if (from.getX() != Double.MAX_VALUE) { Location oldTo = to.clone(); -@@ -1636,6 +1704,13 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic +@@ -1637,6 +1705,13 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic this.player.resetFallDistance(); } @@ -3264,7 +3243,7 @@ index b357953dedc2af39673ad4ef78fed14d5e7235bb..21211e2790cd667ec389353fb90fb700 this.player.checkMovementStatistics(this.player.getX() - d3, this.player.getY() - d4, this.player.getZ() - d5); this.lastGoodX = this.player.getX(); this.lastGoodY = this.player.getY(); -@@ -1669,6 +1744,12 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic +@@ -1670,6 +1745,12 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic } // Paper end - optimise out extra getCubes @@ -3277,7 +3256,7 @@ index b357953dedc2af39673ad4ef78fed14d5e7235bb..21211e2790cd667ec389353fb90fb700 private boolean isPlayerCollidingWithAnythingNew(LevelReader world, AABB box) { Iterable iterable = world.getCollisions(this.player, this.player.getBoundingBox().deflate(9.999999747378752E-6D)); VoxelShape voxelshape = Shapes.create(box.deflate(9.999999747378752E-6D)); -@@ -2013,6 +2094,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic +@@ -2014,6 +2095,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic boolean cancelled; if (movingobjectposition == null || movingobjectposition.getType() != HitResult.Type.BLOCK) { @@ -3285,7 +3264,7 @@ index b357953dedc2af39673ad4ef78fed14d5e7235bb..21211e2790cd667ec389353fb90fb700 org.bukkit.event.player.PlayerInteractEvent event = CraftEventFactory.callPlayerInteractEvent(this.player, Action.RIGHT_CLICK_AIR, itemstack, enumhand); cancelled = event.useItemInHand() == Event.Result.DENY; } else { -@@ -2066,12 +2148,21 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic +@@ -2067,12 +2149,21 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic @Override public void handleResourcePackResponse(ServerboundResourcePackPacket packet) { PacketUtils.ensureRunningOnSameThread(packet, this, this.player.getLevel()); @@ -3307,7 +3286,7 @@ index b357953dedc2af39673ad4ef78fed14d5e7235bb..21211e2790cd667ec389353fb90fb700 player.getBukkitEntity().setResourcePackStatus(packStatus); this.cserver.getPluginManager().callEvent(new PlayerResourcePackStatusEvent(this.getCraftPlayer(), packStatus)); // CraftBukkit // Paper end -@@ -2362,7 +2453,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic +@@ -2363,7 +2454,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic do { instant1 = (Instant) this.lastChatTimeStamp.get(); if (timestamp.isBefore(instant1)) { @@ -3316,7 +3295,7 @@ index b357953dedc2af39673ad4ef78fed14d5e7235bb..21211e2790cd667ec389353fb90fb700 } } while (!this.lastChatTimeStamp.compareAndSet(instant1, timestamp)); -@@ -2499,7 +2590,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic +@@ -2500,7 +2591,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic } } // Paper End @@ -3325,7 +3304,7 @@ index b357953dedc2af39673ad4ef78fed14d5e7235bb..21211e2790cd667ec389353fb90fb700 if ( org.spigotmc.SpigotConfig.logCommands ) // Spigot this.LOGGER.info(this.player.getScoreboardName() + " issued server command: " + s); -@@ -2509,7 +2600,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic +@@ -2510,7 +2601,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic this.cserver.getPluginManager().callEvent(event); if (event.isCancelled()) { @@ -3334,7 +3313,7 @@ index b357953dedc2af39673ad4ef78fed14d5e7235bb..21211e2790cd667ec389353fb90fb700 return; } -@@ -2522,7 +2613,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic +@@ -2523,7 +2614,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic java.util.logging.Logger.getLogger(ServerGamePacketListenerImpl.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); return; } finally { @@ -3343,7 +3322,7 @@ index b357953dedc2af39673ad4ef78fed14d5e7235bb..21211e2790cd667ec389353fb90fb700 } } // CraftBukkit end -@@ -2788,6 +2879,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic +@@ -2789,6 +2880,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic AABB axisalignedbb = entity.getBoundingBox(); if (axisalignedbb.distanceToSqr(this.player.getEyePosition()) < ServerGamePacketListenerImpl.MAX_INTERACTION_DISTANCE) { @@ -3351,7 +3330,7 @@ index b357953dedc2af39673ad4ef78fed14d5e7235bb..21211e2790cd667ec389353fb90fb700 packet.dispatch(new ServerboundInteractPacket.Handler() { private void performInteraction(InteractionHand enumhand, ServerGamePacketListenerImpl.EntityInteraction playerconnection_a, PlayerInteractEntityEvent event) { // CraftBukkit ItemStack itemstack = ServerGamePacketListenerImpl.this.player.getItemInHand(enumhand); -@@ -2801,6 +2893,8 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic +@@ -2802,6 +2894,8 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic ServerGamePacketListenerImpl.this.cserver.getPluginManager().callEvent(event); @@ -3360,7 +3339,7 @@ index b357953dedc2af39673ad4ef78fed14d5e7235bb..21211e2790cd667ec389353fb90fb700 // Entity in bucket - SPIGOT-4048 and SPIGOT-6859a if ((entity instanceof Bucketable && entity instanceof LivingEntity && origItem != null && origItem.asItem() == Items.WATER_BUCKET) && (event.isCancelled() || ServerGamePacketListenerImpl.this.player.getInventory().getSelected() == null || ServerGamePacketListenerImpl.this.player.getInventory().getSelected().getItem() != origItem)) { entity.getEntityData().resendPossiblyDesyncedEntity(player); // Paper - The entire mob gets deleted, so resend it. -@@ -3352,6 +3446,12 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic +@@ -3353,6 +3447,12 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic } } } @@ -3373,7 +3352,7 @@ index b357953dedc2af39673ad4ef78fed14d5e7235bb..21211e2790cd667ec389353fb90fb700 boolean flag1 = packet.getSlotNum() >= 1 && packet.getSlotNum() <= 45; boolean flag2 = itemstack.isEmpty() || itemstack.getDamageValue() >= 0 && itemstack.getCount() <= 64 && !itemstack.isEmpty(); -@@ -3458,11 +3558,17 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic +@@ -3459,11 +3559,17 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic for (int i = 0; i < signText.size(); ++i) { FilteredText filteredtext = (FilteredText) signText.get(i); @@ -3394,7 +3373,7 @@ index b357953dedc2af39673ad4ef78fed14d5e7235bb..21211e2790cd667ec389353fb90fb700 } SignChangeEvent event = new SignChangeEvent((org.bukkit.craftbukkit.block.CraftBlock) player.getWorld().getBlockAt(x, y, z), this.player.getBukkitEntity(), lines); this.cserver.getPluginManager().callEvent(event); -@@ -3484,6 +3590,16 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic +@@ -3485,6 +3591,16 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic @Override public void handleKeepAlive(ServerboundKeepAlivePacket packet) { @@ -3411,7 +3390,7 @@ index b357953dedc2af39673ad4ef78fed14d5e7235bb..21211e2790cd667ec389353fb90fb700 //PacketUtils.ensureRunningOnSameThread(packet, this, this.player.getLevel()); // CraftBukkit // Paper - This shouldn't be on the main thread if (this.keepAlivePending && packet.getId() == this.keepAliveChallenge) { int i = (int) (Util.getMillis() - this.keepAliveTime); -@@ -3534,6 +3650,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic +@@ -3535,6 +3651,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic private static final ResourceLocation CUSTOM_UNREGISTER = new ResourceLocation("unregister"); private static final ResourceLocation MINECRAFT_BRAND = new ResourceLocation("brand"); // Paper - Brand support @@ -3419,7 +3398,7 @@ index b357953dedc2af39673ad4ef78fed14d5e7235bb..21211e2790cd667ec389353fb90fb700 @Override public void handleCustomPayload(ServerboundCustomPayloadPacket packet) { -@@ -3558,6 +3675,13 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic +@@ -3559,6 +3676,13 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic ServerGamePacketListenerImpl.LOGGER.error("Couldn\'t unregister custom payload", ex); this.disconnect("Invalid payload UNREGISTER!", org.bukkit.event.player.PlayerKickEvent.Cause.INVALID_PAYLOAD); // Paper - kick event cause } @@ -3488,10 +3467,10 @@ index 9ddbfcf80d9a381dace78a62880f85a4d767e0eb..7383c7d3820dce06108eaafd236a7c6c } diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java -index a1096ea424c0724af93a2dc65512ee71f4a0bf72..b04e905534baf35e50d9d09921581e04edd19fc5 100644 +index 4d837c1530a3031a4c2a5a39d87bd013d60e14a6..33d4c1af86382cc3343d5db42283b27f69f52374 100644 --- a/src/main/java/net/minecraft/server/players/PlayerList.java +++ b/src/main/java/net/minecraft/server/players/PlayerList.java -@@ -466,6 +466,7 @@ public abstract class PlayerList { +@@ -467,6 +467,7 @@ public abstract class PlayerList { scoreboard.addPlayerToTeam(player.getScoreboardName(), collideRuleTeam); } // Paper end @@ -3499,7 +3478,7 @@ index a1096ea424c0724af93a2dc65512ee71f4a0bf72..b04e905534baf35e50d9d09921581e04 // CraftBukkit - Moved from above, added world PlayerList.LOGGER.info("{}[{}] logged in with entity id {} at ([{}]{}, {}, {})", player.getName().getString(), s1, player.getId(), worldserver1.serverLevelData.getLevelName(), player.getX(), player.getY(), player.getZ()); } -@@ -575,6 +576,8 @@ public abstract class PlayerList { +@@ -576,6 +577,8 @@ public abstract class PlayerList { } public net.kyori.adventure.text.Component remove(ServerPlayer entityplayer, net.kyori.adventure.text.Component leaveMessage) { // Paper end @@ -3508,7 +3487,7 @@ index a1096ea424c0724af93a2dc65512ee71f4a0bf72..b04e905534baf35e50d9d09921581e04 ServerLevel worldserver = entityplayer.getLevel(); entityplayer.awardStat(Stats.LEAVE_GAME); -@@ -728,7 +731,7 @@ public abstract class PlayerList { +@@ -729,7 +732,7 @@ public abstract class PlayerList { event.disallow(PlayerLoginEvent.Result.KICK_BANNED, PaperAdventure.asAdventure(ichatmutablecomponent)); // Paper - Adventure } else { // return this.players.size() >= this.maxPlayers && !this.canBypassPlayerLimit(gameprofile) ? IChatBaseComponent.translatable("multiplayer.disconnect.server_full") : null; @@ -3517,7 +3496,7 @@ index a1096ea424c0724af93a2dc65512ee71f4a0bf72..b04e905534baf35e50d9d09921581e04 event.disallow(PlayerLoginEvent.Result.KICK_FULL, net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer.legacySection().deserialize(org.spigotmc.SpigotConfig.serverFullMessage)); // Spigot // Paper - Adventure } } -@@ -966,6 +969,8 @@ public abstract class PlayerList { +@@ -967,6 +970,8 @@ public abstract class PlayerList { } // Paper end @@ -3526,7 +3505,7 @@ index a1096ea424c0724af93a2dc65512ee71f4a0bf72..b04e905534baf35e50d9d09921581e04 // CraftBukkit end return entityplayer1; } -@@ -1026,6 +1031,20 @@ public abstract class PlayerList { +@@ -1027,6 +1032,20 @@ public abstract class PlayerList { } // CraftBukkit end @@ -3547,7 +3526,7 @@ index a1096ea424c0724af93a2dc65512ee71f4a0bf72..b04e905534baf35e50d9d09921581e04 public void broadcastAll(Packet packet, ResourceKey dimension) { Iterator iterator = this.players.iterator(); -@@ -1129,6 +1148,7 @@ public abstract class PlayerList { +@@ -1130,6 +1149,7 @@ public abstract class PlayerList { } else { b0 = (byte) (24 + permissionLevel); } @@ -3555,7 +3534,7 @@ index a1096ea424c0724af93a2dc65512ee71f4a0bf72..b04e905534baf35e50d9d09921581e04 player.connection.send(new ClientboundEntityEventPacket(player, b0)); } -@@ -1137,6 +1157,27 @@ public abstract class PlayerList { +@@ -1138,6 +1158,27 @@ public abstract class PlayerList { player.getBukkitEntity().recalculatePermissions(); // CraftBukkit this.server.getCommands().sendCommands(player); } // Paper @@ -3583,7 +3562,7 @@ index a1096ea424c0724af93a2dc65512ee71f4a0bf72..b04e905534baf35e50d9d09921581e04 } public boolean isWhiteListed(GameProfile profile) { -@@ -1198,7 +1239,7 @@ public abstract class PlayerList { +@@ -1199,7 +1240,7 @@ public abstract class PlayerList { public void saveAll(int interval) { io.papermc.paper.util.MCUtil.ensureMain("Save Players" , () -> { // Paper - Ensure main @@ -3592,7 +3571,7 @@ index a1096ea424c0724af93a2dc65512ee71f4a0bf72..b04e905534baf35e50d9d09921581e04 int numSaved = 0; long now = MinecraftServer.currentTick; for (int i = 0; i < this.players.size(); ++i) { -@@ -1209,7 +1250,7 @@ public abstract class PlayerList { +@@ -1210,7 +1251,7 @@ public abstract class PlayerList { } // Paper end } @@ -4049,7 +4028,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 548133e399b5abc4aa83045af87c135a3455b722..3c10c719f6172161a2dcc6592a0a1492e9b3d7c1 100644 +index e25be74ef0a88541884ad62a4b84219400d5a142..b2ee73a2ef6042694ca84c27d592e5fb13b4a0fe 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; @@ -4615,7 +4594,7 @@ index c1e9b40a4a0f9cdc650caa88b5ea132e06ee2496..6f723171fa71d74b351b5cf0cd167bb6 @Override diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java -index 791f672b30f2a4d3b329e2ce0f4fb9c2ca627b01..8d7c33e16f9eaec2120c5aad75172ff656d1bd17 100644 +index f3d96caa83ef4a8083b78e3265282d4723e37d28..b67660cda74a4754d1701e746aca99bde868c150 100644 --- a/src/main/java/net/minecraft/world/entity/LivingEntity.java +++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java @@ -216,9 +216,9 @@ public abstract class LivingEntity extends Entity implements Attackable { @@ -10945,7 +10924,7 @@ index ad0df80d1adb1d945f40e1b5f7732bb36b2ca2ff..90cab3586d3e3e290475fe8d59a69d89 } 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 ce2c3c146ef64400e00084bd2245d2b87a67fbc2..b0dd274fde1ce23a984de9492d7605ffcca4a86b 100644 +index 536856300da929c101f50da5827677bada5feb50..98844ccc6200ba060022525b3a00bcb1de1d0a7a 100644 --- a/src/main/java/net/minecraft/world/entity/item/FallingBlockEntity.java +++ b/src/main/java/net/minecraft/world/entity/item/FallingBlockEntity.java @@ -131,7 +131,7 @@ public class FallingBlockEntity extends Entity { @@ -12141,10 +12120,10 @@ index 41004c28edb748e12c4f868aa07b4672891197c1..4e5b9f772ba587b4e108add3758dffa6 } } diff --git a/src/main/java/net/minecraft/world/entity/monster/Guardian.java b/src/main/java/net/minecraft/world/entity/monster/Guardian.java -index 6e0f4f15e49afb989874468b2a459178aef552f5..73e973e10f767d0efe0e0410d97c6892c4ea35d8 100644 +index cf7e9c1db229f9e2cc05ce3046540db1d4fc4ec4..f10304b38e904528907cb36c342acf9d49935edd 100644 --- a/src/main/java/net/minecraft/world/entity/monster/Guardian.java +++ b/src/main/java/net/minecraft/world/entity/monster/Guardian.java -@@ -67,14 +67,50 @@ public class Guardian extends Monster { +@@ -69,15 +69,51 @@ public class Guardian extends Monster { this.xpReward = 10; this.setPathfindingMalus(BlockPathTypes.WATER, 0.0F); this.moveControl = new Guardian.GuardianMoveControl(this); @@ -12189,21 +12168,22 @@ index 6e0f4f15e49afb989874468b2a459178aef552f5..73e973e10f767d0efe0e0410d97c6892 + @Override protected void registerGoals() { - MoveTowardsRestrictionGoal moveTowardsRestrictionGoal = new MoveTowardsRestrictionGoal(this, 1.0D); + MoveTowardsRestrictionGoal pathfindergoalmovetowardsrestriction = new MoveTowardsRestrictionGoal(this, 1.0D); + this.randomStrollGoal = new RandomStrollGoal(this, 1.0D, 80); + this.goalSelector.addGoal(0, new org.purpurmc.purpur.entity.ai.HasRider(this)); // Purpur - this.goalSelector.addGoal(4, new Guardian.GuardianAttackGoal(this)); - this.goalSelector.addGoal(5, moveTowardsRestrictionGoal); + this.goalSelector.addGoal(4, this.guardianAttackGoal = new Guardian.GuardianAttackGoal(this)); // CraftBukkit - assign field + this.goalSelector.addGoal(5, pathfindergoalmovetowardsrestriction); this.goalSelector.addGoal(7, this.randomStrollGoal); -@@ -83,6 +119,7 @@ public class Guardian extends Monster { +@@ -86,6 +122,7 @@ public class Guardian extends Monster { this.goalSelector.addGoal(9, new RandomLookAroundGoal(this)); this.randomStrollGoal.setFlags(EnumSet.of(Goal.Flag.MOVE, Goal.Flag.LOOK)); - moveTowardsRestrictionGoal.setFlags(EnumSet.of(Goal.Flag.MOVE, Goal.Flag.LOOK)); + pathfindergoalmovetowardsrestriction.setFlags(EnumSet.of(Goal.Flag.MOVE, Goal.Flag.LOOK)); + this.targetSelector.addGoal(0, new org.purpurmc.purpur.entity.ai.HasRider(this)); // Purpur this.targetSelector.addGoal(1, new NearestAttackableTargetGoal<>(this, LivingEntity.class, 10, true, false, new Guardian.GuardianAttackSelector(this))); } -@@ -341,7 +378,7 @@ public class Guardian extends Monster { +@@ -351,7 +388,7 @@ public class Guardian extends Monster { @Override public void travel(Vec3 movementInput) { if (this.isControlledByLocalInstance() && this.isInWater()) { @@ -12212,16 +12192,16 @@ index 6e0f4f15e49afb989874468b2a459178aef552f5..73e973e10f767d0efe0e0410d97c6892 this.move(MoverType.SELF, this.getDeltaMovement()); this.setDeltaMovement(this.getDeltaMovement().scale(0.9D)); if (!this.isMoving() && this.getTarget() == null) { -@@ -448,7 +485,7 @@ public class Guardian extends Monster { - } +@@ -363,7 +400,7 @@ public class Guardian extends Monster { + } -- static class GuardianMoveControl extends MoveControl { -+ static class GuardianMoveControl extends org.purpurmc.purpur.controller.WaterMoveControllerWASD { // Purpur +- private static class GuardianMoveControl extends MoveControl { ++ private static class GuardianMoveControl extends org.purpurmc.purpur.controller.WaterMoveControllerWASD { // Purpur + private final Guardian guardian; - public GuardianMoveControl(Guardian guardian) { -@@ -456,8 +493,17 @@ public class Guardian extends Monster { +@@ -372,8 +409,17 @@ public class Guardian extends Monster { this.guardian = guardian; } @@ -12238,17 +12218,17 @@ index 6e0f4f15e49afb989874468b2a459178aef552f5..73e973e10f767d0efe0e0410d97c6892 + @Override + public void vanillaTick() { // Purpur if (this.operation == MoveControl.Operation.MOVE_TO && !this.guardian.getNavigation().isDone()) { - Vec3 vec3 = new Vec3(this.wantedX - this.guardian.getX(), this.wantedY - this.guardian.getY(), this.wantedZ - this.guardian.getZ()); - double d = vec3.length(); -@@ -467,7 +513,7 @@ public class Guardian extends Monster { - float h = (float)(Mth.atan2(vec3.z, vec3.x) * (double)(180F / (float)Math.PI)) - 90.0F; - this.guardian.setYRot(this.rotlerp(this.guardian.getYRot(), h, 90.0F)); + Vec3 vec3d = new Vec3(this.wantedX - this.guardian.getX(), this.wantedY - this.guardian.getY(), this.wantedZ - this.guardian.getZ()); + double d0 = vec3d.length(); +@@ -384,7 +430,7 @@ public class Guardian extends Monster { + + this.guardian.setYRot(this.rotlerp(this.guardian.getYRot(), f, 90.0F)); this.guardian.yBodyRot = this.guardian.getYRot(); -- float i = (float)(this.speedModifier * this.guardian.getAttributeValue(Attributes.MOVEMENT_SPEED)); -+ float i = (float)(this.getSpeedModifier() * this.guardian.getAttributeValue(Attributes.MOVEMENT_SPEED)); // Purpur - float j = Mth.lerp(0.125F, this.guardian.getSpeed(), i); - this.guardian.setSpeed(j); - double k = Math.sin((double)(this.guardian.tickCount + this.guardian.getId()) * 0.5D) * 0.05D; +- float f1 = (float) (this.speedModifier * this.guardian.getAttributeValue(Attributes.MOVEMENT_SPEED)); ++ float f1 = (float) (this.getSpeedModifier() * this.guardian.getAttributeValue(Attributes.MOVEMENT_SPEED)); // Purpur + float f2 = Mth.lerp(0.125F, this.guardian.getSpeed(), f1); + + this.guardian.setSpeed(f2); diff --git a/src/main/java/net/minecraft/world/entity/monster/Husk.java b/src/main/java/net/minecraft/world/entity/monster/Husk.java index 4996347c6dde85a2dc9aa37fdf495160093fac64..a7b690c0730d0b10133f24d7ce2d9f6a0e4a7c04 100644 --- a/src/main/java/net/minecraft/world/entity/monster/Husk.java @@ -16348,7 +16328,7 @@ index 9c7d0b9cc2fa98d5785c914c0183f7d4b5b1c1ea..89a4ab17ca8d2aa1f52b041c610d7de1 return InteractionResult.PASS; } diff --git a/src/main/java/net/minecraft/world/item/BlockItem.java b/src/main/java/net/minecraft/world/item/BlockItem.java -index b0204af850ee182773ad458208cccd946ad148d5..193ae502acb622da3a42d49dc0c69da9d22f6ede 100644 +index ebee8de2ed831755b6fd154f6cc77ac993839bb9..9060a844cd3bb3b62171872d84516b9195b9b677 100644 --- a/src/main/java/net/minecraft/world/item/BlockItem.java +++ b/src/main/java/net/minecraft/world/item/BlockItem.java @@ -153,7 +153,24 @@ public class BlockItem extends Item { @@ -16660,10 +16640,10 @@ 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 d690b8d0c1da1f56b226376df8c76c34375e3c73..0c0a0639cd9c85d4332a6fa85e3143510f3c7448 100644 +index a7533d18fe6148d7bfd3106b9cdcb6fa3347cf7c..45d864679816cb39420e079d37220a967e9d71d1 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; +@@ -111,6 +111,7 @@ import org.bukkit.event.world.StructureGrowEvent; public final class ItemStack { @@ -16671,7 +16651,7 @@ index d690b8d0c1da1f56b226376df8c76c34375e3c73..0c0a0639cd9c85d4332a6fa85e314351 public static final Codec CODEC = RecordCodecBuilder.create((instance) -> { return instance.group(BuiltInRegistries.ITEM.byNameCodec().fieldOf("id").forGetter((itemstack) -> { return itemstack.item; -@@ -415,6 +416,7 @@ public final class ItemStack { +@@ -417,6 +418,7 @@ public final class ItemStack { world.preventPoiUpdated = true; // CraftBukkit - SPIGOT-5710 for (BlockState blockstate : blocks) { blockstate.update(true, false); @@ -16679,7 +16659,7 @@ index d690b8d0c1da1f56b226376df8c76c34375e3c73..0c0a0639cd9c85d4332a6fa85e314351 } world.preventPoiUpdated = false; -@@ -444,6 +446,7 @@ public final class ItemStack { +@@ -446,6 +448,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 } @@ -16687,7 +16667,7 @@ index d690b8d0c1da1f56b226376df8c76c34375e3c73..0c0a0639cd9c85d4332a6fa85e314351 world.notifyAndUpdatePhysics(newblockposition, null, oldBlock, block, world.getBlockState(newblockposition), updateFlag, 512); // send null chunk as chunk.k() returns false by this point } -@@ -559,6 +562,16 @@ public final class ItemStack { +@@ -566,6 +569,16 @@ public final class ItemStack { return this.isDamageableItem() && this.getDamageValue() > 0; } @@ -16704,7 +16684,7 @@ index d690b8d0c1da1f56b226376df8c76c34375e3c73..0c0a0639cd9c85d4332a6fa85e314351 public int getDamageValue() { return this.tag == null ? 0 : this.tag.getInt("Damage"); } -@@ -578,7 +591,7 @@ public final class ItemStack { +@@ -585,7 +598,7 @@ public final class ItemStack { int j; if (amount > 0) { @@ -16713,7 +16693,7 @@ index d690b8d0c1da1f56b226376df8c76c34375e3c73..0c0a0639cd9c85d4332a6fa85e314351 int k = 0; for (int l = 0; j > 0 && l < amount; ++l) { -@@ -633,6 +646,12 @@ public final class ItemStack { +@@ -640,6 +653,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(); @@ -16726,7 +16706,7 @@ index d690b8d0c1da1f56b226376df8c76c34375e3c73..0c0a0639cd9c85d4332a6fa85e314351 // 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); -@@ -1165,7 +1184,7 @@ public final class ItemStack { +@@ -1172,7 +1191,7 @@ public final class ItemStack { ListTag nbttaglist = this.tag.getList("Enchantments", 10); @@ -16735,7 +16715,7 @@ index d690b8d0c1da1f56b226376df8c76c34375e3c73..0c0a0639cd9c85d4332a6fa85e314351 processEnchantOrder(this.tag); // Paper } -@@ -1173,6 +1192,12 @@ public final class ItemStack { +@@ -1180,6 +1199,12 @@ public final class ItemStack { return this.tag != null && this.tag.contains("Enchantments", 9) ? !this.tag.getList("Enchantments", 10).isEmpty() : false; } @@ -17514,7 +17494,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 3aa79a441ac4bd6b4d87d19bdb3011455210fd41..4de8e77ef7574a0febf9c89258e4aeb26f4af6fc 100644 +index d1d5363ab1742add8ff45507a303106f4d65f52f..19d31064eb271ee02115a75cde383796c899e7f7 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 @@ -17525,8 +17505,8 @@ index 3aa79a441ac4bd6b4d87d19bdb3011455210fd41..4de8e77ef7574a0febf9c89258e4aeb2 + if (world.purpurConfig.bedExplode) world.explode((Entity) null, world.damageSources().badRespawnPointExplosion(vec3d, explodedBlockState), (ExplosionDamageCalculator) null, vec3d, (float) world.purpurConfig.bedExplosionPower, world.purpurConfig.bedExplosionFire, world.purpurConfig.bedExplosionEffect); // Purpur return InteractionResult.SUCCESS; } else if ((Boolean) state.getValue(BedBlock.OCCUPIED)) { - if (!this.kickVillagerOutOfBed(world, pos)) { -@@ -149,7 +149,7 @@ public class BedBlock extends HorizontalDirectionalBlock implements EntityBlock + if (!BedBlock.canSetSpawn(world)) return this.explodeBed(state, world, pos); // Paper - check explode first +@@ -150,7 +150,7 @@ public class BedBlock extends HorizontalDirectionalBlock implements EntityBlock Vec3 vec3d = blockposition.getCenter(); @@ -19567,19 +19547,19 @@ index 505503a3f59d4b747649275c6f6faa504b7c7b64..bee42ce7c1cb0f5ebd4890c02bc9c5dd protected final SoundType soundType; protected final float friction; 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 e7e2b0fc88c9320449bcd0e0929269c2508886e4..b367184f415b6e20c2fc02a1e8853003349a0a1b 100644 +index 13594b96cc8f451723c3598ef302ccee8e01bcac..e9d92bf484fb0d2fcb66a7c424eced109bfa031d 100644 --- a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java +++ b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java -@@ -130,7 +130,7 @@ public class LevelChunk extends ChunkAccess { +@@ -129,7 +129,7 @@ public class LevelChunk extends ChunkAccess { + this.blockTicks = blockTickScheduler; this.fluidTicks = fluidTickScheduler; - // CraftBukkit start - this.bukkitChunk = new org.bukkit.craftbukkit.CraftChunk(this); + - this.lightningTick = this.level.getThreadUnsafeRandom().nextInt(100000) << 1; // Pufferfish - initialize lightning tick + this.lightningTick = java.util.concurrent.ThreadLocalRandom.current().nextInt(100000) << 1; // Pufferfish - initialize lightning tick // Purpur - any random will do } - public org.bukkit.Chunk bukkitChunk; -@@ -930,7 +930,7 @@ public class LevelChunk extends ChunkAccess { + // CraftBukkit start +@@ -925,7 +925,7 @@ public class LevelChunk extends ChunkAccess { this.chunkHolder.getEntityChunk().callEntitiesLoadEvent(); // Paper - rewrite chunk system if (this.needsDecoration) { @@ -19588,16 +19568,16 @@ index e7e2b0fc88c9320449bcd0e0929269c2508886e4..b367184f415b6e20c2fc02a1e8853003 this.needsDecoration = false; java.util.Random random = new java.util.Random(); random.setSeed(this.level.getSeed()); -@@ -950,7 +950,7 @@ public class LevelChunk extends ChunkAccess { +@@ -945,7 +945,7 @@ public class LevelChunk extends ChunkAccess { } } - server.getPluginManager().callEvent(new org.bukkit.event.world.ChunkPopulateEvent(this.bukkitChunk)); + server.getPluginManager().callEvent(new org.bukkit.event.world.ChunkPopulateEvent(bukkitChunk)); - } // Paper + //} // Paper // Purpur } } } -@@ -1319,10 +1319,10 @@ public class LevelChunk extends ChunkAccess { +@@ -1315,10 +1315,10 @@ public class LevelChunk extends ChunkAccess { if (LevelChunk.this.isTicking(blockposition)) { try { @@ -19611,7 +19591,7 @@ index e7e2b0fc88c9320449bcd0e0929269c2508886e4..b367184f415b6e20c2fc02a1e8853003 BlockState iblockdata = LevelChunk.this.getBlockState(blockposition); if (this.blockEntity.getType().isValid(iblockdata)) { -@@ -1333,7 +1333,7 @@ public class LevelChunk extends ChunkAccess { +@@ -1329,7 +1329,7 @@ public class LevelChunk extends ChunkAccess { LevelChunk.LOGGER.warn("Block entity {} @ {} state {} invalid for ticking:", new Object[]{LogUtils.defer(this::getType), LogUtils.defer(this::getPos), iblockdata}); } @@ -19620,7 +19600,7 @@ index e7e2b0fc88c9320449bcd0e0929269c2508886e4..b367184f415b6e20c2fc02a1e8853003 } catch (Throwable throwable) { if (throwable instanceof ThreadDeath) throw throwable; // Paper // Paper start - Prevent tile entity and entity crashes -@@ -1344,7 +1344,7 @@ public class LevelChunk extends ChunkAccess { +@@ -1340,7 +1340,7 @@ public class LevelChunk extends ChunkAccess { // Paper end // Spigot start } finally { @@ -20109,7 +20089,7 @@ index 714afc98b5150907b45a00060be4e41582333204..312a6d90c0a09570aef24c205dc2ff27 + // Purpur end - OfflinePlayer API } diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -index 7672fe8e6d08370327bb7ad5fa5ac3292c49e3c4..5ace171b786e5b5a9a33b51e9b93e6d71159c29b 100644 +index 58eaa1142bb0568bef439bba76903309914d3ae1..b4d174e3603a45f768add973796d603f4ed8f976 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java @@ -256,7 +256,7 @@ import javax.annotation.Nullable; // Paper @@ -20267,10 +20247,10 @@ index 7672fe8e6d08370327bb7ad5fa5ac3292c49e3c4..5ace171b786e5b5a9a33b51e9b93e6d7 + // Purpur end } diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java -index 5e9055fdf411029ea2fed91acd6b981f79156418..c6a3b59c65466f9f2b16cefe0059a6e5dd84044c 100644 +index 86ffc869b57410fd4993c0fd0ae000da2e2c070c..b5415f0c65db728f4a935b87b54fa14b68d31bc4 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java -@@ -2253,6 +2253,48 @@ public class CraftWorld extends CraftRegionAccessor implements World { +@@ -2263,6 +2263,48 @@ public class CraftWorld extends CraftRegionAccessor implements World { return (this.getHandle().dragonFight() == null) ? null : new CraftDragonBattle(this.getHandle().dragonFight()); } @@ -20320,7 +20300,7 @@ index 5e9055fdf411029ea2fed91acd6b981f79156418..c6a3b59c65466f9f2b16cefe0059a6e5 public PersistentDataContainer getPersistentDataContainer() { return this.persistentDataContainer; diff --git a/src/main/java/org/bukkit/craftbukkit/Main.java b/src/main/java/org/bukkit/craftbukkit/Main.java -index 4966a1e3dd35357a8ea6a7d2944c84c9c3e9058e..ab05f4151e6ec7404a85ddb3a141ed39d9ed86d7 100644 +index 755c223ab2a046285eb9916b6195093714f4c5ba..d2e20a03bf031011b64d0ae15c09ab7105e0cffa 100644 --- a/src/main/java/org/bukkit/craftbukkit/Main.java +++ b/src/main/java/org/bukkit/craftbukkit/Main.java @@ -173,6 +173,20 @@ public class Main { @@ -20579,7 +20559,7 @@ index a925b5c490e7129b27370aa57b5fad1cf05530c6..ea15690da167ec5e653da6f5afb55b33 + // Purpur end } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java -index aec588b41f19b2147a4e7267bafa417fbcf7abc0..cf7ba8724ab68f6955b5ebfa1ba46c4397da32b3 100644 +index d43859f8aa7beed82dd3a146bb1086982cd0cda7..7ef5980f7321662aa7034a74c2f6926846425db9 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java @@ -444,7 +444,7 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity { @@ -20591,16 +20571,16 @@ index aec588b41f19b2147a4e7267bafa417fbcf7abc0..cf7ba8724ab68f6955b5ebfa1ba46c43 } // Paper end -@@ -455,7 +455,7 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity { - +@@ -456,7 +456,7 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity { @Override public boolean addPotionEffect(PotionEffect effect, boolean force) { + org.spigotmc.AsyncCatcher.catchOp("effect add"); // Paper - this.getHandle().addEffect(new MobEffectInstance(MobEffect.byId(effect.getType().getId()), effect.getDuration(), effect.getAmplifier(), effect.isAmbient(), effect.hasParticles(), effect.hasIcon()), EntityPotionEffectEvent.Cause.PLUGIN); // Paper - Don't ignore icon + this.getHandle().addEffect(new MobEffectInstance(MobEffect.byId(effect.getType().getId()), effect.getDuration(), effect.getAmplifier(), effect.isAmbient(), effect.hasParticles(), effect.hasIcon(), effect.getKey()), EntityPotionEffectEvent.Cause.PLUGIN); // Purpur - add key // Paper - Don't ignore icon return true; } -@@ -476,7 +476,7 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity { +@@ -477,7 +477,7 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity { @Override public PotionEffect getPotionEffect(PotionEffectType type) { MobEffectInstance handle = this.getHandle().getEffect(MobEffect.byId(type.getId())); @@ -20609,7 +20589,7 @@ index aec588b41f19b2147a4e7267bafa417fbcf7abc0..cf7ba8724ab68f6955b5ebfa1ba46c43 } @Override -@@ -488,7 +488,7 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity { +@@ -489,7 +489,7 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity { public Collection getActivePotionEffects() { List effects = new ArrayList(); for (MobEffectInstance handle : this.getHandle().activeEffects.values()) { @@ -20618,7 +20598,7 @@ index aec588b41f19b2147a4e7267bafa417fbcf7abc0..cf7ba8724ab68f6955b5ebfa1ba46c43 } return effects; } -@@ -883,7 +883,7 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity { +@@ -884,7 +884,7 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity { return EntityCategory.WATER; } @@ -20627,7 +20607,7 @@ index aec588b41f19b2147a4e7267bafa417fbcf7abc0..cf7ba8724ab68f6955b5ebfa1ba46c43 } @Override -@@ -1070,4 +1070,32 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity { +@@ -1071,4 +1071,32 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity { getHandle().knockback(strength, directionX, directionZ); }; // Paper end @@ -20682,10 +20662,10 @@ 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 589783e93785196eb9f7ff6890c03e84f3102d93..b7f1382d48a66f78c4492b0f8b90c16116a90220 100644 +index c8d8ab8e5d8d0a986ff023ce1e195667472d7798..1ddb96be5644a8af51c2e3677e31773a61033aca 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -@@ -528,10 +528,15 @@ public class CraftPlayer extends CraftHumanEntity implements Player { +@@ -529,10 +529,15 @@ public class CraftPlayer extends CraftHumanEntity implements Player { @Override public void setPlayerListName(String name) { @@ -20702,7 +20682,7 @@ index 589783e93785196eb9f7ff6890c03e84f3102d93..b7f1382d48a66f78c4492b0f8b90c161 for (ServerPlayer player : (List) server.getHandle().players) { if (player.getBukkitEntity().canSee(this)) { player.connection.send(new ClientboundPlayerInfoUpdatePacket(ClientboundPlayerInfoUpdatePacket.Action.UPDATE_DISPLAY_NAME, this.getHandle())); -@@ -1339,6 +1344,10 @@ public class CraftPlayer extends CraftHumanEntity implements Player { +@@ -1359,6 +1364,10 @@ public class CraftPlayer extends CraftHumanEntity implements Player { } if (entity.isVehicle() && !ignorePassengers) { // Paper - Teleport API @@ -20713,7 +20693,7 @@ index 589783e93785196eb9f7ff6890c03e84f3102d93..b7f1382d48a66f78c4492b0f8b90c161 return false; } -@@ -2369,6 +2378,28 @@ public class CraftPlayer extends CraftHumanEntity implements Player { +@@ -2396,6 +2405,28 @@ public class CraftPlayer extends CraftHumanEntity implements Player { return this.getHandle().getAbilities().walkingSpeed * 2f; } @@ -20742,7 +20722,7 @@ index 589783e93785196eb9f7ff6890c03e84f3102d93..b7f1382d48a66f78c4492b0f8b90c161 private void validateSpeed(float value) { if (value < 0) { if (value < -1f) { -@@ -3161,4 +3192,97 @@ public class CraftPlayer extends CraftHumanEntity implements Player { +@@ -3188,4 +3219,97 @@ public class CraftPlayer extends CraftHumanEntity implements Player { return this.spigot; } // Spigot end @@ -20922,10 +20902,10 @@ index e43fd3e59fd8c74828ae65965fade27f56beef65..b2f133c8baabba1cffa6e92ea0f85453 + // Purpur end } diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java -index cdb8ec04f4a19ec3dbedbd5b17a7d1f3afaa238e..16261aa799c34d7134f4c1489e2ab0a5db7992f0 100644 +index 819c9c020f4d5a1373f68850134960d24b8fc308..a60948f4085232082f205ad4f0f627a28342bd36 100644 --- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java +++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java -@@ -544,6 +544,15 @@ public class CraftEventFactory { +@@ -561,6 +561,15 @@ public class CraftEventFactory { // Paper end craftServer.getPluginManager().callEvent(event); @@ -20941,7 +20921,7 @@ index cdb8ec04f4a19ec3dbedbd5b17a7d1f3afaa238e..16261aa799c34d7134f4c1489e2ab0a5 return event; } -@@ -981,6 +990,7 @@ public class CraftEventFactory { +@@ -998,6 +1007,7 @@ public class CraftEventFactory { damageCause = DamageCause.ENTITY_EXPLOSION; } event = new EntityDamageByEntityEvent(damager.getBukkitEntity(), entity.getBukkitEntity(), damageCause, modifiers, modifierFunctions, source.isCritical()); // Paper - add critical damage API @@ -20949,7 +20929,7 @@ index cdb8ec04f4a19ec3dbedbd5b17a7d1f3afaa238e..16261aa799c34d7134f4c1489e2ab0a5 } event.setCancelled(cancelled); -@@ -1090,6 +1100,7 @@ public class CraftEventFactory { +@@ -1107,6 +1117,7 @@ public class CraftEventFactory { } else { entity.lastDamageCancelled = true; // SPIGOT-5339, SPIGOT-6252, SPIGOT-6777: Keep track if the event was canceled } @@ -20957,7 +20937,7 @@ index cdb8ec04f4a19ec3dbedbd5b17a7d1f3afaa238e..16261aa799c34d7134f4c1489e2ab0a5 return event; } -@@ -1149,6 +1160,7 @@ public class CraftEventFactory { +@@ -1166,6 +1177,7 @@ public class CraftEventFactory { EntityDamageEvent event; if (damager != null) { event = new EntityDamageByEntityEvent(damager.getBukkitEntity(), damagee.getBukkitEntity(), cause, modifiers, modifierFunctions, critical); // Paper - add critical damage API @@ -21922,7 +21902,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..d3f2002759ac4788feca1e62c90c2e64596eb2f2 +index 0000000000000000000000000000000000000000..9159e790533f06582a521f11103e6cbcbc72978b --- /dev/null +++ b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java @@ -0,0 +1,3189 @@ @@ -22374,7 +22354,7 @@ index 0000000000000000000000000000000000000000..d3f2002759ac4788feca1e62c90c2e64 + set("gameplay-mechanics.player.idle-timeout.mods-target", null); + set("gameplay-mechanics.player.idle-timeout.mobs-target", oldVal); + } -+ idleTimeoutKick = getBoolean("gameplay-mechanics.player.idle-timeout.kick-if-idle", idleTimeoutKick); ++ idleTimeoutKick = System.getenv("PURPUR_FORCE_IDLE_KICK") == null ? getBoolean("gameplay-mechanics.player.idle-timeout.kick-if-idle", idleTimeoutKick) : Boolean.parseBoolean(System.getenv("PURPUR_FORCE_IDLE_KICK")); + idleTimeoutTickNearbyEntities = getBoolean("gameplay-mechanics.player.idle-timeout.tick-nearby-entities", idleTimeoutTickNearbyEntities); + idleTimeoutCountAsSleeping = getBoolean("gameplay-mechanics.player.idle-timeout.count-as-sleeping", idleTimeoutCountAsSleeping); + idleTimeoutUpdateTabList = getBoolean("gameplay-mechanics.player.idle-timeout.update-tab-list", idleTimeoutUpdateTabList); @@ -27203,18 +27183,18 @@ index 07050c78a2eb6ce0c699101b38961b111d631a41..ee64ddb0da23ea1e54d0295324aca5b4 if ( entity instanceof FireworkRocketEntity ) { return true; diff --git a/src/main/java/org/spigotmc/TicksPerSecondCommand.java b/src/main/java/org/spigotmc/TicksPerSecondCommand.java -index b1a72aa3634405f3fce64c66677a75d8f77cb6f6..df158d5339000cbc3206e4e1e0603acb1d39c528 100644 +index bf970bf3356a914459c2d6db93537ce2d32c7e18..08221c7256f41ca511a4a61ffb2b979325aebee9 100644 --- a/src/main/java/org/spigotmc/TicksPerSecondCommand.java +++ b/src/main/java/org/spigotmc/TicksPerSecondCommand.java -@@ -37,7 +37,7 @@ public class TicksPerSecondCommand extends Command - for ( int i = 0; i < tps.length; i++) { - tpsAvg[i] = TicksPerSecondCommand.format( tps[i] ); +@@ -39,7 +39,7 @@ public class TicksPerSecondCommand extends Command } -- sender.sendMessage(net.kyori.adventure.text.Component.text("TPS from last 1m, 5m, 15m: " + org.apache.commons.lang.StringUtils.join(tpsAvg, ", "), net.kyori.adventure.text.format.NamedTextColor.GOLD)); -+ sender.sendMessage(net.kyori.adventure.text.Component.text("TPS from last 5s, 1m, 5m, 15m: " + org.apache.commons.lang.StringUtils.join(tpsAvg, ", "), net.kyori.adventure.text.format.NamedTextColor.GOLD)); + + net.kyori.adventure.text.TextComponent.Builder builder = net.kyori.adventure.text.Component.text(); +- builder.append(net.kyori.adventure.text.Component.text("TPS from last 1m, 5m, 15m: ", net.kyori.adventure.text.format.NamedTextColor.GOLD)); ++ builder.append(net.kyori.adventure.text.Component.text("TPS from last 5s, 1m, 5m, 15m: ", net.kyori.adventure.text.format.NamedTextColor.GOLD)); + builder.append(net.kyori.adventure.text.Component.join(net.kyori.adventure.text.JoinConfiguration.commas(true), tpsAvg)); + sender.sendMessage(builder.asComponent()); if (args.length > 0 && args[0].equals("mem") && sender.hasPermission("bukkit.command.tpsmemory")) { - sender.sendMessage(net.kyori.adventure.text.Component.text() - .append(net.kyori.adventure.text.Component.text("Current Memory Usage: ", net.kyori.adventure.text.format.NamedTextColor.GOLD)) diff --git a/src/main/java/org/spigotmc/WatchdogThread.java b/src/main/java/org/spigotmc/WatchdogThread.java index e9fa7faaa4451e36b3908cbcbbe0baf213abde96..a810bfd3b8d6bd4d8f2ef8797e4281ae4fe8a67f 100644 --- a/src/main/java/org/spigotmc/WatchdogThread.java diff --git a/patches/server/0003-Rebrand.patch b/patches/server/0003-Rebrand.patch index 0bb56d3..a062be7 100644 --- a/patches/server/0003-Rebrand.patch +++ b/patches/server/0003-Rebrand.patch @@ -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 46b9aed8ab46bd4bfdcf44a392ffc34e26da0f5f..62ccafc3df9e2d25dbe7e2ad9322f306f8df8061 100644 +index beb05039926e1fb7a656dfcd0c503f82db67fc46..615c456de68a20d0e95b30e124a2bdf46039408f 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java @@ -930,7 +930,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop, 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 int mobSpawner = Boolean.getBoolean("Plazma.disableConfigOptimization") ? 1 : 2; // Plazma - Optimize Default Configurations -+ // Plazma start - Optimize Default Configurations -+ public Table, String, Integer> sensor = Util.make(HashBasedTable.create(), table -> { -+ if (!Boolean.getBoolean("Plazma.disableConfigOptimization")) { -+ table.put(EntityType.VILLAGER, "secondarypoisensor", 80); -+ table.put(EntityType.VILLAGER, "nearestbedsensor", 80); -+ table.put(EntityType.VILLAGER, "villagerbabiessensor", 40); -+ table.put(EntityType.VILLAGER, "playersensor", 40); -+ table.put(EntityType.VILLAGER, "nearestlivingentitysensor", 40); -+ } else { -+ table.put(EntityType.VILLAGER, "secondarypoisensor", 40); -+ } -+ }); -+ public Table, String, Integer> behavior = Util.make(HashBasedTable.create(), table -> { -+ if (!Boolean.getBoolean("Plazma.disableConfigOptimization")) { -+ table.put(EntityType.VILLAGER, "acquirepoi", 120); -+ table.put(EntityType.VILLAGER, "validatenearbypoi", 60); -+ } else { -+ table.put(EntityType.VILLAGER, "validatenearbypoi", -1); -+ } -+ }); -+ // Plazma end + 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)); } - - @Setting(FeatureSeedsGeneration.FEATURE_SEEDS_KEY) -@@ -464,9 +505,9 @@ public class WorldConfiguration extends ConfigurationPart { +@@ -464,9 +486,9 @@ public class WorldConfiguration extends ConfigurationPart { public class Misc extends ConfigurationPart { public int lightQueueSize = 20; @@ -290,7 +261,7 @@ index 1ea3012995c738c67b31e997c138f824f9e69ba1..8ed00a650b712cbf4bc8796165a539d7 this.enableStatus = this.get("enable-status", true); this.hideOnlinePlayers = this.get("hide-online-players", false); diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -index 4ddbda401c1161aa0a6295d3fbc245f8085f1e1d..aa3fb2e582b6a2ba22647b2153a6459090620774 100644 +index a694d01b32bff939eb82d3c659158454af75225c..9760095f77b6425610f93abac467f92742eb2178 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java @@ -346,7 +346,7 @@ public final class CraftServer implements Server { @@ -328,7 +299,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 d3f2002759ac4788feca1e62c90c2e64596eb2f2..47f2c8f23e318b89324bfcb1342dadc325f53afc 100644 +index 9159e790533f06582a521f11103e6cbcbc72978b..ebe966834337740fa5f918bf66fc3be1c3f5c588 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 { diff --git a/patches/server/0011-Console-log-tweaks.patch b/patches/server/0011-Console-log-tweaks.patch index bcf70ca..2107538 100644 --- a/patches/server/0011-Console-log-tweaks.patch +++ b/patches/server/0011-Console-log-tweaks.patch @@ -73,10 +73,10 @@ index 429ccd583ecd136a63862e94b8eb36b371e28d0f..efcee39cd7154493de04ca903edbd32b if (!OldUsersConverter.serverReadyAfterUserconversion(this)) { return false; diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java -index b04e905534baf35e50d9d09921581e04edd19fc5..d30485648605c258c181e6b0edcbed586381ae91 100644 +index 33d4c1af86382cc3343d5db42283b27f69f52374..030166f46b2ce23976a679685ffccf8b5439ce48 100644 --- a/src/main/java/net/minecraft/server/players/PlayerList.java +++ b/src/main/java/net/minecraft/server/players/PlayerList.java -@@ -1430,7 +1430,7 @@ public abstract class PlayerList { +@@ -1431,7 +1431,7 @@ public abstract class PlayerList { } public void broadcastChatMessage(PlayerChatMessage message, Predicate shouldSendFiltered, @Nullable ServerPlayer sender, ChatType.Bound params, @Nullable Function unsignedFunction) { // Paper end diff --git a/patches/server/0014-Add-permission-to-bypass-reducedDebugInfo-gamerule.patch b/patches/server/0014-Add-permission-to-bypass-reducedDebugInfo-gamerule.patch index 9f74e7d..01189d4 100644 --- a/patches/server/0014-Add-permission-to-bypass-reducedDebugInfo-gamerule.patch +++ b/patches/server/0014-Add-permission-to-bypass-reducedDebugInfo-gamerule.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Add permission to bypass reducedDebugInfo gamerule diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java -index d30485648605c258c181e6b0edcbed586381ae91..9a8959ad267281264f368bf76972796a211e7ce9 100644 +index 030166f46b2ce23976a679685ffccf8b5439ce48..427a50198c80459fb4d2364a859ed978b1ec7871 100644 --- a/src/main/java/net/minecraft/server/players/PlayerList.java +++ b/src/main/java/net/minecraft/server/players/PlayerList.java -@@ -272,7 +272,7 @@ public abstract class PlayerList { +@@ -273,7 +273,7 @@ public abstract class PlayerList { ServerGamePacketListenerImpl playerconnection = new ServerGamePacketListenerImpl(this.server, connection, player); GameRules gamerules = worldserver1.getGameRules(); boolean flag = gamerules.getBoolean(GameRules.RULE_DO_IMMEDIATE_RESPAWN); @@ -17,7 +17,7 @@ index d30485648605c258c181e6b0edcbed586381ae91..9a8959ad267281264f368bf76972796a // Spigot - view distance playerconnection.send(new ClientboundLoginPacket(player.getId(), worlddata.isHardcore(), player.gameMode.getGameModeForPlayer(), player.gameMode.getPreviousGameModeForPlayer(), this.server.levelKeys(), this.synchronizedRegistries, worldserver1.dimensionTypeId(), worldserver1.dimension(), BiomeManager.obfuscateSeed(worldserver1.getSeed()), this.getMaxPlayers(), worldserver1.getChunkSource().chunkMap.playerChunkManager.getTargetSendDistance(), worldserver1.getChunkSource().chunkMap.playerChunkManager.getTargetTickViewDistance(), flag1, !flag, worldserver1.isDebug(), worldserver1.isFlat(), player.getLastDeathLocation())); // Paper - replace old player chunk management -@@ -1297,7 +1297,7 @@ public abstract class PlayerList { +@@ -1298,7 +1298,7 @@ public abstract class PlayerList { player.getEntityData().refresh(player); // CraftBukkkit - SPIGOT-7218: sync metadata player.connection.send(new ClientboundSetCarriedItemPacket(player.getInventory().selected)); // CraftBukkit start - from GameRules diff --git a/patches/server/0022-Add-configuration-to-disable-moved-to-quickly-check-.patch b/patches/server/0022-Add-configuration-to-disable-moved-to-quickly-check-.patch index 852a0f5..4d6e6a2 100644 --- a/patches/server/0022-Add-configuration-to-disable-moved-to-quickly-check-.patch +++ b/patches/server/0022-Add-configuration-to-disable-moved-to-quickly-check-.patch @@ -6,10 +6,10 @@ Subject: [PATCH] Add configuration to disable moved to quickly check for diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index 21211e2790cd667ec389353fb90fb700f33421cc..e05ddf449d29c669a9c366a9e5ad761d079ef5f3 100644 +index 177090697e42fcca84dbfdf04ca5118a2c5e7be2..32e91b8866dd2aa5e4d26ef6ca77dc3f1206781b 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -@@ -1542,7 +1542,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic +@@ -1543,7 +1543,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic if (!this.player.isChangingDimension() && (!this.player.getLevel().getGameRules().getBoolean(GameRules.RULE_DISABLE_ELYTRA_MOVEMENT_CHECK) || !this.player.isFallFlying())) { float f2 = this.player.isFallFlying() ? 300.0F : 100.0F; diff --git a/patches/server/0023-Apply-faster-random.patch b/patches/server/0023-Apply-faster-random.patch index 3e714ba..e5c8d50 100644 --- a/patches/server/0023-Apply-faster-random.patch +++ b/patches/server/0023-Apply-faster-random.patch @@ -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 abf904a1d0dc7a5943cdba540c2b76eb0577954d..62507bb72288a01f15068aaaee5ae40f0655112c 100644 +index cc6968a064b30f7250d18c20efb2bb8602bb0cdd..3c80e14392ee7a6bf5040d7cb81b7d894e162eff 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java @@ -694,7 +694,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop packet) { @@ -96,10 +96,10 @@ index e05ddf449d29c669a9c366a9e5ad761d079ef5f3..bf7840fe8bd1548ae0dcd5d542f2ba57 if (packet == null || this.processedDisconnect) { // Spigot return; diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java -index 9a8959ad267281264f368bf76972796a211e7ce9..43a9fa8dbf55a4fdc75f8c2283e6188b283aa10b 100644 +index 427a50198c80459fb4d2364a859ed978b1ec7871..6d3e66f91f6ba47a2cde29e68f6961fdf0bde4de 100644 --- a/src/main/java/net/minecraft/server/players/PlayerList.java +++ b/src/main/java/net/minecraft/server/players/PlayerList.java -@@ -1461,7 +1461,7 @@ public abstract class PlayerList { +@@ -1462,7 +1462,7 @@ public abstract class PlayerList { } public boolean verifyChatTrusted(PlayerChatMessage message) { // Paper - private -> public diff --git a/settings.gradle.kts b/settings.gradle.kts index 79f8870..64a97fc 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -9,7 +9,7 @@ pluginManagement { rootProject.name = "plazma" for (name in listOf("Plazma-API", "Plazma-Server")) { - val projName = name.toLowerCase(Locale.ENGLISH) + val projName = name.lowercase(Locale.ENGLISH) include(projName) findProject(":$projName")!!.projectDir = file(name) }