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


Java VehicleDamageEvent.getDamage方法代码示例

本文整理汇总了Java中org.bukkit.event.vehicle.VehicleDamageEvent.getDamage方法的典型用法代码示例。如果您正苦于以下问题:Java VehicleDamageEvent.getDamage方法的具体用法?Java VehicleDamageEvent.getDamage怎么用?Java VehicleDamageEvent.getDamage使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.bukkit.event.vehicle.VehicleDamageEvent的用法示例。


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

示例1: damageEntity

import org.bukkit.event.vehicle.VehicleDamageEvent; //导入方法依赖的package包/类
public boolean damageEntity(DamageSource damagesource, float f) {
    if (!this.world.isStatic && !this.dead) {
        if (this.isInvulnerable()) {
            return false;
        } else {
            // CraftBukkit start - fire VehicleDamageEvent
            Vehicle vehicle = (Vehicle) this.getBukkitEntity();
            org.bukkit.entity.Entity passenger = (damagesource.getEntity() == null) ? null : damagesource.getEntity().getBukkitEntity();

            VehicleDamageEvent event = new VehicleDamageEvent(vehicle, passenger, f);
            this.world.getServer().getPluginManager().callEvent(event);

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

            f = (float) event.getDamage();
            // CraftBukkit end

            this.j(-this.l());
            this.c(10);
            this.Q();
            this.setDamage(this.getDamage() + f * 10.0F);
            boolean flag = damagesource.getEntity() instanceof EntityHuman && ((EntityHuman) damagesource.getEntity()).abilities.canInstantlyBuild;

            if (flag || this.getDamage() > 40.0F) {
                if (this.passenger != null) {
                    this.passenger.mount(this);
                }

                // CraftBukkit start
                VehicleDestroyEvent destroyEvent = new VehicleDestroyEvent(vehicle, passenger);
                this.world.getServer().getPluginManager().callEvent(destroyEvent);

                if (destroyEvent.isCancelled()) {
                    this.setDamage(40); // Maximize damage so this doesn't get triggered again right away
                    return true;
                }
                // CraftBukkit end

                if (flag && !this.k_()) {
                    this.die();
                } else {
                    this.a(damagesource);
                }
            }

            return true;
        }
    } else {
        return true;
    }
}
 
开发者ID:OvercastNetwork,项目名称:CraftBukkit,代码行数:54,代码来源:EntityMinecartAbstract.java

示例2: damageEntity

import org.bukkit.event.vehicle.VehicleDamageEvent; //导入方法依赖的package包/类
public boolean damageEntity(DamageSource damagesource, float f) {
    if (!this.world.isStatic && !this.dead) {
        if (this.isInvulnerable()) {
            return false;
        } else {
            // CraftBukkit start
            Vehicle vehicle = (Vehicle) this.getBukkitEntity();
            org.bukkit.entity.Entity passenger = (damagesource.getEntity() == null) ? null : damagesource.getEntity().getBukkitEntity();

            VehicleDamageEvent event = new VehicleDamageEvent(vehicle, passenger, f);
            this.world.getServer().getPluginManager().callEvent(event);

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

            f = (float) event.getDamage();
            // CraftBukkit end

            this.h(-this.k());
            this.c(10);
            this.K();
            this.setDamage(this.getDamage() + f * 10.0F);
            boolean flag = damagesource.getEntity() instanceof EntityHuman && ((EntityHuman) damagesource.getEntity()).abilities.canInstantlyBuild;

            if (flag || this.getDamage() > 40.0F) {
                if (this.passenger != null) {
                    this.passenger.mount(this);
                }

                // CraftBukkit start
                VehicleDestroyEvent destroyEvent = new VehicleDestroyEvent(vehicle, passenger);
                this.world.getServer().getPluginManager().callEvent(destroyEvent);

                if (destroyEvent.isCancelled()) {
                    this.setDamage(40); // Maximize damage so this doesn't get triggered again right away
                    return true;
                }
                // CraftBukkit end

                if (flag && !this.c()) {
                    this.die();
                } else {
                    this.a(damagesource);
                }
            }

            return true;
        }
    } else {
        return true;
    }
}
 
开发者ID:AlmuraDev,项目名称:Almura-Server,代码行数:54,代码来源:EntityMinecartAbstract.java

示例3: attackEntityFrom

