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


Java HangingBreakByEntityEvent.isCancelled方法代码示例

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


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

示例1: onHangingDamaged

import org.bukkit.event.hanging.HangingBreakByEntityEvent; //导入方法依赖的package包/类
@EventHandler
  public void onHangingDamaged(HangingBreakByEntityEvent e) {
  	if (e.isCancelled()) {
          return;
      }
  	
      Entity ent = e.getRemover();
      Location loc = e.getEntity().getLocation();
      Region r = RedProtect.get().rm.getTopRegion(loc);
      if (r != null){
	return;
}
      
      if (ent instanceof Player) { 
      	Player p = (Player)ent;
          if (!bypassBuild(p, null, 0)) {
              e.setCancelled(true);
          }
      }
  }
 
开发者ID:FabioZumbi12,项目名称:RedProtect,代码行数:21,代码来源:RPGlobalListener.java

示例2: onFrameBrake

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

示例3: onHangingDamaged

import org.bukkit.event.hanging.HangingBreakByEntityEvent; //导入方法依赖的package包/类
@EventHandler
public void onHangingDamaged(HangingBreakByEntityEvent e) {
	if (e.isCancelled()) {
        return;
    }
	RedProtect.get().logger.debug("Is RPPlayerListener - HangingBreakByEntityEvent event");
    Entity ent = e.getRemover();
    Location loc = e.getEntity().getLocation();
    Region r = RedProtect.get().rm.getTopRegion(loc);
    
    if (ent instanceof Player) {
        Player player = (Player)ent; 
        if (r != null && !r.canBuild(player) && !r.canBreak(e.getEntity().getType())) {
        	RPLang.sendMessage(player, "blocklistener.region.cantbuild");
            e.setCancelled(true);
        }
    } 
    if (ent instanceof Monster){
    	if (r != null && !r.canMobLoot()) {
            e.setCancelled(true);
        }
    }
}
 
开发者ID:FabioZumbi12,项目名称:RedProtect,代码行数:24,代码来源:RPPlayerListener.java

示例4: onHangingBreakByEntity

import org.bukkit.event.hanging.HangingBreakByEntityEvent; //导入方法依赖的package包/类
/**
 * Prevent players from destroying item frames in protected regions
 */
@EventHandler
public void onHangingBreakByEntity(HangingBreakByEntityEvent event) {
    CuboidRegion region = regionHandler.getApplicableRegion(event.getEntity().getLocation());
    if (!event.isCancelled() && region != null && !region.allows("destroy")) {
        event.setCancelled(true);
        if (event.getRemover() instanceof Player) {
            warnPlayer((Player) event.getRemover());
        }
    }
}
 
开发者ID:redwallhp,项目名称:AthenaGM,代码行数:14,代码来源:BlockBreakListener.java

示例5: onItemFrameDestory

import org.bukkit.event.hanging.HangingBreakByEntityEvent; //导入方法依赖的package包/类
@EventHandler
public void onItemFrameDestory(final HangingBreakByEntityEvent event) {
	if (!event.isCancelled() && event.getEntity() instanceof ItemFrame) {
		final Block block = event.getEntity().getLocation().getBlock();
		if (block.getType().equals(Material.STONE_BUTTON)) {
			final Optional<Craftomat> craftomat = this.storage.getCraftomat(block.getLocation());
			if (craftomat.isPresent()) {
				event.setCancelled(true);
			}
		}
	}
}
 
开发者ID:Craftolution,项目名称:CraftoPlugin,代码行数:13,代码来源:CraftomatListener.java

示例6: onLightningStrike

import org.bukkit.event.hanging.HangingBreakByEntityEvent; //导入方法依赖的package包/类
public void onLightningStrike(EntityLightning entitylightning) {
    // CraftBukkit start
    final org.bukkit.entity.Entity thisBukkitEntity = this.getBukkitEntity();
    final org.bukkit.entity.Entity stormBukkitEntity = entitylightning.getBukkitEntity();
    final PluginManager pluginManager = Bukkit.getPluginManager();

    if (thisBukkitEntity instanceof Hanging) {
        HangingBreakByEntityEvent hangingEvent = new HangingBreakByEntityEvent((Hanging) thisBukkitEntity, stormBukkitEntity);
        pluginManager.callEvent(hangingEvent);

        if (hangingEvent.isCancelled()) {
            return;
        }
    }

    if (this.fireProof) {
        return;
    }
    CraftEventFactory.entityDamage = entitylightning;
    if (!this.damageEntity(DamageSource.LIGHTNING, 5.0F)) {
        CraftEventFactory.entityDamage = null;
        return;
    }
    // CraftBukkit end
    ++this.fireTicks;
    if (this.fireTicks == 0) {
        // CraftBukkit start - Call a combust event when lightning strikes
        EntityCombustByEntityEvent entityCombustEvent = new EntityCombustByEntityEvent(stormBukkitEntity, thisBukkitEntity, 8);
        pluginManager.callEvent(entityCombustEvent);
        if (!entityCombustEvent.isCancelled()) {
            this.setOnFire(entityCombustEvent.getDuration());
        }
        // CraftBukkit end
    }

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


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