本文整理匯總了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);
}
}
示例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);
}
}
}
示例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);
}
}
}
}
示例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);
}
}
示例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;
}
}
}
}
示例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);
}
}
}
示例7: onEntityExplode
import org.bukkit.event.entity.EntityExplodeEvent; //導入方法依賴的package包/類
@EventHandler
private void onEntityExplode(EntityExplodeEvent evt){
if(evt.getEntityType() == EntityType.CREEPER){
evt.setCancelled(!Settings.allowCreeperDestroyFields);
}
}