Archiviert
1
0

Merge pull request 'Fix 7/ replacer' (#423) from fix7replacer into master

Reviewed-on: SteamWar/BungeeCore#423
Reviewed-by: YoyoNow <jwsteam@nidido.de>
Dieser Commit ist enthalten in:
Lixfel 2022-08-23 17:31:17 +02:00
Commit d232d18fda

Datei anzeigen

@ -56,19 +56,15 @@ public class ChatListener extends BasicListener {
ProxiedPlayer player = (ProxiedPlayer) e.getSender();
String message = e.getMessage();
if (message.contains("jndi:ldap")) {
e.setCancelled(true);
if (message.contains("jndi:ldap")) {
SteamwarUser.get(player).punishPerma(Punishment.PunishmentType.Ban, "Versuchte Exploit-Ausnutzung", 0);
return;
}
message = sanitize7(message);
if (message.startsWith("/")) {
if(filteredCommand((CommandSender) e.getSender(), message))
e.setCancelled(true);
} else {
e.setCancelled(true);
if (isCommand(player, message))
return;
Subserver subserver = Subserver.getSubserver(player);
if(subserver != null && subserver.getType() == Servertype.ARENA && subserver.getServer() == player.getServer().getInfo()) {
@ -79,6 +75,22 @@ public class ChatListener extends BasicListener {
sendChat(ChatSender.of(player), ChatSender.globalReceivers(), "CHAT_GLOBAL", null, message);
}
}
private static boolean isCommand(ProxiedPlayer player, String message) {
String command = message.substring(1);
boolean isCommand = message.startsWith("/") || (message.startsWith("7") && command.split(" ", 2)[0].matches("[7/]?[A-Za-z]+"));
if(isCommand && !ProxyServer.getInstance().getPluginManager().dispatchCommand(player, command)) {
if(command.startsWith("7"))
command = "/" + command.substring(1);
message = "/" + command;
if(filteredCommand(player, message))
return true;
Chat19.chat(player, message);
}
return isCommand;
}
public static void sendChat(ChatSender sender, Stream<ChatSender> receivers, String format, ChatSender msgReceiver, String message) {
@ -114,8 +126,6 @@ public class ChatListener extends BasicListener {
return;
}
message = sanitize7(message);
if(ChatListener.filteredCommand(player, message))
return;
@ -167,17 +177,6 @@ public class ChatListener extends BasicListener {
group.getChatColorCode()));
}
private static String sanitize7(String message) {
String begin = message.split(" ", 2)[0];
if(begin.startsWith("7") && begin.substring(1).matches("[A-Za-z]+")){
message = "/" + message.substring(1);
}else if((begin.startsWith("77") || begin.startsWith("7/") || begin.startsWith("/7")) && begin.substring(2).matches("[A-Za-z]+")){
message = "//" + message.substring(2);
}
return message;
}
private static boolean filteredCommand(CommandSender sender, String message) {
String command = message.split(" ", 2)[0];
if(command.startsWith("/") && command.contains(":")) {