diff options
author | Petr Ilin <hevav@hevav.dev> | 2023-01-03 22:22:14 +0300 |
---|---|---|
committer | Petr Ilin <hevav@hevav.dev> | 2023-01-03 22:22:14 +0300 |
commit | 85591122aa274c640c3980588c948bfdd07eed91 (patch) | |
tree | 870cea0115f1aab5208609a118f47fa1f5ce2487 /src/main/java | |
parent | 672e6802e51bfdc1a11f82e8e48f699822ab89f2 (diff) | |
download | LimboAuth-85591122aa274c640c3980588c948bfdd07eed91.tar.gz LimboAuth-85591122aa274c640c3980588c948bfdd07eed91.tar.bz2 LimboAuth-85591122aa274c640c3980588c948bfdd07eed91.zip |
incrementBruteforceAttempts correctly
Diffstat (limited to 'src/main/java')
-rw-r--r-- | src/main/java/net/elytrium/limboauth/LimboAuth.java | 8 |
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) { |