From fd17b8315f6bd1bf45f4b6b2769744a4be18a2b1 Mon Sep 17 00:00:00 2001 From: D4rkr34lm Date: Mon, 22 Apr 2024 19:58:34 +0200 Subject: [PATCH] Fix trace Rserver null error ? --- .../steamwar/bausystem/features/tracer/Trace.java | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/Trace.java b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/Trace.java index c46a1df3..f2f896c4 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/Trace.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/Trace.java @@ -188,7 +188,20 @@ public class Trace { * @param playerTraceShowData The showData for modifying the rendering */ protected void render(List records, Player player, PlayerTraceShowData playerTraceShowData) { - render(records, entityServerMap.get(player), playerTraceShowData); + REntityServer entityServer = entityServerMap.get(player); + if (entityServer == null) { + entityServer = new REntityServer(); + entityServer.addPlayer(player); + entityServer.setCallback((p, rEntity, entityAction) -> { + if (entityAction != REntityServer.EntityAction.INTERACT) return; + if (rEntity instanceof TraceEntity) { + ((TraceEntity) rEntity).printIntoChat(p); + } + }); + entityServerMap.put(player, entityServer); + } + + render(records, entityServer, playerTraceShowData); } /**