CavePVP-Stuff/cSpigot-master/spigot-server-Patches/0050-Protect-from-TE-E-crashes.patch
2023-05-01 19:59:40 +01:00

69 lines
3.4 KiB
Diff

From 56c601934aaaf95a9307e431bc0216ec8a247958 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Wed, 3 Jul 2013 08:29:26 -0400
Subject: [PATCH] Protect from TE/E crashes
diff --git a/src/main/java/net/minecraft/server/TileEntity.java b/src/main/java/net/minecraft/server/TileEntity.java
index 27fedeb07..fd6f9ad5d 100644
--- a/src/main/java/net/minecraft/server/TileEntity.java
+++ b/src/main/java/net/minecraft/server/TileEntity.java
@@ -187,7 +187,10 @@ public class TileEntity {
public void a(CrashReportSystemDetails crashreportsystemdetails) {
crashreportsystemdetails.a("Name", (Callable) (new CrashReportTileEntityName(this)));
+ Block block = this.q(); // PaperSpigot
+ if (block != null) { // PaperSpigot
CrashReportSystemDetails.a(crashreportsystemdetails, this.x, this.y, this.z, this.q(), this.p());
+ } // PaperSpigot
crashreportsystemdetails.a("Actual block type", (Callable) (new CrashReportTileEntityType(this)));
crashreportsystemdetails.a("Actual block data value", (Callable) (new CrashReportTileEntityData(this)));
}
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
index ebb537577..e0f759608 100644
--- a/src/main/java/net/minecraft/server/World.java
+++ b/src/main/java/net/minecraft/server/World.java
@@ -1486,10 +1486,19 @@ public abstract class World implements IBlockAccess {
this.playerJoinedWorld(entity);
SpigotTimings.tickEntityTimer.stopTiming(); // Spigot
} catch (Throwable throwable1) {
+ // PaperSpigot start
+ SpigotTimings.tickEntityTimer.stopTiming(); // Spigot
+ System.err.println("Entity threw exception at " + entity.world.getWorld().getName()+":"+entity.locX +"," + entity.locY+","+entity.locZ);
+ throwable1.printStackTrace();
+ entity.dead = true;
+ continue;
+ /*
crashreport = CrashReport.a(throwable1, "Ticking entity");
crashreportsystemdetails = crashreport.a("Entity being ticked");
entity.a(crashreportsystemdetails);
throw new ReportedException(crashreport);
+ */
+ // PaperSpigot end
}
}
@@ -1542,11 +1551,19 @@ public abstract class World implements IBlockAccess {
tileentity.h();
tileentity.tickTimer.stopTiming(); // Spigot
} catch (Throwable throwable2) {
+ // PaperSpigot start
tileentity.tickTimer.stopTiming(); // Spigot
+ System.err.println("TileEntity threw exception at " + tileentity.world.getWorld().getName()+":"+tileentity.x +"," + tileentity.y+","+tileentity.z);
+ throwable2.printStackTrace();
+ iterator.remove();
+ continue;
+ /*
crashreport = CrashReport.a(throwable2, "Ticking block entity");
crashreportsystemdetails = crashreport.a("Block entity being ticked");
tileentity.a(crashreportsystemdetails);
throw new ReportedException(crashreport);
+ */
+ // PaperSpigot end
}
}
--
2.13.3