Fixed breaking Spawnable tiles and cancelling it

This commit is contained in:
Shoghi Cervantes 2014-05-27 12:12:45 +02:00
parent 5e97da2e11
commit a669797ccb
2 changed files with 7 additions and 0 deletions

View File

@ -1737,6 +1737,7 @@ class Player extends Human implements CommandSender, InventoryHolder, IPlayer{
break;
}
$target = $this->getLevel()->getBlock($vector);
$tile = $this->getLevel()->getTile($vector);
$pk = new UpdateBlockPacket;
$pk->x = $target->x;
$pk->y = $target->y;
@ -1744,6 +1745,9 @@ class Player extends Human implements CommandSender, InventoryHolder, IPlayer{
$pk->block = $target->getID();
$pk->meta = $target->getDamage();
$this->directDataPacket($pk);
if($tile instanceof Spawnable){
$tile->spawnTo($this);
}
break;
case ProtocolInfo::PLAYER_ARMOR_EQUIPMENT_PACKET:
if($this->spawned === false or $this->blocked === true){

View File

@ -101,6 +101,9 @@ class SimpleTransactionGroup implements TransactionGroup{
Server::getInstance()->getPluginManager()->callEvent($ev = new InventoryTransactionEvent($this));
if($ev->isCancelled()){
foreach($this->inventories as $inventory){
$inventory->sendContents($inventory->getViewers());
}
return false;
}