Basculer le menu
Changer de menu des préférences
Basculer le menu personnel
Non connecté(e)
Votre adresse IP sera visible au public si vous faites des modifications.

« Module:Infobox/Configs/Plugin » : différence entre les versions

De Nefald
Hiob (discussion | contributions)
correction type
Hiob (discussion | contributions)
Aucun résumé des modifications
Ligne 19 : Ligne 19 :
         return nil
         return nil
     end,
     end,
    -- Configuration du champ "type" (utilisée par le Core)
    typeField = {
        required = true,
        allowedValues = {
            ['économie'] = {
                display = 'Économie',
                category = 'Plugins d\'économie'
            },
            ['pvp'] = {
                display = 'PvP',
                category = 'Plugins de PvP'
            },
            ['roleplay'] = {
                display = 'Roleplay',
                category = 'Plugins de roleplay'
            },
            ['administration'] = {
                display = 'Administration',
                category = 'Plugins d\'administration'
            },
            ['protection'] = {
                display = 'Protection',
                category = 'Plugins de protection'
            },
            ['cosmétique'] = {
                display = 'Cosmétique',
                category = 'Plugins cosmétiques'
            },
            ['communication'] = {
                display = 'Communication',
                category = 'Plugins de communication'
            },
            ['utilitaire'] = {
                display = 'Utilitaire',
                category = 'Plugins utilitaires'
            },
            ['mini-jeu'] = {
                display = 'Mini-jeu',
                category = 'Plugins de mini-jeux'
            },
            ['monde'] = {
                display = 'Monde',
                category = 'Plugins de monde'
            },
            ['inventaire'] = {
                display = 'Inventaire',
                category = 'Plugins d\'inventaire'
            },
            ['transport'] = {
                display = 'Transport',
                category = 'Plugins de transport'
            },
            ['magie'] = {
                display = 'Magie',
                category = 'Plugins de magie'
            },
            ['mob'] = {
                display = 'Mob',
                category = 'Plugins de mobs'
            }
        },
        errorMessage = 'Type de plugin non reconnu. Types autorisés : économie, pvp, roleplay, administration, protection, cosmétique, communication, utilitaire, mini-jeu, monde, inventaire, transport, magie, mob'
    },


     sections = {
     sections = {
         {
         {
             champs = {
             champs = {
                 { cle = 'type', label = 'Type' },
                 { cle = 'type', label = 'Type',
                  process = function(value, args)
                    local types = {
                        ['économie'] = 'Économie',
                        ['pvp'] = 'PvP',
                        ['roleplay'] = 'Roleplay',
                        ['administration'] = 'Administration',
                        ['protection'] = 'Protection',
                        ['cosmétique'] = 'Cosmétique',
                        ['communication'] = 'Communication',
                        ['utilitaire'] = 'Utilitaire',
                        ['mini-jeu'] = 'Mini-jeu',
                        ['monde'] = 'Monde',
                        ['inventaire'] = 'Inventaire',
                        ['transport'] = 'Transport',
                        ['magie'] = 'Magie',
                        ['mob'] = 'Mob'
                    }
                    return types[value] or value
                  end
                },
                 { cle = 'dev', label = 'Développeur' },
                 { cle = 'dev', label = 'Développeur' },
                 { cle = 'status', label = 'Statut' },
                 { cle = 'status', label = 'Statut' },
Ligne 96 : Ligne 52 :
             titre = 'Téléchargements',
             titre = 'Téléchargements',
             champs = {
             champs = {
                 { cle = 'bukkit', label = 'Bukkit' },
                 { cle = 'bukkit', label = 'Bukkit',
                 { cle = 'hangar', label = 'Hangar (PaperMC)' },
                  process = function(value)
                 { cle = 'modrinth', label = 'Modrinth' },
                    return value and '[https://dev.bukkit.org/projects/' .. value .. ' Bukkit]' or nil
                 { cle = 'builtbybit', label = 'BuiltByBit' },
                  end
                 { cle = 'spigot', label = 'Spigot' },
                },
                 { cle = 'hangar', label = 'Hangar (PaperMC)',
                  process = function(value)
                    return value and '[https://hangar.papermc.io/projects/' .. value .. ' Hangar]' or nil
                  end
                },
                 { cle = 'modrinth', label = 'Modrinth',
                  process = function(value)
                    return value and '[https://modrinth.com/plugin/' .. value .. ' Modrinth]' or nil
                  end
                },
                 { cle = 'builtbybit', label = 'BuiltByBit',
                  process = function(value)
                    return value and '[https://builtbybit.com/resources/' .. value .. ' BuiltByBit]' or nil
                  end
                },
                 { cle = 'spigot', label = 'Spigot',
                  process = function(value)
                    return value and '[https://www.spigotmc.org/resources/' .. value .. ' Spigot]' or nil
                  end
                },
                 { cle = 'sources', label = 'Code source' }
                 { cle = 'sources', label = 'Code source' }
             }
             }
Ligne 111 : Ligne 87 :
             }
             }
         }
         }
     }
     },
 
    -- Ajout des catégories automatiques selon le type
    categories = function(args, config, frame)
        local cats = {}
       
        -- Catégorie générale
        table.insert(cats, 'Plugins Minecraft')
       
        -- Catégorie selon le type
        if args.type then
            local typeCategories = {
                ['économie'] = 'Plugins d\'économie',
                ['pvp'] = 'Plugins de PvP',
                ['roleplay'] = 'Plugins de roleplay',
                ['administration'] = 'Plugins d\'administration',
                ['protection'] = 'Plugins de protection',
                ['cosmétique'] = 'Plugins cosmétiques',
                ['communication'] = 'Plugins de communication',
                ['utilitaire'] = 'Plugins utilitaires',
                ['mini-jeu'] = 'Plugins de mini-jeux',
                ['monde'] = 'Plugins de monde',
                ['inventaire'] = 'Plugins d\'inventaire',
                ['transport'] = 'Plugins de transport',
                ['magie'] = 'Plugins de magie',
                ['mob'] = 'Plugins de mobs'
            }
            if typeCategories[args.type] then
                table.insert(cats, typeCategories[args.type])
            end
        end
       
        return cats
    end
}
}


