fix a critical bug that caused firewall configs to not be read

- removed a debug statement
- remove null return type from FilterRuleEvaluator#lookup
This commit is contained in:
Piotr W. committed 2026-04-22 02:44:24 +01:00
1 parent bbea257eab
commit c7b2baa77e
3 files changed
+3 -6

No files matched your search

@@ -50,7 +50,7 @@ public final class FirewallModule extends AbstractModule {
// read allowlist files
for (String loc : Objects.requireNonNullElse(
firewallConfig.getStringList("allowlist"), new ArrayList<String>()
firewallConfig.getStringList("allowlists"), new ArrayList<String>()
)) {
try {
allowLists.add(resolveFilterList(loc));
@@ -61,7 +61,7 @@ public final class FirewallModule extends AbstractModule {
// read blocklist files
for (String loc : Objects.requireNonNullElse(
firewallConfig.getStringList("blocklist"), new ArrayList<String>()
firewallConfig.getStringList("blocklists"), new ArrayList<String>()
)) {
try {
blockLists.add(resolveFilterList(loc));
@@ -41,8 +41,6 @@ public class PacketInterceptorBehaviour extends AbstractBehaviour {
// get player's IP
InetAddress address = event.getPlayer().getAddress().getAddress();
ctx.plugin().getSLF4JLogger().info("Received packet from " + address.getHostAddress());
// evaluate rules
for (RuleEvaluator ruleEvaluator : ruleEvaluators) {
if (ruleEvaluator.lookup(address) == RuleType.BLOCK) {
@@ -17,13 +17,12 @@ public class FilterRuleEvaluator implements RuleEvaluator {
this.v6trie = v6trie;
}
@Nullable
public RuleType lookup(@NotNull InetAddress address) {
if (address instanceof Inet4Address addr4) {
return v4trie.getRuleType(addr4);
} else if (address instanceof Inet6Address addr6) {
return v6trie.getRuleType(addr6);
}
return null;
return RuleType.DEFAULT;
}
}