aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/net/elytrium/limboauth
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/net/elytrium/limboauth')
-rw-r--r--src/main/java/net/elytrium/limboauth/LimboAuth.java8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/main/java/net/elytrium/limboauth/LimboAuth.java b/src/main/java/net/elytrium/limboauth/LimboAuth.java
index eed58f3..15cc0be 100644
--- a/src/main/java/net/elytrium/limboauth/LimboAuth.java
+++ b/src/main/java/net/elytrium/limboauth/LimboAuth.java
@@ -834,17 +834,21 @@ public class LimboAuth {
}
public void incrementBruteforceAttempts(InetAddress address) {
- this.bruteforceCache.get(address).incrementAttempts();
+ this.getBruteforceUser(address).incrementAttempts();
}
public int getBruteforceAttempts(InetAddress address) {
+ return this.getBruteforceUser(address).getAttempts();
+ }
+
+ private CachedBruteforceUser getBruteforceUser(InetAddress address) {
CachedBruteforceUser user = this.bruteforceCache.get(address);
if (user == null) {
user = new CachedBruteforceUser(System.currentTimeMillis());
this.bruteforceCache.put(address, user);
}
- return user.getAttempts();
+ return user;
}
public void clearBruteforceAttempts(InetAddress address) {