Sign: Do not allow edits by any player except the one who placed it, and only while that player is online

signs now become finalized if:
- the player quits and rejoins (because the entity runtime ID of the player will not be the same)
- the chunk is unloaded and reloaded (because the tagged entity runtime ID is not saved).

closes #4198
This commit is contained in:
Dylan K. Taylor
2021-05-02 13:22:31 +01:00
parent c19d2fe891
commit c47ecb55c0
2 changed files with 26 additions and 1 deletions

View File

@ -68,7 +68,10 @@ class SignPost extends Transparent{
$this->getLevelNonNull()->setBlock($blockReplace, BlockFactory::get(Block::WALL_SIGN, $this->meta), true);
}
Tile::createTile(Tile::SIGN, $this->getLevelNonNull(), TileSign::createNBT($this, $face, $item, $player));
$sign = Tile::createTile(Tile::SIGN, $this->getLevelNonNull(), TileSign::createNBT($this, $face, $item, $player));
if($player !== null && $sign instanceof TileSign){
$sign->setEditorEntityRuntimeId($player->getId());
}
return true;
}