Bukkit-API  1.7.9-R0.2
The inofficial Bukkit-API
org.bukkit.event.player.PlayerEggThrowEvent Class Reference
Inheritance diagram for org.bukkit.event.player.PlayerEggThrowEvent:
org.bukkit.event.player.PlayerEvent org.bukkit.event.Event

Public Member Functions

 PlayerEggThrowEvent (final Player player, final Egg egg, final boolean hatching, final byte numHatches, final EntityType hatchingType)
 
 PlayerEggThrowEvent (Player player, Egg egg, boolean hatching, byte numHatches, CreatureType hatchingType)
 
Egg getEgg ()
 
boolean isHatching ()
 
void setHatching (boolean hatching)
 
CreatureType getHatchType ()
 
EntityType getHatchingType ()
 
void setHatchType (CreatureType hatchType)
 
void setHatchingType (EntityType hatchType)
 
byte getNumHatches ()
 
void setNumHatches (byte numHatches)
 
HandlerList getHandlers ()
 
- Public Member Functions inherited from org.bukkit.event.player.PlayerEvent
 PlayerEvent (final Player who)
 
final Player getPlayer ()
 
- Public Member Functions inherited from org.bukkit.event.Event
 Event ()
 
 Event (boolean isAsync)
 
String getEventName ()
 
abstract HandlerList getHandlers ()
 
final boolean isAsynchronous ()
 

Static Public Member Functions

static HandlerList getHandlerList ()
 

Additional Inherited Members

- Protected Attributes inherited from org.bukkit.event.player.PlayerEvent
Player player
 

Detailed Description

Called when a player throws an egg and it might hatch

Definition at line 12 of file PlayerEggThrowEvent.java.

Member Function Documentation

Egg org.bukkit.event.player.PlayerEggThrowEvent.getEgg ( )

Gets the egg involved in this event.

Returns
the egg involved in this event

Definition at line 37 of file PlayerEggThrowEvent.java.

37  {
38  return egg;
39  }
EntityType org.bukkit.event.player.PlayerEggThrowEvent.getHatchingType ( )

Get the type of the mob being hatched (EntityType.CHICKEN by default)

Returns
The type of the mob being hatched by the egg

Definition at line 77 of file PlayerEggThrowEvent.java.

77  {
78  return hatchType;
79  }
CreatureType org.bukkit.event.player.PlayerEggThrowEvent.getHatchType ( )

Get the type of the mob being hatched (EntityType.CHICKEN by default)

Returns
The type of the mob being hatched by the egg
Deprecated:
In favour of getHatchingType().

Definition at line 68 of file PlayerEggThrowEvent.java.

68  {
69  return CreatureType.fromEntityType(hatchType);
70  }
byte org.bukkit.event.player.PlayerEggThrowEvent.getNumHatches ( )

Get the number of mob hatches from the egg. By default the number will be the number the server would've done

  • 7/8 chance of being 0
  • 31/256 ~= 1/8 chance to be 1
  • 1/256 chance to be 4
Returns
The number of mobs going to be hatched by the egg

Definition at line 113 of file PlayerEggThrowEvent.java.

113  {
114  return numHatches;
115  }
boolean org.bukkit.event.player.PlayerEggThrowEvent.isHatching ( )

Gets whether the egg is hatching or not. Will be what the server would've done without interaction.

Returns
boolean Whether the egg is going to hatch or not

Definition at line 47 of file PlayerEggThrowEvent.java.

47  {
48  return hatching;
49  }
void org.bukkit.event.player.PlayerEggThrowEvent.setHatching ( boolean  hatching)

Sets whether the egg will hatch or not.

Parameters
hatchingtrue if you want the egg to hatch, false if you want it not to

Definition at line 57 of file PlayerEggThrowEvent.java.

57  {
58  this.hatching = hatching;
59  }
void org.bukkit.event.player.PlayerEggThrowEvent.setHatchingType ( EntityType  hatchType)

Change the type of mob being hatched by the egg

Parameters
hatchTypeThe type of the mob being hatched by the egg

Definition at line 97 of file PlayerEggThrowEvent.java.

References org.bukkit.entity.EntityType.isSpawnable().

97  {
98  if(!hatchType.isSpawnable()) throw new IllegalArgumentException("Can't spawn that entity type from an egg!");
99  this.hatchType = hatchType;
100  }
void org.bukkit.event.player.PlayerEggThrowEvent.setHatchType ( CreatureType  hatchType)

Change the type of mob being hatched by the egg

Parameters
hatchTypeThe type of the mob being hatched by the egg
Deprecated:
In favour of setHatchingType(EntityType).

Definition at line 88 of file PlayerEggThrowEvent.java.

88  {
89  this.hatchType = hatchType.toEntityType();
90  }
void org.bukkit.event.player.PlayerEggThrowEvent.setNumHatches ( byte  numHatches)

Change the number of mobs coming out of the hatched egg

The boolean hatching will override this number. Ie. If hatching = false, this number will not matter

Parameters
numHatchesThe number of mobs coming out of the egg

Definition at line 125 of file PlayerEggThrowEvent.java.

125  {
126  this.numHatches = numHatches;
127  }

The documentation for this class was generated from the following file: