Hey guys what do I do here: if($data["target"]->getID() == SaplingBlock::OAK); If($data["target"]->getD() == SaplingBlock::BIRCH); //what do I write here case SaplingBlock::SPRUCE: So it doesnt crash my server
Ok replace the SaplingBlock::... with the actual ID of the item. Example: Say you want to se if the player was hitting air (again just an example XD) if($data["target"]->getID() == "0"){ //What happens if the item is air }
Yeah but I need 6:1 6:2 6:3 And when I write ":" it crashes (If u put the id to 0 it wouldnt work cause my handler is player.block.place
Just a tip, "updating it later" isn't just changing a few lines of code or anything. It's recoding the entire plugin. So take that into consideration if you're not too far into development with this plugin
PHP: if($data["item"] == $this->api->block->getItem("6","0")) {// Oak sapling} else if($data["item"] == $this->api->block->getItem("6","1")) {// Spruce sapling} else if($data["item"] == $this->api->block->getItem("6","2")) {// Birch sapling} // Continue IF statement as needed.
You guys never awnsered my question I asked what do I put in between the getid and the case or do change the case?
Omg... Having.. Or Use this... PHP: getMetadata() === 1 http://docs.pocketmine.net/dc/d9e/classpocketmine_1_1block_1_1_wood.html