aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/cc/polyfrost/oneconfig/config/data/Mod.java
blob: c7e86cdb78c864d1ec95266266603651dc66b1ef (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
package cc.polyfrost.oneconfig.config.data;

import cc.polyfrost.oneconfig.config.interfaces.Config;

import java.util.ArrayList;

public class Mod {
    public final String name;
    public final ModType modType;
    public final String creator;
    public final String version;
    public Config config;
    public final OptionPage defaultPage;
    public boolean isShortCut = false;
    private static final ArrayList<Mod> mods = new ArrayList<>();

    /**
     * @param name    Friendly name of the mod
     * @param modType Type of the mod (for example ModType.QOL)
     * @param creator Creator of the mod
     * @param version Version of the mod
     */
    public Mod(String name, ModType modType, String creator, String version) {
        int i = 1;
        for (Mod mod : mods) {
            if (mod.name.startsWith(name)) {
                ++i;
                name = name + " " + i;
            }
        }
        this.name = name;
        this.modType = modType;
        this.creator = creator;
        this.version = version;
        this.defaultPage = new OptionPage(name, this);
        mods.add(this);
    }
}