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


Java HangingBreakEvent.setCancelled方法代码示例

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


在下文中一共展示了HangingBreakEvent.setCancelled方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: onFrameBrake

import org.bukkit.event.hanging.HangingBreakEvent; //导入方法依赖的package包/类
@EventHandler
  public void onFrameBrake(HangingBreakEvent e) {
  	if (e.isCancelled()){
  		return;
  	}

  	Location l = e.getEntity().getLocation();
Region r = RedProtect.get().rm.getTopRegion(l);
  	if (r != null){
  		return;
  	}
  	
  	if (e.getCause().toString().equals("EXPLOSION") || e.getCause().toString().equals("ENTITY")) {
  		if (!RPConfig.getGlobalFlagBool(l.getWorld().getName()+".entity-block-damage")){
  			e.setCancelled(true);
	}
      }   
  }
 
开发者ID:FabioZumbi12,项目名称:RedProtect,代码行数:19,代码来源:RPGlobalListener.java

示例2: onFrameBrake

import org.bukkit.event.hanging.HangingBreakEvent; //导入方法依赖的package包/类
@EventHandler
 public void onFrameBrake(HangingBreakEvent e) {
 	RedProtect.get().logger.debug("Is BlockListener - HangingBreakEvent event");
 	if (e.isCancelled()){
 		return;
 	}
 	
 	Entity ent = e.getEntity();
 	Location l = e.getEntity().getLocation();		
 	
 	if ((ent instanceof ItemFrame || ent instanceof Painting) && (e.getCause().toString().equals("EXPLOSION"))) {
 		Region r = RedProtect.get().rm.getTopRegion(l);
 		if (r != null && !r.canFire()){
 			e.setCancelled(true);
}
     }    
 }
 
开发者ID:FabioZumbi12,项目名称:RedProtect,代码行数:18,代码来源:RPBlockListener.java

示例3: onHangingBreak

import org.bukkit.event.hanging.HangingBreakEvent; //导入方法依赖的package包/类
@EventHandler
public void onHangingBreak(HangingBreakEvent event) {
    EntityProtection entityProtection = this.module.getProtectManager().getEntityProtection(event.getEntity().getType(), event.getEntity().getUniqueId());
    if(entityProtection.exists()) {
        if(event instanceof HangingBreakByEntityEvent) {
            HangingBreakByEntityEvent entityEvent = (HangingBreakByEntityEvent) event;
            if(entityEvent.getRemover() instanceof Player) {
                Player player = (Player) entityEvent.getRemover();

                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.getEntity().getWorld().getName()));
            }
        }

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

示例4: onHangingDamage

import org.bukkit.event.hanging.HangingBreakEvent; //导入方法依赖的package包/类
@EventHandler
public void onHangingDamage(HangingBreakEvent event) {
    if (!event.isCancelled()) {
        for (Region region : regions) {
            if (region.contains(event.getEntity().getLocation())) {
                event.setCancelled(true);
            }
        }
    }
}
 
开发者ID:WarzoneMC,项目名称:Warzone,代码行数:11,代码来源:BuildFilterType.java

示例5: onHangingBreak

import org.bukkit.event.hanging.HangingBreakEvent; //导入方法依赖的package包/类
@EventHandler
public void onHangingBreak(HangingBreakEvent event)
{
	if(event.isCancelled())
		return;
	if(event.getCause() == RemoveCause.ENTITY)
		event.setCancelled(true);
}
 
开发者ID:Limeth,项目名称:Breakpoint,代码行数:9,代码来源:PlayerInteractListener.java

示例6: onItemFrameBreak

import org.bukkit.event.hanging.HangingBreakEvent; //导入方法依赖的package包/类
@EventHandler(priority = HIGHEST, ignoreCancelled = true)
public void onItemFrameBreak(HangingBreakEvent ev) {
    if (!(ev.getEntity() instanceof ItemFrame)) return;
    ItemFrame f = (ItemFrame) ev.getEntity();
    if (f.getItem() == null || f.getItem().getType() == Material.AIR) return;
    if (ExhibitionFrame.fromItemFrame(f).isSet()) {
        if (ev.getCause() == HangingBreakEvent.RemoveCause.EXPLOSION) { // Explosion protect
            ev.setCancelled(true);
        } else {
            plugin.getLogger().warning(String.format("Exhibition broken: Location: %s, item: %s", f.getLocation().toString(),
                    f.getItem().toString()));
            f.setItem(new ItemStack(Material.AIR));
        }
    }
}
 
