pocketmine\inventory\Inventory::clearAll PHP Méthode

clearAll() public méthode

Clears all the slots
public clearAll ( )
    public function clearAll();

Usage Example

Exemple #1
0
 public function loadInventory(Player $player, Inventory $inv)
 {
     $n = trim(strtolower($player->getName()));
     if ($n === "") {
         return false;
     }
     if ($this->isGlobal) {
         $ln = "*";
     } else {
         $ln = trim(strtolower($player->getLevel()->getName()));
     }
     $inv->clearAll();
     $sql = "SELECT slot,id,damage,count FROM NetherChests WHERE player = " . $this->prepare($n) . " AND world = " . $this->prepare($ln);
     $res = $this->database->query($sql);
     if ($res === false) {
         return false;
     }
     while (($row = $res->fetch_assoc()) != null) {
         $inv->setItem($row["slot"], Item::get($row["id"], $row["damage"], $row["count"]));
     }
     $res->free();
     return true;
 }
All Usage Examples Of pocketmine\inventory\Inventory::clearAll