From 8029dd09e99b2bc4d10eec7c54b84089e27f001a Mon Sep 17 00:00:00 2001 From: Lixfel Date: Mon, 11 Mar 2024 22:29:22 +0100 Subject: [PATCH] Fix Node debug code changes, Debug messages, script_syntax, Signed-off-by: Lixfel --- src/de/steamwar/bungeecore/Node.java | 7 +------ src/de/steamwar/bungeecore/listeners/IPSanitizer.java | 4 ++-- src/de/steamwar/bungeecore/listeners/PluginMessage.java | 8 +++++--- src/de/steamwar/bungeecore/mods/LabyMod.java | 5 ++++- 4 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src/de/steamwar/bungeecore/Node.java b/src/de/steamwar/bungeecore/Node.java index b7b244cd..eb132e20 100644 --- a/src/de/steamwar/bungeecore/Node.java +++ b/src/de/steamwar/bungeecore/Node.java @@ -22,10 +22,7 @@ package de.steamwar.bungeecore; import net.md_5.bungee.BungeeCord; import net.md_5.bungee.api.ProxyServer; -import java.io.BufferedReader; -import java.io.File; -import java.io.IOException; -import java.io.InputStreamReader; +import java.io.*; import java.nio.file.Files; import java.util.*; import java.util.concurrent.TimeUnit; @@ -122,8 +119,6 @@ public abstract class Node { cmd.add(worldDir); cmd.add("--level-name"); cmd.add(levelName); - cmd.add("--plugins"); - cmd.add("/home/lixfel/bpl"); cmd.add("--port"); cmd.add(String.valueOf(port)); cmd.add("nogui"); diff --git a/src/de/steamwar/bungeecore/listeners/IPSanitizer.java b/src/de/steamwar/bungeecore/listeners/IPSanitizer.java index 50c3ee2e..9396a27d 100644 --- a/src/de/steamwar/bungeecore/listeners/IPSanitizer.java +++ b/src/de/steamwar/bungeecore/listeners/IPSanitizer.java @@ -56,11 +56,11 @@ public class IPSanitizer extends BasicListener { } - private final InetSocketAddress inetSocketAddress = new InetSocketAddress("127.127.127.127", 25565); + private final InetSocketAddress sanitized = new InetSocketAddress("127.127.127.127", 25565); @EventHandler public void loginEvent(LoginEvent e) { BungeeCore.get().getLogger().log(Level.INFO, e.getConnection().getSocketAddress() + " has logged in with user name " + e.getConnection().getName()); - getChannelWrapper(e.getConnection()).setRemoteAddress(inetSocketAddress); + getChannelWrapper(e.getConnection()).setRemoteAddress(sanitized); } } diff --git a/src/de/steamwar/bungeecore/listeners/PluginMessage.java b/src/de/steamwar/bungeecore/listeners/PluginMessage.java index 3246e055..64e70597 100644 --- a/src/de/steamwar/bungeecore/listeners/PluginMessage.java +++ b/src/de/steamwar/bungeecore/listeners/PluginMessage.java @@ -86,6 +86,8 @@ public class PluginMessage extends BasicListener { knownChannels.add("forge:login"); knownChannels.add("forge:handshake"); + knownChannels.add(ApolloManager.PLUGIN_MESSAGE_CHANNEL); + knownChannels.add("Replay|Restrict"); knownChannels.add("replaymod:restrict"); knownChannels.add("WDL|CONTROL"); @@ -100,7 +102,6 @@ public class PluginMessage extends BasicListener { register("MC|Brand", false, directional(this::steamWarBrand, this::userBrand)); register("minecraft:brand", false, directional(this::steamWarBrand, this::userBrand)); - register("sw:script_syntax", false, directional(onlySWSource(PASS_THROUGH), UNKNOWN)); register("sw:bridge", false, directional(onlySWSource(async(event -> NetworkPacket.handle(new ServerMetaInfo(((Server) event.getSender()).getInfo()), event.getData()))), UNKNOWN)); register("worldedit:cui", false, PASS_THROUGH); register("fabricmodsender:mods", true, directional(UNKNOWN, fabricModSender::handlePluginMessage)); @@ -115,6 +116,9 @@ public class PluginMessage extends BasicListener { register("labymod3:main", true, directional(UNKNOWN, async(labyMod::handlePluginMessage))); register(FML.CHANNEL, true, directional(UNKNOWN, async(fml::handlePluginMessage))); + //vanilla does not register any channels (sends only one minecraft:brand vanilla, nothing else (potential spoofed client detection)) + //meteor https://github.com/MeteorDevelopment/meteor-client/blob/master/src/main/java/meteordevelopment/meteorclient/systems/modules/misc/ServerSpoof.java https://github.com/MeteorDevelopment/meteor-client/blob/master/src/main/java/meteordevelopment/meteorclient/systems/modules/misc/DiscordPresence.java + //feather:client https://github.com/Koupah/Feather-Client-API/blob/main/src/club/koupah/feather/handler/FeatherHandler.java //litematica/malilib https://github.com/maruohon/litematica/issues/75 https://github.com/maruohon/malilib/blob/liteloader_1.12.2/src/main/java/malilib/network/message/ConfigLockPacketHandler.java#L65 } @@ -122,8 +126,6 @@ public class PluginMessage extends BasicListener { public void onPluginMessage(PluginMessageEvent event) { event.setCancelled(true); - BungeeCore.get().getLogger().log(Level.INFO, event + "\n" + new String(event.getData()) + "\n" + Arrays.toString(event.getData())); //TODO remove logging - try { handlers.getOrDefault(event.getTag(), UNKNOWN).handle(event); } catch (Exception e) { diff --git a/src/de/steamwar/bungeecore/mods/LabyMod.java b/src/de/steamwar/bungeecore/mods/LabyMod.java index ed2ae223..1114adc6 100644 --- a/src/de/steamwar/bungeecore/mods/LabyMod.java +++ b/src/de/steamwar/bungeecore/mods/LabyMod.java @@ -22,6 +22,7 @@ package de.steamwar.bungeecore.mods; import com.google.gson.JsonElement; import com.google.gson.JsonObject; import com.google.gson.JsonParser; +import de.steamwar.bungeecore.BungeeCore; import de.steamwar.sql.Mod; import io.netty.buffer.ByteBuf; import io.netty.buffer.Unpooled; @@ -31,6 +32,7 @@ import net.md_5.bungee.protocol.DefinedPacket; import java.util.LinkedList; import java.util.List; +import java.util.logging.Level; public class LabyMod { // https://docs.labymod.net/pages/server/introduction/ @@ -71,9 +73,10 @@ public class LabyMod { } if(message.has("mods")) { + BungeeCore.get().getLogger().log(Level.WARNING, () -> "LabyMod External Mods for debugging: " + message.getAsJsonArray("mods")); for(JsonElement element : message.getAsJsonArray("mods")) { JsonObject addon = element.getAsJsonObject(); - //TODO observer, FORGE and FABRIC mods available, do they always and with .jar? (would equal new mod platform) + //TODO observe: FORGE and FABRIC mods available, do they always and with .jar? (would equal new mod platform) //mods.add(Mod.getOrCreate(addon.get("name").getAsString().replace(".jar", ""), Mod.Platform.FORGE)); } }