Fail safely if BungeeCord implementation specific classes are not found

This commit is contained in:
games647 committed 2021-03-15 13:40:28 +01:00
1 parent 337e01e537
commit e88f2e7f8e
8 files changed
+69 -37

No files matched your search

@@ -206,7 +206,7 @@ public class AuthStorage {
saveStmt.execute();
try (ResultSet generatedKeys = saveStmt.getGeneratedKeys()) {
if (generatedKeys != null && generatedKeys.next()) {
if (generatedKeys.next()) {
playerProfile.setRowId(generatedKeys.getInt(1));
}
}
@@ -3,6 +3,7 @@ package com.github.games647.fastlogin.core;
import com.github.games647.craftapi.model.Profile;
import java.time.Instant;
import java.util.Objects;
import java.util.Optional;
import java.util.UUID;
import java.util.concurrent.locks.ReentrantLock;
@@ -86,6 +87,21 @@ public class StoredProfile extends Profile {
this.lastLogin = lastLogin;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (!(o instanceof StoredProfile)) return false;
if (!super.equals(o)) return false;
StoredProfile that = (StoredProfile) o;
return rowId == that.rowId && premium == that.premium
&& Objects.equals(lastIp, that.lastIp) && lastLogin.equals(that.lastLogin);
}
@Override
public int hashCode() {
return Objects.hash(super.hashCode(), rowId, premium, lastIp, lastLogin);
}
@Override
public synchronized String toString() {
return this.getClass().getSimpleName() + '{' +
@@ -90,7 +90,7 @@ public class FastLoginCore<P extends C, C, T extends PlatformPlugin<C>> {
}
int maxCon = config.getInt("anti-bot.connections", 200);
long expireTime = config.getInt("anti-bot.expire", 5) * 60 * 1_000L;
long expireTime = config.getLong("anti-bot.expire", 5) * 60 * 1_000L;
if (expireTime > MAX_EXPIRE_RATE) {
expireTime = MAX_EXPIRE_RATE;
}
@@ -132,7 +132,7 @@ public class FastLoginCore<P extends C, C, T extends PlatformPlugin<C>> {
config = configProvider.load(reader, defaults);
}
//explicitly add keys here, because Configuration.getKeys doesn't return the keys from the default configuration
// explicitly add keys here, because Configuration.getKeys doesn't return the keys from the default configuration
for (String key : defaults.getKeys()) {
config.set(key, config.get(key));
}