diff --git a/common/src/main/java/net/william278/huskhomes/manager/HomesManager.java b/common/src/main/java/net/william278/huskhomes/manager/HomesManager.java index a7ab6eff..6277323e 100644 --- a/common/src/main/java/net/william278/huskhomes/manager/HomesManager.java +++ b/common/src/main/java/net/william278/huskhomes/manager/HomesManager.java @@ -311,6 +311,9 @@ public class HomesManager { } public void setHomeName(@NotNull Home home, @NotNull String newName) throws ValidationException { + if (plugin.getDatabase().getHome(home.getOwner(), newName).isPresent()) { + throw new ValidationException(ValidationException.Type.NAME_TAKEN); + } plugin.getValidator().validateName(newName); home.getMeta().setName(newName); plugin.getDatabase().saveHome(home); diff --git a/common/src/main/java/net/william278/huskhomes/manager/WarpsManager.java b/common/src/main/java/net/william278/huskhomes/manager/WarpsManager.java index 336e8dde..5363df6c 100644 --- a/common/src/main/java/net/william278/huskhomes/manager/WarpsManager.java +++ b/common/src/main/java/net/william278/huskhomes/manager/WarpsManager.java @@ -206,6 +206,9 @@ public class WarpsManager { } public void setWarpName(@NotNull Warp warp, @NotNull String newName) throws ValidationException { + if (plugin.getDatabase().getWarp(newName).isPresent()) { + throw new ValidationException(ValidationException.Type.NAME_TAKEN); + } plugin.getValidator().validateName(newName); warp.getMeta().setName(newName); plugin.getDatabase().saveWarp(warp);