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


Java DamageCause.FIRE_TICK属性代码示例

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


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

示例1: onItemDamage

@EventHandler
public void onItemDamage(EntityDamageEvent event) {
    if (event.getEntityType() == EntityType.DROPPED_ITEM && (event.getCause() == DamageCause.LAVA || event.getCause() == DamageCause.FIRE_TICK || event.getCause() == DamageCause.FIRE)) {
        Vector v = Vector.getRandom().normalize();
        v = v.setX(v.getX() - 0.5f);
        v = v.setZ(v.getZ() - 0.5f);
        v = v.multiply(0.35);
        if (v.getX() > 0 && v.getX() < 0.10)
            v.setX(0.10);
        if (v.getZ() > 0 && v.getZ() < 0.10)
            v.setZ(0.10);
        if (v.getX() < 0 && v.getX() > -0.10)
            v.setX(-0.10);
        if (v.getZ() < 0 && v.getZ() > -0.10)
            v.setZ(-0.10);
        v.setY(0.3);
        event.getEntity().setVelocity(v);
        event.setCancelled(true);
        RScheduler.schedule(plugin, () -> {
            event.getEntity().setFireTicks(0);
        }, RTicks.seconds(1));
    }
    if (event.getEntityType() == EntityType.ARMOR_STAND && (event.getCause() == DamageCause.LAVA || event.getCause() == DamageCause.FIRE_TICK || event.getCause() == DamageCause.FIRE)) {
        event.setCancelled(true);
    }
}
 
开发者ID:edasaki,项目名称:ZentrelaRPG,代码行数:26,代码来源:EnvironmentManager.java

示例2: monsterDies

@EventHandler(priority = EventPriority.NORMAL)
public void monsterDies(EntityDeathEvent event) {
	
	if (_apocalypseOn && event.getEntity().getLastDamageCause().getCause() != DamageCause.FIRE_TICK) {
		
		if (event.getEntity() instanceof Monster) {
			_monsterDead++;
		}
		
		if (_monsterDead >= _maxMonsters) {
			_completed = true;
			distributeLoot();
			resetEvent();
		}		
		
		try {
			_spawner.spawnMonsterCloseToPlayer(event.getEntity().getLocation());
		}
		catch (Exception ex) {
			_logger.info("exception raised in Mayhem.monsterDies(EntityDeathEvent event) while using the ApocalypseSpawner");
		}
		
	}
}
 
开发者ID:Allov,项目名称:world-of-icerealm,代码行数:24,代码来源:Mayhem.java

示例3: onMonsterDamage

@EventHandler(priority = EventPriority.NORMAL)
public void onMonsterDamage(EntityDamageEvent event) {		

	if (event instanceof EntityDamageByEntityEvent) {
		
		EntityDamageByEntityEvent damageEvent = (EntityDamageByEntityEvent)event;
		CustomMonster damager = _damageMonsters.get(damageEvent.getDamager().getEntityId());
		
		if (damager != null && damageEvent.getDamager() instanceof Monster && event.getEntity() instanceof Player) {
			int damageDone = (int)(event.getDamage() + (2 * (int)damager.DamageModifier));
			//logger.info("damage done is: " + damageDone + " modifier is: " + (int)damager.DamageModifier + " base damage is: " + event.getDamage());
			event.setDamage(damageDone);
		}
	}
	
	CustomMonster noBurn = _noBurnMonsters.get(event.getEntity().getEntityId());
	if (noBurn != null && event.getEntity() instanceof Monster && event.getCause() == DamageCause.FIRE_TICK) {
		event.setCancelled(true);
		event.getEntity().setFireTicks(0);
	}
}
 
开发者ID:Allov,项目名称:world-of-icerealm,代码行数:21,代码来源:CustomMonsterListener.java

示例4: onEntityDamage

@EventHandler
public void onEntityDamage(final EntityDamageEvent event) {

	if (event.getCause() == DamageCause.DROWNING || event.getCause() == DamageCause.SUFFOCATION || event.getCause() == DamageCause.FIRE || event.getCause() == DamageCause.FIRE_TICK || event.getCause() == DamageCause.LAVA) {

		// Ok so an entity damage event begins
		// Find the nearest gate!
		final WorldCoord entityCoord = new WorldCoord(event.getEntity().getLocation());
		final WorldCoord entityCoordUp = new WorldCoord(event.getEntity().getLocation().getBlock().getRelative(BlockFace.UP));
		final Gate nearestGate = GateUtil.nearestGate(entityCoord, false);
		final Gate nearestGateUp = GateUtil.nearestGate(entityCoordUp, false);

		if (nearestGate != null || nearestGateUp != null) {
			event.setCancelled(true);
			event.getEntity().setFireTicks(0);
		}
	}
}
 
