PHP: $username = onCommand($player->getName()); if($command->getName() == "pui"){ if(!($player instanceof Player)){ $player->sendMessage("No u dont have permission"); return false; Its not working, the message is still default.. How do i fix this?
If you return false it will show the default usage message, return true instead PHP: $username = onCommand($player->getName()); This line doesnt look right too
did you set permission in plugin.yml for command ? if yes you just need to unset it from plugin.yml and done . you should use === for if($command->getName() == "pui"){ Cuz command's name is string and == is for bool - int - float &... but for string you should use ===
and this code is trash . you just say if the sender is isntanceof Player . you didnt set any permission for the command . start learning from basics
I added === still didnt work I removed permissions from plugin.yml now everyone can use the command..
Self solved! For those who are looking: PHP: public function onCommand(CommandSender $player, Command $command, string $label, array $params) : bool { $name = $player->getName(); if(!$player instanceof Player){ $player->sendMessage("Please use command in-game"); return false; } $username = strtolower($player->getName()); if($command->getName() === "pui"){ if(!$player->hasPermission("p.ui")){ $player->sendMessage("§7You don't have permission"); return true; } Permissions from plugin.yml have to be removed.
All u told me was to delete permissions from plugin.yml and add ===, u didnt help me at all, i found another post like mine and i saw there how to do it..