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.features.tpslimit.TPSUtils;
|
||||||
import de.steamwar.bausystem.region.Region;
|
import de.steamwar.bausystem.region.Region;
|
||||||
import de.steamwar.linkage.Linked;
|
import de.steamwar.linkage.Linked;
|
||||||
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.block.Block;
|
import org.bukkit.block.Block;
|
||||||
import org.bukkit.entity.TNTPrimed;
|
import org.bukkit.entity.TNTPrimed;
|
||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
@ -32,6 +33,8 @@ import org.bukkit.event.entity.EntityExplodeEvent;
|
|||||||
import org.bukkit.event.entity.EntitySpawnEvent;
|
import org.bukkit.event.entity.EntitySpawnEvent;
|
||||||
|
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
import java.util.logging.Level;
|
||||||
|
import java.util.logging.Logger;
|
||||||
|
|
||||||
@Linked
|
@Linked
|
||||||
public class TraceRecorder implements Listener {
|
public class TraceRecorder implements Listener {
|
||||||
@ -158,14 +161,23 @@ public class TraceRecorder implements Listener {
|
|||||||
List<TNTPoint> history = historyMap.getOrDefault(tntPrimed, new ArrayList<>());
|
List<TNTPoint> history = historyMap.getOrDefault(tntPrimed, new ArrayList<>());
|
||||||
|
|
||||||
// Failsave for tnt entering unloaded chunks
|
// 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;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
int tntID;
|
int tntID;
|
||||||
|
|
||||||
if (history.size() == 0) {
|
if (history.size() == 0) {
|
||||||
|
try {
|
||||||
historyMap.put(tntPrimed, history);
|
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();
|
tntID = wrappedTrace.getNextOpenRecordIdAndIncrement();
|
||||||
} else {
|
} else {
|
||||||
tntID = history.get(0).getTntId();
|
tntID = history.get(0).getTntId();
|
||||||
|
In neuem Issue referenzieren
Einen Benutzer sperren