mirror of
https://github.com/darksaid98/HuskHomes.git
synced 2026-12-02 06:28:49 +00:00
Fix edithome permission logic check & warn against bad rtp spawn radius (#531)
* Fixup edithome logic * Add warning against bad spawn radius
This commit is contained in:
1 parent
8a69e4a075
commit
859993b37e
3 files changed
+28
-10
No files matched your search
@@ -336,14 +336,16 @@ public class HomesManager {
|
||||
throw new ValidationException(ValidationException.Type.NOT_FOUND);
|
||||
}
|
||||
|
||||
this.setHomePrivacy(optionalHome.get(), isPublic);
|
||||
this.setHomePrivacy(owner, optionalHome.get(), isPublic);
|
||||
}
|
||||
|
||||
public void setHomePrivacy(@NotNull Home home, boolean isPublic) {
|
||||
if (isPublic && home.getOwner() instanceof OnlineUser online) {
|
||||
final int publicHomes = plugin.getDatabase().getHomes(home.getOwner()).stream()
|
||||
.filter(Home::isPublic)
|
||||
.toList().size();
|
||||
this.setHomePrivacy(home.getOwner(), home, isPublic);
|
||||
}
|
||||
|
||||
public void setHomePrivacy(@NotNull User owner, @NotNull Home home, boolean isPublic) {
|
||||
if (isPublic && owner instanceof OnlineUser online) {
|
||||
int publicHomes = plugin.getDatabase().getHomes(owner).stream().filter(Home::isPublic).toList().size();
|
||||
if (publicHomes >= getMaxPublicHomes(online)) {
|
||||
throw new ValidationException(ValidationException.Type.REACHED_MAX_PUBLIC_HOMES);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user