当前位置: 首页>>代码示例>>Java>>正文


Java SlimeSplitEvent类代码示例

本文整理汇总了Java中org.bukkit.event.entity.SlimeSplitEvent的典型用法代码示例。如果您正苦于以下问题:Java SlimeSplitEvent类的具体用法?Java SlimeSplitEvent怎么用?Java SlimeSplitEvent使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


SlimeSplitEvent类属于org.bukkit.event.entity包,在下文中一共展示了SlimeSplitEvent类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: onSlimeSplit

import org.bukkit.event.entity.SlimeSplitEvent; //导入依赖的package包/类
@EventHandler
public void onSlimeSplit(SlimeSplitEvent event)
{
	Slime slime = event.getEntity();
	if (plugin.getLegendaryEntityId() != null && plugin.getLegendaryEntityId().equals(slime.getUniqueId()))
	{
		event.setCount(0);

		Player killer = slime.getKiller();
		if (killer != null)
		{
			Material mat = MaterialUtil.getMaterial(plugin.getConfig().getString("slimeDropsType"));
			slime.getWorld().dropItem(slime.getLocation(), new ItemStack(mat, plugin.getConfig().getInt("slimeDropsAmount")));
			killer.sendMessage(ChatColor.GREEN + "You have killed a legendary monster!");
		}

		slime.remove();
		plugin.removeLegendary();
	}
}
 
开发者ID:MineSworn,项目名称:SwornCritters,代码行数:21,代码来源:EntityListener.java

示例2: die

import org.bukkit.event.entity.SlimeSplitEvent; //导入依赖的package包/类
public void die() {
    int i = this.getSize();

    if (!this.world.isStatic && i > 1 && this.getHealth() <= 0.0F) {
        int j = 2 + this.random.nextInt(3);

        // CraftBukkit start
        SlimeSplitEvent event = new SlimeSplitEvent((org.bukkit.entity.Slime) this.getBukkitEntity(), j);
        this.world.getServer().getPluginManager().callEvent(event);

        if (!event.isCancelled() && event.getCount() > 0) {
            j = event.getCount();
        } else {
            super.die();
            return;
        }
        // CraftBukkit end

        for (int k = 0; k < j; ++k) {
            float f = ((float) (k % 2) - 0.5F) * (float) i / 4.0F;
            float f1 = ((float) (k / 2) - 0.5F) * (float) i / 4.0F;
            EntitySlime entityslime = this.bQ();

            entityslime.setSize(i / 2);
            entityslime.setPositionRotation(this.locX + (double) f, this.locY + 0.5D, this.locZ + (double) f1, this.random.nextFloat() * 360.0F, 0.0F);
            this.world.addEntity(entityslime, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.SLIME_SPLIT); // CraftBukkit - SpawnReason
        }
    }

    super.die();
}
 
开发者ID:OvercastNetwork,项目名称:CraftBukkit,代码行数:32,代码来源:EntitySlime.java

示例3: die

import org.bukkit.event.entity.SlimeSplitEvent; //导入依赖的package包/类
public void die() {
    int i = this.getSize();

    if (!this.world.isStatic && i > 1 && this.getHealth() <= 0.0F) {
        int j = 2 + this.random.nextInt(3);

        // CraftBukkit start
        SlimeSplitEvent event = new SlimeSplitEvent((org.bukkit.entity.Slime) this.getBukkitEntity(), j);
        this.world.getServer().getPluginManager().callEvent(event);

        if (!event.isCancelled() && event.getCount() > 0) {
            j = event.getCount();
        } else {
            super.die();
            return;
        }
        // CraftBukkit end

        for (int k = 0; k < j; ++k) {
            float f = ((float) (k % 2) - 0.5F) * (float) i / 4.0F;
            float f1 = ((float) (k / 2) - 0.5F) * (float) i / 4.0F;
            EntitySlime entityslime = this.bK();

            entityslime.setSize(i / 2);
            entityslime.setPositionRotation(this.locX + (double) f, this.locY + 0.5D, this.locZ + (double) f1, this.random.nextFloat() * 360.0F, 0.0F);
            this.world.addEntity(entityslime, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.SLIME_SPLIT); // CraftBukkit - SpawnReason
        }
    }

    super.die();
}
 
开发者ID:AlmuraDev,项目名称:Almura-Server,代码行数:32,代码来源:EntitySlime.java

示例4: setDead

