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