World blacklist -> world whitelist

This commit is contained in:
NotAlexNoyle committed 2026-07-30 18:53:27 -04:00
1 parent d739ed6d1f
commit 4ab18417be
5 files changed
+17 -13

No files matched your search

@@ -147,11 +147,13 @@ public class PluginConfig extends OkaeriConfig {
public Duration combatTimerDuration = Duration.ofSeconds(20);
@Comment({
"# List of worlds where combat logging is disabled.",
"# Players in these worlds will not be tagged or affected by combat rules."
"# List of worlds where combat logging is enabled (whitelist).",
"# Only players in these worlds will be tagged and affected by combat rules."
})
public List<String> ignoredWorlds = List.of(
"your_world"
public List<String> allowedWorlds = List.of(
"world",
"world_nether",
"world_the_end"
);
}
}
@@ -47,7 +47,7 @@ public class EndCrystalListener implements Listener {
return;
}
if (pluginConfig.settings.ignoredWorlds.contains(event.getEntity().getWorld().getName())) {
if (!pluginConfig.settings.allowedWorlds.contains(event.getEntity().getWorld().getName())) {
return;
}
@@ -69,7 +69,7 @@ public class RespawnAnchorListener implements Listener {
return;
}
if (pluginConfig.settings.ignoredWorlds.contains(event.getEntity().getWorld().getName())) {
if (!pluginConfig.settings.allowedWorlds.contains(event.getEntity().getWorld().getName())) {
return;
}
@@ -124,7 +124,8 @@ public class FightTagController implements Listener {
private boolean isPlayerInDisabledWorld(Player player) {
String worldName = player.getWorld().getName();
return this.config.settings.ignoredWorlds.contains(worldName);
// Treat allowedWorlds as a whitelist: if the world is not listed, consider it disabled
return !this.config.settings.allowedWorlds.contains(worldName);
}
@@ -16,12 +16,13 @@ settings:
# The duration (in seconds) that a player remains in combat after being attacked.
# After this time expires, the player will no longer be considered in combat.
combatTimerDuration: 20s
# List of worlds where combat logging is disabled.
# Players in these worlds will not be tagged or affected by combat rules.
ignoredWorlds:
- HB1-hub
- Ancient_Plateau
# - More to come when Multiverse is set up fully.
# List of worlds where combat logging is enabled (whitelist).
# Only players in these worlds will be tagged and affected by combat rules.
allowedWorlds:
- world
- world_nether
- world_the_end
# - Add more worlds here if needed.
#
# Settings related to Ender Pearls.
# Configure cooldowns, restrictions, and other behaviors for Ender Pearls during combat.