I have a list of entries in a HashMap, a String as a Key, and a Long as a Value. I'm trying to check if the Value is greater than a certain number, but I'm not sure how I can get the value and check it.
I know this is incorrect, but this may show what I mean better than I can explain:
long offlineTimeLimit = (offlineTimeLimitConfig*1000);
long limit = (offlineTimeLimit + System.currentTimeMillis());
Long playerName = playerTimeCheck.get(p);
if (playerTimeCheck.containsValue( > limit)) {
}
This gets the amount of time a player is allowed offline, offlimeTimeLimitConfig, then multiplies by 1000 (so it's in milliseconds), then adds the current time. I want to check if any of the values in the hashmap are greater than the current time plus the time limit, then execute a code.
I've been doing research, and I've found other ways to store my data (like a TreeMap) and I'm not sure if that may be a better way to store the data.
Here's the rest of the code:
String p = event.getPlayer().getName();
HashMap<String, Long> playerTimeCheck = new HashMap<String, Long>();
ConfigurationSection section = getConfig().getConfigurationSection("PlayerTime");
long currentTime = System.currentTimeMillis();
String playerCheck = getConfig().getString("PlayerTime");
for (String key : section.getKeys(false)) {
playerTimeCheck.put(key, section.getLong(key));
}
Thanks for the help, Colby