getKnockBack in entitydamageevent does not help. Lots of hack clients knockback player fast and then teleport to the previsious position
Nope. as if you "can" do it, how about if a player lags? will you force knockback him? That's the reason of how hard to block hacks.
What about this code? PHP: public function idk(PlayerMoveEvent $e) { $p = $e->getPlayer(); $from = $e->getFrom(); $to = $e->getTo(); $knockdistance = $from->distance($to); if ($knockdistance > 2.5) { $this->teleport[$p->getName()] = $p->getName(); } elseif ($knockdistance < 1.1) { if (isset($this->knockback[$p->getName()])) { if (isset($this->teleport[$p->getName()])) { $p->kick("AntiKnockback:D", false); } } } } public function onDamage(EntityDamageEvent $e) { $p = $e->getEntity(); if ($e instanceof EntityDamageByEntityEvent) { if ($e->getKnockBack() > 2.5) { if (isset($this->teleport[$p->getName()])) { $this->knockback[$p->getName()] = $p->getName(); } } } }} I do not have time to test now.. Can it be usable?