Allow users to modify existing homes when over homes limit (#3776)

Fixes #3761
This commit is contained in:
Josh Roy 2020-11-15 12:40:34 -05:00 committed by GitHub
parent 1fed7a9a3a
commit 3ba675a899
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -71,10 +71,10 @@ public class Commandsethome extends EssentialsCommand {
private boolean checkHomeLimit(final User user, final User usersHome, final String name) throws Exception {
if (!user.isAuthorized("essentials.sethome.multiple.unlimited")) {
final int limit = ess.getSettings().getHomeLimit(user);
if (usersHome.getHomes().size() == limit && usersHome.getHomes().contains(name)) {
return false;
}
if (usersHome.getHomes().size() >= limit) {
if (usersHome.getHomes().contains(name)) {
return false;
}
throw new Exception(tl("maxHomes", ess.getSettings().getHomeLimit(user)));
}
return limit == 1;