Fixes new team members randomly cannot join island.

https://github.com/BentoBoxWorld/BentoBox/issues/718

Caused by edge case where island owner has no safe home spot and all
other safe spots checked were unsafe too. Now uses homeTeleport method
to do a full island search for a safe spot.
This commit is contained in:
tastybento 2019-05-30 23:30:34 -07:00
parent 2946e3c298
commit a87ef8bff6

View File

@ -5,7 +5,6 @@ import java.util.UUID;
import org.bukkit.Bukkit;
import org.bukkit.GameMode;
import org.bukkit.Location;
import com.google.common.collect.BiMap;
@ -86,11 +85,8 @@ public class IslandTeamInviteAcceptCommand extends ConfirmableCommand {
// Add the player as a team member of the new island
getIslands().setJoinTeam(teamIsland, playerUUID);
//Move player to team's island
User prospectiveOwner = User.getInstance(prospectiveOwnerUUID);
Location newHome = getIslands().getSafeHomeLocation(getWorld(), prospectiveOwner, 1);
user.teleport(newHome);
// Set the player's home
getPlayers().setHomeLocation(playerUUID, user.getLocation());
getPlayers().clearHomeLocations(getWorld(), playerUUID);
getIslands().homeTeleport(getWorld(), user.getPlayer());
// Delete the old island
if (island != null) {
getIslands().deleteIsland(island, true);