More aggressive name/ID caching.

To 30 days from 10.
This commit is contained in:
ryanhamshire 2014-11-20 19:26:17 -08:00
parent b58e74aac3
commit d69ab8fae6

View File

@ -305,7 +305,7 @@ public class GriefPrevention extends JavaPlugin
int playersCached = 0; int playersCached = 0;
OfflinePlayer [] offlinePlayers = this.getServer().getOfflinePlayers(); OfflinePlayer [] offlinePlayers = this.getServer().getOfflinePlayers();
long now = System.currentTimeMillis(); long now = System.currentTimeMillis();
final long TENDAYS = 1000 * 60 * 60 * 24 * 10; final long WHILEBACK = 1000 * 60 * 60 * 24 * 30; //30 days back
for(OfflinePlayer player : offlinePlayers) for(OfflinePlayer player : offlinePlayers)
{ {
try try
@ -315,8 +315,8 @@ public class GriefPrevention extends JavaPlugin
if(playerName == null || playerID == null) continue; if(playerName == null || playerID == null) continue;
long absentMilliseconds = now - player.getLastPlayed(); long absentMilliseconds = now - player.getLastPlayed();
//if the player has been seen in the last 10 days, cache his name/UUID pair //if the player has been seen in the last 30 days, cache his name/UUID pair
if(absentMilliseconds < TENDAYS) if(absentMilliseconds < WHILEBACK)
{ {
this.playerNameToIDMap.put(playerName, playerID); this.playerNameToIDMap.put(playerName, playerID);
this.playerNameToIDMap.put(playerName.toLowerCase(), playerID); this.playerNameToIDMap.put(playerName.toLowerCase(), playerID);