From 2e178b09c67f6886ffce0d837ad127eb88089f44 Mon Sep 17 00:00:00 2001 From: Parker Hawke Date: Tue, 18 Aug 2020 17:54:36 +1000 Subject: [PATCH] #730: Let World#setSpawnLocation() support an angle --- src/main/java/org/bukkit/craftbukkit/CraftWorld.java | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java index eb189b5d99..571108b535 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java @@ -310,14 +310,14 @@ public class CraftWorld implements World { public boolean setSpawnLocation(Location location) { Preconditions.checkArgument(location != null, "location"); - return equals(location.getWorld()) ? setSpawnLocation(location.getBlockX(), location.getBlockY(), location.getBlockZ()) : false; + return equals(location.getWorld()) ? setSpawnLocation(location.getBlockX(), location.getBlockY(), location.getBlockZ(), location.getYaw()) : false; } @Override - public boolean setSpawnLocation(int x, int y, int z) { + public boolean setSpawnLocation(int x, int y, int z, float angle) { try { Location previousLocation = getSpawnLocation(); - world.worldData.setSpawn(new BlockPosition(x, y, z), 0.0F); + world.worldData.setSpawn(new BlockPosition(x, y, z), angle); // Notify anyone who's listening. SpawnChangeEvent event = new SpawnChangeEvent(this, previousLocation); @@ -329,6 +329,11 @@ public class CraftWorld implements World { } } + @Override + public boolean setSpawnLocation(int x, int y, int z) { + return setSpawnLocation(x, y, z, 0.0F); + } + @Override public Chunk getChunkAt(int x, int z) { return this.world.getChunkProvider().getChunkAt(x, z, true).bukkitChunk;