return config
return config

Version du 1 octobre 2025 à 12:55

La documentation pour ce module peut être créée à Module:Infobox/Configs/Plugin/doc

local config = {
    titre = function(args) 
        return args.nom or '{{PAGENAME}}' 
    end,
    
    icone = {
        type = 'fas',
        nom = 'puzzle-piece'
    },
    
    image = function(args) 
        if args.image then
            return {
                nom = args.image,
                taille = args.tailleimage or "280x200px",
                legende = args.legende or args.nom or '{{PAGENAME}}'
            }
        end
        return nil
    end,

    sections = {
        {
            champs = {
                { cle = 'type', label = 'Type', 
                  process = function(value, args)
                    local types = {
                        ['économie'] = 'Économie',
                        ['pvp'] = 'PvP', 
                        ['roleplay'] = 'Roleplay',
                        ['administration'] = 'Administration',
                        ['protection'] = 'Protection',
                        ['cosmétique'] = 'Cosmétique',
                        ['communication'] = 'Communication',
                        ['utilitaire'] = 'Utilitaire',
                        ['mini-jeu'] = 'Mini-jeu',
                        ['monde'] = 'Monde',
                        ['inventaire'] = 'Inventaire',
                        ['transport'] = 'Transport',
                        ['magie'] = 'Magie',
                        ['mob'] = 'Mob'
                    }
                    return types[value] or value
                  end
                },
                { cle = 'dev', label = 'Développeur' },
                { cle = 'status', label = 'Statut' },
                { cle = 'grade', label = 'Grade requis' }
            }
        },
        {
            titre = 'Téléchargements',
            champs = {
                { cle = 'bukkit', label = 'Bukkit',
                  process = function(value) 
                    return value and '[https://dev.bukkit.org/projects/' .. value .. ' Bukkit]' or nil 
                  end
                },
                { cle = 'hangar', label = 'Hangar (PaperMC)',
                  process = function(value) 
                    return value and '[https://hangar.papermc.io/projects/' .. value .. ' Hangar]' or nil 
                  end
                },
                { cle = 'modrinth', label = 'Modrinth',
                  process = function(value) 
                    return value and '[https://modrinth.com/plugin/' .. value .. ' Modrinth]' or nil 
                  end
                },
                { cle = 'builtbybit', label = 'BuiltByBit',
                  process = function(value) 
                    return value and '[https://builtbybit.com/resources/' .. value .. ' BuiltByBit]' or nil 
                  end
                },
                { cle = 'spigot', label = 'Spigot',
                  process = function(value) 
                    return value and '[https://www.spigotmc.org/resources/' .. value .. ' Spigot]' or nil 
                  end
                },
                { cle = 'sources', label = 'Code source' }
            }
        },
        {
            titre = 'Compatibilité',
            champs = {
                { cle = 'dépendance', label = 'Dépendances' },
                { cle = 'compatibilité', label = 'Compatible avec' }
            }
        }
    },

    -- Ajout des catégories automatiques selon le type
    categories = function(args, config, frame)
        local cats = {}
        
        -- Catégorie générale
        table.insert(cats, 'Plugins Minecraft')
        
        -- Catégorie selon le type
        if args.type then
            local typeCategories = {
                ['économie'] = 'Plugins d\'économie',
                ['pvp'] = 'Plugins de PvP',
                ['roleplay'] = 'Plugins de roleplay',
                ['administration'] = 'Plugins d\'administration',
                ['protection'] = 'Plugins de protection',
                ['cosmétique'] = 'Plugins cosmétiques',
                ['communication'] = 'Plugins de communication',
                ['utilitaire'] = 'Plugins utilitaires',
                ['mini-jeu'] = 'Plugins de mini-jeux',
                ['monde'] = 'Plugins de monde',
                ['inventaire'] = 'Plugins d\'inventaire',
                ['transport'] = 'Plugins de transport',
                ['magie'] = 'Plugins de magie',
                ['mob'] = 'Plugins de mobs'
            }
            if typeCategories[args.type] then
                table.insert(cats, typeCategories[args.type])
            end
        end
        
        return cats
    end
}

return config