Hi, That useless programmer is back again! I'm making this useless plugin for my server, and I think I can make it even better. Could you please help me to improve this code? PHP: <?php/*__PocketMine Plugin__name=Infernodescription=I'm just a useless plugin!version=1.0.0author=XKTiVerzclass=Infernoapiversion=11,12*//*DO NOT COPY MY CODE WITHOUT MY PERMISSION- XKTiVerz*/class Inferno implements Plugin{ private $api; public function __construct(ServerAPI $api, $server = false) { $this->api = $api; } public function init() { $this->api->console->register("inferno", "<radius> (/inf <radius>)", array($this, "CommandHandler")); $this->api->console->alias("inf","inferno"); } public function CommandHandler($cmd, $params, $issuer, $alias) { if(!($issuer instanceof Player)) { return "Please run this command in-game."; } if(count($params) > 1) { return "< [XTi-Server] > Usage: /inferno <radius> (/inf <radius>)"; } $rd = (int)$params[0]; if($params[0] == "") { $rd = 3; } if($rd <= 1 || $rd > 32) { return "< [XTi-Server] > Error: Invalid Number!"; } $fire = $this->api->block->get(51, 0); $x = (int)$issuer->entity->x; $y = (int)$issuer->entity->y; $z = (int)$issuer->entity->z; $px1 = $x - $rd; $px2 = $x + $rd; $pz1 = $z - $rd; $pz2 = $z + $rd; for($tx = $px1; $tx <= $px2; $tx++) { for($tz = $pz1; $tz <= $pz2; $tz++) { $pos = new Vector3($tx, $y, $tz); if(($pos != new Vector3($x - 1, $y, $z - 1)) and ($pos != new Vector3($x - 1, $y, $z)) and ($pos != new Vector3($x - 1, $y, $z + 1))) { if(($pos != new Vector3($x, $y, $z - 1)) and ($pos != new Vector3($x, $y, $z)) and ($pos != new Vector3($x, $y, $z + 1))) { if(($pos != new Vector3($x + 1, $y, $z - 1)) and ($pos != new Vector3($x + 1, $y, $z)) and ($pos != new Vector3($x + 1, $y, $z + 1))) { $issuer->level->setBlock($pos, $fire, $fire->getMetadata()); } } } } } } public function __destruct() { }}?>
The problem at setBlock You were correct to use the Fire object, but if you want to specify the meta data of the block, you should define this when you construct the block. (BlockAPI::get($id, $metaData)) BTW use the static function not the object function. This is not a must, but you better do so because this is shorter.