[Free] Bungee Mod Blocker

Status
This thread has been locked.
PebbleHost
High performance, consistent uptime and fast support. Minecraft hosting that just works.

Morals

Feedback score
1
Posts
97
Reactions
32
Resources
1
Download from here until the resource is approved, a simple API has been added.
Code:
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;
            }

        }
    }
}
 
Last edited:
Status
This thread has been locked.
Top