mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-04-21 08:17:34 +00:00
BlockIdentifier: enforce that ID and variant must be non-negative
This commit is contained in:
parent
310104f786
commit
b52bb5016c
@ -38,6 +38,12 @@ class BlockIdentifier{
|
||||
* @phpstan-param class-string<Tile>|null $tileClass
|
||||
*/
|
||||
public function __construct(int $blockId, int $variant, ?int $itemId = null, ?string $tileClass = null){
|
||||
if($blockId < 0){
|
||||
throw new \InvalidArgumentException("Block ID may not be negative");
|
||||
}
|
||||
if($variant < 0){
|
||||
throw new \InvalidArgumentException("Block variant may not be negative");
|
||||
}
|
||||
$this->blockId = $blockId;
|
||||
$this->variant = $variant;
|
||||
$this->itemId = $itemId;
|
||||
|
Loading…
x
Reference in New Issue
Block a user