mirror of
https://github.com/BentoBoxWorld/BentoBox.git
synced 2024-11-24 03:35:11 +01:00
Fixes NPE caused by island delete of a null island
If a player is invited and has no island, the accept command was still trying to delete it and causing an NPE. Also, the island save was being done on the old island, not the new team island. https://github.com/BentoBoxWorld/BentoBox/issues/481
This commit is contained in:
parent
4958304aa5
commit
9e0772367a
@ -96,7 +96,9 @@ public class IslandTeamInviteAcceptCommand extends ConfirmableCommand {
|
||||
// Set the player's home
|
||||
getPlayers().setHomeLocation(playerUUID, user.getLocation());
|
||||
// Delete the old island
|
||||
getIslands().deleteIsland(island, true);
|
||||
if (island != null) {
|
||||
getIslands().deleteIsland(island, true);
|
||||
}
|
||||
// TODO Set the cooldown
|
||||
// Reset deaths
|
||||
if (getIWM().isTeamJoinDeathReset(getWorld())) {
|
||||
@ -110,7 +112,7 @@ public class IslandTeamInviteAcceptCommand extends ConfirmableCommand {
|
||||
if (inviter != null) {
|
||||
inviter.sendMessage("commands.island.team.invite.accept.name-joined-your-island", TextVariables.NAME, user.getName());
|
||||
}
|
||||
getIslands().save(island);
|
||||
getIslands().save(teamIsland);
|
||||
});
|
||||
|
||||
return true;
|
||||
|
Loading…
Reference in New Issue
Block a user