Sueta
FO

ForgeModBlocker for Bungee

1.1

A Free Mod Blocker for Bungee, an alternative to all the paid ones.

·Plugin

This is a fork of Mas' ForgeModBlocker plugin ( https://github.com/Mas281/ForgeModBlocker) which only works for Spigot. This is a Bungee plugin with the same functionality.

Link to original resource: https://www.spigotmc.org/resources/forgemodblocker.45220/

Permissions are the same, however it is using Bungee permissions and not player permissions.

In order to implement the mod list into a plugin, you need to listen for plugin messages on the FMB|ML channel. The mod list is sent one second after the player joins a server.

ModList Method
public class ModListListener implements PluginMessageListener, Listener {

    private final JavaPlugin plugin;

    public ModListListener(JavaPlugin plugin) {
        this.plugin = plugin;
        plugin.getServer().getPluginManager().registerEvents(this, plugin);
        plugin.getServer().getMessenger().registerIncomingPluginChannel(plugin, "FMB|ML", this);
    }

    @Override
    public void onPluginMessageReceived(String channel, Player player, byte[] data) {
        if (channel.equalsIgnoreCase("FMB|ML")) {
            PlayerData playerData = plugin.getPlayerDataManager().getData(player);

            boolean store = false;
            String tempName = null;

            for (int i = 2; i < data.length; store = !store) {
                int end = i + data[i] + 1;
                byte[] range = Arrays.copyOfRange(data, i + 1, end);

                String string = new String(range);

                if (store) {
                    playerData.addMod(tempName, string);
                } else {
                    tempName = string;
                }

                i = end;
            }

        }
    }
}

Similar projects

Plugin →