KillMoney plugin not working

Discussion in 'Plugin Development' started by EnchantedP, Apr 22, 2017.

Thread Status:
Not open for further replies.
  1. Code:
    package me.enchanted.killmoney;
    import org.bukkit.Bukkit;
    import org.bukkit.entity.Entity;
    import org.bukkit.event.Listener;
    import org.bukkit.event.entity.PlayerDeathEvent;
    public class KillMoney extends JavaPlugin implements Listener {
        public void onDeath(PlayerDeathEvent e){
            Entity killer = e.getEntity().getKiller();
            Bukkit.getServer().dispatchCommand(Bukkit.getConsoleSender(), "eco give " + killer.getName() + " " + getConfig().getString("money-ammount"));
            killer.sendMessage("You have been rewarded " + getConfig().getString("money-ammount"));
    Its showing no errors at all. Its just not working.
  2. Offline


    You need an @EventHandler above the onDeath method, and you need to register your events in the onEnable method
  3. Offline


    Make sure you check that the killer is actually a player! What you're trying to do could return a ton of errors if a player dies from say fall damage.
    Also you should use vault to give the player money, not essentials.
Thread Status:
Not open for further replies.

Share This Page