mirror of
https://github.com/PaperMC/Paper.git
synced 2025-08-19 14:23:48 -07:00
Renamed MobType->CreatureType and MobSpawner->CreatureSpawner.
This is to bring the names in line with the rest of bukkit. Deprecated code has been left in to ensure nothing breaks as a result of refactoring MobType. This will be removed after 1 week, to give plugin devs time to migrate By: Andrew Ardill <andrew.ardill@gmail.com>
This commit is contained in:
42
paper-api/src/main/java/org/bukkit/entity/CreatureType.java
Normal file
42
paper-api/src/main/java/org/bukkit/entity/CreatureType.java
Normal file
@@ -0,0 +1,42 @@
|
||||
package org.bukkit.entity;
|
||||
|
||||
import java.util.EnumSet;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
public enum CreatureType {
|
||||
CHICKEN("Chicken"),
|
||||
COW("Cow"),
|
||||
CREEPER("Creeper"),
|
||||
GHAST("Ghast"),
|
||||
PIG("Pig"),
|
||||
PIG_ZOMBIE("PigZombie"),
|
||||
SHEEP("Sheep"),
|
||||
SKELETON("Skeleton"),
|
||||
SPIDER("Spider"),
|
||||
ZOMBIE("Zombie"),
|
||||
SQUID("Squid");
|
||||
|
||||
private String name;
|
||||
|
||||
private static final Map<String, CreatureType> mapping
|
||||
= new HashMap<String, CreatureType>();
|
||||
|
||||
static {
|
||||
for (CreatureType type : EnumSet.allOf(CreatureType.class)) {
|
||||
mapping.put(type.name, type);
|
||||
}
|
||||
}
|
||||
|
||||
private CreatureType(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public static CreatureType fromName(String name) {
|
||||
return mapping.get(name);
|
||||
}
|
||||
}
|
@@ -3,7 +3,10 @@ package org.bukkit.entity;
|
||||
import java.util.EnumSet;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @deprecated Should be using CreatureType
|
||||
*
|
||||
*/
|
||||
public enum MobType {
|
||||
CHICKEN("Chicken"),
|
||||
COW("Cow"),
|
||||
|
Reference in New Issue
Block a user