开发者ID:NyaaCat,项目名称:NyaaUtils,代码行数:16,代码来源:ExhibitionListener.java

示例7: onHangingBreak

import org.bukkit.event.hanging.HangingBreakEvent; //导入方法依赖的package包/类
@EventHandler
public void onHangingBreak(HangingBreakEvent event) {
    if (event instanceof HangingBreakByEntityEvent) {
        if (region.contains(event.getEntity().getLocation().toVector()) && filter.evaluate(event.getEntity(), ((HangingBreakByEntityEvent) event).getRemover(), event).equals(FilterState.DENY)) {
            event.setCancelled(true);
        }
    } else {
        if (region.contains(event.getEntity().getLocation().toVector()) && filter.evaluate(event.getEntity(), event).equals(FilterState.DENY)) {
            event.setCancelled(true);
        }
    }
}
 
开发者ID:dentmaged,项目名称:Cardinal-Plus,代码行数:13,代码来源:BlockBreakRegion.java

示例8: onHangingBreak

import org.bukkit.event.hanging.HangingBreakEvent; //导入方法依赖的package包/类
@EventHandler(priority = EventPriority.HIGHEST)
public void onHangingBreak(HangingBreakEvent event) {
  Hanging hanging = event.getEntity();
  if (event.getCause().equals(RemoveCause.OBSTRUCTION)) {
    hanging.getLocation().getBlock().breakNaturally();
    event.setCancelled(true);
  } else if (event.getCause().equals(RemoveCause.EXPLOSION)) {
    event.setCancelled(true);
  }

}
 
开发者ID:BedwarsRel,项目名称:BedwarsRel,代码行数:12,代码来源:HangingListener.java

示例9: onHangingBreak

import org.bukkit.event.hanging.HangingBreakEvent; //导入方法依赖的package包/类
@EventHandler
public void onHangingBreak(HangingBreakEvent event) {
    if(event instanceof HangingBreakByEntityEvent) {
        Entity attacker = ((HangingBreakByEntityEvent) event).getRemover();
        if(attacker instanceof Player) {
            Player player = (Player) attacker;
            Lot lot = this.module.getLotManager().getLot(event.getEntity().getLocation());
            Town town = this.module.getLotManager().getTown(event.getEntity().getLocation());
            if(((lot != null && !lot.canBuild(player)) || (lot == null && town != null)) && !player.hasPermission(LotPermissions.BUILD_ANYWHERE)) {
                event.setCancelled(true);
            }
        }
    }
}
 
开发者ID:Steveice10,项目名称:Peacecraft,代码行数:15,代码来源:LotsListener.java

示例10: onHangingBreak

import org.bukkit.event.hanging.HangingBreakEvent; //导入方法依赖的package包/类
@EventHandler
public void onHangingBreak(HangingBreakEvent event) {
   if (event.getCause() == RemoveCause.ENTITY) {
      HangingBreakByEntityEvent entityEvent = (HangingBreakByEntityEvent) event;
      if (entityEvent.getRemover() instanceof Player) {
         Player remover = (Player) entityEvent.getRemover();
         if (remover.isOp() && remover.getGameMode() == GameMode.CREATIVE) {
            return;
         }
      }
   }
   event.setCancelled(true);
}
 
开发者ID:PaulBGD,项目名称:MiniMiniGames,代码行数:14,代码来源:WorldListener.java

示例11: onHangingBreak

import org.bukkit.event.hanging.HangingBreakEvent; //导入方法依赖的package包/类
/**
 * On hanging break.
 *
 * @param event the event
 */
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
public void onHangingBreak(HangingBreakEvent event) {

    if (conf.isOverrideExplosions()) {
        // Check for painting
        if (event.getCause() == RemoveCause.EXPLOSION) {
            Factoid.getThisPlugin().iLog().write("Cancel HangingBreak : " + event.getEntity() + ", Cause: " + event.getCause());
            event.setCancelled(true);
        }
    }
}
 
