I have a question. I program a minigame in which you have to kill Villager.
Now I want that if you kill a villager that the player who killed him has got money (VaultAPI).
I can't find a solution how to do it well.
I hope you can help me.
LG
Ps: Sorry for the spelling mistakes.
Depends on what you program with
if you do that via MC used / scoreboard and something srry that I do not remember
Thanks but I mean in Java.
@EventHandler
public void onDeath (EntityDeathEvent e) {
Player p = (Player) e.getEntity ();
Villager b = (Villager) e.getEntity ();
if (b.getKiller (). Equals (p)) {
int peuro = EcoEuros.accountsFile.getInt (p.getName ());
EcoEuros.accountsFile.set (p.getName (), peuro + 5);
ConfigHandler.saveConfig (EcoEuros.accountsFile, EcoEuros.accounts);
p.sendMessage (ChatColor.GRAY + "[EcoEuros]" + ChatColor.GREEN + "Gave you" + ChatColor.GREEN + "for killing a villager!");
}
}
But you have to adapt the method!
Many Thanks! It worked!