Add debug listener for DamageEntityEvent.

This commit is contained in:
wizjany 2019-02-11 16:57:15 -05:00
parent 144c31645c
commit f8e129f33e

View File

@ -23,6 +23,7 @@
import com.sk89q.worldguard.bukkit.event.block.BreakBlockEvent;
import com.sk89q.worldguard.bukkit.event.block.PlaceBlockEvent;
import com.sk89q.worldguard.bukkit.event.block.UseBlockEvent;
import com.sk89q.worldguard.bukkit.event.entity.DamageEntityEvent;
import com.sk89q.worldguard.bukkit.event.entity.DestroyEntityEvent;
import com.sk89q.worldguard.bukkit.event.entity.SpawnEntityEvent;
import com.sk89q.worldguard.bukkit.event.entity.UseEntityEvent;
@ -164,6 +165,24 @@ public void onUseEntity(UseEntityEvent event) {
logger.info(builder.toString());
}
@EventHandler(priority = EventPriority.MONITOR)
public void onDamageEntity(DamageEntityEvent event) {
StringBuilder builder = new StringBuilder();
builder.append("DAMAGE");
builder.append(" ");
builder.append("").append(event.getEntity().getType());
builder.append(" ");
builder.append("[").append(event.getCause()).append("]");
builder.append(" ");
builder.append("@").append(toBlockString(event.getTarget()));
builder.append(" ");
builder.append(":").append(getEventName(event.getOriginalEvent()));
if (event.getResult() != Result.DEFAULT) {
builder.append(" [").append(event.getResult()).append("]");
}
logger.info(builder.toString());
}
@EventHandler(priority = EventPriority.MONITOR)
public void onUseItem(UseItemEvent event) {
StringBuilder builder = new StringBuilder();