feat: broke down if statement for the getHead() to refactor Complex Conditional Code smell
This commit is contained in:
parent
ec6dd42efe
commit
0137f8395c
|
@ -80,9 +80,13 @@ public class HeadGetter {
|
|||
// just check if requested cache exists and compare it with value from plugin settings.
|
||||
// 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))
|
||||
|
||||
long cacheTimeStampDifference = System.currentTimeMillis() - cache.getTimestamp();
|
||||
|
||||
boolean cacheRequestTimeCondition = cache.getTimestamp() == 0 || cacheTimeout == 0 ||
|
||||
(cacheTimeStampDifference <= cacheTimeout);
|
||||
|
||||
if (cache != null && (cacheRequestTimeCondition))
|
||||
{
|
||||
panelItem.setHead(cachedHeads.get(panelItem.getPlayerHeadName()).getPlayerHead());
|
||||
requester.setHead(panelItem);
|
||||
|
|
Loading…
Reference in New Issue