當前位置: 首頁>>代碼示例>>Java>>正文


Java EntityExplodeEvent.getEntityType方法代碼示例

本文整理匯總了Java中org.bukkit.event.entity.EntityExplodeEvent.getEntityType方法的典型用法代碼示例。如果您正苦於以下問題:Java EntityExplodeEvent.getEntityType方法的具體用法?Java EntityExplodeEvent.getEntityType怎麽用?Java EntityExplodeEvent.getEntityType使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.bukkit.event.entity.EntityExplodeEvent的用法示例。


在下文中一共展示了EntityExplodeEvent.getEntityType方法的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: cancelExplosionIfConfig

import org.bukkit.event.entity.EntityExplodeEvent; //導入方法依賴的package包/類
public static void cancelExplosionIfConfig(EntityExplodeEvent e) {
	EntityType type = e.getEntityType();
	if(type.equals(EntityType.PRIMED_TNT) && Config.getBool("protection", "blockTnt")) {
		e.setYield(0);
		e.setCancelled(true);
	} else if(type.equals(EntityType.CREEPER) && Config.getBool("protection", "blockCreeper")) {
		e.setYield(0);
		e.setCancelled(true);
	}
}
 
開發者ID:cjburkey01,項目名稱:ClaimChunk,代碼行數:11,代碼來源:ChunkHelper.java

示例2: onTNTExplosion

import org.bukkit.event.entity.EntityExplodeEvent; //導入方法依賴的package包/類
@EventHandler
public void onTNTExplosion(EntityExplodeEvent event) {
    if (event.getEntityType() == EntityType.PRIMED_TNT || event.getEntityType() == EntityType.CREEPER) {
        List<Block> blocks = event.blockList();
        for (int i = 0; i < blocks.size(); i++) {
            Block b = blocks.get(i);
            if (b.getType() == Material.SPONGE)
                event.blockList().remove(b);
        }
    }
}
 
開發者ID:josegrobles,項目名稱:LuckyBlocksBukkit,代碼行數:12,代碼來源:LuckyBlocksMainController.java

示例3: onEntityExplode

import org.bukkit.event.entity.EntityExplodeEvent; //導入方法依賴的package包/類
@EventHandler
public void onEntityExplode(EntityExplodeEvent e) {
    if(e.getEntityType() == EntityType.PRIMED_TNT) {
        for(Block block : e.blockList()) {
            if(block.getType() == Material.SPONGE) {
                e.blockList().remove(block);
            }
            if(block.getType() == Material.ENDER_STONE) {
                e.blockList().remove(block);
            }
        }
    }
}
 
開發者ID:grzegorz2047,項目名稱:SurvivalCG,代碼行數:14,代碼來源:PlayerBlockBreakListener.java

示例4: onExplode

import org.bukkit.event.entity.EntityExplodeEvent; //導入方法依賴的package包/類
@EventHandler
public void onExplode(EntityExplodeEvent event)
{
    if (event.getEntity() instanceof Creeper) {
        event.setCancelled(true);
        return;
    }
    else if (event.getEntityType() == EntityType.PRIMED_TNT) {
        event.setCancelled(true);
    }
}
 
開發者ID:sabersamus,項目名稱:Bytecraft,代碼行數:12,代碼來源:BytecraftBlockListener.java

示例5: WitherExplosionDamage

import org.bukkit.event.entity.EntityExplodeEvent; //導入方法依賴的package包/類
@EventHandler
public void WitherExplosionDamage(EntityExplodeEvent event){
	EntityType eType;
	try{
		eType = event.getEntityType();
	}catch(Exception e){
		eType = null;
	}
	if((eType != null)){
		if (eType == EntityType.WITHER) {
               if (plugin.isBlockWitherDamage()) {
                   event.blockList().clear();
                   return;
               }

               if (plugin.isBlockWitherExplosion()) {
                   event.setCancelled(true);
                   return;
               }
           }

           if (eType == EntityType.WITHER_SKULL) {
               if (plugin.isBlockWitherDamage()) {
                   event.blockList().clear();
                   return;
               }

               if (plugin.isBlockWitherExplosion()) {
                   event.setCancelled(true);
                   return;
               }
           }
	}
}
 
開發者ID:MutinyCraft,項目名稱:Wither,代碼行數:35,代碼來源:WitherEventHandler.java

示例6: onEntityExplode

import org.bukkit.event.entity.EntityExplodeEvent; //導入方法依賴的package包/類
/**
 * On entity explode.
 *
 * @param event the event
 */
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
public void onEntityExplode(EntityExplodeEvent event) {

    if (event.getEntity() == null) {
        return;
    }

    if (conf.isOverrideExplosions()) {

        float power;

        // Creeper Explosion
        if (event.getEntityType() == EntityType.CREEPER) {
            if (((Creeper) event.getEntity()).isPowered()) {
                // bugfix : droped item destroyed
            	power = 0L;
            } else {
                // bugfix : droped item destroyed
            	power = 0L;
            }
            ExplodeBlocks(event, event.blockList(), FlagList.CREEPER_DAMAGE.getFlagType(), event.getLocation(),
                    event.getYield(), power, false, true);

            //  Wither
        } else if (event.getEntityType() == EntityType.WITHER_SKULL) {
            ExplodeBlocks(event, event.blockList(), FlagList.WITHER_DAMAGE.getFlagType(), event.getLocation(),
                    event.getYield(), 1L, false, true);
        } else if (event.getEntityType() == EntityType.WITHER) {
            ExplodeBlocks(event, event.blockList(), FlagList.WITHER_DAMAGE.getFlagType(), event.getLocation(),
                    event.getYield(), 7L, false, true);

            // Ghast
        } else if (event.getEntityType() == EntityType.FIREBALL) {
            ExplodeBlocks(event, event.blockList(), FlagList.GHAST_DAMAGE.getFlagType(), event.getLocation(),
                    event.getYield(), 1L, true, true);

            // TNT
        } else if (event.getEntityType() == EntityType.MINECART_TNT
                || event.getEntityType() == EntityType.PRIMED_TNT) {
            ExplodeBlocks(event, event.blockList(), FlagList.TNT_DAMAGE.getFlagType(), event.getLocation(),
                    event.getYield(), 4L, false, true);
        } else if (event.getEntityType() == EntityType.ENDER_DRAGON) {
            ExplodeBlocks(event, event.blockList(), FlagList.ENDERDRAGON_DAMAGE.getFlagType(), event.getLocation(),
                    event.getYield(), 4L, false, false);
        }
    }
}
 
開發者ID:Tabinol,項目名稱:Factoid,代碼行數:53,代碼來源:WorldListener.java

示例7: onEntityExplode

import org.bukkit.event.entity.EntityExplodeEvent; //導入方法依賴的package包/類
@EventHandler
private void onEntityExplode(EntityExplodeEvent evt){
    if(evt.getEntityType() == EntityType.CREEPER){
        evt.setCancelled(!Settings.allowCreeperDestroyFields);
    }
}
 
開發者ID:lolopasdugato,項目名稱:MCWarClan,代碼行數:7,代碼來源:EventManager.java


注:本文中的org.bukkit.event.entity.EntityExplodeEvent.getEntityType方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。