Tag Plugin Help (EntityDamageByEntityEvent)

Discussion in 'Plugin Development' started by Zolltar, May 5, 2014.

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

    Zolltar

    So 'im trying to make a simple tag plugin. But i'm having trouble with the tag part. There are no errors coming up in the console. So here is the code that I have. Any help is very appreciated!
    Code:
        @EventHandler
        public void ontag(EntityDamageByEntityEvent event){
            Entity target = event.getEntity();
            Entity player = event.getDamager();
            if(target instanceof Player){
            if(player instanceof Player){   
            if(tag.contains((Player)player)){
                ((Player)player).getInventory().remove(getCustomItem(Items.tag));
                ((Player)player).getInventory().remove(getCustomItem(Items.helm));
                ((Player)target).getInventory().setItemInHand(getCustomItem(Items.tag));
                tag.remove((Player)player);
                tag.add((Player) target);
            for(Player online : Bukkit.getOnlinePlayers()){
                if(!(toggle.contains(online))){
                    online.sendMessage(ChatColor.GRAY + "[" + ChatColor.GOLD + "Tag" + ChatColor.GRAY + "]: " + ChatColor.RED + ((Player)target).getName() + " is it!");
       
            }else if(target instanceof Player){
                if(player instanceof Player){
                    if(toggle.contains(target)){
                        ((Player) player).sendMessage(ChatColor.GRAY + "[" + ChatColor.GOLD + "Tag" + ChatColor.GRAY + "]: " + ChatColor.RED + ((Player)target).getName() + " isn't playing tag!");
                    }
                }
            }
            }
           
            }
            }       
        }
        }
            
     
  2. Offline

    maxben34

    Zolltar did you register events?
     
  3. Offline

    Zolltar

    Yes, and I have other events in the plugin that are functioning fine.
     
  4. Offline

    PluginStudios

    If you did register the events like stated before then add debug lines to every if statement. See what is not firing, and try to figure out why! ;)
     
  5. Offline

    Drkmaster83

    And here's where I let my signature do the work...
     
Thread Status:
Not open for further replies.

Share This Page