interact event fixed

This commit is contained in:
GameHerobrine 2022-11-10 10:51:09 +03:00
parent 6bc20a0a02
commit 834bb3d486
2 changed files with 9 additions and 6 deletions

View file

@ -762,9 +762,8 @@ class Entity extends Position
if($this->class === ENTITY_PLAYER and ($this->server->api->getProperty("pvp") == false or $this->server->difficulty <= 0 or ($e->player->gamemode & 0x01) === 0x01)){
return false;
}
$data["targetentity"] = $this;
$data["entity"] = $e;
if($this->server->handle("player.interact", $data) !== false && $action === InteractPacket::ACTION_ATTACK && $e->isPlayer()){
if($action === InteractPacket::ACTION_ATTACK && $e->isPlayer()){
$slot = $e->player->getHeldItem();
$damage = $slot->getDamageAgainstOf($e);
$this->harm($damage, $e->eid);
@ -1411,4 +1410,4 @@ class Entity extends Position
{
throw new Exception("Use getHeight or getWidth method instead of this.");
}
}
}