mirror of
https://github.com/PaperMC/Paper.git
synced 2024-11-05 02:10:30 +01:00
64840b3018
Fix NPE when setting a player's spectator target
26 lines
1.1 KiB
Diff
26 lines
1.1 KiB
Diff
From c47b3feb44e365c99fd60c6146e29b450566808c 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
|
|
index 8f6c44a3..9c7b86a5 100644
|
|
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
|
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
|
@@ -968,7 +968,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;
|
|
--
|
|
2.19.1
|
|
|