mirror of
https://github.com/darksaid98/HuskHomes.git
synced 2026-12-04 14:38:53 +00:00
fix: edithome/warp overwriting existing, close #594
This commit is contained in:
2 files changed
+6
No files matched your search
@@ -311,6 +311,9 @@ public class HomesManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void setHomeName(@NotNull Home home, @NotNull String newName) throws ValidationException {
|
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);
|
plugin.getValidator().validateName(newName);
|
||||||
home.getMeta().setName(newName);
|
home.getMeta().setName(newName);
|
||||||
plugin.getDatabase().saveHome(home);
|
plugin.getDatabase().saveHome(home);
|
||||||
|
|||||||
@@ -206,6 +206,9 @@ public class WarpsManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void setWarpName(@NotNull Warp warp, @NotNull String newName) throws ValidationException {
|
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);
|
plugin.getValidator().validateName(newName);
|
||||||
warp.getMeta().setName(newName);
|
warp.getMeta().setName(newName);
|
||||||
plugin.getDatabase().saveWarp(warp);
|
plugin.getDatabase().saveWarp(warp);
|
||||||
|
|||||||
Reference in new issue
Block a user