Files
ParchmentMC/patches/server/0010-Fix-missing-CraftMetaSkull-serializedProfile.patch
Lexi Larkin cc60bfd0f8 Updated Upstream (Paper)
Upstream has released updates that appear to apply and compile correctly

Paper Changes:
PaperMC/Paper@0bf8790 Fix client lag spikes due to client light recalc
PaperMC/Paper@aabf676 Prevent unloading worlds with pending player logins
PaperMC/Paper@eff22eb Ensure players are removed from pendingLogin
PaperMC/Paper@046466f Re-arrange most chunk system patches to front (#8338)
PaperMC/Paper@e8c2c3b Fix World#refreshChunk not working for chunks in no-tick range
PaperMC/Paper@09904fd Re-add legacy getChunkAtAsynchronously to ChunkProviderServer
PaperMC/Paper@36a5f15 Allow preventing BlockDestroyEvent from dropping items (#8349)
PaperMC/Paper@e51401e Updated Upstream (Bukkit/CraftBukkit/Spigot) (#8347)
PaperMC/Paper@51183af Fix console completer/highlighter having invalid source stack (#8346)
PaperMC/Paper@ef0e5a6 Updated Upstream (Bukkit/CraftBukkit/Spigot)
PaperMC/Paper@178f035 Restore no-crash behaviour when read-only config file(s) (#8318)
PaperMC/Paper@267dd18 Stop large look changes from crashing the server (#8326)
PaperMC/Paper@36f0c1b Rebuild patches
PaperMC/Paper@751d092 Properly close section storage managed files (#8364)
PaperMC/Paper@f5f84ff Add custom destroyerIdentity parameter to the sendBlockBreak function (#5840)
PaperMC/Paper@05f6a5c Limit size of Authenticator Cache Thread Pool (#8360)
PaperMC/Paper@ef670eb EndDragonFight killed statuses should be false for newly created worlds (#8354)
PaperMC/Paper@b826065 fire EntityChangeBlockEvent in more places (#6371)
PaperMC/Paper@34777cd Missing eating regain reason (#8244)
PaperMC/Paper@dbda887 Missing some effect cause (#8307)
PaperMC/Paper@63cb747 Added byte array serialization/deserialization for PersistentDataContainers (#7505)
PaperMC/Paper@ea777c3 Add a consumer parameter to ProjectileSource#launchProjectile (#8374)
PaperMC/Paper@470c638 Configurable chat thread limit (#7878)
PaperMC/Paper@dbc2d60 Make WorldCreator#keepSpawnLoaded return the WorldCreator (Fixes #8321) (#8371)
PaperMC/Paper@f8742e2 Also load resources from LibraryLoader (#8335)
PaperMC/Paper@f7e6809 Fix Pathfinding After World Has Changed (#8068)
PaperMC/Paper@ad3dffe Respect preventMovingIntoUnloadedChunks for optimized collision checking (#8259)
PaperMC/Paper@8db45c4 Copper clear on lightning strike calls EntityChangeBlockEvent (#8126)
PaperMC/Paper@9e614e6 Fix ground pathfinding (#7683)
PaperMC/Paper@339e85d Updated Upstream (CraftBukkit) (#8376)
PaperMC/Paper@980c1d1 Updated Upstream (Bukkit/CraftBukkit) (#8378)
PaperMC/Paper@8681503 Call EntityChangeBlockEvent for frogs egg (#8136)
PaperMC/Paper@ec0c550 Call BlockPhysicsEvent more often (#8264)
PaperMC/Paper@f528f53 Correct javadocs on PlayerArmorStandManipulateEvent (#7719)
PaperMC/Paper@3996e6e Updated Upstream (Bukkit/CraftBukkit/Spigot)
PaperMC/Paper@d332623 Avoid potential place where the world map could be modified after its iterator is created (#8315)
PaperMC/Paper@6736f39 Fix mangled patch
PaperMC/Paper@4d52f1d Add method isTickingWorlds to Bukkit (#8316)
PaperMC/Paper@62680d5 Avoid item meta usage for itemstack enchantment getter (#8373)
PaperMC/Paper@b4c025b Fix player desync on dimension change (#8253)
PaperMC/Paper@6d63005 Fix setEggCount method from TurtleLayEggEvent (#8385)
PaperMC/Paper@abe53a7 Fix typos in isTickingWorlds API javadocs (#8382)
PaperMC/Paper@01a1387 Rewrite chunk system (#8177)
PaperMC/Paper@b58c0cf Update snekyaml
2022-09-26 19:36:07 -04:00

41 lines
2.2 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: lexikiq <noellekiq@gmail.com>
Date: Mon, 21 Jun 2021 20:47:24 -0400
Subject: [PATCH] Fix missing CraftMetaSkull serializedProfile
Plugins (ab)using NMS may change the "profile" field using reflections instead of the "setProfile" method, especially if they are targeted towards old Minecraft versions. This fixes the potential discrepancies and NPEs.
diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaSkull.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaSkull.java
index 92b56f16b4d8107ccf206be6b81a98dc58986c10..0882d7271c51d79c4d089ec643d633bb0a81ef07 100644
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaSkull.java
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaSkull.java
@@ -96,6 +96,11 @@ class CraftMetaSkull extends CraftMetaItem implements SkullMeta {
private void setProfile(GameProfile profile) {
this.profile = profile;
+ // Parchment start -- fix NPEs from plugins abusing NMS
+ refreshSerializedProfile();
+ }
+ private void refreshSerializedProfile() {
+ // Parchment end
this.serializedProfile = (profile == null) ? null : NbtUtils.writeGameProfile(new CompoundTag(), profile);
}
@@ -104,6 +109,7 @@ class CraftMetaSkull extends CraftMetaItem implements SkullMeta {
super.applyToItem(tag);
if (this.profile != null) {
+ refreshSerializedProfile(); // Parchment -- fix NPEs from plugins abusing NMS
// SPIGOT-6558: Set initial textures
tag.put(SKULL_OWNER.NBT, serializedProfile);
// Fill in textures
@@ -243,6 +249,8 @@ class CraftMetaSkull extends CraftMetaItem implements SkullMeta {
if (meta instanceof CraftMetaSkull) {
CraftMetaSkull that = (CraftMetaSkull) meta;
+ refreshSerializedProfile(); // Parchment -- fix NPEs from plugins abusing NMS
+ that.refreshSerializedProfile(); // Parchment -- fix NPEs from plugins abusing NMS
// SPIGOT-5403: equals does not check properties
return (this.profile != null ? that.profile != null && this.serializedProfile.equals(that.serializedProfile) : that.profile == null);
}