Refactor V2 Auth

This commit is contained in:
2025-02-23 17:24:14 +01:00
parent b045f16160
commit a2b3661605
6 changed files with 60 additions and 182 deletions
@@ -42,6 +42,7 @@ import de.steamwar.velocitycore.network.NetworkSender;
import java.util.Arrays;
import java.util.List;
import java.util.Set;
import java.util.concurrent.TimeUnit;
import java.util.logging.Level;
import java.util.logging.Logger;
@@ -53,6 +54,8 @@ public class ChatListener extends BasicListener {
private static final List<String> rankedModes = ArenaMode.getAllModes().stream().filter(ArenaMode::isRanked).map(ArenaMode::getSchemTypeOrInternalName).toList();
private static final Set<String> noLogCommands = Set.of("webpw", "webpassword");
@Subscribe(order = PostOrder.FIRST)
public void fixCommands(CommandExecuteEvent e) {
String command = e.getCommand();
@@ -73,7 +76,8 @@ public class ChatListener extends BasicListener {
public void logCommands(CommandExecuteEvent e) {
String command = e.getCommand();
int space = command.indexOf(' ');
if(VelocityCore.getProxy().getCommandManager().hasCommand(space != -1 ? command.substring(0, space) : command)) {
String cmd = space != -1 ? command.substring(0, space) : command;
if(VelocityCore.getProxy().getCommandManager().hasCommand(cmd)) {
CommandSource source = e.getCommandSource();
String name;
if(source instanceof Player player)
@@ -83,6 +87,10 @@ public class ChatListener extends BasicListener {
else
name = source.toString();
if (noLogCommands.contains(cmd)) {
return;
}
cmdLogger.log(Level.INFO, "%s -> executed command /%s".formatted(name, command));
} else if (e.getCommandSource() instanceof Player player) {
// System.out.println("spoofChatInput " + e);