Fixes a bug with cache. (#1533)

It was not possible to set it to unlimited time due to my poor programming and logic skills. 
It also was contradicting to config comments.
This commit is contained in:
BONNe 2020-10-09 03:47:17 +03:00 committed by GitHub
parent cda300e28a
commit 6cd9339652
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -78,9 +78,8 @@ public class HeadGetter {
// If timestamp is set to 0, then it must be kept forever.
// If settings time is set to 0, then always use cache.
if (cache != null &&
cache.getTimestamp() != 0 &&
cacheTimeout > 0 &&
System.currentTimeMillis() - cache.getTimestamp() <= cacheTimeout)
(cache.getTimestamp() == 0 || cacheTimeout == 0 ||
System.currentTimeMillis() - cache.getTimestamp() <= cacheTimeout))
{
panelItem.setHead(cachedHeads.get(panelItem.getPlayerHeadName()).getPlayerHead());
requester.setHead(panelItem);
@ -285,4 +284,4 @@ public class HeadGetter {
return returnValue;
}
}
}