开发者ID:Tabinol,项目名称:Factoid,代码行数:17,代码来源:WorldListener.java

示例12: onHangingDestroy

import org.bukkit.event.hanging.HangingBreakEvent; //导入方法依赖的package包/类
@EventHandler
public void onHangingDestroy(HangingBreakEvent event) {
	for(Game game : SurvivalGames.gameManager.getGames()) {
		for(Arena arena : game.getArenas()) {
			if(arena.containsBlock(event.getEntity().getLocation()))
				event.setCancelled(true);
		}
	}
}
 
开发者ID:maker56,项目名称:UltimateSurvivalGames,代码行数:10,代码来源:PlayerListener.java

示例13: onHangingBreak

import org.bukkit.event.hanging.HangingBreakEvent; //导入方法依赖的package包/类
@EventHandler
public void onHangingBreak(HangingBreakEvent event) {
    // If there's no portal, we don't care.
    final ABPortal portal = plugin.getManager().getByFrame(event.getEntity());
    if (portal == null)
        return;

    // Cancel it so it doesn't break.
    event.setCancelled(true);
}
 
开发者ID:stendec,项目名称:Abyss,代码行数:11,代码来源:ItemListener.java

示例14: onHangingBreak

import org.bukkit.event.hanging.HangingBreakEvent; //导入方法依赖的package包/类
@EventHandler
public void onHangingBreak(HangingBreakEvent event) {
	Entity hanging = event.getEntity();
	
	ArenaManager am = SimpleSurvivalGames.instance.getArenaManager();

	for(Arena a : am.getArenas())
		if(a.isArenaCuboidSet())
			if(a.getArenaCuboid().isInsideCuboid(hanging.getLocation()))
				if(!a.isInEditMode())
					event.setCancelled(true);
}
 
开发者ID:timvisee,项目名称:simple-survival-games,代码行数:13,代码来源:SSGHangingListener.java

示例15: onHangingBreak

import org.bukkit.event.hanging.HangingBreakEvent; //导入方法依赖的package包/类
@EventHandler (priority = EventPriority.HIGH)
public void onHangingBreak(HangingBreakEvent event) {
	if (event.isCancelled() || (event.getEntity().getType() != EntityType.ITEM_FRAME)) return;
	ItemFrame entity = (ItemFrame)event.getEntity();
	Frame frame = this.manager.getFrame(entity);
	if (frame == null) return;
	
	Player player = null;
	if (event instanceof HangingBreakByEntityEvent) {
		Entity remover = ((HangingBreakByEntityEvent)event).getRemover();
		if (remover.getType() == EntityType.PLAYER) {
			player = (Player) remover;
		}
	}

	if ((player != null) && Config.WORLDGUARD_ENABLED && Config.WORLDGUARD_BREAK && !player.hasPermission("FramePicture.ignoreWorldGuard"))
	{
		RegionManager rm = FramePicturePlugin.getWorldGuard().getRegionManager(player.getWorld());
		LocalPlayer localPlayer = FramePicturePlugin.getWorldGuard().wrapPlayer(player);
		if (!rm.getApplicableRegions(frame.getLocation()).canBuild(localPlayer)) {
			player.sendMessage(Lang.PREFIX.getText() + Lang.NO_PERMISSION.getText());
			event.setCancelled(true);
			return;
		}
	}
	
	this.manager.removeFrame(frame);
	if (player != null)
		player.sendMessage(Lang.PREFIX.getText() + Lang.FRAME_REMOVED.getText().replace("%id", String.valueOf(frame.getId())));
	
	for (Entity e : entity.getNearbyEntities(32.0, 32.0, 32.0)) {
		if (e.getType() != EntityType.PLAYER) continue;
		Player p = (Player)e;
		this.sendFrameDestroy(p, entity.getEntityId());
	}
}
 
开发者ID:Howaner,项目名称:FramePicture,代码行数:37,代码来源:FrameListener.java


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