Bukkit  1.5.2-R1.0
 All Classes Namespaces Files Functions Variables Enumerator Pages
CreatureSpawnEvent.java
Go to the documentation of this file.
1 package org.bukkit.event.entity;
2 
3 import org.bukkit.Location;
4 import org.bukkit.entity.CreatureType;
5 import org.bukkit.entity.Entity;
6 import org.bukkit.entity.LivingEntity;
7 import org.bukkit.event.Cancellable;
8 import org.bukkit.event.HandlerList;
9 
15 public class CreatureSpawnEvent extends EntityEvent implements Cancellable {
16  private static final HandlerList handlers = new HandlerList();
17  private boolean canceled;
18  private final SpawnReason spawnReason;
19 
20  public CreatureSpawnEvent(final LivingEntity spawnee, final SpawnReason spawnReason) {
21  super(spawnee);
22  this.spawnReason = spawnReason;
23  }
24 
25  @Deprecated
26  public CreatureSpawnEvent(Entity spawnee, CreatureType type, Location loc, SpawnReason reason) {
27  super(spawnee);
28  spawnReason = reason;
29  }
30 
31  public boolean isCancelled() {
32  return canceled;
33  }
34 
35  public void setCancelled(boolean cancel) {
36  canceled = cancel;
37  }
38 
39  @Override
41  return (LivingEntity) entity;
42  }
43 
49  public Location getLocation() {
50  return getEntity().getLocation();
51  }
52 
59  @Deprecated
62  }
63 
70  return spawnReason;
71  }
72 
73  @Override
75  return handlers;
76  }
77 
78  public static HandlerList getHandlerList() {
79  return handlers;
80  }
81 
85  public enum SpawnReason {
86 
120  @Deprecated
157  DEFAULT
158  }
159 }