• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java VehicleDestroyEvent类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: getAttacker

import org.bukkit.event.vehicle.VehicleDestroyEvent; //导入依赖的package包/类
private static Object getAttacker(final Event e) {
	if (e instanceof EntityDamageByEntityEvent) {
		if (((EntityDamageByEntityEvent) e).getDamager() instanceof Projectile) {
			return ((Projectile) ((EntityDamageByEntityEvent) e).getDamager()).getShooter();
		}
		return ((EntityDamageByEntityEvent) e).getDamager();
	} else if (e instanceof EntityDamageByBlockEvent) {
		return ((EntityDamageByBlockEvent) e).getDamager();
	} else if (e instanceof EntityDeathEvent) {
		return getAttacker(((EntityDeathEvent) e).getEntity().getLastDamageCause());
	} else if (e instanceof VehicleDamageEvent) {
		return ((VehicleDamageEvent) e).getAttacker();
	} else if (e instanceof VehicleDestroyEvent) {
		return ((VehicleDestroyEvent) e).getAttacker();
	}
	return null;
}
 
开发者ID:nfell2009,项目名称:Skript,代码行数:18,代码来源:ExprAttackerAlt.java


示例2: getAttacker

import org.bukkit.event.vehicle.VehicleDestroyEvent; //导入依赖的package包/类
@Nullable
	private static Entity getAttacker(final @Nullable Event e) {
		if (e == null)
			return null;
		if (e instanceof EntityDamageByEntityEvent) {
			if (((EntityDamageByEntityEvent) e).getDamager() instanceof Projectile) {
				final Object o = ProjectileUtils.getShooter((Projectile) ((EntityDamageByEntityEvent) e).getDamager());
				if (o instanceof Entity)
					return (Entity) o;
				return null;
			}
			return ((EntityDamageByEntityEvent) e).getDamager();
//		} else if (e instanceof EntityDamageByBlockEvent) {
//			return ((EntityDamageByBlockEvent) e).getDamager();
		} else if (e instanceof EntityDeathEvent) {
			return getAttacker(((EntityDeathEvent) e).getEntity().getLastDamageCause());
		} else if (e instanceof VehicleDamageEvent) {
			return ((VehicleDamageEvent) e).getAttacker();
		} else if (e instanceof VehicleDestroyEvent) {
			return ((VehicleDestroyEvent) e).getAttacker();
		}
		return null;
	}
 
开发者ID:nfell2009,项目名称:Skript,代码行数:24,代码来源:ExprAttacker.java


示例3: 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);
	}
}
 
开发者ID:FabioZumbi12,项目名称:RedProtect,代码行数:21,代码来源:RPGlobalListener.java


示例4: 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);
	}
}
 
开发者ID:FabioZumbi12,项目名称:RedProtect,代码行数:19,代码来源:RPBlockListener.java


示例5: onVehicleDestroy

import org.bukkit.event.vehicle.VehicleDestroyEvent; //导入依赖的package包/类
@EventHandler
public void onVehicleDestroy(VehicleDestroyEvent event) {
    EntityProtection entityProtection = this.module.getProtectManager().getEntityProtection(event.getVehicle().getType(), event.getVehicle().getUniqueId());
    if(entityProtection.exists()) {
        if(event.getAttacker() instanceof Player) {
            Player player = (Player) event.getAttacker();

            if(entityProtection.getOwner().equals(player.getUniqueId()) || player.hasPermission(ProtectPermissions.MODIFY_ALL)) {
                entityProtection.remove();
                sendMessage(player, "protect.entity-unprotected");
                return;
            }

            sendMessage(player, "protect.entity-protected-by", getDisplayName(this.module.getManager().getUsername(entityProtection.getOwner()), event.getVehicle().getWorld().getName()));
        }

        event.setCancelled(true);
    }
}
 
开发者ID:Steveice10,项目名称:Peacecraft,代码行数:20,代码来源:ProtectListener.java


示例6: onBoatHit

import org.bukkit.event.vehicle.VehicleDestroyEvent; //导入依赖的package包/类
/**
 * @param e
 *            This function prevents boats from exploding when they hit
 *            something
 */
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = false)
public void onBoatHit(VehicleDestroyEvent e) {
    // plugin.getLogger().info("Vehicle destroyed event called");
    final Entity boat = e.getVehicle();
    if (!(boat instanceof Boat)) {
        return;
    }
    if (!boat.getWorld().getName().equalsIgnoreCase(Settings.worldName)) {
        // Not the right world
        return;
    }
    if (!(e.getAttacker() instanceof Player)) {
        // plugin.getLogger().info("Attacker is not a player so cancel event");
        e.setCancelled(true);
    }
}
 
