Actually add IPs to punishment

This commit is contained in:
Telesphoreo 2022-04-02 18:03:58 -05:00
parent 0c6d90e653
commit 470f652e0b
7 changed files with 13 additions and 3 deletions

View File

@ -84,6 +84,10 @@ public class BanCMD extends PlexCommand
punishment.setEndDate(date.plusDays(1)); punishment.setEndDate(date.plusDays(1));
punishment.setCustomTime(false); punishment.setCustomTime(false);
punishment.setActive(!isAdmin(plexPlayer)); punishment.setActive(!isAdmin(plexPlayer));
if (player != null)
{
punishment.setIp(player.getAddress().getAddress().getHostAddress().trim());
}
plugin.getPunishmentManager().doPunishment(punishedPlayer, punishment); plugin.getPunishmentManager().doPunishment(punishedPlayer, punishment);
PlexUtils.broadcast(messageComponent("banningPlayer", sender.getName(), plexPlayer.getName())); PlexUtils.broadcast(messageComponent("banningPlayer", sender.getName(), plexPlayer.getName()));
if (player != null) if (player != null)

View File

@ -58,6 +58,7 @@ public class FreezeCMD extends PlexCommand
punishment.setEndDate(date.plusMinutes(5)); punishment.setEndDate(date.plusMinutes(5));
punishment.setType(PunishmentType.FREEZE); punishment.setType(PunishmentType.FREEZE);
punishment.setPunishedUsername(player.getName()); punishment.setPunishedUsername(player.getName());
punishment.setIp(player.getAddress().getAddress().getHostAddress().trim());
punishment.setReason(""); punishment.setReason("");
plugin.getPunishmentManager().doPunishment(punishedPlayer, punishment); plugin.getPunishmentManager().doPunishment(punishedPlayer, punishment);

View File

@ -63,6 +63,7 @@ public class KickCMD extends PlexCommand
punishment.setEndDate(LocalDateTime.now()); punishment.setEndDate(LocalDateTime.now());
punishment.setCustomTime(false); punishment.setCustomTime(false);
punishment.setActive(false); punishment.setActive(false);
punishment.setIp(player.getAddress().getAddress().getHostAddress().trim());
plugin.getPunishmentManager().doPunishment(punishedPlayer, punishment); plugin.getPunishmentManager().doPunishment(punishedPlayer, punishment);
PlexUtils.broadcast(messageComponent("kickedPlayer", sender.getName(), plexPlayer.getName())); PlexUtils.broadcast(messageComponent("kickedPlayer", sender.getName(), plexPlayer.getName()));
player.kick(componentFromString(reason)); player.kick(componentFromString(reason));

View File

@ -58,6 +58,7 @@ public class MuteCMD extends PlexCommand
punishment.setEndDate(date.plusMinutes(5)); punishment.setEndDate(date.plusMinutes(5));
punishment.setType(PunishmentType.MUTE); punishment.setType(PunishmentType.MUTE);
punishment.setPunishedUsername(player.getName()); punishment.setPunishedUsername(player.getName());
punishment.setIp(player.getAddress().getAddress().getHostAddress().trim());
punishment.setReason(""); punishment.setReason("");
plugin.getPunishmentManager().doPunishment(punishedPlayer, punishment); plugin.getPunishmentManager().doPunishment(punishedPlayer, punishment);

View File

@ -82,6 +82,10 @@ public class TempbanCMD extends PlexCommand
punishment.setEndDate(PlexUtils.parseDateOffset(args[1])); punishment.setEndDate(PlexUtils.parseDateOffset(args[1]));
punishment.setCustomTime(false); punishment.setCustomTime(false);
punishment.setActive(!isAdmin(plexPlayer)); punishment.setActive(!isAdmin(plexPlayer));
if (player != null)
{
punishment.setIp(player.getAddress().getAddress().getHostAddress().trim());
}
plugin.getPunishmentManager().doPunishment(punishedPlayer, punishment); plugin.getPunishmentManager().doPunishment(punishedPlayer, punishment);
PlexUtils.broadcast(messageComponent("banningPlayer", sender.getName(), plexPlayer.getName())); PlexUtils.broadcast(messageComponent("banningPlayer", sender.getName(), plexPlayer.getName()));
if (player != null) if (player != null)

View File

@ -104,7 +104,6 @@ public class PunishedPlayer extends PlexBase
} }
} }
return file; return file;
} }
@SneakyThrows @SneakyThrows

View File

@ -23,7 +23,7 @@ public class Punishment
private static final DateTimeFormatter DATE_FORMAT = DateTimeFormatter.ofPattern("MM/dd/yyyy 'at' hh:mm:ss a"); private static final DateTimeFormatter DATE_FORMAT = DateTimeFormatter.ofPattern("MM/dd/yyyy 'at' hh:mm:ss a");
private final UUID punished; private final UUID punished;
private final UUID punisher; private final UUID punisher;
private final List<String> IPS; private String ip;
private String punishedUsername; private String punishedUsername;
private PunishmentType type; private PunishmentType type;
private String reason; private String reason;
@ -35,8 +35,8 @@ public class Punishment
{ {
this.punished = punished; this.punished = punished;
this.punisher = punisher; this.punisher = punisher;
this.IPS = Lists.newArrayList();
this.ip = "";
this.punishedUsername = ""; this.punishedUsername = "";
this.type = null; this.type = null;
this.reason = ""; this.reason = "";