Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -427,6 +427,8 @@ public interface ISettings extends IConf {

boolean isConfirmHomeOverwrite();

boolean isStrictHomeLimit();

boolean infoAfterDeath();

boolean isRespawnAtBed();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2146,6 +2146,11 @@ public boolean isConfirmHomeOverwrite() {
return config.getBoolean("confirm-home-overwrite", false);
}

@Override
public boolean isStrictHomeLimit() {
return config.getBoolean("strict-home-limit", false);
}

@Override
public boolean infoAfterDeath() {
return config.getBoolean("send-info-after-death", false);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,13 @@ public void run(final Server server, final User user, final String commandLabel,
}
}
}
if (ess.getSettings().isStrictHomeLimit() && user.equals(player)
&& !user.isAuthorized("essentials.sethome.multiple.unlimited")) {
final int limit = ess.getSettings().getHomeLimit(user);
if (user.getHomes().size() > limit) {
throw new TranslatableException("strictHomeLimitExceeded", limit);
}
}
try {
if ("bed".equalsIgnoreCase(homeName) && user.isAuthorized("essentials.home.bed")) {
if (!player.getBase().isOnline() || player.getBase() instanceof OfflinePlayerStub) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,9 @@ private boolean checkHomeLimit(final User user, final User usersHome, final Stri
if (!user.isAuthorized("essentials.sethome.multiple.unlimited")) {
final int limit = ess.getSettings().getHomeLimit(user);
if (usersHome.getHomes().size() >= limit) {
if (ess.getSettings().isStrictHomeLimit() && user.equals(usersHome) && usersHome.getHomes().size() > limit) {
throw new TranslatableException("strictHomeLimitExceeded", limit);
}
if (usersHome.getHomes().contains(name)) {
return false;
}
Expand Down
4 changes: 4 additions & 0 deletions Essentials/src/main/resources/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -833,6 +833,10 @@ spawn-if-no-home: true
# Should players be asked to provide confirmation for homes they attempt to overwrite?
confirm-home-overwrite: false

# Block /sethome and /home for players over their home limit, suggesting /delhome usage
# By default, players with more homes than permitted can overwrite existing home names and still use /home.
strict-home-limit: false

############################################################
# +------------------------------------------------------+ #
# | Economy | #
Expand Down
1 change: 1 addition & 0 deletions Essentials/src/main/resources/messages.properties
Original file line number Diff line number Diff line change
Expand Up @@ -1264,6 +1264,7 @@ speedCommandUsage2=/<command> <type> <speed> [player]
speedCommandUsage2Description=Sets either the specified type of speed to the given speed for you or another player if specified
stonecutterCommandDescription=Opens up a stonecutter.
stonecutterCommandUsage=/<command>
strictHomeLimitExceeded=<dark_red>You are above your home limit of<secondary> {0}<dark_red>. Use /delhome to remove homes before using this command.
sudoCommandDescription=Make another user perform a command.
sudoCommandUsage=/<command> <player> <command [args]>
sudoCommandUsage1=/<command> <player> <command> [args]
Expand Down