Make timings more tolerant of corrupt chunks

Fixes GH-744
This commit is contained in:
Zach Brown 2017-07-02 20:54:29 -05:00
parent a92bce595d
commit b1d34f6180
No known key found for this signature in database
GPG Key ID: CC9DA35FC5450B76
1 changed files with 15 additions and 5 deletions

View File

@ -1,4 +1,4 @@
From c511dea5f0acfa883e9b0d0c2acd313e3366d01f Mon Sep 17 00:00:00 2001
From 9abf1bfaba8bf6b87b4d2c652a356b061764391c Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Mon, 29 Feb 2016 18:48:17 -0600
Subject: [PATCH] Timings v2
@ -671,10 +671,10 @@ index 00000000..916b6f9d
+}
diff --git a/src/main/java/co/aikar/timings/TimingHistory.java b/src/main/java/co/aikar/timings/TimingHistory.java
new file mode 100644
index 00000000..389875b3
index 00000000..c2c2fb83
--- /dev/null
+++ b/src/main/java/co/aikar/timings/TimingHistory.java
@@ -0,0 +1,342 @@
@@ -0,0 +1,352 @@
+/*
+ * This file is licensed under the MIT License (MIT).
+ *
@ -787,10 +787,20 @@ index 00000000..389875b3
+ RegionData data = regions.get(new RegionId(chunk.getX(), chunk.getZ()));
+
+ for (Entity entity : chunk.getEntities()) {
+ if (entity == null) {
+ Bukkit.getLogger().warning("Null entity detected in chunk at position x: " + chunk.getX() + ", z: " + chunk.getZ());
+ continue;
+ }
+
+ data.entityCounts.get(entity.getType()).increment();
+ }
+
+ for (BlockState tileEntity : chunk.getTileEntities()) {
+ if (tileEntity == null) {
+ Bukkit.getLogger().warning("Null tileentity detected in chunk at position x: " + chunk.getX() + ", z: " + chunk.getZ());
+ continue;
+ }
+
+ data.tileEntityCounts.get(tileEntity.getBlock().getType()).increment();
+ }
+ }
@ -3185,7 +3195,7 @@ index 00000000..5527e7c8
+
+}
diff --git a/src/main/java/org/bukkit/command/SimpleCommandMap.java b/src/main/java/org/bukkit/command/SimpleCommandMap.java
index cdf838eb..39b275cb 100644
index 71709126..b886cd82 100644
--- a/src/main/java/org/bukkit/command/SimpleCommandMap.java
+++ b/src/main/java/org/bukkit/command/SimpleCommandMap.java
@@ -31,7 +31,7 @@ public class SimpleCommandMap implements CommandMap {
@ -3856,5 +3866,5 @@ index 8d982974..7e89b97b 100644
- }
}
--
2.13.0.windows.1
2.13.2.windows.1