Added __toString() to Player, Block and Item classes & added protocol order enforcement after login

This commit is contained in:
Shoghi Cervantes Pueyo 2013-02-07 17:04:04 +01:00
parent 4d05d7da0d
commit e7d56a837f
3 changed files with 60 additions and 2 deletions

View file

@ -135,7 +135,6 @@ abstract class Block{
);
protected $id;
protected $meta;
protected $shortname = "";
protected $name = "";
public $isActivable = false;
public $breakable = true;
@ -154,7 +153,6 @@ abstract class Block{
$this->id = (int) $id;
$this->meta = (int) $meta;
$this->name = $name;
$this->shortname = strtolower(str_replace(" ", "_", $name));
}
public function getName(){
@ -186,6 +184,10 @@ abstract class Block{
}
}
final public function __toString(){
return $this->name ." (".$this->id.":".$this->meta.")";
}
abstract function isBreakable(Item $item, Player $player);
abstract function onBreak(BlockAPI $level, Item $item, Player $player);