geforkt von SteamWar/BungeeCore
Fix of Perma ban on Avoiding Alert
Dieser Commit ist enthalten in:
Ursprung
5d35e08af5
Commit
575ef6fb08
@ -21,6 +21,7 @@ package de.steamwar.bungeecore.listeners;
|
||||
|
||||
import de.steamwar.bungeecore.Message;
|
||||
import de.steamwar.bungeecore.sql.BannedUserIPs;
|
||||
import de.steamwar.bungeecore.sql.Punishment;
|
||||
import de.steamwar.bungeecore.sql.SteamwarUser;
|
||||
import net.md_5.bungee.api.ProxyServer;
|
||||
import net.md_5.bungee.api.chat.ClickEvent;
|
||||
@ -51,12 +52,21 @@ public class BanListener extends BasicListener {
|
||||
if(!ips.isEmpty()){
|
||||
|
||||
Timestamp highestBan = ips.get(0).getTimestamp();
|
||||
boolean perma = false;
|
||||
for(BannedUserIPs banned : ips) {
|
||||
if(highestBan.before(banned.getTimestamp()))
|
||||
highestBan = banned.getTimestamp();
|
||||
SteamwarUser bannedUser = SteamwarUser.get(banned.getUserID());
|
||||
if(bannedUser.isBanned()) {
|
||||
Punishment ban = bannedUser.getPunishment(Punishment.PunishmentType.Ban);
|
||||
if(ban.isPerma()) {
|
||||
perma = true;
|
||||
break;
|
||||
}
|
||||
if(ban.getEndTime().after(highestBan))
|
||||
highestBan = ban.getEndTime();
|
||||
}
|
||||
}
|
||||
ClickEvent clickEvent = new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/ban " + user.getUserName() + " "
|
||||
+ highestBan.toLocalDateTime().format(DateTimeFormatter.ofPattern("dd.MM.yyyy_HH:mm"))
|
||||
+ (perma?"perma":highestBan.toLocalDateTime().format(DateTimeFormatter.ofPattern("dd.MM.yyyy_HH:mm")))
|
||||
+ " Bannumgehung");
|
||||
|
||||
for (ProxiedPlayer target : ProxyServer.getInstance().getPlayers()){
|
||||
|
@ -149,6 +149,10 @@ public class SteamwarUser {
|
||||
return team;
|
||||
}
|
||||
|
||||
public Punishment getPunishment(Punishment.PunishmentType type) {
|
||||
return punishments.getOrDefault(type, null);
|
||||
}
|
||||
|
||||
public boolean isBanned() {
|
||||
if(!punishments.containsKey(Punishment.PunishmentType.Ban))
|
||||
return false;
|
||||
|
In neuem Issue referenzieren
Einen Benutzer sperren