api: add #createHome with validation suppression flags

This commit is contained in:
William committed 2023-09-30 16:07:58 +01:00
1 parent 63f6b46497
commit 911b0cb4a1
1 file changed
+25 -2
@@ -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<Home> 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<Home> 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
));
}
/**