diff --git a/common/src/main/java/net/william278/huskhomes/api/BaseHuskHomesAPI.java b/common/src/main/java/net/william278/huskhomes/api/BaseHuskHomesAPI.java index 79ca586c..24b32bfa 100644 --- a/common/src/main/java/net/william278/huskhomes/api/BaseHuskHomesAPI.java +++ b/common/src/main/java/net/william278/huskhomes/api/BaseHuskHomesAPI.java @@ -317,15 +317,38 @@ public abstract class BaseHuskHomesAPI { /** * Create a home for a given user with the specified name and position. + * The returned future may complete exceptionally with a {@link net.william278.huskhomes.util.ValidationException} + * if the home could not be created. * * @param owner The {@link User} to create the home for * @param name The name of the home * @param position The {@link Position} of the home - * @return a {@link CompletableFuture} that will complete with the created {@link Home} + * @return a {@link CompletableFuture} that will complete with the created {@link Home}. * @since 4.5 */ public CompletableFuture createHome(@NotNull User owner, @NotNull String name, @NotNull Position position) { - return plugin.supplyAsync(() -> plugin.getManager().homes().createHome(owner, name, position, false, false)); + return createHome(owner, name, position, false, false, false); + } + + /** + * Create a home for a given user with the specified name and position. + * The returned future may complete exceptionally with a {@link net.william278.huskhomes.util.ValidationException} + * if the home could not be created. + * + * @param owner The {@link User} to create the home for + * @param name The name of the home + * @param position The {@link Position} of the home + * @param overwrite Whether to overwrite an existing home with the same name + * @param buyAdditionalSlots Whether to buy additional home slots if the user has reached their maximum + * @param ignoreMaxHomes Whether to ignore the maximum number of homes a user can have + * @return a {@link CompletableFuture} that will complete with the created {@link Home}. + * @since 4.5.1 + */ + public CompletableFuture createHome(@NotNull User owner, @NotNull String name, @NotNull Position position, + boolean overwrite, boolean buyAdditionalSlots, boolean ignoreMaxHomes) { + return plugin.supplyAsync(() -> plugin.getManager().homes().createHome( + owner, name, position, overwrite, buyAdditionalSlots, ignoreMaxHomes + )); } /**