Solved Send hp with packets

Discussion in 'Spigot Plugin Development' started by Abcik, Jul 27, 2018.

Thread Status:
Not open for further replies.
  1. Hello. I need to send a packet to player that the Entity he is attacking is has 0 health.

    Code (Java):

        public void onEvent(EntityDamageByEntityEvent e) {
            if (e.getDamager() instanceof Player && e.getEntity() instanceof Player) {
                Player p = (Player) e.getDamager();
                //send a packet about a fake hp e.getEntity()
    • Like Like x 1
  2. Health is stored server said afaik just send the entity death packet according to the protocol specification of the version you are using - check out wikivg or the protocollib wrappers.
  3. Can u help me? I find it difficult to find and understand something. English is not my native language.
    • Agree Agree x 1
  4. well all I know is that it's definitely something to do with the play_server_entity_metadata packet
  5. i am confused, are you trying to say that you want entities to be killed upon hit?
    • Like Like x 1
  6. Partially so.
    For the player, the entity will have 0 health.
    But for the server, his health will be right.
    I want to do this to block certain types of killaura (It does not work for corpses)
    • Like Like x 1
  7. Now I have WrapperPlayServerEntityMetadata From ProtocolLib
    But I dont know how to setMetadata


    Attached Files:

    • Like Like x 1
  8. There could be issues with the client you're sending the packet seeing a corpse all the time.

  9. The client doesnt store HP, under the protocol specification of 1.12.2 there is the "Combat Event" packet (dont confuse with bukkit events.) which allows you to notify the client about the death of the entity.
  10. Help please do this!
    • Agree Agree x 1
  11. Is this you asking for code? :D
  12. I ask for any help. It is desirable of course code :D
    • Like Like x 2
  13. You can't, it doesn't matter how much please you say. You can use the combat event packet for it, spawning dead (maybe invisible?) entities beneath the target & sending the dead packet to the target.

    But that'll still become severe resource drain.
Thread Status:
Not open for further replies.