Java 类org.bukkit.event.entity.SheepDyeWoolEvent 实例源码

项目:CraftBukkit    文件:ItemDye.java   
public boolean a(ItemStack itemstack, EntityHuman entityhuman, EntityLiving entityliving) {
    if (entityliving instanceof EntitySheep) {
        EntitySheep entitysheep = (EntitySheep) entityliving;
        int i = BlockCloth.b(itemstack.getData());

        if (!entitysheep.isSheared() && entitysheep.getColor() != i) {
            // CraftBukkit start
            byte bColor = (byte) i;
            SheepDyeWoolEvent event = new SheepDyeWoolEvent((org.bukkit.entity.Sheep) entitysheep.getBukkitEntity(), org.bukkit.DyeColor.getByData(bColor));
            entitysheep.world.getServer().getPluginManager().callEvent(event);

            if (event.isCancelled()) {
                return false;
            }

            i = (byte) event.getColor().getWoolData();
            // CraftBukkit end
            entitysheep.setColor(i);
            --itemstack.count;
        }

        return true;
    } else {
        return false;
    }
}
项目:Tweakkit-Server    文件:ItemDye.java   
public boolean a(ItemStack itemstack, EntityHuman entityhuman, EntityLiving entityliving) {
    if (entityliving instanceof EntitySheep) {
        EntitySheep entitysheep = (EntitySheep) entityliving;
        int i = BlockCloth.b(itemstack.getData());

        if (!entitysheep.isSheared() && entitysheep.getColor() != i) {
            // CraftBukkit start
            byte bColor = (byte) i;
            SheepDyeWoolEvent event = new SheepDyeWoolEvent((org.bukkit.entity.Sheep) entitysheep.getBukkitEntity(), org.bukkit.DyeColor.getByData(bColor));
            entitysheep.world.getServer().getPluginManager().callEvent(event);

            if (event.isCancelled()) {
                return false;
            }

            i = (byte) event.getColor().getWoolData();
            // CraftBukkit end
            entitysheep.setColor(i);
            --itemstack.count;
        }

        return true;
    } else {
        return false;
    }
}
项目:SpigotSource    文件:ItemDye.java   
public boolean a(ItemStack itemstack, EntityHuman entityhuman, EntityLiving entityliving, EnumHand enumhand) {
    if (entityliving instanceof EntitySheep) {
        EntitySheep entitysheep = (EntitySheep) entityliving;
        EnumColor enumcolor = EnumColor.fromInvColorIndex(itemstack.getData());

        if (!entitysheep.isSheared() && entitysheep.getColor() != enumcolor) {
            // CraftBukkit start
            byte bColor = (byte) enumcolor.getColorIndex();
            SheepDyeWoolEvent event = new SheepDyeWoolEvent((org.bukkit.entity.Sheep) entitysheep.getBukkitEntity(), org.bukkit.DyeColor.getByData(bColor));
            entitysheep.world.getServer().getPluginManager().callEvent(event);

            if (event.isCancelled()) {
                return false;
            }

            enumcolor = EnumColor.fromColorIndex((byte) event.getColor().getWoolData());
            // CraftBukkit end
            entitysheep.setColor(enumcolor);
            --itemstack.count;
        }

        return true;
    } else {
        return false;
    }
}
项目:Almura-Server    文件:ItemDye.java   
public boolean a(ItemStack itemstack, EntityHuman entityhuman, EntityLiving entityliving) {
    if (entityliving instanceof EntitySheep) {
        EntitySheep entitysheep = (EntitySheep) entityliving;
        int i = BlockCloth.j_(itemstack.getData());

        if (!entitysheep.isSheared() && entitysheep.getColor() != i) {
            // CraftBukkit start
            byte bColor = (byte) i;
            SheepDyeWoolEvent event = new SheepDyeWoolEvent((org.bukkit.entity.Sheep) entitysheep.getBukkitEntity(), org.bukkit.DyeColor.getByData(bColor));
            entitysheep.world.getServer().getPluginManager().callEvent(event);

            if (event.isCancelled()) {
                return false;
            }

            i = (byte) event.getColor().getWoolData();
            // CraftBukkit end

            entitysheep.setColor(i);
            --itemstack.count;
        }

        return true;
    } else {
        return false;
    }
}
项目:Cauldron    文件:ItemDye.java   
public boolean itemInteractionForEntity(ItemStack p_111207_1_, EntityPlayer p_111207_2_, EntityLivingBase p_111207_3_)
{
    if (p_111207_3_ instanceof EntitySheep)
    {
        EntitySheep entitysheep = (EntitySheep)p_111207_3_;
        int i = BlockColored.func_150032_b(p_111207_1_.getItemDamage());

        if (!entitysheep.getSheared() && entitysheep.getFleeceColor() != i)
        {
            // CraftBukkit start
            byte bColor = (byte) i;
            SheepDyeWoolEvent event = new SheepDyeWoolEvent((org.bukkit.entity.Sheep) entitysheep.getBukkitEntity(), org.bukkit.DyeColor.getByData(bColor));
            entitysheep.worldObj.getServer().getPluginManager().callEvent(event);

            if (event.isCancelled())
            {
                return false;
            }

            i = (byte) event.getColor().getWoolData();
            // CraftBukkit end
            entitysheep.setFleeceColor(i);
            --p_111207_1_.stackSize;
        }

        return true;
    }
    else
    {
        return false;
    }
}
项目:Craft-city    文件:ItemDye.java   
public boolean a(ItemStack itemstack, EntityLiving entityliving) {
    if (entityliving instanceof EntitySheep) {
        EntitySheep entitysheep = (EntitySheep) entityliving;
        int i = BlockCloth.g_(itemstack.getData());

        if (!entitysheep.isSheared() && entitysheep.getColor() != i) {
            // CraftBukkit start
            byte bColor = (byte) i;
            SheepDyeWoolEvent event = new SheepDyeWoolEvent((org.bukkit.entity.Sheep) entitysheep.getBukkitEntity(), org.bukkit.DyeColor.getByData(bColor));
            entitysheep.world.getServer().getPluginManager().callEvent(event);

            if (event.isCancelled()) {
                return false;
            }

            i = (byte) event.getColor().getWoolData();
            // CraftBukkit end

            entitysheep.setColor(i);
            --itemstack.count;
        }

        return true;
    } else {
        return false;
    }
}
项目:Shopkeepers    文件:LivingEntityShopListener.java   
@EventHandler(ignoreCancelled = true)
void onSheepDyed(SheepDyeWoolEvent event) {
    if (plugin.isShopkeeper(event.getEntity())) {
        event.setCancelled(true);
    }
}