mirror of
https://github.com/PaperMC/Paper.git
synced 2025-08-09 00:22:08 -07:00
@@ -1,53 +1,35 @@
|
||||
package org.bukkit;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import com.google.common.collect.Maps;
|
||||
|
||||
/**
|
||||
* Represents a countable statistic, which is collected by the client
|
||||
*/
|
||||
public enum Statistic {
|
||||
DAMAGE_DEALT(2020),
|
||||
DAMAGE_TAKEN(2021),
|
||||
DEATHS(2022),
|
||||
MOB_KILLS(2023),
|
||||
PLAYER_KILLS(2024),
|
||||
FISH_CAUGHT(2025),
|
||||
MINE_BLOCK(16777216, true),
|
||||
USE_ITEM(6908288, false),
|
||||
BREAK_ITEM(16973824, true);
|
||||
DAMAGE_DEALT,
|
||||
DAMAGE_TAKEN,
|
||||
DEATHS,
|
||||
MOB_KILLS,
|
||||
PLAYER_KILLS,
|
||||
FISH_CAUGHT,
|
||||
MINE_BLOCK(true),
|
||||
USE_ITEM(false),
|
||||
BREAK_ITEM(true);
|
||||
|
||||
private final static Map<Integer, Statistic> BY_ID = Maps.newHashMap();
|
||||
private final int id;
|
||||
private final boolean isSubstat;
|
||||
private final boolean isBlock;
|
||||
|
||||
private Statistic(int id) {
|
||||
this(id, false, false);
|
||||
private Statistic() {
|
||||
this(false, false);
|
||||
}
|
||||
|
||||
private Statistic(int id, boolean isBlock) {
|
||||
this(id, true, isBlock);
|
||||
private Statistic(boolean isBlock) {
|
||||
this(true, isBlock);
|
||||
}
|
||||
|
||||
private Statistic(int id, boolean isSubstat, boolean isBlock) {
|
||||
this.id = id;
|
||||
private Statistic(boolean isSubstat, boolean isBlock) {
|
||||
this.isSubstat = isSubstat;
|
||||
this.isBlock = isBlock;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the ID for this statistic.
|
||||
*
|
||||
* @return ID of this statistic
|
||||
* @deprecated Magic value
|
||||
*/
|
||||
@Deprecated
|
||||
public int getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if this is a substatistic.
|
||||
* <p>
|
||||
@@ -67,22 +49,4 @@ public enum Statistic {
|
||||
public boolean isBlock() {
|
||||
return isSubstat && isBlock;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the statistic associated with the given ID.
|
||||
*
|
||||
* @param id ID of the statistic to return
|
||||
* @return statistic with the given ID
|
||||
* @deprecated Magic value
|
||||
*/
|
||||
@Deprecated
|
||||
public static Statistic getById(int id) {
|
||||
return BY_ID.get(id);
|
||||
}
|
||||
|
||||
static {
|
||||
for (Statistic statistic : values()) {
|
||||
BY_ID.put(statistic.id, statistic);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user