Solved Freeze player when hit

Discussion in 'Spigot Plugin Help' started by Emreeocn, Apr 4, 2020.

  1. Hello,
    I want to freeze the target (player who gets hit) for 5 seconds, when he gets hit with a certain item. But I dont have a plan how to do this.
    Can I use multiple Events in one method?

    Would be nice, if someone could explain me ^^

  2. Hi,

    You could apply a very high slowness effect when the player gets damage with this item.
    It‘s not perfect because the player can move a little bit by jumping.

    If you want to use the PlayerMoveEvent, you can make use of a List, where you add the player in the DamageEvent and if the player of the PlayerMoveEvent is in this list, you can cancel the move.

  3. Thanks <3 I will try
  4. Ummm... how do I get the target (entity who gets hit) with the Event?
  5. @EventHandler
    public void entityDamage(EntityDamageEvent e) {
    if(e instanceof Player) {
    Player p = ((Player) e).getPlayer();

    p.sendMessage("you got attacked");

    p is the Player who got hit
  6. Thanks.