本文整理汇总了Java中org.bukkit.event.entity.EntityDamageEvent.DamageCause.equals方法的典型用法代码示例。如果您正苦于以下问题:Java DamageCause.equals方法的具体用法?Java DamageCause.equals怎么用?Java DamageCause.equals使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.bukkit.event.entity.EntityDamageEvent.DamageCause
的用法示例。
在下文中一共展示了DamageCause.equals方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: handleGroundFall
import org.bukkit.event.entity.EntityDamageEvent.DamageCause; //导入方法依赖的package包/类
/**
* Death messages for the player hitting the ground
*/
private void handleGroundFall(AthenaDeathEvent event) {
String p = event.getPlayer().getName();
String k = event.getKiller().getName();
DamageCause cause = event.getDamageEvent().getEntityEvent().getCause();
if (cause.equals(DamageCause.PROJECTILE)) {
int dist = Math.round(event.getDamageEvent().getDistance());
broadcast(event, String.format("%s was shot off a high place by %s (%dm)", p, k, dist));
}
else {
broadcast(event, String.format("%s was knocked off a high place by %s", p, k));
}
}
示例2: handleVoid
import org.bukkit.event.entity.EntityDamageEvent.DamageCause; //导入方法依赖的package包/类
/**
* Death messages for the player falling into the void
*/
private void handleVoid(AthenaDeathEvent event) {
String p = event.getPlayer().getName();
String k = event.getKiller().getName();
DamageCause cause = event.getDamageEvent().getEntityEvent().getCause();
if (cause.equals(DamageCause.PROJECTILE)) {
int dist = Math.round(event.getDamageEvent().getDistance());
broadcast(event, String.format("%s was shot into the void by %s (%dm)", p, k, dist));
}
else {
broadcast(event, String.format("%s was knocked into the void by %s", p, k));
}
}