blob: 81ad2f1f5bb4da6b9795baee688083b8fd6bb3e8 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
|
package net.ess3.bukkit;
import static net.ess3.I18n._;
import java.util.*;
import org.bukkit.entity.EntityType;
public class LivingEntities
{
final private static Map<String, EntityType> entities = new HashMap<String, EntityType>();
final private static EnumMap<EntityType, String> entityI18n = new EnumMap<EntityType, String>(EntityType.class);
final private static EnumMap<EntityType, String> entityI18nPlural = new EnumMap<EntityType, String>(EntityType.class);
static
{
for (EntityType entityType : EntityType.values())
{
if (entityType.isAlive() && entityType.isSpawnable())
{
String entityName = entityType.name().toLowerCase(Locale.ENGLISH).replace("_", "");
entities.put(entityName, entityType);
entityI18n.put(entityType, entityName);
entityI18nPlural.put(entityType, entityName + "Plural");
}
}
}
public static Set<String> getLivingEntityList()
{
return Collections.unmodifiableSet(entities.keySet());
}
public static EntityType fromName(final String name)
{
return entities.get(name.toLowerCase(Locale.ENGLISH));
}
public static String getName(int count, EntityType type)
{
return count == 1 ? _(entityI18n.get(type)) : _(entityI18nPlural.get(type));
}
public static class MobException extends Exception
{
private static final long serialVersionUID = 1L;
}
}
|