Requesting for a simple mod/plugin that checks what mods the player has when they join and kick them or not allow them to join if they have a mod in the config’s blacklist, eg. xray. Also logging all mods that players have when joining
I don’t think this is possible with the sponge api.
Forge however, does send a list of client mods to the server. I don’t know how to hook into this though…
With Forge you could write :
public static Optional<Map<String, String>> getModList(Player p) {
try {
return Optional.of(net.minecraftforge.fml.common.network.handshake.NetworkDispatcher.get(
((net.minecraft.entity.player.EntityPlayerMP) p).playerNetServerHandler.netManager).getModList());
} catch (Throwable t) {
return Optional.empty();
}
}
Without Forge, you should listen to some packet during client’s connection
Warning : Using custom mods, the client can send a fake list of mods
I think you mean “can”
Yes, I corrected. Thank.
You can also create a mod and in the mod file use:
@NetworkCheckHandler
public static void onConnection(Map<String, String> mods, Side from) {
//do something you want to
}
Any information sent to the server can be faked. There is no way to tell if a client is using a blacklisted mod.
As @pie_flavor has said, the list of mods sent to the server isn’t really useful for enforcing a blacklist. Any cheat or hack worth worying about isn’t going to allow its existence to be broadcasted through the normal FML handshake.
Yes, there’s even some mods faking md5 of mod files on the client… Like this one.
Well I guess there’s no way to avoid cheats on a server then, as of now
You can still use some plugins to find out whether some players have some weird actions, like very high diamond finding rate in mining. You can still use those ways of anti cheat, as they could block most stupid cheaters. After all, the most useful is always to use operators to find out hacks and punish them.
So is this possible after all?
No:
The alternative would be:
But I haven’t seen a plugin like this on Sponge yet.
Edit: That looks good Experimental AntiCheat Plugin - Guardian, by Connor Hartley