import org.bukkit.event.entity.SlimeSplitEvent; //导入依赖的package包/类
public void setDead()
{
    int i = this.getSlimeSize();

    if (!this.worldObj.isRemote && i > 1 && this.getHealth() <= 0.0F)
    {
        int j = 2 + this.rand.nextInt(3);
        // CraftBukkit start
        SlimeSplitEvent event = new SlimeSplitEvent((org.bukkit.entity.Slime) this.getBukkitEntity(), j);
        this.worldObj.getServer().getPluginManager().callEvent(event);

        if (!event.isCancelled() && event.getCount() > 0)
        {
            j = event.getCount();
        }
        else
        {
            super.setDead();
            return;
        }

        // CraftBukkit end

        for (int k = 0; k < j; ++k)
        {
            float f = ((float)(k % 2) - 0.5F) * (float)i / 4.0F;
            float f1 = ((float)(k / 2) - 0.5F) * (float)i / 4.0F;
            EntitySlime entityslime = this.createInstance();
            entityslime.setSlimeSize(i / 2);
            entityslime.setLocationAndAngles(this.posX + (double)f, this.posY + 0.5D, this.posZ + (double)f1, this.rand.nextFloat() * 360.0F, 0.0F);
            this.worldObj.addEntity(entityslime, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.SLIME_SPLIT); // CraftBukkit - SpawnReason
        }
    }

    super.setDead();
}
 
开发者ID:xtrafrancyz,项目名称:Cauldron,代码行数:37,代码来源:EntitySlime.java

示例5: die

import org.bukkit.event.entity.SlimeSplitEvent; //导入依赖的package包/类
public void die() {
    int i = this.getSize();

    if (!this.world.isClientSide && i > 1 && this.getHealth() <= 0.0F) {
        int j = 2 + this.random.nextInt(3);

        // CraftBukkit start
        SlimeSplitEvent event = new SlimeSplitEvent((org.bukkit.entity.Slime) this.getBukkitEntity(), j);
        this.world.getServer().getPluginManager().callEvent(event);

        if (!event.isCancelled() && event.getCount() > 0) {
            j = event.getCount();
        } else {
            super.die();
            return;
        }
        // CraftBukkit end

        for (int k = 0; k < j; ++k) {
            float f = ((float) (k % 2) - 0.5F) * (float) i / 4.0F;
            float f1 = ((float) (k / 2) - 0.5F) * (float) i / 4.0F;
            EntitySlime entityslime = this.cU();

            if (this.hasCustomName()) {
                entityslime.setCustomName(this.getCustomName());
            }

            if (this.isPersistent()) {
                entityslime.cM();
            }

            entityslime.setSize(i / 2);
            entityslime.setPositionRotation(this.locX + (double) f, this.locY + 0.5D, this.locZ + (double) f1, this.random.nextFloat() * 360.0F, 0.0F);
            this.world.addEntity(entityslime, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.SLIME_SPLIT); // CraftBukkit - SpawnReason
        }
    }

    super.die();
}
 
开发者ID:bergerkiller,项目名称:SpigotSource,代码行数:40,代码来源:EntitySlime.java

示例6: die

import org.bukkit.event.entity.SlimeSplitEvent; //导入依赖的package包/类
public void die() {
    int i = this.getSize();

    if (!this.world.isStatic && i > 1 && this.getHealth() <= 0) {
        int j = 2 + this.random.nextInt(3);

        // CraftBukkit start
        SlimeSplitEvent event = new SlimeSplitEvent((org.bukkit.entity.Slime) this.getBukkitEntity(), j);
        this.world.getServer().getPluginManager().callEvent(event);

        if (!event.isCancelled() && event.getCount() > 0) {
            j = event.getCount();
        } else {
            super.die();
            return;
        }
        // CraftBukkit end

        for (int k = 0; k < j; ++k) {
            float f = ((float) (k % 2) - 0.5F) * (float) i / 4.0F;
            float f1 = ((float) (k / 2) - 0.5F) * (float) i / 4.0F;
            EntitySlime entityslime = this.i();

            entityslime.setSize(i / 2);
            entityslime.setPositionRotation(this.locX + (double) f, this.locY + 0.5D, this.locZ + (double) f1, this.random.nextFloat() * 360.0F, 0.0F);
            this.world.addEntity(entityslime, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.SLIME_SPLIT); // CraftBukkit - SpawnReason
        }
    }

    super.die();
}
 
开发者ID:didoupimpon,项目名称:Craft-city,代码行数:32,代码来源:EntitySlime.java

示例7: onSlimeSplit

import org.bukkit.event.entity.SlimeSplitEvent; //导入依赖的package包/类
@EventHandler
public void onSlimeSplit(SlimeSplitEvent event) {
    event.setCancelled(true);
}
 
开发者ID:edasaki,项目名称:ZentrelaRPG,代码行数:5,代码来源:EnvironmentManager.java

示例8: onSlimeSplit

import org.bukkit.event.entity.SlimeSplitEvent; //导入依赖的package包/类
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
public void onSlimeSplit(SlimeSplitEvent event) {
    if(event.getCount() > 0 && resolveEntity(event.getEntity()) != null) {
        splitter = new WeakReference<>(event.getEntity());
    }
}
 
开发者ID:OvercastNetwork,项目名称:ProjectAres,代码行数:7,代码来源:OwnedMobTracker.java


注:本文中的org.bukkit.event.entity.SlimeSplitEvent类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。