import org.bukkit.event.vehicle.VehicleDamageEvent; //导入方法依赖的package包/类
public boolean attackEntityFrom(DamageSource p_70097_1_, float p_70097_2_)
{
    if (!this.worldObj.isRemote && !this.isDead)
    {
        if (this.isEntityInvulnerable())
        {
            return false;
        }
        else
        {
            // CraftBukkit start
            Vehicle vehicle = (Vehicle) this.getBukkitEntity();
            org.bukkit.entity.Entity passenger = (p_70097_1_.getEntity() == null) ? null : p_70097_1_.getEntity().getBukkitEntity();
            VehicleDamageEvent event = new VehicleDamageEvent(vehicle, passenger, p_70097_2_);
            this.worldObj.getServer().getPluginManager().callEvent(event);

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

            p_70097_2_ = (float) event.getDamage();
            // CraftBukkit end
            this.setRollingDirection(-this.getRollingDirection());
            this.setRollingAmplitude(10);
            this.setBeenAttacked();
            this.setDamage(this.getDamage() + p_70097_2_ * 10.0F);
            boolean flag = p_70097_1_.getEntity() instanceof EntityPlayer && ((EntityPlayer)p_70097_1_.getEntity()).capabilities.isCreativeMode;

            if (flag || this.getDamage() > 40.0F)
            {
                if (this.riddenByEntity != null)
                {
                    this.riddenByEntity.mountEntity(this);
                }

                // CraftBukkit start
                VehicleDestroyEvent destroyEvent = new VehicleDestroyEvent(vehicle, passenger);
                this.worldObj.getServer().getPluginManager().callEvent(destroyEvent);

                if (destroyEvent.isCancelled())
                {
                    this.setDamage(40); // Maximize damage so this doesn't get triggered again right away
                    return true;
                }

                // CraftBukkit end

                if (flag && !this.hasCustomInventoryName())
                {
                    this.setDead();
                }
                else
                {
                    this.killMinecart(p_70097_1_);
                }
            }

            return true;
        }
    }
    else
    {
        return true;
    }
}
 
开发者ID:xtrafrancyz,项目名称:Cauldron,代码行数:67,代码来源:EntityMinecart.java

示例4: damageEntity

import org.bukkit.event.vehicle.VehicleDamageEvent; //导入方法依赖的package包/类
public boolean damageEntity(DamageSource damagesource, float f) {
    if (!this.world.isClientSide && !this.dead) {
        if (this.isInvulnerable(damagesource)) {
            return false;
        } else {
            // CraftBukkit start - fire VehicleDamageEvent
            Vehicle vehicle = (Vehicle) this.getBukkitEntity();
            org.bukkit.entity.Entity passenger = (damagesource.getEntity() == null) ? null : damagesource.getEntity().getBukkitEntity();

            VehicleDamageEvent event = new VehicleDamageEvent(vehicle, passenger, f);
            this.world.getServer().getPluginManager().callEvent(event);

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

            f = (float) event.getDamage();
            // CraftBukkit end
            this.e(-this.u());
            this.d(10);
            this.ao();
            this.setDamage(this.getDamage() + f * 10.0F);
            boolean flag = damagesource.getEntity() instanceof EntityHuman && ((EntityHuman) damagesource.getEntity()).abilities.canInstantlyBuild;

            if (flag || this.getDamage() > 40.0F) {
                // CraftBukkit start
                VehicleDestroyEvent destroyEvent = new VehicleDestroyEvent(vehicle, passenger);
                this.world.getServer().getPluginManager().callEvent(destroyEvent);

                if (destroyEvent.isCancelled()) {
                    this.setDamage(40); // Maximize damage so this doesn't get triggered again right away
                    return true;
                }
                // CraftBukkit end
                this.az();
                if (flag && !this.hasCustomName()) {
                    this.die();
                } else {
                    this.a(damagesource);
                }
            }

            return true;
        }
    } else {
        return true;
    }
}
 
开发者ID:bergerkiller,项目名称:SpigotSource,代码行数:49,代码来源:EntityMinecartAbstract.java

示例5: damageEntity

import org.bukkit.event.vehicle.VehicleDamageEvent; //导入方法依赖的package包/类
public boolean damageEntity(DamageSource damagesource, int i) {
    if (!this.world.isStatic && !this.dead) {
        if (this.isInvulnerable()) {
            return false;
        } else {
            // CraftBukkit start
            Vehicle vehicle = (Vehicle) this.getBukkitEntity();
            org.bukkit.entity.Entity passenger = (damagesource.getEntity() == null) ? null : damagesource.getEntity().getBukkitEntity();

            VehicleDamageEvent event = new VehicleDamageEvent(vehicle, passenger, i);
            this.world.getServer().getPluginManager().callEvent(event);

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

            i = event.getDamage();
            // CraftBukkit end

            this.j(-this.k());
            this.i(10);
            this.J();
            this.setDamage(this.getDamage() + i * 10);
            boolean flag = damagesource.getEntity() instanceof EntityHuman && ((EntityHuman) damagesource.getEntity()).abilities.canInstantlyBuild;

            if (flag || this.getDamage() > 40) {
                if (this.passenger != null) {
                    this.passenger.mount(this);
                }

                // CraftBukkit start
                VehicleDestroyEvent destroyEvent = new VehicleDestroyEvent(vehicle, passenger);
                this.world.getServer().getPluginManager().callEvent(destroyEvent);

                if (destroyEvent.isCancelled()) {
                    this.setDamage(40); // Maximize damage so this doesn't get triggered again right away
                    return true;
                }
                // CraftBukkit end

                if (flag && !this.c()) {
                    this.die();
                } else {
                    this.a(damagesource);
                }
            }

            return true;
        }
    } else {
        return true;
    }
}
 
开发者ID:didoupimpon,项目名称:Craft-city,代码行数:54,代码来源:EntityMinecartAbstract.java


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