本文整理汇总了Java中org.bukkit.event.vehicle.VehicleEntityCollisionEvent类的典型用法代码示例。如果您正苦于以下问题:Java VehicleEntityCollisionEvent类的具体用法?Java VehicleEntityCollisionEvent怎么用?Java VehicleEntityCollisionEvent使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
VehicleEntityCollisionEvent类属于org.bukkit.event.vehicle包,在下文中一共展示了VehicleEntityCollisionEvent类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: applyEntityCollision
import org.bukkit.event.vehicle.VehicleEntityCollisionEvent; //导入依赖的package包/类
@Override
/**
* Applies a velocity to each of the entities pushing them away from each other. Args: entity
*/
public void applyEntityCollision(Entity entity)
{
org.bukkit.entity.Entity hitEntity = (entity == null) ? null : entity.getBukkitEntity();
VehicleEntityCollisionEvent event = new VehicleEntityCollisionEvent((Vehicle) this.getBukkitEntity(), hitEntity);
this.worldObj.getServer().getPluginManager().callEvent(event);
if (event.isCancelled())
{
return;
}
super.applyEntityCollision(entity);
}
示例2: onVehicleEntityCollision
import org.bukkit.event.vehicle.VehicleEntityCollisionEvent; //导入依赖的package包/类
@EventHandler (ignoreCancelled = true)
public void onVehicleEntityCollision(VehicleEntityCollisionEvent event) {
Location loc = event.getVehicle().getLocation(BCProtect.location);
EntityType type = event.getEntity().getType();
if (! type.equals(EntityType.PLAYER)
&& ! type.equals(EntityType.MINECART)
&& ! type.equals(EntityType.MINECART_CHEST)
&& ! type.equals(EntityType.MINECART_FURNACE)
&& ! type.equals(EntityType.MINECART_HOPPER)
&& ! type.equals(EntityType.MINECART_MOB_SPAWNER)
&& ! type.equals(EntityType.MINECART_TNT)
&& Util.getQuadtree(loc).contains(loc)) {
event.setCancelled(true);
event.getEntity().remove();
}
}
示例3: collide
import org.bukkit.event.vehicle.VehicleEntityCollisionEvent; //导入依赖的package包/类
@Override
public void collide(Entity entity) {
org.bukkit.entity.Entity hitEntity = (entity == null) ? null : entity.getBukkitEntity();
VehicleEntityCollisionEvent event = new VehicleEntityCollisionEvent((Vehicle) this.getBukkitEntity(), hitEntity);
this.world.getServer().getPluginManager().callEvent(event);
if (event.isCancelled()) {
return;
}
super.collide(entity);
}
示例4: onVehiclePush
import org.bukkit.event.vehicle.VehicleEntityCollisionEvent; //导入依赖的package包/类
@EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true)
public void onVehiclePush(final VehicleEntityCollisionEvent event) {
cancelUnlessInteracting(event, event.getEntity());
}
示例5: onVehicleEntityCollision
import org.bukkit.event.vehicle.VehicleEntityCollisionEvent; //导入依赖的package包/类
@EventHandler(priority = EventPriority.LOW, ignoreCancelled = true)
public void onVehicleEntityCollision(VehicleEntityCollisionEvent event) {
if (this.isObserving(event.getEntity())) {
event.setCancelled(true);
}
}