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 | |
parent | 672e6802e51bfdc1a11f82e8e48f699822ab89f2 (diff) | |
download | LimboAuth-85591122aa274c640c3980588c948bfdd07eed91.tar.gz LimboAuth-85591122aa274c640c3980588c948bfdd07eed91.tar.bz2 LimboAuth-85591122aa274c640c3980588c948bfdd07eed91.zip |
incrementBruteforceAttempts correctly
-rw-r--r-- | build.gradle | 2 | ||||
-rw-r--r-- | src/main/java/net/elytrium/limboauth/LimboAuth.java | 8 |
2 files changed, 7 insertions, 3 deletions
diff --git a/build.gradle b/build.gradle index 875dc2f..2090356 100644 --- a/build.gradle +++ b/build.gradle @@ -10,7 +10,7 @@ plugins { } setGroup("net.elytrium") -setVersion("1.0.8") +setVersion("1.0.9-SNAPSHOT") java { setSourceCompatibility(JavaVersion.VERSION_11) 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) { |