[Bleeding] Added EntityType to replace CreatureType.
This commit is contained in:
committed by
EvilSeph
parent
4b9f306913
commit
cbb9bc0fa3
@@ -1,8 +1,10 @@
|
||||
package org.bukkit.event.entity;
|
||||
|
||||
import org.bukkit.entity.CreatureType;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.EntityType;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.event.Cancellable;
|
||||
import org.bukkit.event.HandlerList;
|
||||
|
||||
@@ -13,18 +15,20 @@ import org.bukkit.event.HandlerList;
|
||||
*/
|
||||
public class CreatureSpawnEvent extends EntityEvent implements Cancellable {
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
private final Location location;
|
||||
private boolean canceled;
|
||||
private final CreatureType creatureType;
|
||||
private final SpawnReason spawnReason;
|
||||
|
||||
public CreatureSpawnEvent(final Entity spawnee, final CreatureType mobtype, final Location loc, final SpawnReason spawnReason) {
|
||||
public CreatureSpawnEvent(final LivingEntity spawnee, final SpawnReason spawnReason) {
|
||||
super(spawnee);
|
||||
this.creatureType = mobtype;
|
||||
this.location = loc;
|
||||
this.spawnReason = spawnReason;
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public CreatureSpawnEvent(Entity spawnee, CreatureType type, Location loc, SpawnReason reason) {
|
||||
super(spawnee);
|
||||
spawnReason = reason;
|
||||
}
|
||||
|
||||
public boolean isCancelled() {
|
||||
return canceled;
|
||||
}
|
||||
@@ -39,7 +43,18 @@ public class CreatureSpawnEvent extends EntityEvent implements Cancellable {
|
||||
* @return The location at which the creature is spawning
|
||||
*/
|
||||
public Location getLocation() {
|
||||
return location;
|
||||
return getEntity().getLocation();
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the type of creature being spawned.
|
||||
*
|
||||
* @return A CreatureType value detailing the type of creature being spawned
|
||||
* @deprecated In favour of {@link #getSpawnedType()}.
|
||||
*/
|
||||
@Deprecated
|
||||
public CreatureType getCreatureType() {
|
||||
return CreatureType.fromEntityType(getSpawnedType());
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -47,8 +62,8 @@ public class CreatureSpawnEvent extends EntityEvent implements Cancellable {
|
||||
*
|
||||
* @return A CreatureType value detailing the type of creature being spawned
|
||||
*/
|
||||
public CreatureType getCreatureType() {
|
||||
return creatureType;
|
||||
public EntityType getSpawnedType() {
|
||||
return getEntity().getType();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user