本文整理汇总了Java中org.bukkit.event.vehicle.VehicleDestroyEvent.isCancelled方法的典型用法代码示例。如果您正苦于以下问题:Java VehicleDestroyEvent.isCancelled方法的具体用法?Java VehicleDestroyEvent.isCancelled怎么用?Java VehicleDestroyEvent.isCancelled使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.bukkit.event.vehicle.VehicleDestroyEvent
的用法示例。
在下文中一共展示了VehicleDestroyEvent.isCancelled方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onVehicleBreak
import org.bukkit.event.vehicle.VehicleDestroyEvent; //导入方法依赖的package包/类
@EventHandler
public void onVehicleBreak(VehicleDestroyEvent e){
if (e.isCancelled()){
return;
}
if (!(e.getAttacker() instanceof Player)){
return;
}
Vehicle cart = e.getVehicle();
Player p = (Player) e.getAttacker();
Region r = RedProtect.get().rm.getTopRegion(cart.getLocation());
if (r != null){
return;
}
if (!RPConfig.getGlobalFlagBool(p.getWorld().getName()+".use-minecart") && !p.hasPermission("redprotect.bypass.world")){
e.setCancelled(true);
}
}
示例2: onVehicleBreak
import org.bukkit.event.vehicle.VehicleDestroyEvent; //导入方法依赖的package包/类
@EventHandler
public void onVehicleBreak(VehicleDestroyEvent e){
RedProtect.get().logger.debug("RPBlockListener - Is VehicleDestroyEvent event");
if (e.isCancelled()){
return;
}
if (!(e.getAttacker() instanceof Player)){
return;
}
Vehicle cart = e.getVehicle();
Player p = (Player) e.getAttacker();
Region r = RedProtect.get().rm.getTopRegion(cart.getLocation());
if (r != null && !r.canMinecart(p)){
RPLang.sendMessage(p, "blocklistener.region.cantbreak");
e.setCancelled(true);
}
}
示例3: a
import org.bukkit.event.vehicle.VehicleDestroyEvent; //导入方法依赖的package包/类
protected void a(double d0, boolean flag) {
int i = MathHelper.floor(this.locX);
int j = MathHelper.floor(this.locY);
int k = MathHelper.floor(this.locZ);
if (flag) {
if (this.fallDistance > 3.0F) {
this.b(this.fallDistance);
if (!this.world.isStatic && !this.dead) {
// CraftBukkit start
Vehicle vehicle = (Vehicle) this.getBukkitEntity();
VehicleDestroyEvent destroyEvent = new VehicleDestroyEvent(vehicle, null);
this.world.getServer().getPluginManager().callEvent(destroyEvent);
if (!destroyEvent.isCancelled()) {
this.die();
int l;
for (l = 0; l < 3; ++l) {
this.a(Item.getItemOf(Blocks.WOOD), 1, 0.0F);
}
for (l = 0; l < 2; ++l) {
this.a(Items.STICK, 1, 0.0F);
}
}
// CraftBukkit end
}
this.fallDistance = 0.0F;
}
} else if (this.world.getType(i, j - 1, k).getMaterial() != Material.WATER && d0 < 0.0D) {
this.fallDistance = (float) ((double) this.fallDistance - d0);
}
}
示例4: a
import org.bukkit.event.vehicle.VehicleDestroyEvent; //导入方法依赖的package包/类
protected void a(double d0, boolean flag, IBlockData iblockdata, BlockPosition blockposition) {
this.aI = this.motY;
if (!this.isPassenger()) {
if (flag) {
if (this.fallDistance > 3.0F) {
if (this.aG != EntityBoat.EnumStatus.ON_LAND) {
this.fallDistance = 0.0F;
return;
}
this.e(this.fallDistance, 1.0F);
if (!this.world.isClientSide && !this.dead) {
// CraftBukkit start
Vehicle vehicle = (Vehicle) this.getBukkitEntity();
VehicleDestroyEvent destroyEvent = new VehicleDestroyEvent(vehicle, null);
this.world.getServer().getPluginManager().callEvent(destroyEvent);
if (!destroyEvent.isCancelled()) {
this.die();
if (this.world.getGameRules().getBoolean("doEntityDrops")) {
int i;
for (i = 0; i < 3; ++i) {
this.a(new ItemStack(Item.getItemOf(Blocks.PLANKS), 1, this.getType().b()), 0.0F);
}
for (i = 0; i < 2; ++i) {
this.a(Items.STICK, 1, 0.0F);
}
}
}
} // CraftBukkit end
}
this.fallDistance = 0.0F;
} else if (this.world.getType((new BlockPosition(this)).down()).getMaterial() != Material.WATER && d0 < 0.0D) {
this.fallDistance = (float) ((double) this.fallDistance - d0);
}
}
}
示例5: damageEntity
import org.bukkit.event.vehicle.VehicleDestroyEvent; //导入方法依赖的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;
}
}
示例6: damageEntity
import org.bukkit.event.vehicle.VehicleDestroyEvent; //导入方法依赖的package包/类
public boolean damageEntity(DamageSource damagesource, float f) {
if (this.isInvulnerable()) {
return false;
} else if (!this.world.isStatic && !this.dead) {
// CraftBukkit start
Vehicle vehicle = (Vehicle) this.getBukkitEntity();
org.bukkit.entity.Entity attacker = (damagesource.getEntity() == null) ? null : damagesource.getEntity().getBukkitEntity();
VehicleDamageEvent event = new VehicleDamageEvent(vehicle, attacker, (double) f);
this.world.getServer().getPluginManager().callEvent(event);
if (event.isCancelled()) {
return true;
}
// f = event.getDamage(); // TODO Why don't we do this?
// CraftBukkit end
this.c(-this.i());
this.a(10);
this.setDamage(this.getDamage() + f * 10.0F);
this.Q();
boolean flag = damagesource.getEntity() instanceof EntityHuman && ((EntityHuman) damagesource.getEntity()).abilities.canInstantlyBuild;
if (flag || this.getDamage() > 40.0F) {
// CraftBukkit start
VehicleDestroyEvent destroyEvent = new VehicleDestroyEvent(vehicle, attacker);
this.world.getServer().getPluginManager().callEvent(destroyEvent);
if (destroyEvent.isCancelled()) {
this.setDamage(40F); // Maximize damage so this doesn't get triggered again right away
return true;
}
// CraftBukkit end
if (this.passenger != null) {
this.passenger.mount(this);
}
if (!flag) {
this.a(Items.BOAT, 1, 0.0F);
}
this.die();
}
return true;
} else {
return true;
}
}
示例7: damageEntity
import org.bukkit.event.vehicle.VehicleDestroyEvent; //导入方法依赖的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;
}
}
示例8: damageEntity
import org.bukkit.event.vehicle.VehicleDestroyEvent; //导入方法依赖的package包/类
public boolean damageEntity(DamageSource damagesource, float f) {
if (this.isInvulnerable()) {
return false;
} else if (!this.world.isStatic && !this.dead) {
// CraftBukkit start
Vehicle vehicle = (Vehicle) this.getBukkitEntity();
org.bukkit.entity.Entity attacker = (damagesource.getEntity() == null) ? null : damagesource.getEntity().getBukkitEntity();
VehicleDamageEvent event = new VehicleDamageEvent(vehicle, attacker, (double) f);
this.world.getServer().getPluginManager().callEvent(event);
if (event.isCancelled()) {
return true;
}
// i = event.getDamage(); // TODO Why don't we do this?
// CraftBukkit end
this.c(-this.h());
this.a(10);
this.setDamage(this.getDamage() + f * 10.0F);
this.K();
boolean flag = damagesource.getEntity() instanceof EntityHuman && ((EntityHuman) damagesource.getEntity()).abilities.canInstantlyBuild;
if (flag || this.getDamage() > 40.0F) {
// CraftBukkit start
VehicleDestroyEvent destroyEvent = new VehicleDestroyEvent(vehicle, attacker);
this.world.getServer().getPluginManager().callEvent(destroyEvent);
if (destroyEvent.isCancelled()) {
this.setDamage(40F); // Maximize damage so this doesn't get triggered again right away
return true;
}
// CraftBukkit end
if (this.passenger != null) {
this.passenger.mount(this);
}
if (!flag) {
this.a(Item.BOAT.id, 1, 0.0F);
}
this.die();
}
return true;
} else {
return true;
}
}
示例9: attackEntityFrom
import org.bukkit.event.vehicle.VehicleDestroyEvent; //导入方法依赖的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;
}
}
示例10: attackEntityFrom
import org.bukkit.event.vehicle.VehicleDestroyEvent; //导入方法依赖的package包/类
public boolean attackEntityFrom(DamageSource p_70097_1_, float p_70097_2_)
{
if (this.isEntityInvulnerable())
{
return false;
}
else if (!this.worldObj.isRemote && !this.isDead)
{
// CraftBukkit start
Vehicle vehicle = (Vehicle) this.getBukkitEntity();
org.bukkit.entity.Entity attacker = (p_70097_1_.getEntity() == null) ? null : p_70097_1_.getEntity().getBukkitEntity();
VehicleDamageEvent event = new VehicleDamageEvent(vehicle, attacker, (double) p_70097_2_);
this.worldObj.getServer().getPluginManager().callEvent(event);
if (event.isCancelled())
{
return true;
}
// f = event.getDamage(); // TODO Why don't we do this?
// CraftBukkit end
this.setForwardDirection(-this.getForwardDirection());
this.setTimeSinceHit(10);
this.setDamageTaken(this.getDamageTaken() + p_70097_2_ * 10.0F);
this.setBeenAttacked();
boolean flag = p_70097_1_.getEntity() instanceof EntityPlayer && ((EntityPlayer)p_70097_1_.getEntity()).capabilities.isCreativeMode;
if (flag || this.getDamageTaken() > 40.0F)
{
// CraftBukkit start
VehicleDestroyEvent destroyEvent = new VehicleDestroyEvent(vehicle, attacker);
this.worldObj.getServer().getPluginManager().callEvent(destroyEvent);
if (destroyEvent.isCancelled())
{
this.setDamageTaken(40F); // Maximize damage so this doesn't get triggered again right away
return true;
}
// CraftBukkit end
if (this.riddenByEntity != null)
{
this.riddenByEntity.mountEntity(this);
}
if (!flag)
{
this.func_145778_a(Items.boat, 1, 0.0F);
}
this.setDead();
}
return true;
}
else
{
return true;
}
}
示例11: damageEntity
import org.bukkit.event.vehicle.VehicleDestroyEvent; //导入方法依赖的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;
}
}
示例12: damageEntity
import org.bukkit.event.vehicle.VehicleDestroyEvent; //导入方法依赖的package包/类
public boolean damageEntity(DamageSource damagesource, float f) {
if (this.isInvulnerable(damagesource)) {
return false;
} else if (!this.world.isClientSide && !this.dead) {
if (damagesource instanceof EntityDamageSourceIndirect && damagesource.getEntity() != null && this.w(damagesource.getEntity())) {
return false;
} else {
// CraftBukkit start
Vehicle vehicle = (Vehicle) this.getBukkitEntity();
org.bukkit.entity.Entity attacker = (damagesource.getEntity() == null) ? null : damagesource.getEntity().getBukkitEntity();
VehicleDamageEvent event = new VehicleDamageEvent(vehicle, attacker, (double) f);
this.world.getServer().getPluginManager().callEvent(event);
if (event.isCancelled()) {
return true;
}
// f = event.getDamage(); // TODO Why don't we do this?
// CraftBukkit end
this.d(-this.q());
this.b(10);
this.setDamage(this.n() + f * 10.0F);
this.ao();
boolean flag = damagesource.getEntity() instanceof EntityHuman && ((EntityHuman) damagesource.getEntity()).abilities.canInstantlyBuild;
if (flag || this.n() > 40.0F) {
// CraftBukkit start
VehicleDestroyEvent destroyEvent = new VehicleDestroyEvent(vehicle, attacker);
this.world.getServer().getPluginManager().callEvent(destroyEvent);
if (destroyEvent.isCancelled()) {
this.setDamage(40F); // Maximize damage so this doesn't get triggered again right away
return true;
}
// CraftBukkit end
if (!flag && this.world.getGameRules().getBoolean("doEntityDrops")) {
this.a(this.j(), 1, 0.0F);
}
this.die();
}
return true;
}
} else {
return true;
}
}
示例13: damageEntity
import org.bukkit.event.vehicle.VehicleDestroyEvent; //导入方法依赖的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;
}
}
示例14: damageEntity
import org.bukkit.event.vehicle.VehicleDestroyEvent; //导入方法依赖的package包/类
public boolean damageEntity(DamageSource damagesource, int i) {
if (this.isInvulnerable()) {
return false;
} else if (!this.world.isStatic && !this.dead) {
// CraftBukkit start
Vehicle vehicle = (Vehicle) this.getBukkitEntity();
org.bukkit.entity.Entity attacker = (damagesource.getEntity() == null) ? null : damagesource.getEntity().getBukkitEntity();
VehicleDamageEvent event = new VehicleDamageEvent(vehicle, attacker, i);
this.world.getServer().getPluginManager().callEvent(event);
if (event.isCancelled()) {
return true;
}
// i = event.getDamage(); // TODO Why don't we do this?
// CraftBukkit end
this.h(-this.h());
this.b(10);
this.setDamage(this.getDamage() + i * 10);
this.J();
boolean flag = damagesource.getEntity() instanceof EntityHuman && ((EntityHuman) damagesource.getEntity()).abilities.canInstantlyBuild;
if (flag || this.getDamage() > 40) {
// CraftBukkit start
VehicleDestroyEvent destroyEvent = new VehicleDestroyEvent(vehicle, attacker);
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 (this.passenger != null) {
this.passenger.mount(this);
}
if (!flag) {
this.a(Item.BOAT.id, 1, 0.0F);
}
this.die();
}
return true;
} else {
return true;
}
}