From 8eac5070f066bdc44fdb6be0d3e36da82677dcbe Mon Sep 17 00:00:00 2001 From: tastybento Date: Sat, 18 Sep 2021 11:37:33 -0700 Subject: [PATCH] Null check --- .../bentobox/api/commands/admin/AdminDeleteCommand.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/main/java/world/bentobox/bentobox/api/commands/admin/AdminDeleteCommand.java b/src/main/java/world/bentobox/bentobox/api/commands/admin/AdminDeleteCommand.java index c7791be91..eee47f960 100644 --- a/src/main/java/world/bentobox/bentobox/api/commands/admin/AdminDeleteCommand.java +++ b/src/main/java/world/bentobox/bentobox/api/commands/admin/AdminDeleteCommand.java @@ -41,12 +41,13 @@ public class AdminDeleteCommand extends ConfirmableCommand { user.sendMessage("general.errors.unknown-player", TextVariables.NAME, args.get(0)); return false; } - if (!getIslands().hasIsland(getWorld(), targetUUID)) { + UUID owner = getIslands().getOwner(getWorld(), targetUUID); + if (owner == null) { user.sendMessage("general.errors.player-has-no-island"); return false; } // 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"); return false; }