Fixing whitelist bug and alertsState bug

- Whitelisted players would not actually return as whitelisted from the database because of use the getFetchSize parameter, which was not used as it was intended.
- The same reasoning as above is why the alertsState would not function.
This commit is contained in:
funkemunky
2021-09-09 15:25:42 -04:00
parent b573fca58b
commit 795f0333c7
4 changed files with 26 additions and 10 deletions
@@ -1,6 +1,7 @@
package dev.brighten.antivpn.api;
import dev.brighten.antivpn.AntiVPN;
import dev.brighten.antivpn.message.VpnString;
import lombok.Getter;
import lombok.RequiredArgsConstructor;
import lombok.Setter;
@@ -19,13 +20,6 @@ public abstract class APIPlayer {
this.uuid = uuid;
this.name = name;
this.ip = ip;
AntiVPN.getInstance().getDatabase().alertsState(uuid, enabled -> {
if(enabled) {
alertsEnabled = enabled; //This can be within the if statement. It's not dirty, it lowers field writes.
sendMessage("");
}
});
}
public abstract void sendMessage(String message);
@@ -36,6 +30,9 @@ public abstract class APIPlayer {
public void setAlertsEnabled(boolean alertsEnabled) {
this.alertsEnabled = alertsEnabled;
}
public void updateAlertsState() {
//Updating into database so its synced across servers and saved on logout.
AntiVPN.getInstance().getDatabase().updateAlertsState(uuid, alertsEnabled);
}