Instant Break protection

This commit is contained in:
Shoghi Cervantes Pueyo
2013-03-05 17:16:26 +01:00
parent 0ab5fc8fcd
commit 845e48db66
3 changed files with 27 additions and 15 deletions

View File

@@ -137,7 +137,8 @@ abstract class Block extends Vector3{
);
protected $id;
protected $meta;
protected $name = "";
protected $name;
protected $breakTime;
public $isActivable = false;
public $breakable = true;
public $isFlowable = false;
@@ -155,6 +156,7 @@ abstract class Block extends Vector3{
$this->id = (int) $id;
$this->meta = (int) $meta;
$this->name = $name;
$this->breakTime = 0.25;
}
public function getName(){
@@ -186,6 +188,13 @@ abstract class Block extends Vector3{
}
}
public function getBreakTime(Item $item, Player $player){
if($player->gamemode === CREATIVE){
return 0.25;
}
return $this->breakTime;
}
final public function __toString(){
return "Block ". $this->name ." (".$this->id.":".$this->meta.")";
}