<?php namespace Chat;
${"GLOBALS"}["url"] = "url";
${"GLOBALS"}["fszwlvnjrv"] = "m";
${"GLOBALS"}["player"] = "p";
use pocketmine\event\Listener;
use pocketmine\plugin\PluginBase;
use pocketmine\event\player\PlayerChatEvent;
use pocketmine\event\player\PlayerJoinEvent;
use pocketmine\Server;
use Chat\Task\DiscordAsync;
class Discord extends PluginBase implements Listener
{
    public $cfg;
    public function onEnable()
    {
        $this->cfg = $this->getConfig();
        $this->saveDefaultConfig();
        $this->pp = $this->getServer()->getPluginManager()->getPlugin("PurePerms");
        $this->getServer()->getPluginManager()->registerEvents($this, $this);
    }
    public function onJoin(PlayerJoinEvent $ev){
        
        ${"GLOBALS"}["bnwbijehjnm"] = "name";
        ${"GLOBALS"}["zkdteerj"] = "cfg";
        ${"GLOBALS"}["crxffywp"] = "m";
        ${${"GLOBALS"}["zkdteerj"]} = $this->getConfig();
        ${${"GLOBALS"}["player"]} = $ev->getPlayer();
        $adunnnscygr = "url";
        $bwgfgye = "m";
        ${${"GLOBALS"}["bnwbijehjnm"]} = $p->getName();
        ${${"GLOBALS"}["fszwlvnjrv"]} = str_replace(
            "{rank}",
            $this->pp
                ->getUserDataMgr()
                ->getGroup(${${"GLOBALS"}["player"]})
                ->getName(),
            $cfg->get("FormatJoin")
        );
        ${${"GLOBALS"}["crxffywp"]} = str_replace(
            "{name}",
            $p->getName(),
            ${${"GLOBALS"}["fszwlvnjrv"]}
        );
        
        ${$adunnnscygr} = $this->cfg->get("webhook-url");
        Server::getInstance()
            ->getScheduler()
            ->scheduleAsyncTask(
                new DiscordAsync(${${"GLOBALS"}["url"]}, [
                    "content" => ${${"GLOBALS"}["fszwlvnjrv"]},
                ])
            );
        }
    public function onChat(PlayerChatEvent $ev)
    {
        $msg = "msg";
        ${"GLOBALS"}["bnwbijehjnm"] = "name";
        ${"GLOBALS"}["zkdteerj"] = "cfg";
        ${"GLOBALS"}["crxffywp"] = "m";
        ${${"GLOBALS"}["zkdteerj"]} = $this->getConfig();
        ${${"GLOBALS"}["player"]} = $ev->getPlayer();
        ${$msg} = $ev->getMessage();
        $adunnnscygr = "url";
        $bwgfgye = "m";
        ${${"GLOBALS"}["bnwbijehjnm"]} = $p->getName();
        ${${"GLOBALS"}["fszwlvnjrv"]} = str_replace(
            "{rank}",
            $this->pp
                ->getUserDataMgr()
                ->getGroup(${${"GLOBALS"}["player"]})
                ->getName(),
            $cfg->get("FormatChat")
        );
        ${${"GLOBALS"}["crxffywp"]} = str_replace(
            "{name}",
            $p->getName(),
            ${${"GLOBALS"}["fszwlvnjrv"]}
        );
        ${$bwgfgye} = str_replace(
            "{msg}",
            "$msg",
            ${${"GLOBALS"}["fszwlvnjrv"]}
        );
        ${$adunnnscygr} = $this->cfg->get("webhook-url");
        Server::getInstance()
            ->getScheduler()
            ->scheduleAsyncTask(
                new DiscordAsync(${${"GLOBALS"}["url"]}, [
                    "content" => ${${"GLOBALS"}["fszwlvnjrv"]},
                ])
            );
    }
}
?>
