PotionEffect Weakness disables fist / non weapon damage? How can I fix this.

Discussion in 'Spigot Plugin Development' started by NikeWade, Apr 16, 2017.

  1. So I've been creating custom damages in my plugin and I ended up adding in weakness and strength to the mix. If he player had strength I would add an amount of damage depending on the amplifier and the opposite for weakness (Would subtract damage). I set the base damage to my own damage and this overrides the potion effects for weapons such as a diamond sword, but I noticed that when you try to hit a player with your first or something like a block, the EntityDamageByEntityEvent doesn't even fire. This only happens when you have the weakness potion effect.
     
  2. I also tried checking if the event was canceled and nothing came up.
     
  3. bumping due to no answers for a while...
     
  4. WAS

    WAS

    It almost seems intended. As you are weak and such attacks do not render you any assistance requiring you to have a weapon to defend yourself while under the spell of Weakness. I am not sure how to get around this, you might have to re-implmement a attack system with PlayerInteractEntityEvent
     
  5. Yea I was thinking about that
     
  6. bump.. anyone have any other ideas?
     
  7. Short of modifying NMS behavior I can't think for another approach. As previously stated this is working as intended as a player with weakness doesn't inflict any damage with their fist and thus EntityDamageByEntityEvent by definition should not fire as no damage has been done.

    If you want to you could fire EntityDamageByEntityEvent yourself from a PlayerInteractEntityEvent event handler you have written.
     
  8. Bump, having this issue myself.
     
  9. Use packets and nms to make everything work but with weakness.
     
  10. Care to expand? Past building my own jar, I can't think of a way to override the behaviour for players. It may even be clientside, in which case it's truly screwed.
     
  11. Easily tested, send a packet to the client which includes a packet for the weakness potion effect. Should the strikes work when just the player has the potion effect, but the server is unaware of it, you could hack around it by using some packet listener to strip the potion effect during an incoming hit and add it back with a tick delay.

    This is however gonna result in some issues like (for example) overlapping of damage and potion effect removal (which while a rare case, but possible to happen.)