Skip to content

Commit 5d62ec0

Browse files
authored
Prevent spawn location getters from allowing making the location invalid (#13831)
1 parent 17524d0 commit 5d62ec0

2 files changed

Lines changed: 2 additions & 2 deletions

File tree

paper-api/src/main/java/io/papermc/paper/event/player/AsyncPlayerSpawnLocationEvent.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ public PlayerConfigurationConnection getConnection() {
5353
* @return the spawn location
5454
*/
5555
public Location getSpawnLocation() {
56-
return this.spawnLocation;
56+
return this.spawnLocation.clone();
5757
}
5858

5959
/**

paper-server/patches/sources/net/minecraft/server/network/config/PrepareSpawnTask.java.patch

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@
125125
+ );
126126
+ ev.callEvent();
127127
+ spawnPosition = io.papermc.paper.util.MCUtil.toVec3(ev.getSpawnLocation());
128-
+ this.spawnLevel = ((org.bukkit.craftbukkit.CraftWorld) ev.getSpawnLocation().getWorld()).getHandle();
128+
+ if (ev.getSpawnLocation().getWorld() != null) this.spawnLevel = ((org.bukkit.craftbukkit.CraftWorld) ev.getSpawnLocation().getWorld()).getHandle();
129129
+ this.spawnPosition = CompletableFuture.completedFuture(spawnPosition);
130130
+ this.spawnAngle = new Vec2(ev.getSpawnLocation().getYaw(), ev.getSpawnLocation().getPitch());
131131
+ }

0 commit comments

Comments
 (0)