Represents a countable statistic, which is collected by the client
| 7 | * Represents a countable statistic, which is collected by the client |
| 8 | */ |
| 9 | public enum Statistic { |
| 10 | DAMAGE_DEALT(2020), |
| 11 | DAMAGE_TAKEN(2021), |
| 12 | DEATHS(2022), |
| 13 | MOB_KILLS(2023), |
| 14 | PLAYER_KILLS(2024), |
| 15 | FISH_CAUGHT(2025), |
| 16 | MINE_BLOCK(16777216, true), |
| 17 | USE_ITEM(6908288, false), |
| 18 | BREAK_ITEM(16973824, true); |
| 19 | |
| 20 | private final static Map<Integer, Statistic> statistics = new HashMap<Integer, Statistic>(); |
| 21 | private final int id; |
| 22 | private final boolean isSubstat; |
| 23 | private final boolean isBlock; |
| 24 | |
| 25 | private Statistic(int id) { |
| 26 | this(id, false, false); |
| 27 | } |
| 28 | |
| 29 | private Statistic(int id, boolean isBlock) { |
| 30 | this(id, true, isBlock); |
| 31 | } |
| 32 | |
| 33 | private Statistic(int id, boolean isSubstat, boolean isBlock) { |
| 34 | this.id = id; |
| 35 | this.isSubstat = isSubstat; |
| 36 | this.isBlock = isBlock; |
| 37 | } |
| 38 | |
| 39 | /** |
| 40 | * Gets the ID for this statistic. |
| 41 | * |
| 42 | * @return ID of this statistic |
| 43 | */ |
| 44 | public int getId() { |
| 45 | return id; |
| 46 | } |
| 47 | |
| 48 | /** |
| 49 | * Checks if this is a substatistic. |
| 50 | * |
| 51 | * A substatistic exists in mass for each block or item, depending on {@link #isBlock()} |
| 52 | * |
| 53 | * @return true if this is a substatistic |
| 54 | */ |
| 55 | public boolean isSubstatistic() { |
| 56 | return isSubstat; |
| 57 | } |
| 58 | |
| 59 | /** |
| 60 | * Checks if this is a substatistic dealing with blocks (As opposed to items) |
| 61 | * |
| 62 | * @return true if this deals with blocks, false if with items |
| 63 | */ |
| 64 | public boolean isBlock() { |
| 65 | return isSubstat && isBlock; |
| 66 | } |