forked from LogBlock/LogBlock
Fix NPE:
[LogBlock] Could not parse BlockState for PLAYER_HEAD java.lang.NullPointerException: Cannot invoke "java.util.UUID.toString()" because the return value of "org.bukkit.profile.PlayerProfile.getUniqueId()" is null at de.diddiz.LogBlock.blockstate.BlockStateCodecSkull.getChangesAsComponent(BlockStateCodecSkull.java:77) ~[LogBlock.jar:?] at de.diddiz.LogBlock.blockstate.BlockStateCodecs.getChangesAsComponent(BlockStateCodecs.java:57) ~[LogBlock.jar:?] at de.diddiz.LogBlock.BlockChange.getTypeDetails(BlockChange.java:95) ~[LogBlock.jar:?] at de.diddiz.LogBlock.BlockChange.getTypeDetails(BlockChange.java:87) ~[LogBlock.jar:?] at de.diddiz.LogBlock.BlockChange.getLogMessage(BlockChange.java:135) ~[LogBlock.jar:?] at de.diddiz.LogBlock.CommandsHandler.showPage(CommandsHandler.java:446) ~[LogBlock.jar:?] at de.diddiz.LogBlock.CommandsHandler.showPage(CommandsHandler.java:428) ~[LogBlock.jar:?] at de.diddiz.LogBlock.CommandsHandler$CommandLookup.run(CommandsHandler.java:578) ~[LogBlock.jar:?] at org.bukkit.craftbukkit.v1_20_R3.scheduler.CraftTask.run(CraftTask.java:101) ~[paper-1.20.4.jar:git-Paper-"9e171ef"] at org.bukkit.craftbukkit.v1_20_R3.scheduler.CraftAsyncTask.run(CraftAsyncTask.java:57) ~[paper-1.20.4.jar:git-Paper-"9e171ef"] at com.destroystokyo.paper.ServerSchedulerReportingWrapper.run(ServerSchedulerReportingWrapper.java:22) ~[paper-1.20.4.jar:?] at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136) ~[?:?] at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635) ~[?:?] at java.lang.Thread.run(Thread.java:840) ~[?:?]
This commit is contained in:
@@ -73,7 +73,7 @@ public class BlockStateCodecSkull implements BlockStateCodec {
|
||||
PlayerProfile profile = (PlayerProfile) conf.get("profile");
|
||||
if (profile != null) {
|
||||
TextComponent tc = new TextComponent("[" + (profile.getName() != null ? profile.getName() : (profile.getUniqueId() != null ? profile.getUniqueId().toString() : "~unknown~")) + "]");
|
||||
if (profile.getName() != null) {
|
||||
if (profile.getName() != null && profile.getUniqueId() != null) {
|
||||
tc.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new Text("UUID: " + profile.getUniqueId().toString())));
|
||||
}
|
||||
return tc;
|
||||
|
Reference in New Issue
Block a user