001 package org.bukkit;
002
003 /**
004 * Represents a countable statistic, which is tracked by the server.
005 */
006 public enum Statistic {
007 DAMAGE_DEALT,
008 DAMAGE_TAKEN,
009 DEATHS,
010 MOB_KILLS,
011 PLAYER_KILLS,
012 FISH_CAUGHT,
013 ANIMALS_BRED,
014 TREASURE_FISHED,
015 JUNK_FISHED,
016 LEAVE_GAME,
017 JUMP,
018 DROP,
019 PLAY_ONE_TICK,
020 WALK_ONE_CM,
021 SWIM_ONE_CM,
022 FALL_ONE_CM,
023 CLIMB_ONE_CM,
024 FLY_ONE_CM,
025 DIVE_ONE_CM,
026 MINECART_ONE_CM,
027 BOAT_ONE_CM,
028 PIG_ONE_CM,
029 HORSE_ONE_CM,
030 MINE_BLOCK(Type.BLOCK),
031 USE_ITEM(Type.ITEM),
032 BREAK_ITEM(Type.ITEM),
033 CRAFT_ITEM(Type.ITEM),
034 KILL_ENTITY(Type.ENTITY),
035 ENTITY_KILLED_BY(Type.ENTITY);
036
037 private final Type type;
038
039 private Statistic() {
040 this(Type.UNTYPED);
041 }
042
043 private Statistic(Type type) {
044 this.type = type;
045 }
046
047 /**
048 * Gets the type of this statistic.
049 *
050 * @return the type of this statistic
051 */
052 public Type getType() {
053 return type;
054 }
055
056 /**
057 * Checks if this is a substatistic.
058 * <p>
059 * A substatistic exists en masse for each block, item, or entitytype, depending on
060 * {@link #getType()}.
061 * <p>
062 * This is a redundant method and equivalent to checking
063 * <code>getType() != Type.UNTYPED</code>
064 *
065 * @return true if this is a substatistic
066 */
067 public boolean isSubstatistic() {
068 return type != Type.UNTYPED;
069 }
070
071 /**
072 * Checks if this is a substatistic dealing with blocks.
073 * <p>
074 * This is a redundant method and equivalent to checking
075 * <code>getType() == Type.BLOCK</code>
076 *
077 * @return true if this deals with blocks
078 */
079 public boolean isBlock() {
080 return type == Type.BLOCK;
081 }
082
083 /**
084 * The type of statistic.
085 *
086 */
087 public enum Type {
088 /**
089 * Statistics of this type do not require a qualifier.
090 */
091 UNTYPED,
092
093 /**
094 * Statistics of this type require an Item Material qualifier.
095 */
096 ITEM,
097
098 /**
099 * Statistics of this type require a Block Material qualifier.
100 */
101 BLOCK,
102
103 /**
104 * Statistics of this type require an EntityType qualifier.
105 */
106 ENTITY;
107 }
108 }