本文整理汇总了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;
}
}
示例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;
}
}
示例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;
}
}
示例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;
}
}
示例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;
}
}