开发者ID:NoChanceSD,项目名称:AncientGates,代码行数:18,代码来源:PluginEntityListener.java

示例5: onEntityDamage

@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
public void onEntityDamage(EntityDamageEvent event) {
	if (((event.getCause() == DamageCause.FIRE_TICK) || (event.getCause() == DamageCause.FIRE) || (event.getCause() == DamageCause.DROWNING))) {
		for (Player player : ServerPlatform.get().getMiscUtils().getNearbyPlayers(event.getEntity().getLocation(), 48, 128, 48)) {
			if (player != null) {
				Connection connection = ProtocolSupportAPI.getConnection(player);
				if (
					(connection != null) &&
					(connection.getVersion().getProtocolType() == ProtocolType.PC) &&
					connection.getVersion().isBefore(ProtocolVersion.MINECRAFT_1_12)
				) {
					connection.sendPacket(ServerPlatform.get().getPacketFactory().createEntityStatusPacket(event.getEntity(), 2));
				}
			}
		}
	}
}
 
开发者ID:ProtocolSupport,项目名称:ProtocolSupport,代码行数:17,代码来源:FeatureEmulation.java

示例6: onDamage

@EventHandler
public void onDamage(EntityDamageEvent e) {
	if (e.getEntity() instanceof Player) {
		if (e.getCause() == DamageCause.FIRE || e.getCause() == DamageCause.FIRE_TICK) {
			Player p = (Player) e.getEntity();
			e.setDamage(e.getDamage() * (1 - EnchantmentZ.calcInventoryPieceAmount(FIRE_PROTECTION, p.getInventory()) * 0.0625));
		}
	}
}
 
开发者ID:crazyhorse961,项目名称:NationZ,代码行数:9,代码来源:EnchantmentZ_FireProtection.java

示例7: onEntityCombustByEntity

@EventHandler(ignoreCancelled = true, priority = EventPriority.LOWEST)
public void onEntityCombustByEntity (EntityCombustByEntityEvent event)
{
    //handle it just like we would an entity damge by entity event, except don't send player messages to avoid double messages
    //in cases like attacking with a flame sword or flame arrow, which would ALSO trigger the direct damage event handler
    @SuppressWarnings("deprecation")
    EntityDamageByEntityEvent eventWrapper = new EntityDamageByEntityEvent(event.getCombuster(), event.getEntity(), DamageCause.FIRE_TICK, event.getDuration());
    this.handleEntityDamageEvent(eventWrapper, false);
    event.setCancelled(eventWrapper.isCancelled());
}
 
开发者ID:BigScary,项目名称:GriefPreventionFlags,代码行数:10,代码来源:FlagDef_AllowPvP.java

示例8: onMonsterDamaged

public void onMonsterDamaged(EntityDamageEvent event) {
	
	Monster monster = null;
	for (Monster m : _spawnedMonsters) {
		if (m.getEntityId() == event.getEntity().getEntityId()) {
			monster = m;
			break;
		}
	}
	
	
	
	if (monster != null) {
		
		if (event.getCause() == DamageCause.FIRE_TICK) {
			event.setCancelled(true);
			event.getEntity().setFireTicks(0);
			// lette, hack, shame on me
			return;
		}
		
		if (!_blockBroken) {
			Damageable mDamage = (Damageable)monster;
			
			monster.setHealth(mDamage.getMaxHealth());
			//_logger.info("" + monster.getHealth());	
		}
		else {
			monster.damage(event.getDamage());
			//_logger.info("" + monster.getHealth() + " got damaged!!!");
		}
	}
}
 
开发者ID:Allov,项目名称:world-of-icerealm,代码行数:33,代码来源:BreakBlockSession.java

示例9: onMonsterBurning

@EventHandler(priority = EventPriority.NORMAL)
public void onMonsterBurning(EntityDamageEvent e) {
	if (!_config.BurnDuringDaylight && _zone.isInside(e.getEntity().getLocation()) && e.getCause() == DamageCause.FIRE_TICK) {
		e.setCancelled(true);
		e.getEntity().setFireTicks(0);
	}
}
 
开发者ID:Allov,项目名称:world-of-icerealm,代码行数:7,代码来源:Infestation.java

示例10: processDamage

public void processDamage(EntityDamageEvent e) {
	if (_scenario.isActive()) {
		if (_monstersTable != null && _monstersTable.contains(e.getEntity())) {
			
			if (e.getCause() == DamageCause.FIRE_TICK) {
				e.setCancelled(true);
			}
						
		}
	}
	
}
 
