mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-15 07:01:36 +08:00
Avoid ArithmeticException should server be stopped before worlds are loaded
Our changes for the spawn radius have the potential to throw an ArithmeticException should the server be stopped before we've loaded worlds, we check if the server is running earlier to check if we should even consider attempting to load chunks, which would cause us to, 1) not load chunks anyways, as we're disabled; 2) throw an ArithmeticException due to us expecting that we're going to be loading more than 0 chunks.
This commit is contained in:
parent
aad194a32e
commit
12b0bf7983
@ -1,4 +1,4 @@
|
||||
From 47ce849db0e23612ca6013dafefca6cfa5129b3d Mon Sep 17 00:00:00 2001
|
||||
From 988ae523c43ece4e6e69d0bbd13d0ceb3f72c013 Mon Sep 17 00:00:00 2001
|
||||
From: Aikar <aikar@aikar.co>
|
||||
Date: Sat, 13 Sep 2014 23:14:43 -0400
|
||||
Subject: [PATCH] Configurable Keep Spawn Loaded range per world
|
||||
@ -6,7 +6,7 @@ Subject: [PATCH] Configurable Keep Spawn Loaded range per world
|
||||
This lets you disable it for some worlds and lower it for others.
|
||||
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
||||
index eb09be512..6ac58e5ec 100644
|
||||
index eb09be5126..6ac58e5ec5 100644
|
||||
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
||||
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
||||
@@ -232,4 +232,10 @@ public class PaperWorldConfig {
|
||||
@ -21,7 +21,7 @@ index eb09be512..6ac58e5ec 100644
|
||||
+ }
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
index 96d31f874..7fb0a58f9 100644
|
||||
index 96d31f8749..071a1e30f7 100644
|
||||
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
@@ -485,13 +485,21 @@ public abstract class MinecraftServer implements IAsyncTaskHandler, IMojangStati
|
||||
@ -38,7 +38,7 @@ index 96d31f874..7fb0a58f9 100644
|
||||
arraylist.add(new ChunkCoordIntPair(blockposition.getX() + i >> 4, blockposition.getZ() + j >> 4));
|
||||
}
|
||||
+ } // Paper
|
||||
+ if (true) { // Paper
|
||||
+ if (this.isRunning()) { // Paper
|
||||
+ int expected = arraylist.size(); // Paper
|
||||
+
|
||||
|
||||
@ -63,7 +63,7 @@ index 96d31f874..7fb0a58f9 100644
|
||||
}
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
|
||||
index 6ec1ee26d..a4c8e62e2 100644
|
||||
index 6ec1ee26dc..a4c8e62e22 100644
|
||||
--- a/src/main/java/net/minecraft/server/World.java
|
||||
+++ b/src/main/java/net/minecraft/server/World.java
|
||||
@@ -2825,8 +2825,9 @@ public abstract class World implements GeneratorAccess, IIBlockAccess, AutoClose
|
||||
@ -78,7 +78,7 @@ index 6ec1ee26d..a4c8e62e2 100644
|
||||
|
||||
public void a(Packet<?> packet) {
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
index 62872675d..7cb795dd8 100644
|
||||
index 62872675d9..7cb795dd89 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
@@ -990,7 +990,7 @@ public final class CraftServer implements Server {
|
||||
@ -91,7 +91,7 @@ index 62872675d..7cb795dd8 100644
|
||||
for (int j = -short1; j <= short1; j += 16) {
|
||||
for (int k = -short1; k <= short1; k += 16) {
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
|
||||
index 0b2a9d09d..ff3558363 100644
|
||||
index 0b2a9d09df..ff3558363b 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
|
||||
@@ -1285,8 +1285,9 @@ public class CraftWorld implements World {
|
||||
|
Loading…
Reference in New Issue
Block a user