Fix minor bugs or code smells.

This commit is contained in:
tastybento 2023-09-08 17:12:50 -07:00
parent b788d4c49f
commit 6507916fc1
3 changed files with 9 additions and 2 deletions

View File

@ -24,7 +24,6 @@ public class IslandTeamInviteAcceptCommand extends ConfirmableCommand {
private static final String INVALID_INVITE = "commands.island.team.invite.errors.invalid-invite";
private final IslandTeamCommand itc;
private UUID playerUUID;
private UUID prospectiveOwnerUUID;
public IslandTeamInviteAcceptCommand(IslandTeamCommand islandTeamCommand) {
super(islandTeamCommand, "accept");
@ -47,7 +46,7 @@ public class IslandTeamInviteAcceptCommand extends ConfirmableCommand {
return false;
}
// Get the island owner
prospectiveOwnerUUID = itc.getInviter(playerUUID);
UUID prospectiveOwnerUUID = itc.getInviter(playerUUID);
if (prospectiveOwnerUUID == null) {
user.sendMessage(INVALID_INVITE);
return false;

View File

@ -167,6 +167,10 @@ public class IslandTeamInviteCommand extends CompositeCommand {
user.sendMessage("commands.island.team.invite.removing-invite");
}
Island island = getIslands().getIsland(getWorld(), user.getUniqueId());
if (island == null) {
user.sendMessage("general.errors.no-island");
return false;
}
// Fire event so add-ons can run commands, etc.
IslandBaseEvent e = TeamEvent.builder()
.island(island)

View File

@ -67,6 +67,10 @@ public class IslandTeamLeaveCommand extends ConfirmableCommand {
private void leave(User user) {
Island island = getIslands().getIsland(getWorld(), user);
if (island == null) {
user.sendMessage("general.errors.no-island");
return;
}
// Fire event
IslandBaseEvent event = TeamEvent.builder()
.island(island)