PaperMC/Spigot-Server-Patches/0319-Avoid-dimension-id-collisions.patch

26 lines
1.1 KiB
Diff
Raw Normal View History

2019-05-05 13:32:20 +02:00
From 9da36883e7b0f7773037d03e6d88a7bdd48077de Mon Sep 17 00:00:00 2001
From: Brokkonaut <hannos17@gmx.de>
Date: Tue, 25 Sep 2018 06:53:43 +0200
Subject: [PATCH] Avoid dimension id collisions
getDimensionId() returns the dimension id - 1. So without this patch
we would reuse an existing dimension id, if some other dimension was
unloaded before.
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
2019-05-05 10:33:44 +02:00
index cf657167d..15756014a 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
2019-05-05 10:33:44 +02:00
@@ -970,7 +970,7 @@ public final class CraftServer implements Server {
boolean used = false;
do {
for (WorldServer server : console.getWorlds()) {
- used = server.dimension.getDimensionID() == dimension;
+ used = server.dimension.getDimensionID() + 1 == dimension; // Paper - getDimensionID returns the dimension - 1, so we have to add 1
if (used) {
dimension++;
break;
--
2019-05-05 13:32:20 +02:00
2.21.0