edit home, warp commands, manager methods that accept warps/homes

This commit is contained in:
William committed 2023-03-14 12:51:31 +00:00
1 parent a72109667a
commit 4ad77a53c1
11 files changed
+299 -443

No files matched your search

@@ -4,6 +4,7 @@ import net.william278.huskhomes.HuskHomes;
import net.william278.huskhomes.position.Warp;
import net.william278.huskhomes.user.CommandUser;
import net.william278.huskhomes.user.OnlineUser;
import net.william278.huskhomes.util.ValidationException;
import org.jetbrains.annotations.NotNull;
import java.util.List;
@@ -29,7 +30,12 @@ public class DelWarpCommand extends SavedPositionCommand<Warp> {
.ifPresent(user::sendMessage);
return;
}
plugin.getManager().warps().deleteWarp(warp.getName());
try {
plugin.getManager().warps().deleteWarp(warp);
} catch (ValidationException e) {
e.dispatchWarpError(executor, plugin, warp.getName());
return;
}
plugin.getLocales().getLocale("warp_deleted", warp.getName())
.ifPresent(executor::sendMessage);
}