开发者ID:tastybento,项目名称:acidisland,代码行数:22,代码来源:SafeBoat.java


示例7: onVehicleDestroy

import org.bukkit.event.vehicle.VehicleDestroyEvent; //导入依赖的package包/类
@EventHandler
public void onVehicleDestroy(VehicleDestroyEvent event) {
	Vehicle v = event.getVehicle();
	Entity attacker = event.getAttacker();
	
	ArenaManager am = SimpleSurvivalGames.instance.getArenaManager();

	for(Arena a : am.getArenas()) {
		if(a.isArenaCuboidSet()) {
			if(a.getArenaCuboid().isInsideCuboid(v.getLocation())) {
				if(!a.isInEditMode()) {
					event.setCancelled(true);
					if(attacker instanceof Player) {
						Player p = (Player) attacker;
						p.sendMessage(ChatColor.DARK_RED + "You may not destroy this vehicle!");
					}
				}
			}
		}
	}
}
 
开发者ID:timvisee,项目名称:simple-survival-games,代码行数:22,代码来源:SSGVehicleListener.java


示例8: onVehicleDestroy

import org.bukkit.event.vehicle.VehicleDestroyEvent; //导入依赖的package包/类
@EventHandler
public void onVehicleDestroy(VehicleDestroyEvent event) {
    if (event.getAttacker() != null && event.getAttacker() instanceof Player) {
        if (isSpectating((Player) event.getAttacker())) {
            event.setCancelled(true);
        }
    }
}
 
开发者ID:WarzoneMC,项目名称:Warzone,代码行数:9,代码来源:SpectatorModule.java


示例9: init

import org.bukkit.event.vehicle.VehicleDestroyEvent; //导入依赖的package包/类
@SuppressWarnings("unchecked")
@Override
public boolean init(final Expression<?>[] vars, final int matchedPattern, final Kleenean isDelayed, final ParseResult parser) {
	if (!ScriptLoader.isCurrentEvent(EntityDamageByEntityEvent.class, EntityDeathEvent.class, VehicleDamageEvent.class, VehicleDestroyEvent.class)) {
		Skript.error("Cannot use 'attacker' outside of a damage/death/destroy event", ErrorQuality.SEMANTIC_ERROR);
		return false;
	}
	return true;
}
 
开发者ID:nfell2009,项目名称:Skript,代码行数:10,代码来源:ExprAttacker.java


示例10: 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);
    }
}
 
开发者ID:OvercastNetwork,项目名称:CraftBukkit,代码行数:36,代码来源:EntityBoat.java


示例11: on

import org.bukkit.event.vehicle.VehicleDestroyEvent; //导入依赖的package包/类
@EventHandler
public void on(VehicleDestroyEvent e) {
    if (breakVehicleEnabled || !(e.getAttacker() instanceof Player)) {
        return;
    }
    Player player = (Player) e.getAttacker();
    if (hasPermission(player, "usb.mod.bypassprotection") || plugin.playerIsOnIsland(player)) {
        return;
    }
    e.setCancelled(true);
    player.sendMessage(tr("\u00a7eYou cannot break vehicles while being a visitor!"));
}
 
开发者ID:rlf,项目名称:uSkyBlock,代码行数:13,代码来源:ExploitEvents.java


示例12: onVehicleDestroy

import org.bukkit.event.vehicle.VehicleDestroyEvent; //导入依赖的package包/类
@EventHandler(ignoreCancelled = true)
public void onVehicleDestroy(VehicleDestroyEvent event) {
    if (event.getVehicle().getPassenger() != null && event.getVehicle().getPassenger() instanceof Player) {
        getBackend().logEnterExit((Player) event.getVehicle().getPassenger());
    }

    AntiCheat.getManager().addEvent(event.getEventName(), event.getHandlers().getRegisteredListeners());
}
 
开发者ID:Obsidian-Realm,项目名称:AntiCheat-COMPAT,代码行数:9,代码来源:VehicleListener.java


示例13: onVehicleDestroy

