當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。