Alright so I have this Code:java private HashMap<Player, Player> tag = new HashMap<Player, Player>(); @EventHandler public void onEntityDamage(EntityDamageByEntityEvent e){ if(e.getEntity() instanceof Player && e.getDamager() instanceof Player){ Player hit = (Player) e.getEntity(); Player damager = (Player) e.getDamager(); if(tag.get(hit) != null){ if(tag.get(hit).equals(damager)){ e.setCancelled(true); return; } if(tag.get(hit).equals(hit)){ tag.clear(); return; } } } } @EventHandler public void onPlayerDeath(PlayerDeathEvent e) { if (e.getEntity().getKiller() instanceof Player) { tag.put(e.getEntity(), e.getEntity().getKiller()); } } Basically if a player is killed by another one then they cannot be hit by their killer until they hit the killer. I got the killer cannot hit victim part down however the second part just isn't working. I've tried every combination with hit and damager and still isn't working. Any ideas?
Shouldn't this be Code: if(tag.get(damager).equals(hit)){ ? I can't imagine a player having hit themself.
Well I'm passing in hit to get the killer. As the .get method returns the value, and the passed in argument is the key for it.