Purged deprecated MobType and MobSpawner

By: Dinnerbone <dinnerbone@dinnerbone.com>
This commit is contained in:
Bukkit/Spigot 2011-03-07 16:29:03 +00:00
parent 188c435e67
commit de5eddce7d
4 changed files with 11 additions and 129 deletions

View file

@ -1,54 +0,0 @@
package org.bukkit.block;
import org.bukkit.entity.MobType;
/**
* Represents a mob spawner.
*
* @author sk89q
*
* @deprecated Use CreatureSpawner instead.
*/
public interface MobSpawner extends BlockState {
/**
* Get the spawner's mob type.
*
* @return
*/
public MobType getMobType();
/**
* Set the spawner mob type.
*
* @param mobType
*/
public void setMobType(MobType mobType);
/**
* Get the spawner's mob type.
*
* @return
*/
public String getMobTypeId();
/**
* Set the spawner mob type.
*
* @param mobType
*/
public void setMobTypeId(String mobType);
/**
* Get the spawner's delay.
*
* @return
*/
public int getDelay();
/**
* Set the spawner's delay.
*
* @param delay
*/
public void setDelay(int delay);
}

View file

@ -1,46 +0,0 @@
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"),
CREEPER("Creeper"),
GHAST("Ghast"),
PIG("Pig"),
PIG_ZOMBIE("PigZombie"),
SHEEP("Sheep"),
SKELETON("Skeleton"),
SPIDER("Spider"),
ZOMBIE("Zombie"),
SQUID("Squid"),
SLIME("Slime");
private String name;
private static final Map<String, MobType> mapping
= new HashMap<String, MobType>();
static {
for (MobType type : EnumSet.allOf(MobType.class)) {
mapping.put(type.name, type);
}
}
private MobType(String name) {
this.name = name;
}
public String getName() {
return name;
}
public static MobType fromName(String name) {
return mapping.get(name);
}
}

View file

@ -1,7 +1,7 @@
package org.bukkit.event.entity;
import org.bukkit.entity.CreatureType;
import org.bukkit.entity.Entity;
import org.bukkit.entity.MobType;
import org.bukkit.Location;
import org.bukkit.event.Cancellable;
import org.bukkit.event.Event;
@ -13,17 +13,17 @@ public class CreatureSpawnEvent extends EntityEvent implements Cancellable {
private Location location;
private boolean canceled;
private MobType mobtype;
private CreatureType creatureType;
public CreatureSpawnEvent(Entity spawnee, MobType mobtype, Location loc) {
public CreatureSpawnEvent(Entity spawnee, CreatureType mobtype, Location loc) {
super(Event.Type.CREATURE_SPAWN, spawnee);
this.mobtype = mobtype;
this.creatureType = mobtype;
this.location = loc;
}
protected CreatureSpawnEvent(Event.Type type, Entity spawnee, MobType mobtype, Location loc) {
protected CreatureSpawnEvent(Event.Type type, Entity spawnee, CreatureType mobtype, Location loc) {
super(type, spawnee);
this.mobtype = mobtype;
this.creatureType = mobtype;
this.location = loc;
}
@ -60,7 +60,7 @@ public class CreatureSpawnEvent extends EntityEvent implements Cancellable {
*
* @return A CreatureType value detailing the type of creature being spawned
*/
public MobType getMobType() {
return mobtype;
public CreatureType getCreatureType() {
return creatureType;
}
}

View file

@ -2,7 +2,6 @@ package org.bukkit.event.player;
import org.bukkit.entity.CreatureType;
import org.bukkit.entity.Egg;
import org.bukkit.entity.MobType;
import org.bukkit.entity.Player;
@ -25,13 +24,6 @@ public class PlayerEggThrowEvent extends PlayerEvent {
this.hatchType = hatchType;
}
public PlayerEggThrowEvent(Type type, Player player, Egg egg, boolean hatching, byte numHatches, MobType hatchType) {
super(type, player);
this.egg = egg;
this.hatching = hatching;
this.numHatches = numHatches;
this.hatchType = CreatureType.fromName(hatchType.getName());
}
/**
* Get the egg.
*
@ -62,12 +54,12 @@ public class PlayerEggThrowEvent extends PlayerEvent {
}
/**
* Get the type of the mob being hatched (MobType.CHICKEN by default)
* Get the type of the mob being hatched (CreatureType.CHICKEN by default)
*
* @return The type of the mob being hatched by the egg
*/
public MobType getHatchType() {
return MobType.fromName(hatchType.getName());
public CreatureType getHatchType() {
return CreatureType.fromName(hatchType.getName());
}
/**
@ -79,16 +71,6 @@ public class PlayerEggThrowEvent extends PlayerEvent {
this.hatchType = hatchType;
}
/**
* Change the type of mob being hatched by the egg
*
* @param hatchType The type of the mob being hatched by the egg
*
* @deprecated Use setHatchType(CreatureType hatchType) instead.
*/
public void setHatchType(MobType hatchType) {
this.hatchType = CreatureType.fromName(hatchType.getName());
}
/**
* Get the number of mob hatches from the egg. By default the number