From a87ef8bff6d978dc28289d0a6ef44f0a90c81edc Mon Sep 17 00:00:00 2001 From: tastybento Date: Thu, 30 May 2019 23:30:34 -0700 Subject: [PATCH] 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. --- .../island/team/IslandTeamInviteAcceptCommand.java | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/src/main/java/world/bentobox/bentobox/api/commands/island/team/IslandTeamInviteAcceptCommand.java b/src/main/java/world/bentobox/bentobox/api/commands/island/team/IslandTeamInviteAcceptCommand.java index b6fd29014..a7e1058c8 100644 --- a/src/main/java/world/bentobox/bentobox/api/commands/island/team/IslandTeamInviteAcceptCommand.java +++ b/src/main/java/world/bentobox/bentobox/api/commands/island/team/IslandTeamInviteAcceptCommand.java @@ -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);