Paper/patches/server/0865-Add-debug-for-invalid-GameProfiles-on-skull-blocks-i.patch
Nassim Jahnke ef0e5a642d
Updated Upstream (Bukkit/CraftBukkit/Spigot)
Upstream has released updates that appear to apply and compile correctly.
This update has not been tested by PaperMC and as with ANY update, please do your own testing

Bukkit Changes:
9ae3f10f SPIGOT-3842: Add Player#fireworkBoost() and expand Firework API
48c0c547 PR-786: Add methods to get sounds from entities

CraftBukkit Changes:
5cc9c022a SPIGOT-7152: Handle hand item changing during air interact event
4ffa1acf6 SPIGOT-7154: Players get kicked when interacting with a conversation
4daa21123 SPIGOT-3842: Add Player#fireworkBoost() and expand Firework API
e5d6a9bbf PR-1100: Add methods to get sounds from entities
b7e9f1c8b SPIGOT-7146: Reduce use of Material switch in ItemMeta

Spigot Changes:
4c157bb4 Rebuild patches
2022-09-12 13:31:45 +02:00

64 lines
3.7 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Jason Penilla <11360596+jpenilla@users.noreply.github.com>
Date: Sat, 26 Feb 2022 13:27:31 -0700
Subject: [PATCH] Add debug for invalid GameProfiles on skull blocks/items
Improves the error message for placed in world skull blocks by default,
also adds 'Paper.debugInvalidSkullProfiles' system property which can be
set to 'true' for extra debug info (trace of updateGameprofile caller).
diff --git a/src/main/java/net/minecraft/world/level/block/entity/SkullBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/SkullBlockEntity.java
index c5d5d90d10b30f30d1262367b3d75df43fbdb231..e017020b7630f54c506d93ab0504c6f3299fc80b 100644
--- a/src/main/java/net/minecraft/world/level/block/entity/SkullBlockEntity.java
+++ b/src/main/java/net/minecraft/world/level/block/entity/SkullBlockEntity.java
@@ -114,13 +114,28 @@ public class SkullBlockEntity extends BlockEntity {
updateGameprofile(this.owner, (owner) -> {
this.owner = owner;
this.setChanged();
+ // Paper start
+ }, () -> {
+ final @Nullable Level level = this.getLevel();
+ return "SkullBlockEntity at " + this.getBlockPos() + (level == null ? "" : (" in level: " + level.dimension().location()));
+ // Paper end
});
}
public static void updateGameprofile(@Nullable GameProfile owner, Consumer<GameProfile> callback) {
+ // Paper start
+ updateGameprofile(owner, callback, null);
+ }
+
+ private static final boolean DEBUG_INVALID_SKULL_PROFILES = Boolean.getBoolean("Paper.debugInvalidSkullProfiles");
+
+ public static void updateGameprofile(@Nullable GameProfile owner, Consumer<GameProfile> callback, final @Nullable java.util.function.Supplier<String> debugInfo) {
if (owner != null && !StringUtil.isNullOrEmpty(owner.getName()) && (!owner.isComplete() || !owner.getProperties().containsKey("textures")) && profileCache != null && sessionService != null) {
+ final @Nullable Throwable trace = DEBUG_INVALID_SKULL_PROFILES ? new Throwable("updateGameprofile caller debug trace") : null;
profileCache.getAsync(owner.getName(), (profile) -> {
Util.PROFILE_EXECUTOR.execute(() -> { // Paper - not a good idea to use BLOCKING OPERATIONS on the worldgen executor
+ try {
+ // Paper end
Util.ifElse(profile, (profilex) -> {
Property property = Iterables.getFirst(profilex.getProperties().get("textures"), (Property)null);
if (property == null) {
@@ -137,6 +152,20 @@ public class SkullBlockEntity extends BlockEntity {
callback.accept(owner);
});
});
+ // Paper start
+ } catch (final Exception ex) {
+ if (trace != null) {
+ ex.addSuppressed(trace);
+ }
+ final String ownerMessage = "Original profile: '" + owner + "'";
+ final String debugMessage = " Run with -DPaper.debugInvalidSkullProfiles=true for further debug information.";
+ final String message = ownerMessage + (trace == null ? debugMessage : "");
+ if (debugInfo == null) {
+ throw new RuntimeException(message, ex);
+ }
+ throw new RuntimeException(debugInfo.get() + " " + message, ex);
+ }
+ // Paper end
});
});
} else {