I was making a plugin that will ban a player on death. So as I went to test it I killed a plyer and it said player(6) has been banned for 5 Mins, instead of the name. I have no idea why this is happening.. The player also wasn't banned -_- Github Repo: https://github.com/DarkRealms/HardCorePvP/edit/master/src/DarkRealms/Main.php Lazy Devs PHP: <?phpnamespace DarkRealms;use pocketmine\plugin\PluginBase;use pocketmine\event\player\PlayerDeathEvent;use pocketmine\event\Event;use pocketmine\event\Listener;use pocketmine\Server;use pocketmine\utils\Config;use pocketmine\utils\TextFormat;use pocketmine\Player;use pocketmine\command\ConsoleCommandSender;class Main extends PluginBase implements Listener{ public function onEnable(){ $this->getServer()->getPluginManager()->registerEvents($this, $this); $this->saveDefaultConfig(); } public function onPlayerDeath(PlayerDeathEvent $event){ $p = $event->getEntity(); if($p instanceof Player){ $time = $this->getConfig()->get("bantime"); $message = $this->getConfig()->get("banmessage"); $command = "timerban add ". $p." ". $time." ". $message; $this->getServer()->dispatchCommand(new ConsoleCommandSender(), $command); $this->getServer()->broadcastMessage(TextFormat::YELLOW. $p. " has been banned for ". $time ." minutes"); } }} Did I need to add PHP: $this->getServer()->getPluginManager()->getPlugin("Timerban");
Try this: PHP: public function onPlayerDeath(PlayerDeathEvent $event){$p = $event->getEntity();$pName = $p->getName();if($p instanceof Player){$time = $this->getConfig()->get("bantime");$message = $this->getConfig()->get("banmessage");$command = "timerban add ". $pName." ". $time." ". $message;$this->getServer()->dispatchCommand(new ConsoleCommandSender(), $command);$this->getServer()->broadcastMessage(TextFormat::YELLOW. $pName. " has been banned for ". $time ." minutes");}}
You calling me lazy? Ask me then I will help lol. Just some ******* telling me I am messing everything up... lol. Not you, @Radix.
PHP: public function onPlayerDeath(PlayerDeathEvent $event){$p = $event->getEntity();if($p instanceof Player){$pName = $p->getName();$time = $this->getConfig()->get("bantime");$message = $this->getConfig()->get("banmessage");$command = "timerban add ". $pName." ". $time." ". $message;$this->getServer()->dispatchCommand(new ConsoleCommandSender(), $command);$this->getServer()->broadcastMessage(TextFormat::YELLOW. $pName. " has been banned for ". $time ." minutes");}}