本文整理了Java中org.bukkit.entity.Entity.setLastDamageCause()
方法的一些代码示例,展示了Entity.setLastDamageCause()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Entity.setLastDamageCause()
方法的具体详情如下:
包路径:org.bukkit.entity.Entity
类名称:Entity
方法名:setLastDamageCause
[英]Record the last EntityDamageEvent inflicted on this entity
[中]记录对该实体施加的最后一次EntityDamageEvent
代码示例来源:origin: GlowstoneMC/Glowstone
/**
* Runs an EntityDamageEvent and updates {@link org.bukkit.entity.Entity#setLastDamageCause} and
* (for a {@link LivingEntity} only) {@link LivingEntity#setLastDamage(double)}.
*
* @param event the event to run
* @param <T> the event's type
* @return the completed event
*/
public <T extends EntityDamageEvent> T onEntityDamage(T event) {
T result = callEvent(event);
if (!result.isCancelled()) {
result.getEntity().setLastDamageCause(result);
if (result.getEntity() instanceof LivingEntity) {
((LivingEntity) result.getEntity()).setLastDamage(result.getDamage());
}
}
return result;
}
代码示例来源:origin: Bukkit/Bukkit
@Override
public boolean execute(CommandSender sender, String currentAlias, String[] args) {
if (!testPermission(sender)) return true;
if (sender instanceof Player) {
Player player = (Player) sender;
EntityDamageEvent ede = new EntityDamageEvent(player, EntityDamageEvent.DamageCause.SUICIDE, 1000);
Bukkit.getPluginManager().callEvent(ede);
if (ede.isCancelled()) return true;
ede.getEntity().setLastDamageCause(ede);
player.setHealth(0);
sender.sendMessage("Ouch. That look like it hurt.");
} else {
sender.sendMessage("You can only perform this command as a player");
}
return true;
}
代码示例来源:origin: bergerkiller/BKCommonLib
@Override
public void setLastDamageCause(EntityDamageEvent arg0) {
base.setLastDamageCause(arg0);
}
代码示例来源:origin: bergerkiller/BKCommonLib
public void setLastDamageCause(EntityDamageEvent arg0) {
entity.setLastDamageCause(arg0);
}
代码示例来源:origin: EngineHub/CommandHelper
@Override
public void setLastDamageCause(MCEntityDamageEvent event) {
e.setLastDamageCause((EntityDamageEvent) event._GetObject());
}
代码示例来源:origin: SpigotMC/Spigot-API
@Override
public boolean execute(CommandSender sender, String currentAlias, String[] args) {
if (!testPermission(sender)) return true;
if (sender instanceof Player) {
Player player = (Player) sender;
EntityDamageEvent ede = new EntityDamageEvent(player, EntityDamageEvent.DamageCause.SUICIDE, 1000);
Bukkit.getPluginManager().callEvent(ede);
if (ede.isCancelled()) return true;
ede.getEntity().setLastDamageCause(ede);
player.setHealth(0);
sender.sendMessage("Ouch. That look like it hurt.");
} else {
sender.sendMessage("You can only perform this command as a player");
}
return true;
}
代码示例来源:origin: ProjectKorra/ProjectKorra
((LivingEntity) entity).damage(damage, source);
final double nextHealth = ((LivingEntity) entity).getHealth();
entity.setLastDamageCause(finalEvent);
if (ignoreArmor) {
if (finalEvent.isApplicable(DamageModifier.ARMOR)) {
内容来源于网络,如有侵权,请联系作者删除!