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


Java EntityRegainHealthEvent.getAmount方法代码示例

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


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

示例1: onHeal

import org.bukkit.event.entity.EntityRegainHealthEvent; //导入方法依赖的package包/类
@EventHandler(ignoreCancelled = true)
protected void onHeal(EntityRegainHealthEvent e) {
    if (isEnabled()) {
        if (!plugin.fade) {
            if (e.getEntity() instanceof Player) {
                Player p = (Player) e.getEntity();
                if (plugin.functions.isTintEnabled(p)) {
                    Damageable d = (Damageable) p;
                    double heal = e.getAmount();
                    int health = (int) (d.getHealth() + heal);
                    plugin.functions.sendBorder(p, health);
                }
            }
        }
    }
}
 
开发者ID:mrsheepsheep,项目名称:Tint-Health,代码行数:17,代码来源:PlayerListener.java

示例2: onHealthRegain

import org.bukkit.event.entity.EntityRegainHealthEvent; //导入方法依赖的package包/类
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
public void onHealthRegain(final EntityRegainHealthEvent event){
	double regainAmountTicker = event.getAmount();
	Deque<DamageData> damagers = getDamageInformationDeque(event.getEntity().getUniqueId());
	while(regainAmountTicker > 0 && damagers.size() > 0){
		DamageData leastRecentDamage = damagers.getLast();
		if(leastRecentDamage.getDamageAmount() > regainAmountTicker){
			// Remove damage attribution from a specific source
			leastRecentDamage.regen += regainAmountTicker;
			regainAmountTicker = 0;
		}else if(Utilities.equals(leastRecentDamage.getDamageAmount(), regainAmountTicker)){
			// Just enough to remove the damage source
			damagers.removeLast();
			regainAmountTicker = 0;
		}else{
			// Damage amount of source is less than regain amount ticker, therefore we remove the last damage source and we decrement the regainer ticker
			regainAmountTicker -= damagers.removeLast().getDamageAmount();
		}
	}
	
}
 
开发者ID:glen3b,项目名称:BukkitLib,代码行数:22,代码来源:Utilities.java

示例3: onHealthRegen

import org.bukkit.event.entity.EntityRegainHealthEvent; //导入方法依赖的package包/类
@EventHandler(priority=EventPriority.HIGH)
public void onHealthRegen(EntityRegainHealthEvent e){
	if(e.getEntity() instanceof Player){
		Player p = (Player) e.getEntity();
		
		Game g = GameManager.getInstance().getGame(p);
		
		if(g != null){
			if(g.gs == GameStage.Lobby || g.gs == GameStage.Build){
				if(e.getAmount() != 20D){
					e.setAmount(20D);
				}
			}
		}
	}
}
 
开发者ID:WeaselBuilds,项目名称:WeaselsWalls,代码行数:17,代码来源:FoodRegen.java

示例4: applyHealthRegen

import org.bukkit.event.entity.EntityRegainHealthEvent; //导入方法依赖的package包/类
@EventHandler(priority = EventPriority.NORMAL)
public void applyHealthRegen(EntityRegainHealthEvent event) {
    if (event.isCancelled()) {
        return;
    }
    if (((event.getEntity() instanceof Player)) &&
            (event.getRegainReason() == EntityRegainHealthEvent.RegainReason.SATIATED)) {
        event.setAmount(event.getAmount() + LoreAttributes.loreManager.getRegenBonus((LivingEntity) event.getEntity()));

        if (event.getAmount() <= 0.0D)
            event.setCancelled(true);
    }
}
 
开发者ID:SettingDust,项目名称:Lore-Attributes-Reloaded,代码行数:14,代码来源:LoreEvents.java

示例5: onEntityRegainHealth

import org.bukkit.event.entity.EntityRegainHealthEvent; //导入方法依赖的package包/类
@EventHandler(priority = EventPriority.MONITOR)
public void onEntityRegainHealth(EntityRegainHealthEvent event)
{
	if (event.isCancelled() || event.getAmount() <= 0.0D)
		return;

	Entity entity = event.getEntity();
	if (entity instanceof LivingEntity)
	{
		plugin.getHealthBarHandler().updateHealth((LivingEntity) entity);
	}
}
 
开发者ID:dmulloy2,项目名称:SwornRPG,代码行数:13,代码来源:EntityListener.java


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