#1073 Add delay to email recovery command
- Add configurable cooldown period after sending an email for /email recovery - Change ExpiringMap to remove expired entries (like ExpiringSet) - Create method to translate durations via the messages file
This commit is contained in:
@@ -46,7 +46,13 @@ public class ExpiringMap<K, V> {
|
||||
*/
|
||||
public V get(K key) {
|
||||
ExpiringEntry<V> value = entries.get(key);
|
||||
return value == null ? null : value.getValue();
|
||||
if (value == null) {
|
||||
return null;
|
||||
} else if (System.currentTimeMillis() > value.getExpiration()) {
|
||||
entries.remove(key);
|
||||
return null;
|
||||
}
|
||||
return value.getValue();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -115,7 +121,7 @@ public class ExpiringMap<K, V> {
|
||||
}
|
||||
|
||||
V getValue() {
|
||||
return System.currentTimeMillis() > expiration ? null : value;
|
||||
return value;
|
||||
}
|
||||
|
||||
long getExpiration() {
|
||||
|
||||
Reference in New Issue
Block a user