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