开发者ID:Allov,项目名称:world-of-icerealm,代码行数:12,代码来源:BasicMonsterWave.java

示例11: processDamage

@Override
public void processDamage(EntityDamageEvent e) {
	if (_scenario.isActive()) {
		if (_monsters != null && _monsters.contains(e.getEntity())) {
			if (e.getCause() == DamageCause.FIRE_TICK) {
				e.setCancelled(true);
			}	
		}
	}
}
 
开发者ID:Allov,项目名称:world-of-icerealm,代码行数:10,代码来源:FourCornerWave.java

示例12: toBukkit

public static DamageCause toBukkit(cn.nukkit.event.entity.EntityDamageEvent.DamageCause nukkit) {
	// TODO Direct mapping via DamageCause.valueOf?
	switch (nukkit) {
		case CONTACT:
			return DamageCause.CONTACT;
		case ENTITY_ATTACK:
			return DamageCause.ENTITY_ATTACK;
		case PROJECTILE:
			return DamageCause.PROJECTILE;
		case SUFFOCATION:
			return DamageCause.SUFFOCATION;
		case FALL:
			return DamageCause.FALL;
		case FIRE:
			return DamageCause.FIRE;
		case FIRE_TICK:
			return DamageCause.FIRE_TICK;
		case LAVA:
			return DamageCause.LAVA;
		case DROWNING:
			return DamageCause.DROWNING;
		case BLOCK_EXPLOSION:
			return DamageCause.BLOCK_EXPLOSION;
		case ENTITY_EXPLOSION:
			return DamageCause.ENTITY_EXPLOSION;
		case VOID:
			return DamageCause.VOID;
		case SUICIDE:
			return DamageCause.SUICIDE;
		case MAGIC:
			return DamageCause.MAGIC;
		case LIGHTNING:
			return DamageCause.LIGHTNING;
		case CUSTOM:
		default:
			return DamageCause.CUSTOM;
	}
}
 
开发者ID:rutgerkok,项目名称:Pokkit,代码行数:38,代码来源:PokkitDamageCause.java

示例13: onDamage

@EventHandler
public void onDamage(EntityDamageEvent e) {
	if (e.getEntity() instanceof Player && e.getCause() == DamageCause.FIRE_TICK) {
		if (Zephyrus.getUser((Player) e.getEntity()).isStateApplied(this)) {

		}
	}
}
 
开发者ID:mcardy,项目名称:Zephyrus-II,代码行数:8,代码来源:FlameStepState.java

示例14: onEntityDamage

/**
 * On entity damage.
 *
 * @param event the event
 */
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
public void onEntityDamage(EntityDamageEvent event) {
	
	// Check for fire cancel
	if(event.getEntity() instanceof Player && 
			(event.getCause() == DamageCause.FIRE
			|| event.getCause() == DamageCause.FIRE_TICK)) {
		
		Player player = (Player) event.getEntity();
		IPlayerConfEntry entry = playerConf.get(player);
		
		if(entry != null) {
			Location loc = player.getLocation();
			IDummyLand land = Factoid.getThisPlugin().iLands().getLandOrOutsideArea(loc);
			
			// Check for fire near the player
			for(Map.Entry<Location, IPlayerContainerPlayer> fireEntry : playerFireLocation.entrySet()) {
				
				if(loc.getWorld() == fireEntry.getKey().getWorld() 
						&& loc.distanceSquared(fireEntry.getKey()) < 5) {
					Block block = loc.getBlock();
					if((block.getType() == Material.FIRE || block.getType() == Material.AIR) 
							&& !isPvpValid(land, fireEntry.getValue(), entry.getPlayerContainer())) {
						
						// remove fire
						Factoid.getThisPlugin().iLog().write("Anti-pvp from " 
								+ entry.getPlayerContainer().getPlayer().getName()
								+ " to " + player.getName());
						block.setType(Material.AIR);
						player.setFireTicks(0);
						event.setDamage(0);
						event.setCancelled(true);
					}
				}
			}
		}
	}
}
 
开发者ID:Tabinol,项目名称:Factoid,代码行数:43,代码来源:PvpListener.java

示例15: onEntityDamage

@EventHandler
public void onEntityDamage(EntityDamageEvent event) {
    if (event.getEntity() instanceof Player) {
        if (event.getCause() == DamageCause.LAVA || event.getCause() == DamageCause.FIRE || event.getCause() == DamageCause.FIRE_TICK) {
            event.getEntity().setFireTicks(0);
        }
        if (event.getCause() != DamageCause.VOID) {
            event.setCancelled(true);
        }
    }
}
 
开发者ID:EyeOfEnder-Ltd,项目名称:EOEHub,代码行数:11,代码来源:PlayerListener.java


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