@@ -0,0 +1,2027 @@
+package fr.aumgn.motd.provider;%0A%0Aimport java.util.ArrayList;%0Aimport java.util.List;%0A%0Aimport org.bukkit.configuration.ConfigurationSection;%0A%0Aimport fr.aumgn.motd.MotdsProvider;%0A%0Apublic class ConfigProvider implements MotdsProvider %7B%0A%0A    private class Motd %7B%0A        public String content;%0A        public int weight;%0A    %7D%0A%0A    private Motd%5B%5D motds;%0A    private int totalSize;%0A%0A    public ConfigProvider(ConfigurationSection section) %7B%0A        load(section);%0A    %7D%0A%0A    public void load(ConfigurationSection section) %7B%0A        List%3CMotd%3E motdsList = new ArrayList%3CMotd%3E();%0A        for (String key : section.getKeys(false)) %7B%0A            if (section.isString(key)) %7B%0A                motdsList.add(createMotd(section.getString(key)));%0A            %7D else if (section.isConfigurationSection(key)) %7B%0A                ConfigurationSection motdSection = section.getConfigurationSection(key);%0A                if (motdSection.isString(%22content%22)) %7B%0A                    String content = motdSection.getString(%22content%22);%0A                    if (section.isInt(%22weight%22)) %7B%0A                        motdsList.add(createMotd(content, section.getInt(%22weight%22)));%0A                    %7D else %7B%0A                        motdsList.add(createMotd(content));%0A                    %7D%0A                %7D                %0A            %7D%0A        %7D%0A        motds = (Motd%5B%5D) motdsList.toArray();%0A    %7D%0A%0A    private Motd createMotd(String content, int weight) %7B%0A        Motd motd = new Motd();%0A        motd.content = content;%0A        motd.weight = weight;%0A        totalSize += weight;%0A        return motd;%0A    %7D%0A%0A    private Motd createMotd(String content) %7B%0A        return createMotd(content, 1);%0A    %7D%0A%0A    @Override%0A    public int size() %7B%0A        return totalSize;%0A    %7D%0A%0A    @Override%0A    public String get(int index) %7B%0A        int i = index;%0A        for (Motd motd : motds) %7B%0A            if (i %3C motd.weight) %7B%0A                return motd.content;%0A            %7D else %7B%0A                i -= motd.weight;%0A            %7D%0A        %7D%0A        return null;%0A    %7D%0A%0A%7D%0A

Add default ConfigProvider