Fix SpawnChangeEvent not firing for all use-cases

This commit is contained in:
William Blake Galbreath
2020-08-22 23:36:21 +02:00
parent 17cde37876
commit b77fd7dd24
2 changed files with 27 additions and 15 deletions

View File

@@ -243,12 +243,14 @@ public class CraftWorld extends CraftRegionAccessor implements World {
@Override
public boolean setSpawnLocation(int x, int y, int z, float angle) {
try {
Location previousLocation = this.getSpawnLocation();
this.world.levelData.setSpawn(new BlockPos(x, y, z), angle);
// Location previousLocation = this.getSpawnLocation(); // Paper - Call SpawnChangeEvent; moved to nms.ServerLevel
this.world.setDefaultSpawnPos(new BlockPos(x, y, z), angle); // Paper - use ServerLevel#setDefaultSpawnPos
// Paper start - Call SpawnChangeEvent; move to nms.ServerLevel
// Notify anyone who's listening.
SpawnChangeEvent event = new SpawnChangeEvent(this, previousLocation);
this.server.getPluginManager().callEvent(event);
// SpawnChangeEvent event = new SpawnChangeEvent(this, previousLocation);
// server.getPluginManager().callEvent(event);
// Paper end - Call SpawnChangeEvent
return true;
} catch (Exception e) {