Skip to content

Commit

Permalink
Allow minecraft names instead of bukkit names for entities
Browse files Browse the repository at this point in the history
  • Loading branch information
Brokkonaut committed Sep 9, 2022
1 parent 0e601aa commit c34ad1c
Showing 1 changed file with 13 additions and 9 deletions.
22 changes: 13 additions & 9 deletions src/main/java/de/diddiz/LogBlock/util/BukkitUtils.java
Expand Up @@ -946,15 +946,19 @@ public static Entity loadEntityAround(Chunk chunk, UUID uuid) {
private static final HashMap<String, EntityType> types = new HashMap<>();
static {
for (EntityType t : EntityType.values()) {
types.put(t.name().toLowerCase(), t);
@SuppressWarnings("deprecation")
String typeName = t.getName();
if (typeName != null) {
types.put(typeName.toLowerCase(), t);
}
Class<? extends Entity> ec = t.getEntityClass();
if (ec != null) {
types.put(ec.getSimpleName().toLowerCase(), t);
if (t != EntityType.UNKNOWN) {
types.put(t.name().toLowerCase(), t);
@SuppressWarnings("deprecation")
String typeName = t.getName();
if (typeName != null) {
types.put(typeName.toLowerCase(), t);
}
Class<? extends Entity> ec = t.getEntityClass();
if (ec != null) {
types.put(ec.getSimpleName().toLowerCase(), t);
}
types.put(t.getKey().getKey(), t);
types.put(t.getKey().toString(), t);
}
}
}
Expand Down

0 comments on commit c34ad1c

Please sign in to comment.