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; break;
} }
$target = $this->getLevel()->getBlock($vector); $target = $this->getLevel()->getBlock($vector);
$tile = $this->getLevel()->getTile($vector);
$pk = new UpdateBlockPacket; $pk = new UpdateBlockPacket;
$pk->x = $target->x; $pk->x = $target->x;
$pk->y = $target->y; $pk->y = $target->y;
@ -1744,6 +1745,9 @@ class Player extends Human implements CommandSender, InventoryHolder, IPlayer{
$pk->block = $target->getID(); $pk->block = $target->getID();
$pk->meta = $target->getDamage(); $pk->meta = $target->getDamage();
$this->directDataPacket($pk); $this->directDataPacket($pk);
if($tile instanceof Spawnable){
$tile->spawnTo($this);
}
break; break;
case ProtocolInfo::PLAYER_ARMOR_EQUIPMENT_PACKET: case ProtocolInfo::PLAYER_ARMOR_EQUIPMENT_PACKET:
if($this->spawned === false or $this->blocked === true){ 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)); Server::getInstance()->getPluginManager()->callEvent($ev = new InventoryTransactionEvent($this));
if($ev->isCancelled()){ if($ev->isCancelled()){
foreach($this->inventories as $inventory){
$inventory->sendContents($inventory->getViewers());
}
return false; return false;
} }