summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorAidan Matzko <amatzko48@gmail.com>2012-01-21 21:20:49 -0500
committerEvilSeph <evilseph@gmail.com>2012-01-23 18:57:37 -0500
commit26a6a1edf4613e374b32d62863fdfb4de008f262 (patch)
treed2f4ed6d3832490fe02c098d75a06f0d5a8483fd /src
parent468d45b7613dfd177a40cee0ff097728954c16e2 (diff)
downloadbukkit-26a6a1edf4613e374b32d62863fdfb4de008f262.tar
bukkit-26a6a1edf4613e374b32d62863fdfb4de008f262.tar.gz
bukkit-26a6a1edf4613e374b32d62863fdfb4de008f262.tar.lz
bukkit-26a6a1edf4613e374b32d62863fdfb4de008f262.tar.xz
bukkit-26a6a1edf4613e374b32d62863fdfb4de008f262.zip
[Bleeding] Added Sheep, Shear and EntityChangeBlock API. Thanks tips48! Closes BUKKIT-512
Diffstat (limited to 'src')
-rw-r--r--src/main/java/org/bukkit/entity/Sheep.java2
-rw-r--r--src/main/java/org/bukkit/event/Event.java26
-rw-r--r--src/main/java/org/bukkit/event/entity/EntityChangeBlockEvent.java62
-rw-r--r--src/main/java/org/bukkit/event/entity/SheepDyeWoolEvent.java58
-rw-r--r--src/main/java/org/bukkit/event/entity/SheepRegrowWoolEvent.java37
-rw-r--r--src/main/java/org/bukkit/event/player/PlayerShearEntityEvent.java49
6 files changed, 232 insertions, 2 deletions
diff --git a/src/main/java/org/bukkit/entity/Sheep.java b/src/main/java/org/bukkit/entity/Sheep.java
index b62911aa..f4ce312c 100644
--- a/src/main/java/org/bukkit/entity/Sheep.java
+++ b/src/main/java/org/bukkit/entity/Sheep.java
@@ -8,13 +8,11 @@ import org.bukkit.material.Colorable;
public interface Sheep extends Animals, Colorable {
/**
- * @author Celtic Minstrel
* @return Whether the sheep is sheared.
*/
public boolean isSheared();
/**
- * @author Celtic Minstrel
* @param flag Whether to shear the sheep
*/
public void setSheared(boolean flag);
diff --git a/src/main/java/org/bukkit/event/Event.java b/src/main/java/org/bukkit/event/Event.java
index 0658e003..af614c41 100644
--- a/src/main/java/org/bukkit/event/Event.java
+++ b/src/main/java/org/bukkit/event/Event.java
@@ -375,6 +375,12 @@ public abstract class Event implements Serializable {
* @see org.bukkit.event.player.PlayerExpChangeEvent
*/
PLAYER_EXP_CHANGE(Category.PLAYER, PlayerExpChangeEvent.class),
+ /**
+ * Called when a player shears an entity
+ *
+ * @see org.bukkit.event.player.PlayerShearEntityEvent
+ */
+ PLAYER_SHEAR_ENTITY(Category.LIVING_ENTITY, PlayerShearEntityEvent.class),
/**
* BLOCK EVENTS
@@ -739,6 +745,18 @@ public abstract class Event implements Serializable {
*/
ENTITY_TARGET(Category.LIVING_ENTITY, EntityTargetEvent.class),
/**
+ * Called when a sheep regrows its wool
+ *
+ * @see org.bukkit.event.entity.SheepRegrowWoolEvent
+ */
+ SHEEP_REGROW_WOOL(Category.LIVING_ENTITY, SheepRegrowWoolEvent.class),
+ /**
+ * Called when a sheep's wool is dyed
+ *
+ * @see org.bukkit.event.entity.SheepDyeWoolEvent
+ */
+ SHEEP_DYE_WOOL(Category.LIVING_ENTITY, SheepDyeWoolEvent.class),
+ /**
* Called when an entity interacts with a block
* This event specifically excludes player entities
*
@@ -764,6 +782,14 @@ public abstract class Event implements Serializable {
*/
ENTITY_TAME(Category.LIVING_ENTITY, EntityTameEvent.class),
/**
+ * Called when a LivingEntity changes a block
+ *
+ * This event specifically excludes player entities
+ *
+ * @see org.bukkit.event.entity.EntityChangeBlockEvent
+ */
+ ENTITY_CHANGE_BLOCK(Category.LIVING_ENTITY, EntityChangeBlockEvent.class),
+ /**
* Called when a {@link Projectile} hits something
*
* @see org.bukkit.event.entity.ProjectileHitEvent
diff --git a/src/main/java/org/bukkit/event/entity/EntityChangeBlockEvent.java b/src/main/java/org/bukkit/event/entity/EntityChangeBlockEvent.java
new file mode 100644
index 00000000..30790750
--- /dev/null
+++ b/src/main/java/org/bukkit/event/entity/EntityChangeBlockEvent.java
@@ -0,0 +1,62 @@
+package org.bukkit.event.entity;
+
+import org.bukkit.Material;
+import org.bukkit.block.Block;
+import org.bukkit.entity.Entity;
+import org.bukkit.event.Cancellable;
+import org.bukkit.event.HandlerList;
+
+@SuppressWarnings("serial")
+/**
+ * Called when a LivingEntity changes a block
+ *
+ * This event specifically excludes player entities
+ */
+public class EntityChangeBlockEvent extends EntityEvent implements Cancellable {
+ private static final HandlerList handlers = new HandlerList();
+ private Block block;
+ private boolean cancel;
+ private Material to;
+
+ public EntityChangeBlockEvent(Entity what, Block block, Material to) {
+ super(Type.ENTITY_CHANGE_BLOCK, what);
+ this.block = block;
+ this.cancel = false;
+ this.to = to;
+ }
+
+ /**
+ * Gets the block the entity is changing
+ *
+ * @return the block that is changing
+ */
+ public Block getBlock() {
+ return block;
+ }
+
+ public boolean isCancelled() {
+ return cancel;
+ }
+
+ public void setCancelled(boolean cancel) {
+ this.cancel = cancel;
+ }
+
+ /**
+ * Gets the Material that the block is changing into
+ *
+ * @return the material that the block is changing into
+ */
+ public Material getTo() {
+ return to;
+ }
+
+ @Override
+ public HandlerList getHandlers() {
+ return handlers;
+ }
+
+ public static HandlerList getHandlerList() {
+ return handlers;
+ }
+}
diff --git a/src/main/java/org/bukkit/event/entity/SheepDyeWoolEvent.java b/src/main/java/org/bukkit/event/entity/SheepDyeWoolEvent.java
new file mode 100644
index 00000000..b69175ae
--- /dev/null
+++ b/src/main/java/org/bukkit/event/entity/SheepDyeWoolEvent.java
@@ -0,0 +1,58 @@
+package org.bukkit.event.entity;
+
+import org.bukkit.DyeColor;
+import org.bukkit.entity.Entity;
+import org.bukkit.event.Cancellable;
+import org.bukkit.event.HandlerList;
+
+@SuppressWarnings("serial")
+/**
+ * Called when a sheep's wool is dyed
+ */
+public class SheepDyeWoolEvent extends EntityEvent implements Cancellable {
+ private static final HandlerList handlers = new HandlerList();
+ private boolean cancel;
+ private DyeColor color;
+
+ public SheepDyeWoolEvent(Entity what, DyeColor color) {
+ super(Type.SHEEP_DYE_WOOL, what);
+ this.cancel = false;
+ this.color = color;
+ }
+
+ public boolean isCancelled() {
+ return cancel;
+ }
+
+ public void setCancelled(boolean cancel) {
+ this.cancel = cancel;
+ }
+
+ /**
+ * Gets the DyeColor the sheep is being dyed
+ *
+ * @return the DyeColor the sheep is being dyed
+ */
+ public DyeColor getColor() {
+ return color;
+ }
+
+ /**
+ * Sets the DyeColor the sheep is being dyed
+ *
+ * @param color the DyeColor the sheep will be dyed
+ */
+ public void setColor(DyeColor color) {
+ this.color = color;
+ }
+
+ @Override
+ public HandlerList getHandlers() {
+ return handlers;
+ }
+
+ public static HandlerList getHandlerList() {
+ return handlers;
+ }
+
+}
diff --git a/src/main/java/org/bukkit/event/entity/SheepRegrowWoolEvent.java b/src/main/java/org/bukkit/event/entity/SheepRegrowWoolEvent.java
new file mode 100644
index 00000000..73ef7fab
--- /dev/null
+++ b/src/main/java/org/bukkit/event/entity/SheepRegrowWoolEvent.java
@@ -0,0 +1,37 @@
+package org.bukkit.event.entity;
+
+import org.bukkit.entity.Entity;
+import org.bukkit.event.Cancellable;
+import org.bukkit.event.HandlerList;
+
+@SuppressWarnings("serial")
+/**
+ * Called when a sheep regrows its wool
+ */
+public class SheepRegrowWoolEvent extends EntityEvent implements Cancellable {
+ private static final HandlerList handlers = new HandlerList();
+ private boolean cancel;
+
+ public SheepRegrowWoolEvent(Entity what) {
+ super(Type.SHEEP_REGROW_WOOL, what);
+ this.cancel = false;
+ }
+
+ public boolean isCancelled() {
+ return cancel;
+ }
+
+ public void setCancelled(boolean cancel) {
+ this.cancel = cancel;
+ }
+
+ @Override
+ public HandlerList getHandlers() {
+ return handlers;
+ }
+
+ public static HandlerList getHandlerList() {
+ return handlers;
+ }
+
+}
diff --git a/src/main/java/org/bukkit/event/player/PlayerShearEntityEvent.java b/src/main/java/org/bukkit/event/player/PlayerShearEntityEvent.java
new file mode 100644
index 00000000..8fb73f78
--- /dev/null
+++ b/src/main/java/org/bukkit/event/player/PlayerShearEntityEvent.java
@@ -0,0 +1,49 @@
+package org.bukkit.event.player;
+
+import org.bukkit.entity.Entity;
+import org.bukkit.entity.Player;
+import org.bukkit.event.Cancellable;
+import org.bukkit.event.HandlerList;
+
+@SuppressWarnings("serial")
+/**
+ * Called when a player shears an entity
+ */
+public class PlayerShearEntityEvent extends PlayerEvent implements Cancellable {
+ private static final HandlerList handlers = new HandlerList();
+ private boolean cancel;
+ private Entity what;
+
+ public PlayerShearEntityEvent(Player who, Entity what) {
+ super(Type.PLAYER_SHEAR_ENTITY, who);
+ this.cancel = false;
+ this.what = what;
+ }
+
+ public boolean isCancelled() {
+ return cancel;
+ }
+
+ public void setCancelled(boolean cancel) {
+ this.cancel = cancel;
+ }
+
+ /**
+ * Gets the entity the player is shearing
+ *
+ * @return the entity the player is shearing
+ */
+ public Entity getEntity() {
+ return what;
+ }
+
+ @Override
+ public HandlerList getHandlers() {
+ return handlers;
+ }
+
+ public static HandlerList getHandlerList() {
+ return handlers;
+ }
+
+}