Archiviert
1
0

Fix bannumgehungs timings

Signed-off-by: Lixfel <agga-games@gmx.de>
Dieser Commit ist enthalten in:
Lixfel 2020-12-19 12:08:18 +01:00
Ursprung adf0d6b716
Commit a5dc11cac1

Datei anzeigen

@ -33,7 +33,6 @@ import net.md_5.bungee.api.event.LoginEvent;
import net.md_5.bungee.event.EventHandler; import net.md_5.bungee.event.EventHandler;
import java.sql.Timestamp; import java.sql.Timestamp;
import java.time.Instant;
import java.time.format.DateTimeFormatter; import java.time.format.DateTimeFormatter;
import java.util.List; import java.util.List;
@ -52,7 +51,7 @@ public class BanListener extends BasicListener {
List<BannedUserIPs> ips = BannedUserIPs.get(event.getConnection().getAddress().getAddress().getHostAddress()); List<BannedUserIPs> ips = BannedUserIPs.get(event.getConnection().getAddress().getAddress().getHostAddress());
if(!ips.isEmpty()){ if(!ips.isEmpty()){
Timestamp highestBan = Timestamp.from(Instant.now()); Timestamp highestBan = ips.get(0).getTimestamp();
for(BannedUserIPs banned : ips) { for(BannedUserIPs banned : ips) {
if(highestBan.before(banned.getTimestamp())) if(highestBan.before(banned.getTimestamp()))
highestBan = banned.getTimestamp(); highestBan = banned.getTimestamp();
@ -70,8 +69,8 @@ public class BanListener extends BasicListener {
for(BannedUserIPs banned : ips) { for(BannedUserIPs banned : ips) {
SteamwarUser bannedUser = SteamwarUser.get(banned.getUserID()); SteamwarUser bannedUser = SteamwarUser.get(banned.getUserID());
potentialBan.append(Message.parse("BAN_AVOIDING_LIST", target, bannedUser.getId(), potentialBan.append(Message.parse("BAN_AVOIDING_LIST", target, bannedUser.getUserName(),
banned.getTimestamp().toLocalDateTime().format(BungeeCore.DATE_FORMAT), bannedUser.getUserName())); banned.getTimestamp().toLocalDateTime().format(BungeeCore.DATE_FORMAT)));
} }
TextComponent msg = new TextComponent(potentialBan.toString()); TextComponent msg = new TextComponent(potentialBan.toString());