Add new IPs

This commit is contained in:
Telesphoreo 2022-04-02 14:55:47 -05:00
parent a4ce9511fd
commit aa18e5d11a

View File

@ -56,19 +56,22 @@ public class PlayerListener extends PlexListener
else else
{ {
plexPlayer = DataUtils.getPlayer(player.getUniqueId()); plexPlayer = DataUtils.getPlayer(player.getUniqueId());
/*List<String> ips = plexPlayer.getIps(); List<String> ips = plexPlayer.getIps();
String currentIP = player.getAddress().getAddress().getHostAddress().trim(); String currentIP = player.getAddress().getAddress().getHostAddress().trim();
for (int i = 0; i < plexPlayer.getIps().size(); i++) if (!ips.contains(currentIP))
{ {
if (!currentIP.equals(ips.get(i))) PlexLog.debug("New IP address detected for player: " + player.getName() + ". Adding " + currentIP + " to the database.");
ips.add(currentIP);
plexPlayer.setIps(ips);
if (mongoPlayerData != null) //back to mongo checking
{ {
PlexLog.debug("New IP address detected for player: " + player.getName() + ". Adding " + currentIP + " to the database."); mongoPlayerData.update(plexPlayer); //update the player's document
ips.add(currentIP);
plexPlayer.setIps(ips);
DataUtils.update(plexPlayer);
return;
} }
}*/ else if (sqlPlayerData != null) //sql checking
{
sqlPlayerData.update(plexPlayer);
}
}
} }
PunishedPlayer punishedPlayer = PlayerCache.getPunishedPlayer(player.getUniqueId()); PunishedPlayer punishedPlayer = PlayerCache.getPunishedPlayer(player.getUniqueId());