本文整理匯總了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());
}
}
}
示例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;
}
}
示例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()));
}
}
}
示例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()));
}
}
}
示例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
}
}
示例6: EntityRegainHealthEvent
import org.bukkit.event.entity.EntityRegainHealthEvent; //導入方法依賴的package包/類
@Deprecated public EntityRegainHealthEvent(Entity entity, int amount, EntityRegainHealthEvent.RegainReason regainReason) {
}
示例7: getRegainReason
import org.bukkit.event.entity.EntityRegainHealthEvent; //導入方法依賴的package包/類
public EntityRegainHealthEvent.RegainReason getRegainReason() {
return null;
}