SpongePowered/SpongeAPI — pull request #317 by ST-DDT (2014-12-23 17:05:32+00:00)
Title: Statistics/Achievements API addition: GameRegistry get statistics by Entity/Item/Team

**Helper PR for:** https://github.com/SpongePowered/SpongeAPI/pull/220
There will be another PR for statistic set/change methods including events.

Quick access methods for specific statistics.
* `getEntityStatistic(EntityStatisticType, EntityType)`
* `getItemStatistic(ItemStatisticType, ItemType)`
* `getTeamStatistic(TeamStatisticType, TextColor)`
+ default getters in the `GameRegistry`

`___StatisticType` is some kind of grouping inside statistics like `"stat.craftItem"` for `"stat.craftItem.1/5/..."`

Based on @Aaron1011 suggestions for https://github.com/SpongePowered/SpongeAPI/pull/299
````java
gr.createCriteria(gr.getEntityStatistics(EntityStatisticTypes.HASKILLED, EntityTypes.ZOMBIE));
````
(Hope i could recreate your example properly)

**TBD**
- `Collection getEntityStatistics(EntityStatisticType)`
same for Item and Team as well
- Create `StatisticType` class as base for `Entity/Item/TeamStatisticType`
- `Collection getStatistics(StatisticType)`

**Create/Register new Statistics**
It is not yet possible to create new statistics, because there is no consent on how to register new stuff at all.
This will probably be solved by: https://github.com/SpongePowered/SpongeAPI/pull/242
But i don't want to create a dependency to another PR for this now.

It will probably look like this:
````java
GameDictionary gd = gr.getGameDictionary();
// Create single statistic
Statistic wordsTyped = gd.registerStatistic("pluginXYZ.wordsTyped");
// Add additional statistic to group
ItemStatistic nukesUsed = (ItemStatistic) gd.registerGroupedStatistic(ItemStatisticType.USE, "nuke");
// Create new grouped statistic
EntityStatisticType entitiesBreadType = gd.registerStatisticType("stat.entitiesBreed", EntityStatisticType.class);
EntityStatistic cowsBread = (EntityStatistic) gd.registerGroupedStatistic(entitiesBreadType, "cow");
````