2011-04-21 20:56:19 +01:00
|
|
|
package org.bukkit;
|
|
|
|
|
|
|
|
/**
|
2014-01-14 23:16:04 -05:00
|
|
|
* Represents a countable statistic, which is tracked by the server.
|
2011-04-21 20:56:19 +01:00
|
|
|
*/
|
|
|
|
public enum Statistic {
|
2013-11-13 17:53:49 -07:00
|
|
|
DAMAGE_DEALT,
|
|
|
|
DAMAGE_TAKEN,
|
|
|
|
DEATHS,
|
|
|
|
MOB_KILLS,
|
|
|
|
PLAYER_KILLS,
|
|
|
|
FISH_CAUGHT,
|
2014-01-14 23:16:04 -05:00
|
|
|
ANIMALS_BRED,
|
|
|
|
TREASURE_FISHED,
|
|
|
|
JUNK_FISHED,
|
|
|
|
LEAVE_GAME,
|
|
|
|
JUMP,
|
|
|
|
DROP,
|
|
|
|
PLAY_ONE_TICK,
|
|
|
|
WALK_ONE_CM,
|
|
|
|
SWIM_ONE_CM,
|
|
|
|
FALL_ONE_CM,
|
|
|
|
CLIMB_ONE_CM,
|
|
|
|
FLY_ONE_CM,
|
|
|
|
DIVE_ONE_CM,
|
|
|
|
MINECART_ONE_CM,
|
|
|
|
BOAT_ONE_CM,
|
|
|
|
PIG_ONE_CM,
|
|
|
|
HORSE_ONE_CM,
|
|
|
|
MINE_BLOCK(Type.BLOCK),
|
|
|
|
USE_ITEM(Type.ITEM),
|
|
|
|
BREAK_ITEM(Type.ITEM),
|
|
|
|
CRAFT_ITEM(Type.ITEM),
|
|
|
|
KILL_ENTITY(Type.ENTITY),
|
|
|
|
ENTITY_KILLED_BY(Type.ENTITY);
|
2011-04-21 20:56:19 +01:00
|
|
|
|
2014-01-14 23:16:04 -05:00
|
|
|
private final Type type;
|
2011-04-21 20:56:19 +01:00
|
|
|
|
2013-11-13 17:53:49 -07:00
|
|
|
private Statistic() {
|
2014-01-14 23:16:04 -05:00
|
|
|
this(Type.UNTYPED);
|
2011-04-21 20:56:19 +01:00
|
|
|
}
|
2011-05-14 23:22:54 +02:00
|
|
|
|
2014-01-14 23:16:04 -05:00
|
|
|
private Statistic(Type type) {
|
|
|
|
this.type = type;
|
2011-04-21 20:56:19 +01:00
|
|
|
}
|
|
|
|
|
2014-01-14 23:16:04 -05:00
|
|
|
/**
|
|
|
|
* Gets the type of this statistic.
|
|
|
|
*
|
|
|
|
* @return the type of this statistic
|
|
|
|
*/
|
|
|
|
public Type getType() {
|
|
|
|
return type;
|
2011-04-21 20:56:19 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Checks if this is a substatistic.
|
2013-04-02 00:11:22 -04:00
|
|
|
* <p>
|
2014-01-14 23:16:04 -05:00
|
|
|
* A substatistic exists en masse for each block, item, or entitytype, depending on
|
|
|
|
* {@link #getType()}.
|
|
|
|
* <p>
|
|
|
|
* This is a redundant method and equivalent to checking
|
|
|
|
* <code>getType() != Type.UNTYPED</code>
|
2011-04-21 20:56:19 +01:00
|
|
|
*
|
|
|
|
* @return true if this is a substatistic
|
|
|
|
*/
|
|
|
|
public boolean isSubstatistic() {
|
2014-01-14 23:16:04 -05:00
|
|
|
return type != Type.UNTYPED;
|
2011-04-21 20:56:19 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2014-01-14 23:16:04 -05:00
|
|
|
* Checks if this is a substatistic dealing with blocks.
|
|
|
|
* <p>
|
|
|
|
* This is a redundant method and equivalent to checking
|
|
|
|
* <code>getType() == Type.BLOCK</code>
|
2011-04-21 20:56:19 +01:00
|
|
|
*
|
2014-01-14 23:16:04 -05:00
|
|
|
* @return true if this deals with blocks
|
2011-04-21 20:56:19 +01:00
|
|
|
*/
|
|
|
|
public boolean isBlock() {
|
2014-01-14 23:16:04 -05:00
|
|
|
return type == Type.BLOCK;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* The type of statistic.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
public enum Type {
|
|
|
|
/**
|
|
|
|
* Statistics of this type do not require a qualifier.
|
|
|
|
*/
|
|
|
|
UNTYPED,
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Statistics of this type require an Item Material qualifier.
|
|
|
|
*/
|
|
|
|
ITEM,
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Statistics of this type require a Block Material qualifier.
|
|
|
|
*/
|
|
|
|
BLOCK,
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Statistics of this type require an EntityType qualifier.
|
|
|
|
*/
|
|
|
|
ENTITY;
|
2011-04-21 20:56:19 +01:00
|
|
|
}
|
|
|
|
}
|