Source:
<code>public void handle(GlowSession session, InteractEntityMessage message) { GlowPlayer player = session.getPlayer(); if (player.isDead()) { GlowServer.logger.info("Player " + player + " tried to interact with an entity while dead"); return; } GlowEntity possibleTarget = player.getWorld().getEntityById(message.getId()); GlowLivingEntity target = possibleTarget instanceof GlowLivingEntity ? (GlowLivingEntity) possibleTarget : null; if (message.getAction() == InteractEntityMessage.Action.ATTACK.ordinal()) { if (target == null) { <START> GlowServer.logger.info("Player " + player + " tried to attack an entity that does not exist"); <END> } else { ItemStack hand = player.getItemInHand(); Material type = hand == null ? Material.AIR : hand.getType(); boolean critical = false; float damage = AttackDamage.getMeleeDamage(type, critical); if (!target.isDead() && (!(target instanceof Player) || !invulnerableGamemodes.contains(((Player) target).getGameMode()))) { EntityDamageByEntityEvent event = new EntityDamageByEntityEvent(player, target, EntityDamageEvent.DamageCause.ENTITY_ATTACK, damage); EventFactory.callEvent(event); if (!event.isCancelled()) { target.damage(damage, player, EntityDamageEvent.DamageCause.ENTITY_ATTACK); short durabilityLoss = AttackDamage.getMeleeDurabilityLoss(type); if (durabilityLoss > 0 && hand != null) { hand.setDurability((short) (hand.getDurability() + durabilityLoss)); } player.updateInventory(); } } } } else if (message.getAction() == InteractEntityMessage.Action.ATTACK_AT.ordinal()) { } else if (message.getAction() == InteractEntityMessage.Action.INTERACT.ordinal()) { } else { GlowServer.logger.info("Player " + player + " sent unknown interact action: " + message.getAction()); } }</code><technical_language>warning instead</technical_language>

Target:
public void handle(GlowSession session, InteractEntityMessage message) { GlowPlayer player = session.getPlayer(); if (player.isDead()) { GlowServer.logger.info("Player " + player + " tried to interact with an entity while dead"); return; } GlowEntity possibleTarget = player.getWorld().getEntityById(message.getId()); GlowLivingEntity target = possibleTarget instanceof GlowLivingEntity ? (GlowLivingEntity) possibleTarget : null; if (message.getAction() == InteractEntityMessage.Action.ATTACK.ordinal()) { if (target == null) { GlowServer.logger.info("Player " + player + " tried to attack an entity that does not exist"); } else { ItemStack hand = player.getItemInHand(); Material type = hand == null ? Material.AIR : hand.getType(); boolean critical = false; float damage = AttackDamage.getMeleeDamage(type, critical); if (!target.isDead() && (!(target instanceof Player) || !invulnerableGamemodes.contains(((Player) target).getGameMode()))) { EntityDamageByEntityEvent event = new EntityDamageByEntityEvent(player, target, EntityDamageEvent.DamageCause.ENTITY_ATTACK, damage); EventFactory.callEvent(event); if (!event.isCancelled()) { target.damage(damage, player, EntityDamageEvent.DamageCause.ENTITY_ATTACK); short durabilityLoss = AttackDamage.getMeleeDurabilityLoss(type); if (durabilityLoss > 0 && hand != null) { hand.setDurability((short) (hand.getDurability() + durabilityLoss)); } player.updateInventory(); } } } } else if (message.getAction() == InteractEntityMessage.Action.INTERACT_AT.ordinal()) { } else if (message.getAction() == InteractEntityMessage.Action.INTERACT.ordinal()) { } else { GlowServer.logger.info("Player " + player + " sent unknown interact action: " + message.getAction()); } }