From 6856fcaf96978cfb671c366c1f123815b24c2691 Mon Sep 17 00:00:00 2001 From: Luck Date: Wed, 23 Oct 2024 08:40:02 +0100 Subject: [PATCH] Fix NPE on NeoForge when starting profiler (#465) --- .../spark/neoforge/NeoForgeServerCommandSender.java | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/spark-neoforge/src/main/java/me/lucko/spark/neoforge/NeoForgeServerCommandSender.java b/spark-neoforge/src/main/java/me/lucko/spark/neoforge/NeoForgeServerCommandSender.java index a2162eea..36ac1ca9 100644 --- a/spark-neoforge/src/main/java/me/lucko/spark/neoforge/NeoForgeServerCommandSender.java +++ b/spark-neoforge/src/main/java/me/lucko/spark/neoforge/NeoForgeServerCommandSender.java @@ -70,6 +70,14 @@ public boolean hasPermission(String permission) { @Override protected Object getObjectForComparison() { - return this.delegate.getEntity(); + UUID uniqueId = getUniqueId(); + if (uniqueId != null) { + return uniqueId; + } + Entity entity = this.delegate.getEntity(); + if (entity != null) { + return entity; + } + return getName(); } }