boolean hasBed = event.getPlayer().getBedSpawnLocation() != null;
// if the player attempts to respawn in a different world, bring them back
Location respawnLocation = event.getRespawnLocation();
boolean changeRespawn = !hasBed || respawnLocation.getWorld() != match.getWorld() ||
match.inStartRegion(respawnLocation);
if (changeRespawn) event.setRespawnLocation(match.getPlayerSpawn(event.getPlayer()));
// setup respawn for the player
match.getPlayer(event.getPlayer()).respawn();
}