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


Java VehicleDestroyEvent.setCancelled方法代码示例

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


在下文中一共展示了VehicleDestroyEvent.setCancelled方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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);
	}
}
 
开发者ID:FabioZumbi12,项目名称:RedProtect,代码行数:21,代码来源:RPGlobalListener.java

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

示例3: 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

示例4: 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

示例5: 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

示例6: 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

示例7: 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

示例8: 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

示例9: 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

示例10: 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

示例11: 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

示例12: 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

示例13: onVehicleDestroy

import org.bukkit.event.vehicle.VehicleDestroyEvent; //导入方法依赖的package包/类
@EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true)
public void onVehicleDestroy(final VehicleDestroyEvent e) {
    final Location l = BukkitUtil.getLocation(e.getVehicle());
    if (PlotSquared.isPlotWorld(l.getWorld())) {
        final Entity d = e.getAttacker();
        if (d instanceof Player) {
            final Player p = (Player) d;
            PlotSquared.getPlotWorld(l.getWorld());
            final PlotPlayer pp = BukkitUtil.getPlayer(p);
            Plot plot = MainUtil.getPlot(l);
            if (plot == null) {
                if (!MainUtil.isPlotAreaAbs(l)) {
                    return;
                }
                if (!Permissions.hasPermission(pp, "plots.admin.vehicle.break.road")) {
                    MainUtil.sendMessage(pp, C.NO_PERMISSION, "plots.admin.vehicle.break.road");
                    e.setCancelled(true);
                    return;
                }
            } else {
                if (!plot.hasOwner()) {
                    if (!Permissions.hasPermission(pp, "plots.admin.vehicle.break.unowned")) {
                        MainUtil.sendMessage(pp, C.NO_PERMISSION, "plots.admin.vehicle.break.unowned");
                        e.setCancelled(true);
                        return;
                    }
                    return;
                }
                if (!plot.isAdded(pp.getUUID())) {
                    if (FlagManager.isPlotFlagTrue(plot, "vehicle-break")) {
                        return;
                    }
                    if (!Permissions.hasPermission(pp, "plots.admin.vehicle.break.other")) {
                        if (MainUtil.isPlotArea(l)) {
                            MainUtil.sendMessage(pp, C.NO_PERMISSION, "plots.admin.vehicle.break.other");
                            e.setCancelled(true);
                            return;
                        }
                    }
                }
            }
        }
    }
}
 
开发者ID:Mayomi,项目名称:PlotSquared-Chinese,代码行数:45,代码来源:PlayerEvents.java


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