Help onEntityDeath

Discussion in 'Plugin Development' started by AlessioDP, Nov 13, 2012.

Thread Status:
Not open for further replies.
  1. Offline

    AlessioDP

    I make a new plugin, when a mob dies in what appears to be a chat.

    EntityListener.class
    Code:
    public class EntityListener  implements Listener {
    public Plugin plugin;
     
    public EntityListener(Congratulations instance) {
      this.plugin = instance;
    }
     
    @EventHandler
    Public void onEntityDeath(EntityDeathEvent event) {
      Entity entity = event.getEntity();
      EntityDamageEvent damage = entity.getLastDamageCause();
     
    if (((entity instanceof Zombie))) {
                if ((damage instanceof EntityDamageByEntityEvent)) {
                  EntityDamageByEntityEvent Eventd = (EntityDamageByEntityEvent)damage;
     
                  if ((Eventd.getDamager() instanceof Player)) {
                    Player player = (Player)Eventd.getDamager();
                    String playern = player.getName();
                    this.plugin.congZombie(player, playern);
                  }
                  if ((Eventd.getDamager() instanceof Arrow)) {
                    Player player = (Player)((Arrow)Eventd.getDamager()).getShooter();
                    String playern = player.getName();
                    this.plugin.congZombie(player, playern);
                  }
                }
          }
    Plugin.Class
    Code:
    public void congZombie(Player player, String playern) {
    ** Other.. Permissions control...**
                    player.sendMessage("test");
        }
     
  2. Offline

    bryce325

    In the events you call congWolf but in the class you show congZombie.
    Not sure if that is your issue but you should show the relevent coding either way.
     
  3. Offline

    AlessioDP

    oh si sorry is problem of paste . fix..
     
Thread Status:
Not open for further replies.

Share This Page