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


Java EntityRegainHealthEvent.RegainReason方法代碼示例

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


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

示例1: onRegen

import org.bukkit.event.entity.EntityRegainHealthEvent; //導入方法依賴的package包/類
@EventHandler(priority = EventPriority.HIGHEST)
public void onRegen(EntityRegainHealthEvent event) {
    Entity entity = event.getEntity();
    if (!(entity instanceof Player)) {
        return;
    }

    Player player = (Player) entity;
    EntityRegainHealthEvent.RegainReason reason = event.getRegainReason();
    if (reason == EntityRegainHealthEvent.RegainReason.SATIATED) {
        FightData data = FightData.getData(player);
        boolean canCheckRegeneration = CHECK_MANAGER.canCheckPlayer(player, CheckType.REGENERATION);
        if (canCheckRegeneration) {
            event.setCancelled(REGENERATION.check(player, data));
            data.setLastHealthEvent(System.currentTimeMillis());
        }
    }

}
 
開發者ID:Vrekt,項目名稱:Arc-v2,代碼行數:20,代碼來源:FightListener.java

示例2: heal

import org.bukkit.event.entity.EntityRegainHealthEvent; //導入方法依賴的package包/類
public void heal(int i, EntityRegainHealthEvent.RegainReason regainReason) {
    if (this.health > 0) {
        EntityRegainHealthEvent event = new EntityRegainHealthEvent(this.getBukkitEntity(), i, regainReason);
        this.world.getServer().getPluginManager().callEvent(event);

        if (!event.isCancelled()) {
            this.setHealth(this.getHealth() + event.getAmount());
        }

        // this.getMaxHealth() -> this.maxHealth
        if (this.health > this.maxHealth) {
            this.setHealth(this.maxHealth);
            // CraftBukkit end
        }

        this.noDamageTicks = this.maxNoDamageTicks / 2;
    }
}
 
開發者ID:didoupimpon,項目名稱:Craft-city,代碼行數:19,代碼來源:EntityLiving.java

示例3: heal

import org.bukkit.event.entity.EntityRegainHealthEvent; //導入方法依賴的package包/類
public void heal(float f, EntityRegainHealthEvent.RegainReason regainReason) {
    float f1 = this.getHealth();

    if (f1 > 0.0F) {
        EntityRegainHealthEvent event = new EntityRegainHealthEvent(this.getBukkitEntity(), f, regainReason);
        this.world.getServer().getPluginManager().callEvent(event);

        if (!event.isCancelled()) {
            this.setHealth((float) (this.getHealth() + event.getAmount()));
        }
    }
}
 
開發者ID:OvercastNetwork,項目名稱:CraftBukkit,代碼行數:13,代碼來源:EntityLiving.java

示例4: heal

import org.bukkit.event.entity.EntityRegainHealthEvent; //導入方法依賴的package包/類
public void heal(float f, EntityRegainHealthEvent.RegainReason regainReason)
{
    float f1 = this.getHealth();

    if (f1 > 0.0F)
    {
        EntityRegainHealthEvent event = new EntityRegainHealthEvent(this.getBukkitEntity(), f, regainReason);
        this.worldObj.getServer().getPluginManager().callEvent(event);

        if (!event.isCancelled())
        {
            this.setHealth((float)(this.getHealth() + event.getAmount()));
        }
    }
}
 
開發者ID:xtrafrancyz,項目名稱:Cauldron,代碼行數:16,代碼來源:EntityLivingBase.java

示例5: heal

import org.bukkit.event.entity.EntityRegainHealthEvent; //導入方法依賴的package包/類
public void heal(float f, EntityRegainHealthEvent.RegainReason regainReason) {
    float f1 = this.getHealth();

    if (f1 > 0.0F) {
        EntityRegainHealthEvent event = new EntityRegainHealthEvent(this.getBukkitEntity(), f, regainReason);
        this.world.getServer().getPluginManager().callEvent(event);

        if (!event.isCancelled()) {
            this.setHealth((float) (this.getHealth() + event.getAmount()));
        }
        // CraftBukkit end
    }

}
 
開發者ID:bergerkiller,項目名稱:SpigotSource,代碼行數:15,代碼來源:EntityLiving.java

示例6: EntityRegainHealthEvent

import org.bukkit.event.entity.EntityRegainHealthEvent; //導入方法依賴的package包/類
@Deprecated public EntityRegainHealthEvent(Entity entity, int amount, EntityRegainHealthEvent.RegainReason regainReason) {
}
 
開發者ID:deathcap,項目名稱:BedrockAPI,代碼行數:3,代碼來源:EntityRegainHealthEvent.java

示例7: getRegainReason

import org.bukkit.event.entity.EntityRegainHealthEvent; //導入方法依賴的package包/類
public EntityRegainHealthEvent.RegainReason getRegainReason() {
	return null;
}
 
開發者ID:deathcap,項目名稱:BedrockAPI,代碼行數:4,代碼來源:EntityRegainHealthEvent.java


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