As per the title. Can be tested with the following code and a player on the server.
Player player = Bukkit.getWorlds().get(0).getPlayers().get(0); player.damage(0, player); Bukkit.getServer().broadcastMessage("" + player.getAttackCooldown());
Note that commenting out the second line should result in an output of 1.0 assuming that the player's attack meter is fully charged. Otherwise, the result will be less than 1.
I don't think this is the intended behaviour as the client will still display the player's attack cooldow meter as fully charged.
Another thing that may be related is that when the damage function is called without a source, the damage cause of the EntityDamageEvent gets set to CUSTOM, however if a source is provided, then the cause gets set to ENTITY_ATTACK.