Added debug message for trace history map nullpointer and potential fix #257
@ -23,6 +23,7 @@ import de.steamwar.bausystem.BauSystem;
|
||||
import de.steamwar.bausystem.features.tpslimit.TPSUtils;
|
||||
import de.steamwar.bausystem.region.Region;
|
||||
import de.steamwar.linkage.Linked;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.entity.TNTPrimed;
|
||||
import org.bukkit.event.EventHandler;
|
||||
@ -32,6 +33,8 @@ import org.bukkit.event.entity.EntityExplodeEvent;
|
||||
import org.bukkit.event.entity.EntitySpawnEvent;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
@Linked
|
||||
public class TraceRecorder implements Listener {
|
||||
@ -158,14 +161,23 @@ public class TraceRecorder implements Listener {
|
||||
List<TNTPoint> history = historyMap.getOrDefault(tntPrimed, new ArrayList<>());
|
||||
|
||||
// Failsave for tnt entering unloaded chunks
|
||||
if (tntPrimed.isDead() || history.size() > 0 && history.get(history.size() - 1).getFuse() == tntPrimed.getFuseTicks()) {
|
||||
if (tntPrimed == null || tntPrimed.isDead() || history.size() > 0 && history.get(history.size() - 1).getFuse() == tntPrimed.getFuseTicks()) {
|
||||
return null;
|
||||
}
|
||||
|
||||
int tntID;
|
||||
|
||||
if (history.size() == 0) {
|
||||
try {
|
||||
historyMap.put(tntPrimed, history);
|
||||
}
|
||||
catch (NullPointerException e) {
|
||||
Logger logger = Bukkit.getLogger();
|
||||
logger.log(Level.WARNING, "Nullpointer thrown by historyMap");
|
||||
logger.log(Level.WARNING, "TNT History: " + history);
|
||||
logger.log(Level.WARNING, "History Map" + history);
|
||||
throw e;
|
||||
}
|
||||
tntID = wrappedTrace.getNextOpenRecordIdAndIncrement();
|
||||
} else {
|
||||
tntID = history.get(0).getTntId();
|
||||
|
In neuem Issue referenzieren
Einen Benutzer sperren