Upload files to 'AdminMail/src/AdminMail'
This commit is contained in:
parent
40516097c8
commit
c8412d996b
42
AdminMail/src/AdminMail/AdminMail.php
Normal file
42
AdminMail/src/AdminMail/AdminMail.php
Normal file
@ -0,0 +1,42 @@
|
||||
<?php
|
||||
|
||||
namespace AdminMail;
|
||||
|
||||
use pocketmine\Player;
|
||||
use pocketmine\event\player\PlayerJoinEvent;
|
||||
use pocketmine\plugin\PluginBase;
|
||||
use pocketmine\event\Listener;
|
||||
use pocketmine\command\Command;
|
||||
use pocketmine\command\CommandSender;
|
||||
use pocketmine\utils\Config;
|
||||
|
||||
|
||||
class AdminMail extends PluginBase implements Listener {
|
||||
|
||||
public function onLoad() { # Called when the plugin is being loaded by the server
|
||||
$this->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.");
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user