Fix null in reject invite (#1933)

* remove debug

* fix null in reject invite
This commit is contained in:
Huynh Tien 2022-01-29 09:42:56 +07:00 committed by GitHub
parent 52cc2a8593
commit 178529adb1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 6 deletions

View File

@ -1,6 +1,7 @@
package world.bentobox.bentobox.api.commands.island.team;
import java.util.List;
import java.util.Optional;
import java.util.UUID;
import world.bentobox.bentobox.api.commands.CompositeCommand;
@ -40,14 +41,15 @@ public class IslandTeamInviteRejectCommand extends CompositeCommand {
return false;
}
Optional.ofNullable(itc.getInviter(playerUUID))
.map(User::getInstance)
.ifPresent(inviter ->
inviter.sendMessage("commands.island.team.invite.reject.name-rejected-your-invite", TextVariables.NAME, user.getName())
);
// Remove this player from the global invite list
itc.removeInvite(user.getUniqueId());
user.sendMessage("commands.island.team.invite.reject.you-rejected-invite");
User inviter = User.getInstance(itc.getInviter(playerUUID));
if (inviter != null) {
inviter.sendMessage("commands.island.team.invite.reject.name-rejected-your-invite", TextVariables.NAME, user.getName());
}
} else {
// Someone typed /island reject and had not been invited
user.sendMessage("commands.island.team.invite.errors.none-invited-you");

View File

@ -85,7 +85,6 @@ public class InventoryListener extends FlagListener {
checkIsland(e, player, e.getInventory().getLocation(), Flags.CHEST);
}
else if (!(inventoryHolder instanceof Player)) {
BentoBox.getInstance().logDebug(inventoryHolder.getClass().toGenericString());
// All other containers
checkIsland(e, player, e.getInventory().getLocation(), Flags.CONTAINER);
}