Add exception reporting event

This commit is contained in:
Joseph Hirschfeld
2016-03-03 03:15:41 -06:00
parent 1ae9ee1205
commit 68979dd492
8 changed files with 130 additions and 35 deletions

View File

@@ -469,7 +469,7 @@
} else if (flag && this.shouldTickBlocksAt(tickingblockentity.getPos())) {
tickingblockentity.tick();
}
@@ -461,17 +719,18 @@
@@ -461,17 +719,19 @@
this.tickingBlockEntities = false;
gameprofilerfiller.pop();
@@ -488,12 +488,13 @@
+ // Paper start - Prevent block entity and entity crashes
+ final String msg = String.format("Entity threw exception at %s:%s,%s,%s", entity.level().getWorld().getName(), entity.getX(), entity.getY(), entity.getZ());
+ MinecraftServer.LOGGER.error(msg, throwable);
+ getCraftServer().getPluginManager().callEvent(new com.destroystokyo.paper.event.server.ServerExceptionEvent(new com.destroystokyo.paper.exception.ServerInternalException(msg, throwable))); // Paper - ServerExceptionEvent
+ entity.discard(org.bukkit.event.entity.EntityRemoveEvent.Cause.DISCARD);
+ // Paper end - Prevent block entity and entity crashes
}
}
@@ -510,13 +769,29 @@
@@ -510,13 +770,29 @@
@Nullable
@Override
public BlockEntity getBlockEntity(BlockPos pos) {
@@ -524,7 +525,7 @@
this.getChunkAt(blockposition).addAndRegisterBlockEntity(blockEntity);
}
}
@@ -643,7 +918,7 @@
@@ -643,7 +919,7 @@
for (int k = 0; k < j; ++k) {
EnderDragonPart entitycomplexpart = aentitycomplexpart[k];
@@ -533,7 +534,7 @@
if (t0 != null && predicate.test(t0)) {
result.add(t0);
@@ -912,7 +1187,7 @@
@@ -912,7 +1188,7 @@
public static enum ExplosionInteraction implements StringRepresentable {