Added EntityTame event. Thanks halvors!

By: EvilSeph <evilseph@unaligned.org>
This commit is contained in:
CraftBukkit/Spigot 2011-06-09 04:03:15 -04:00
parent e03c45c1ec
commit 0965fddfe3

View File

@ -31,6 +31,7 @@ import org.bukkit.craftbukkit.CraftServer;
import org.bukkit.craftbukkit.CraftWorld;
import org.bukkit.craftbukkit.block.CraftBlock;
import org.bukkit.craftbukkit.inventory.CraftItemStack;
import org.bukkit.entity.AnimalTamer;
import org.bukkit.entity.CreatureType;
import org.bukkit.entity.Player;
import org.bukkit.event.Event.Type;
@ -38,6 +39,7 @@ import org.bukkit.event.block.Action;
import org.bukkit.event.block.BlockDamageEvent;
import org.bukkit.event.block.BlockPlaceEvent;
import org.bukkit.event.entity.CreatureSpawnEvent;
import org.bukkit.event.entity.EntityTameEvent;
import org.bukkit.event.player.PlayerBucketEmptyEvent;
import org.bukkit.event.player.PlayerBucketFillEvent;
import org.bukkit.event.player.PlayerEvent;
@ -228,4 +230,17 @@ public class CraftEventFactory {
craftServer.getPluginManager().callEvent(event);
return event;
}
/**
* EntityTameEvent
*/
public static EntityTameEvent callEntityTameEvent(EntityLiving entity, EntityHuman tamer) {
org.bukkit.entity.Entity bukkitEntity = entity.getBukkitEntity();
org.bukkit.entity.AnimalTamer bukkitTamer = (AnimalTamer) tamer.getBukkitEntity();
CraftServer craftServer = (CraftServer) bukkitEntity.getServer();
EntityTameEvent event = new EntityTameEvent(bukkitEntity, bukkitTamer);
craftServer.getPluginManager().callEvent(event);
return event;
}
}