Null check

This commit is contained in:
tastybento 2021-09-18 11:37:33 -07:00
parent 25fe86d812
commit 8eac5070f0

View File

@ -41,12 +41,13 @@ public class AdminDeleteCommand extends ConfirmableCommand {
user.sendMessage("general.errors.unknown-player", TextVariables.NAME, args.get(0)); user.sendMessage("general.errors.unknown-player", TextVariables.NAME, args.get(0));
return false; return false;
} }
if (!getIslands().hasIsland(getWorld(), targetUUID)) { UUID owner = getIslands().getOwner(getWorld(), targetUUID);
if (owner == null) {
user.sendMessage("general.errors.player-has-no-island"); user.sendMessage("general.errors.player-has-no-island");
return false; return false;
} }
// Team members should be kicked before deleting otherwise the whole team will become weird // Team members should be kicked before deleting otherwise the whole team will become weird
if (getIslands().inTeam(getWorld(), targetUUID) && getIslands().getOwner(getWorld(), targetUUID).equals(targetUUID)) { if (getIslands().inTeam(getWorld(), targetUUID) && owner.equals(targetUUID)) {
user.sendMessage("commands.admin.delete.cannot-delete-owner"); user.sendMessage("commands.admin.delete.cannot-delete-owner");
return false; return false;
} }