Add IP Banning by getting every IP punishment through SQL and checking if it's the same IP, if it's a ban / tempban, and if it's active

Make the ban command add the most recent IP used by a PlexPlayer if the player being banned is not online, else use online player's IP
This commit is contained in:
Taah
2024-01-16 22:23:31 -08:00
parent 79206d9354
commit f34df4f296
4 changed files with 45 additions and 23 deletions

View File

@ -80,10 +80,7 @@ public class BanCMD extends PlexCommand
punishment.setEndDate(date.plusDays(1));
punishment.setCustomTime(false);
punishment.setActive(true);
if (player != null)
{
punishment.setIp(player.getAddress().getAddress().getHostAddress().trim());
}
punishment.setIp(player != null ? player.getAddress().getAddress().getHostAddress().trim() : plexPlayer.getIps().get(plexPlayer.getIps().size() - 1));
plugin.getPunishmentManager().punish(plexPlayer, punishment);
PlexUtils.broadcast(messageComponent("banningPlayer", sender.getName(), plexPlayer.getName()));
Bukkit.getScheduler().runTask(Plex.get(), () ->