diff --git a/AdminMail/src/AdminMail/AdminMail.php b/AdminMail/src/AdminMail/AdminMail.php new file mode 100644 index 0000000..d4a11de --- /dev/null +++ b/AdminMail/src/AdminMail/AdminMail.php @@ -0,0 +1,42 @@ +getLogger()->info("Loading plugin..."); # Logs to the console + } + + public function onEnable() { # Called when the plugin is enabled successfully without any errors + $this->getServer()->getPluginManager()->registerEvents($this, $this); # Registers the events + @mkdir($this->getDataFolder()); + $this->saveDefaultConfig(); + } + + public function onDisable() { # Called when the plugin is being disabled + $this->getLogger()->info("Plugin disabled!"); # Logs to the console + } + + public function onCommand(CommandSender $sender, Command $cmd, $label, array $args) { # This is called when a player rans the command from this plugin + if($cmd->getName() == "example") { # Remove this if your plugin has only one command + $sender->sendMessage("This is an example command"); # Sends to the sender + } + } + + public function onJoin(PlayerJoinEvent $event) { # Called when a player joins + $player = $event->getPlayer(); + $name = $player->getName(); + $adminmail = $this->getConfig()->get("adminmail"); + mail($adminmail, "PMMP - $name joined", "Hello, player $name has joined the server."); + } +} \ No newline at end of file