Configurable essentials: home tiers by permission, cooldowns, warp cap, RTP radii; rewards config
This commit is contained in:
11 files changed
+276
-16
No files matched your search
+5
-1
@@ -33,8 +33,12 @@ final class FabricConfig {
|
||||
String text(String key, String fallback) { return p.getProperty(key, fallback).trim(); }
|
||||
|
||||
EssentialsConfig essentials() {
|
||||
java.util.Map<String, Integer> cooldowns = new java.util.HashMap<>();
|
||||
for (String cmd : new String[]{"spawn", "home", "back", "tpa", "rtp", "warp"}) cooldowns.put(cmd, Math.max(0, integer("essentials.cooldown." + cmd, 0)));
|
||||
return new EssentialsConfig(Math.max(0, integer("essentials.max_homes", 5)), Math.max(10, integer("essentials.rtp_radius", 2500)),
|
||||
Math.max(5, integer("essentials.tpa_timeout_seconds", 60)) * 1000L, 15);
|
||||
Math.max(5, integer("essentials.tpa_timeout_seconds", 60)) * 1000L, Math.max(1, integer("essentials.rtp_attempts", 15)),
|
||||
Math.max(0, integer("essentials.rtp_min_radius", 0)), Math.max(0, integer("essentials.max_warps", 0)),
|
||||
Math.max(1, integer("essentials.home_name_max_length", 32)), cooldowns);
|
||||
}
|
||||
|
||||
Features features(Settings s) {
|
||||
|
||||
@@ -16,8 +16,11 @@ final class Perms {
|
||||
|
||||
static boolean luckPermsPresent() { return LUCKPERMS; }
|
||||
|
||||
/** Nodes that grant extras (limit tiers like scopenet.homes.10): nobody has them unless a permissions system says so. */
|
||||
static boolean isGrantNode(String node) { return node.startsWith("scopenet.homes.") || node.startsWith("scopenet.limit."); }
|
||||
|
||||
static boolean isAdminNode(String node) {
|
||||
return node.equals("scopenet.claims.bypass") || node.startsWith("scopenet.admin")
|
||||
return node.equals("scopenet.claims.bypass") || node.equals("scopenet.cooldown.bypass") || node.startsWith("scopenet.admin")
|
||||
|| node.equals("scopenet.command.scopenet.status") || node.equals("scopenet.command.scopenet.reload");
|
||||
}
|
||||
|
||||
@@ -30,6 +33,7 @@ final class Perms {
|
||||
// LuckPerms not ready yet or an API change: fall back to the defaults below.
|
||||
}
|
||||
}
|
||||
if (isGrantNode(node)) return false;
|
||||
if (isAdminNode(node)) return player.hasPermissions(2);
|
||||
return everyoneByDefault || player.hasPermissions(2);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user