mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-10-20 07:39:42 +00:00
Instant Break protection
This commit is contained in:
@@ -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.")";
|
||||
}
|
||||
|
Reference in New Issue
Block a user