mirror of
https://github.com/oldminecraftcommunity/NostalgiaCore.git
synced 2026-11-22 20:49:43 +00:00
Object check on getting distance for PvP attacks
Fixes #586, although I'm not entirely sure what's causing the object to be invalid in the first case, so this is a temporal fix.
This commit is contained in:
parent
c1e1f5195b
commit
f3f6828699
1 changed files with 5 additions and 4 deletions
|
|
@ -1402,12 +1402,12 @@ class Player{
|
||||||
$this->craftingItems = array();
|
$this->craftingItems = array();
|
||||||
$this->toCraft = array();
|
$this->toCraft = array();
|
||||||
$target = $this->server->api->entity->get($data["target"]);
|
$target = $this->server->api->entity->get($data["target"]);
|
||||||
if($this->gamemode !== VIEW and $this->blocked === false and ($target instanceof Entity) and $this->entity->distance($target) <= 8){
|
if($target instanceof Entity and $this->entity instanceof Entity and $this->gamemode !== VIEW and $this->blocked === false and ($target instanceof Entity) and $this->entity->distance($target) <= 8){
|
||||||
$data["targetentity"] = $target;
|
$data["targetentity"] = $target;
|
||||||
$data["entity"] = $this->entity;
|
$data["entity"] = $this->entity;
|
||||||
if($target->class === ENTITY_PLAYER and ($this->server->api->getProperty("pvp") == false or $this->server->difficulty <= 0 or ($target->player->gamemode & 0x01) === 0x01)){
|
if($target->class === ENTITY_PLAYER and ($this->server->api->getProperty("pvp") == false or $this->server->difficulty <= 0 or ($target->player->gamemode & 0x01) === 0x01)){
|
||||||
break;
|
break;
|
||||||
}elseif($this->server->handle("player.interact", $data) !== false){
|
}elseif($this->server->handle("player.interact", $data) !== false){
|
||||||
$slot = $this->getSlot($this->slot);
|
$slot = $this->getSlot($this->slot);
|
||||||
switch($slot->getID()){
|
switch($slot->getID()){
|
||||||
case WOODEN_SWORD:
|
case WOODEN_SWORD:
|
||||||
|
|
@ -1475,6 +1475,7 @@ class Player{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case MC_ANIMATE:
|
case MC_ANIMATE:
|
||||||
if($this->spawned === false){
|
if($this->spawned === false){
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue