1
0
forked from Clones/Controlify

🐛 Fix reach-around policy not being loaded from server config

✏️ Force-enable reach-around on the client if the server specifically allows it, regardless of option in settings
This commit is contained in:
isXander
2023-08-08 11:01:45 +01:00
parent 5836c380ac
commit 44ab103b65
6 changed files with 46 additions and 14 deletions

View File

@ -0,0 +1,23 @@
package dev.isxander.controlify.reacharound;
import java.util.function.Function;
public enum ReachAroundPolicy {
ALLOWED(mode -> true),
DISALLOWED(mode -> false),
UNSET(ReachAroundMode::canReachAround);
private final Function<ReachAroundMode, Boolean> canReachAround;
ReachAroundPolicy(Function<ReachAroundMode, Boolean> canReachAround) {
this.canReachAround = canReachAround;
}
public boolean canReachAround(ReachAroundMode mode) {
return canReachAround.apply(mode);
}
public static ReachAroundPolicy fromServer(boolean allowed) {
return allowed ? ALLOWED : DISALLOWED;
}
}