2019-12-13 21:41:01 +01:00
From 70c826696730642c3602faf0056ab265ed2f90cc Mon Sep 17 00:00:00 2001
2018-09-25 16:53:52 +02:00
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-12-12 17:20:43 +01:00
index 1ca9a7724..e1c9a9e12 100644
2018-09-25 16:53:52 +02:00
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
2019-12-12 17:20:43 +01:00
@@ -977,7 +977,7 @@ public final class CraftServer implements Server {
2018-09-25 16:53:52 +02:00
boolean used = false;
do {
for (WorldServer server : console.getWorlds()) {
2019-05-14 04:20:58 +02:00
- used = server.getWorldProvider().getDimensionManager().getDimensionID() == dimension;
+ used = server.getWorldProvider().getDimensionManager().getDimensionID() + 1 == dimension; // Paper - getDimensionID returns the dimension - 1, so we have to add 1
2018-09-25 16:53:52 +02:00
if (used) {
dimension++;
break;
--
2019-12-13 21:41:01 +01:00
2.24.1
2018-09-25 16:53:52 +02:00