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 @@ -166,6 +166,6 @@ public int getHomeLimit(Player player) {
return Stream.empty();
})
.max(Integer::compareTo)
.orElse(0);
.orElse(this.homesSettings.defaultLimit());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -27,25 +27,35 @@ public class HomesConfig extends OkaeriConfig implements HomesSettings {
public Duration delay = Duration.ofSeconds(5);

@Comment({
"# Maximum number of homes per permission group",
"# Configure how many homes players can set based on their permissions",
"# ",
"# Permission format: 'permission' -> max_homes",
"# Players with higher permissions will get the highest limit they qualify for",
"# ",
"# Default permissions:",
"# - eternalcore.home.default: Basic players (1 home)",
"# Configure how many homes a player can set depending on their permissions.",
"#",
"# Permission format: 'permission.node : max_homes'",
"# If user has multiple permissions from the list the highest number will be taken",
"#",
"# Fallback behavior:",
"# - If a player does not have any of the listed permissions,",
"# the value from 'defaultLimit' will be used.",
"#",
"# Example permissions:",
"# - eternalcore.home.vip: VIP players (2 homes)",
"# - eternalcore.home.premium: Premium players (3 homes)",
"# ",
"# You can add custom permission groups and limits as needed",
"# Example: 'eternalcore.home.admin' -> 999"
"# How it works:",
"# If a player has both 'eternalcore.home.vip' and 'eternalcore.home.premium',",
"# they will be able to set 3 homes (highest value wins).",
"# If the player does not have any permission from the list he will be able to set the limit defined by `defaultLimit`.",
"#",
"# You can define additional permissions as needed.",
"# Example: 'eternalcore.home.admin: 999'"
})
public Map<String, Integer> maxHomes = new LinkedHashMap<>() {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
public Map<String, Integer> maxHomes = new LinkedHashMap<>() {
public Map<String, Integer> maxHomes = Map.of(

{
put("eternalcore.home.default", 1);
put("eternalcore.home.vip", 2);
put("eternalcore.home.premium", 3);
}
};
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Conventionally wise, I think I would use Map#of here. 😀


@Comment({
"# Default limit of homes used when the player does not have any permission from the list above."
})
public Integer defaultLimit = 1;
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,5 @@ public interface HomesSettings {
Map<String, Integer> maxHomes();
Duration delay();
String defaultName();
Integer defaultLimit();
}