The title of this thread has self-explanatory. I am making a city roleplay server and I need a plugin that the command can only execute- when you step on a certain block, its for robbery plugin so the player can only use /startrob when they step on the bank floor (example gold block)
PHP: // onCommand$block = $player->getLevel()->getBlock($player->subtract(0, 1, 0));if($block->getId() !== Block::GOLD_BLOCK) { // I'm not sure if it's golden or just gold $player->sendMessage("You may not execute this command here."); return;}
Don't forget to make sure the player is on the bank's region! Otherwise players can just create gold blocks and defeat the system. Example: PHP: $x = [100, 200];$y = [20, 50];$z = [100, 200];$minY = min($y);$minZ = min($z);$maxX = max($x);$maxY = max($y);$maxZ = max($z);$pos = $player->getPosition();if( $pos->x >= $minX and $pos->x <= $maxX and $pos->y >= $minY and $pos->y <= $maxY and $pos->z >= $minZ and $pos->z <= $maxZ){ // Player is inside the region}
If you haven't noticed, this was written on the development section. not the plugin request sections.