/Main.php Secret
Created
May 31, 2024 17:29
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace MyFirstPlugin; | |
use pocketmine\plugin\PluginBase; | |
use pocketmine\command\Command; | |
use pocketmine\command\CommandSender; | |
use pocketmine\player\Player; | |
class Main extends PluginBase { | |
public function onEnable(): void { | |
$this->getLogger()->info("¡Hola, mundo! Mi primer plugin ha sido habilitado."); | |
} | |
public function onCommand(CommandSender $sender, Command $command, string $label, array $args): bool { | |
if ($command->getName() === "hello") { | |
if ($sender instanceof Player) { | |
$sender->sendMessage("¡Hola, " . $sender->getName() . "!"); | |
return true; | |
} else { | |
$sender->sendMessage("Este comando solo puede ser usado en el juego."); | |
return false; | |
} | |
} | |
return false; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment