Permalink
Browse files

Add debug listener for DamageEntityEvent.

  • Loading branch information...
wizjany committed Feb 11, 2019
1 parent 144c316 commit f8e129f33e0f8c0a9583f8f02b7c10489add86dd
@@ -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();

0 comments on commit f8e129f

Please sign in to comment.