import org.bukkit.event.vehicle.VehicleDestroyEvent; //导入依赖的package包/类
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
public void onVehicleDestroy(VehicleDestroyEvent event) {
    Location l = BukkitUtil.getLocation(event.getVehicle());
    PlotArea area = l.getPlotArea();
    if (area == null) {
        return;
    }
    Entity d = event.getAttacker();
    if (d instanceof Player) {
        Player p = (Player) d;
        PlotPlayer pp = BukkitUtil.getPlayer(p);
        Plot plot = area.getPlot(l);
        if (plot == null) {
            if (!Permissions.hasPermission(pp, "plots.admin.vehicle.break.road")) {
                MainUtil.sendMessage(pp, C.NO_PERMISSION_EVENT, "plots.admin.vehicle.break.road");
                event.setCancelled(true);
            }
        } else {
            if (!plot.hasOwner()) {
                if (!Permissions.hasPermission(pp, "plots.admin.vehicle.break.unowned")) {
                    MainUtil.sendMessage(pp, C.NO_PERMISSION_EVENT, "plots.admin.vehicle.break.unowned");
                    event.setCancelled(true);
                    return;
                }
                return;
            }
            if (!plot.isAdded(pp.getUUID())) {
                if (plot.getFlag(Flags.VEHICLE_BREAK, false)) {
                    return;
                }
                if (!Permissions.hasPermission(pp, "plots.admin.vehicle.break.other")) {
                    MainUtil.sendMessage(pp, C.NO_PERMISSION_EVENT, "plots.admin.vehicle.break.other");
                    event.setCancelled(true);
                }
            }
        }
    }
}
 
开发者ID:IntellectualSites,项目名称:PlotSquared,代码行数:39,代码来源:PlayerEvents.java


示例14: onVehicleDestroy

import org.bukkit.event.vehicle.VehicleDestroyEvent; //导入依赖的package包/类
@EventHandler
public void onVehicleDestroy(final VehicleDestroyEvent event) {
	debug("VehicleDamageEvent triggered!");
	if (event.getAttacker() == null) { return; }

	final Entity damager = Utility.getRealDamager(event.getAttacker());
	if (!(damager instanceof Player)) { return; }
	debug("Determined real damager: " + damager.getName());

	if (!this.canInteract(event.getVehicle(), (Player)damager)) { event.setCancelled(true); }
}
 
开发者ID:Craftolution,项目名称:CraftoPlugin,代码行数:12,代码来源:EntityProtectionBreakListener.java


示例15: VehicleDestroy

import org.bukkit.event.vehicle.VehicleDestroyEvent; //导入依赖的package包/类
@EventHandler
public void VehicleDestroy(final VehicleDestroyEvent event)
{
	if (!(event.getAttacker() instanceof Player))
		return;
	final Player player = (Player) event.getAttacker();
	if (plugin.isLoggedIn(player))
		return;
	event.setCancelled(true);
	plugin.sendAuthReminderMessage(player);
}
 
开发者ID:ST-DDT,项目名称:CrazyLogin,代码行数:12,代码来源:DynamicVehicleListener.java


示例16: 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);
        }

    }
}
 
开发者ID:bergerkiller,项目名称:SpigotSource,代码行数:41,代码来源:EntityBoat.java


示例17: onVehicleDestroy

import org.bukkit.event.vehicle.VehicleDestroyEvent; //导入依赖的package包/类
@EventHandler (ignoreCancelled = true)
public void onVehicleDestroy(VehicleDestroyEvent event) {
	Location loc = event.getVehicle().getLocation(BCProtect.location);
	if (Util.getQuadtree(loc).contains(loc)) {
		event.setCancelled(true);
	}
}
 
开发者ID:catageek,项目名称:BCProtect,代码行数:8,代码来源:VehicleDestroyListener.java


示例18: onVehicleDestroy

import org.bukkit.event.vehicle.VehicleDestroyEvent; //导入依赖的package包/类
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
public void onVehicleDestroy(final VehicleDestroyEvent event) {
    if (event.getAttacker() != null && event.getAttacker().getType() == EntityType.PLAYER) {
        final Player player = (Player)event.getAttacker();
        final GeneralRegion region = this.getPlugin().getDb().getPriorByLocation(event.getVehicle().getLocation());
        if (region != null && region.getFlag(Flag.BUILD) && !region.isUser(player)) {
            event.setCancelled(true);
        }
    }
}
 
开发者ID:Ribesg,项目名称:NPlugins,代码行数:11,代码来源:BuildFlagListener.java


示例19: onVehicleDestroy

import org.bukkit.event.vehicle.VehicleDestroyEvent; //导入依赖的package包/类
@EventHandler
public void onVehicleDestroy(VehicleDestroyEvent event) {
    if (event.getAttacker() instanceof Player) {
        this.manager.invoke((Player) event.getAttacker(), event);
    }
}
 
开发者ID:AbilityAPI,项目名称:AbilityAPI,代码行数:7,代码来源:SequenceListener.java


示例20: 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;
    }
}
 
开发者ID:OvercastNetwork,项目名称:CraftBukkit,代码行数:54,代码来源:EntityMinecartAbstract.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java ActiveMQComponent类代码示例发布时间:2022-05-21
下一篇:
Java IEntityMultiPart类代码示例发布时间:2022-05-21
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap