SteamWar/BungeeCore
Archiviert
13
2

Update ColorChat Perm, Simplify BanListener
Einige Prüfungen sind fehlgeschlagen
SteamWarCI Build failed

Signed-off-by: Lixfel <agga-games@gmx.de>
Dieser Commit ist enthalten in:
Lixfel 2023-08-29 18:09:25 +02:00
Ursprung 2f928349d7
Commit 356afc9bff
5 geänderte Dateien mit 18 neuen und 37 gelöschten Zeilen

@ -1 +1 @@
Subproject commit fc1e7c60d7eed04aebc336c3c69de0dcdf1d002e Subproject commit 4eadcb4b09c0747cd1726c7f6cfe86ff07e59ea2

Datei anzeigen

@ -24,24 +24,20 @@ import de.steamwar.bungeecore.Message;
import de.steamwar.bungeecore.commands.PunishmentCommand; import de.steamwar.bungeecore.commands.PunishmentCommand;
import de.steamwar.bungeecore.commands.WebpasswordCommand; import de.steamwar.bungeecore.commands.WebpasswordCommand;
import de.steamwar.bungeecore.listeners.mods.Forge; import de.steamwar.bungeecore.listeners.mods.Forge;
import de.steamwar.messages.ChatSender;
import de.steamwar.sql.BannedUserIPs; import de.steamwar.sql.BannedUserIPs;
import de.steamwar.sql.Punishment; import de.steamwar.sql.Punishment;
import de.steamwar.sql.SteamwarUser; import de.steamwar.sql.SteamwarUser;
import de.steamwar.messages.ChatSender;
import de.steamwar.sql.UserPerm;
import net.md_5.bungee.api.ProxyServer; import net.md_5.bungee.api.ProxyServer;
import net.md_5.bungee.api.chat.ClickEvent; import net.md_5.bungee.api.chat.ClickEvent;
import net.md_5.bungee.api.chat.ComponentBuilder;
import net.md_5.bungee.api.chat.HoverEvent;
import net.md_5.bungee.api.chat.TextComponent;
import net.md_5.bungee.api.connection.PendingConnection; import net.md_5.bungee.api.connection.PendingConnection;
import net.md_5.bungee.api.connection.ProxiedPlayer;
import net.md_5.bungee.api.event.LoginEvent; 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.format.DateTimeFormatter; import java.time.format.DateTimeFormatter;
import java.util.List; import java.util.List;
import java.util.stream.Collectors;
public class BanListener extends BasicListener { public class BanListener extends BasicListener {
@ -80,25 +76,17 @@ public class BanListener extends BasicListener {
+ (perma?"perma":highestBan.toLocalDateTime().format(DateTimeFormatter.ofPattern("dd.MM.yyyy_HH:mm"))) + (perma?"perma":highestBan.toLocalDateTime().format(DateTimeFormatter.ofPattern("dd.MM.yyyy_HH:mm")))
+ " Bannumgehung"); + " Bannumgehung");
for (ProxiedPlayer target : ProxyServer.getInstance().getPlayers()){ ChatSender.serverteamReceivers().forEach(sender -> sender.system(
if (SteamwarUser.get(target.getUniqueId()).hasPerm(UserPerm.TEAM) "BAN_AVOIDING_ALERT",
&& (target.getChatMode() == ProxiedPlayer.ChatMode.COMMANDS_ONLY new Message("BAN_AVOIDING_BAN_HOVER"),
|| target.getChatMode() == ProxiedPlayer.ChatMode.SHOWN)){ clickEvent,
StringBuilder potentialBan = new StringBuilder(); user.getUserName(),
potentialBan.append(Message.parsePrefixed("BAN_AVOIDING_ALERT", target, user.getUserName())); ips.stream().map(banned -> {
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.getUserName(), return sender.parseToLegacy("BAN_AVOIDING_LIST", bannedUser.getUserName(),
banned.getTimestamp().toLocalDateTime().format(DateTimeFormatter.ofPattern(Message.parse("TIMEFORMAT", target))))); banned.getTimestamp().toLocalDateTime().format(DateTimeFormatter.ofPattern(sender.parseToLegacy("TIMEFORMAT"))));
} }).collect(Collectors.joining(" "))
));
TextComponent msg = new TextComponent(potentialBan.toString());
msg.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new ComponentBuilder(Message.parse("BAN_AVOIDING_BAN_HOVER", target)).create()));
msg.setClickEvent(clickEvent);
target.sendMessage(msg);
}
}
} }
Forge.onServerConnected(event); Forge.onServerConnected(event);

Datei anzeigen

@ -46,13 +46,6 @@ public class ChatListener extends BasicListener {
private static final List<String> rankedModes = ArenaMode.getAllModes().stream().filter(ArenaMode::isRanked).map(ArenaMode::getSchemType).collect(Collectors.toList()); private static final List<String> rankedModes = ArenaMode.getAllModes().stream().filter(ArenaMode::isRanked).map(ArenaMode::getSchemType).collect(Collectors.toList());
private static final Set<Integer> coloredTeams = new HashSet<>();
static {
coloredTeams.add(12);
coloredTeams.add(54);
coloredTeams.add(285);
}
@EventHandler @EventHandler
public void onChatEvent(ChatEvent e) { public void onChatEvent(ChatEvent e) {
if(!(e.getSender() instanceof ProxiedPlayer)) if(!(e.getSender() instanceof ProxiedPlayer))
@ -101,7 +94,7 @@ public class ChatListener extends BasicListener {
public static void sendChat(ChatSender sender, Stream<ChatSender> receivers, String format, ChatSender msgReceiver, String message) { public static void sendChat(ChatSender sender, Stream<ChatSender> receivers, String format, ChatSender msgReceiver, String message) {
SteamwarUser user = sender.user(); SteamwarUser user = sender.user();
final String coloredMessage = (user.prefix() != UserPerm.emptyPrefix || coloredTeams.contains(user.getTeam())) ? ChatColor.translateAlternateColorCodes('&', message) : message; final String coloredMessage = user.hasPerm(UserPerm.COLOR_CHAT) ? ChatColor.translateAlternateColorCodes('&', message) : message;
if(chatFilter(sender, coloredMessage)) if(chatFilter(sender, coloredMessage))
return; return;

Datei anzeigen

@ -134,8 +134,8 @@ BAN_UNTIL=§7You are §e§lbanned §euntil {0}§8: §e{1}
UNBAN_ERROR=§cThe player isn't banned. UNBAN_ERROR=§cThe player isn't banned.
UNBAN=§7You have §e§lunbanned §e{0}. UNBAN=§7You have §e§lunbanned §e{0}.
BAN_AVOIDING_ALERT=§cPotential ban bypass by §r{0}§c: §c BAN_AVOIDING_ALERT=§cPotential ban bypass by §r{0}§c: {1}
BAN_AVOIDING_LIST={0} §e{1} §c BAN_AVOIDING_LIST=§c{0} §e{1}
BAN_AVOIDING_BAN_HOVER=§cBan player because of bann bypass. BAN_AVOIDING_BAN_HOVER=§cBan player because of bann bypass.
MUTE_TEAM={0} §e{1} §7was §e§lmuted§7 by §e{2} {3}§8: §f{4} MUTE_TEAM={0} §e{1} §7was §e§lmuted§7 by §e{2} {3}§8: §f{4}

Datei anzeigen

@ -119,8 +119,8 @@ BAN_UNTIL=§7Du bist §ebis zum {0} §e§lgebannt§8. §7Grund§8: §e{1}
UNBAN_ERROR=§cDer Spieler ist nicht gebannt. UNBAN_ERROR=§cDer Spieler ist nicht gebannt.
UNBAN=§7Du hast §e{0} §e§lentbannt. UNBAN=§7Du hast §e{0} §e§lentbannt.
BAN_AVOIDING_ALERT=§cMögliche Bannumgehung durch §r{0}§c: §c BAN_AVOIDING_ALERT=§cMögliche Bannumgehung durch §r{0}§c: {1}
BAN_AVOIDING_LIST={0} §e{1} §c BAN_AVOIDING_LIST=§c{0} §e{1}
BAN_AVOIDING_BAN_HOVER=§cBanne Spieler wegen Bannumgehung BAN_AVOIDING_BAN_HOVER=§cBanne Spieler wegen Bannumgehung
MUTE_TEAM={0} §e{1} §7wurde von §e{2} {3} §e§lgemuted§8. §7Grund§8: §f{4} MUTE_TEAM={0} §e{1} §7wurde von §e{2} {3} §e§lgemuted§8. §7Grund§8: §f{4}