package net.komputerking.tracker.trackers;

import net.komputerking.tracker.api.Damage;
import net.komputerking.tracker.events.PlayerDamageEvent;
import org.bukkit.ChatColor;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener;
import org.bukkit.event.entity.EntityDamageEvent;

/**
 * Tracker for damage that doesn't require extra info. (e.g: Void damage)
 */
public class GeneralTracker implements Listener {

    @EventHandler(priority = EventPriority.LOW, ignoreCancelled = true)
    public void onDamage(PlayerDamageEvent event) {
        if (event.getCause().getCause().equals(EntityDamageEvent.DamageCause.VOID)) {
            event.setTrackerDamage(new VoidDamage(event.getPlayer(), event.getDamage()));
        }
    }

    public class VoidDamage implements Damage {

        private Player damaged;
        private double damage;

        VoidDamage(Player damaged, double damage) {
            this.damaged = damaged;
            this.damage = damage;
        }

        @Override
        public String getDescription() {
            return "Void";
        }

        @Override
        public Player getDamaged() {
            return damaged;
        }

        @Override
        public double getDamage() {
            return damage;
        }

        @Override
        public String getDeathMessage() {
            return damaged.getDisplayName() + ChatColor.GRAY + " fell into the void";
        }

    }

}

@@ -315,58 +315,8 @@
 ner;
-%0Aimport org.bukkit.event.entity.EntityDamageEvent;
 %0A%0A/*
@@ -582,10 +582,14 @@
     
-if
+switch
  (ev
@@ -617,143 +617,1582 @@
 se()
-.equals(EntityDamageEvent.DamageCause.VOID)) %7B%0A            event.setTrackerDamage(new VoidDamage(event.getPlayer(), event.getDamage()))
+) %7B%0A            case VOID:%0A                event.setTrackerDamage(new GeneralDamage(event.getPlayer(), event.getDamage(), %22Void%22, %22fell into the void%22));%0A                break;%0A            case SUFFOCATION:%0A                event.setTrackerDamage(new GeneralDamage(event.getPlayer(), event.getDamage(), %22Suffocation%22, %22suffocated%22));%0A                break;%0A            case DROWNING:%0A                event.setTrackerDamage(new GeneralDamage(event.getPlayer(), event.getDamage(), %22Water%22, %22drowned%22));%0A                break;%0A            case STARVATION:%0A                event.setTrackerDamage(new GeneralDamage(event.getPlayer(), event.getDamage(), %22Food%22, %22starved to death%22));%0A                break;%0A            case FIRE_TICK:%0A                event.setTrackerDamage(new GeneralDamage(event.getPlayer(), event.getDamage(), %22Fire%22, %22burned to death%22));%0A                break;%0A            case LAVA:%0A                event.setTrackerDamage(new GeneralDamage(event.getPlayer(), event.getDamage(), %22Lava%22, %22burned to death%22));%0A                break;%0A            case LIGHTNING:%0A                event.setTrackerDamage(new GeneralDamage(event.getPlayer(), event.getDamage(), %22Lightning%22, %22was struck by lightning%22));%0A                break;%0A            case POISON:%0A                event.setTrackerDamage(new GeneralDamage(event.getPlayer(), event.getDamage(), %22Poison%22, %22was poisoned%22));%0A                break;%0A            case WITHER:%0A                event.setTrackerDamage(new GeneralDamage(event.getPlayer(), event.getDamage(), %22Wither%22, %22withered away%22));%0A                break
 ;%0A  
@@ -2223,20 +2223,23 @@
 c class 
-Void
+General
 Damage i
@@ -2321,25 +2321,24 @@
 damage;%0A
-%0A
         
 VoidDama
@@ -2333,117 +2333,305 @@
     
-VoidDamage(Player damaged, double damage) %7B%0A            this.damaged = damaged;%0A            this.damage = dam
+private String description;%0A        private String message;%0A%0A        GeneralDamage(Player damaged, double damage, String description, String message) %7B%0A            this.damaged = damaged;%0A            this.damage = damage;%0A            this.description = description;%0A            this.message = mess
 age;
@@ -2720,22 +2720,27 @@
  return 
-%22Void%22
+description
 ;%0A      
@@ -3055,35 +3055,27 @@
 RAY + %22 
-fell into the void%22
+%22 + message
 ;%0A      

Add more causes to GeneralTracker.