aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/io/github/moulberry/repo/constants/Enchants.java
blob: 84e5761fc7a39065b9071c16f26ee39c06626fcd (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 io.github.moulberry.repo.constants;

import com.google.gson.annotations.SerializedName;
import lombok.Getter;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;

public class Enchants {

    @Getter
    @SerializedName("enchants")
    Map<String, List<String>> availableEnchants;

    @Getter
    @SerializedName("enchant_pools")
    List<List<String>> enchantPools;

    @Getter
    @SerializedName("enchants_xp_cost")
    Map<String, List<Integer>> enchantExperienceCost;

    public List<String> getAvailableEnchants(String tooltype) {
        return availableEnchants.get(tooltype);
    }

    public List<String> getConflictingEnchants(String enchant) {
        List<String> conflicts = new ArrayList<>();
        for (List<String> enchantPool : enchantPools) {
            if (enchantPool.contains(enchant)) {
                conflicts.addAll(enchantPool);
                conflicts.remove(enchant);
            }
        }
        return conflicts;
    }
}