i'm getting an error with this plugin and i don't know what's wrong with the line of code someone pls help? Console message: CRITICAL> ParseError: "syntax error, unexpected ';', expecting ',' or ')'" (EXCEPTION) in "/phar_CrateKeys-master_5gsYfMCBxQTzFKf.phar/src/Blubberboy333/CrateKeys/Main" at line 47 Line 47 - 48: $this->getServer()->dispatchCommand(new ConsoleCommandSender, str_replace(array("{PLAYER}", "{NAME}"), $player, $player->getName()); } Can anyone tell me what's wrong? also I uploaded the zip if you wanna take a closer look in 'main.php'
Syntax errors are pretty simple. This PHP: $this->getServer()->dispatchCommand(new ConsoleCommandSender, str_replace(array("{PLAYER}", "{NAME}"), $player, $player->getName());} needs to be this: PHP: //You need to define the string or array to str_replace in$this->getServer()->dispatchCommand(new ConsoleCommandSender, str_replace(["{PLAYER}", "{NAME}"], [$player, $player->getName()], $command));}//Define $command as whatever command you want to execute. You were missing multiple closing parentheses. Remember, for every (, [, or {, you must have a cooresponding ), ], }, respectively. You also used str_replace a little inaccurately. You can get some information on that from here, but basically, you need two arrays(or variables) and a third argument, either an array or string, to do the replacing in.