This is the code: PHP: public function KillMoney(PlayerDeathEvent $event) { $damager = $event->getPlayer()->getLastDamageCause()->getEntity(); $player = $event->getPlayer()->getName(); $pl = $event->getPlayer(); // SOME LOGGING STUFF FOR MONEY $a = $this->getCfg()->get("a"); $b = $this->getCfg()->get("b"); $c = $this->getCfg()->get("c"); $d = $this->getCfg()->get("d"); if ($pl->getLastDamageCause() instanceof EntityDamageEvent) { if ($damager instanceof Player) { if ($damager->hasPermission("killmoney.a")){ $this->ecoAPI->setMoney($damager, $a); $damager->sendMessage(TF::GREEN . "You just got " . $a . "$ for killing " . $player); } elseif ($damager->hasPermission("killmoney.b")){ $this->ecoAPI->setMoney($damager, $b); $damager->sendMessage(TF::GREEN . "You just got " . $b . "$ for killing " . $player); } elseif ($damager->hasPermission("killmoney.c")){ $this->ecoAPI->setMoney($damager, $c); $damager->sendMessage(TF::GREEN . "You just got " . $c . "$ for killing " . $player); } elseif ($damager->hasPermission("killmoney.d")){ $this->ecoAPI->setMoney($damager, $d); $damager->sendMessage(TF::GREEN . "You just got " . $d . "$ for killing " . $player); } else { // WHEN PLAYER HAS NONE OF THESE PERMISSIONS AN ERROR MESSAGE WILL COME $damager->sendMessage($this->getCfg()->get("error")); } } } } I get no message or anything
Here is the full code: PHP: <?phpdeclare(strict_types=1);<?phpdeclare(strict_types=1);namespace mzztin\KillMoney;use onebone\economyapi\EconomyAPI;use pocketmine\event\entity\EntityDamageEvent;use pocketmine\event\Listener;use pocketmine\event\player\PlayerDeathEvent;use pocketmine\Player;use pocketmine\plugin\PluginBase;use pocketmine\utils\Config;use pocketmine\utils\TextFormat as TF;class Main extends PluginBase implements Listener{ private $ecoAPI; public function onLoad() { $this->ecoAPI = $this->getServer()->getPluginManager()->getPlugin("EconomyAPI"); @mkdir($this->getDataFolder()); $this->saveResource("config.yml"); } public function getCfg() : Config { $cfg = new Config($this->getDataFolder() . "config.yml", Config::YAML); return $cfg; } public function KillMoney(PlayerDeathEvent $event){ $damager = $event->getPlayer()->getLastDamageCause()->getEntity(); $player = $event->getPlayer()->getName(); $pl = $event->getPlayer(); // SOME LOGGING STUFF FOR MONEY $a = $this->getCfg()->get("a"); $b = $this->getCfg()->get("b"); $c = $this->getCfg()->get("c"); $d = $this->getCfg()->get("d"); if ($pl->getLastDamageCause() instanceof EntityDamageEvent) { if ($damager instanceof Player) { if ($damager->hasPermission("killmoney.a")){ $this->ecoAPI->setMoney($damager, $a); $damager->sendMessage(TF::GREEN . "You just got " . $a . "$ for killing " . $player); } elseif ($damager->hasPermission("killmoney.b")){ $this->ecoAPI->setMoney($damager, $b); $damager->sendMessage(TF::GREEN . "You just got " . $b . "$ for killing " . $player); } elseif ($damager->hasPermission("killmoney.c")){ $this->ecoAPI->setMoney($damager, $c); $damager->sendMessage(TF::GREEN . "You just got " . $c . "$ for killing " . $player); } elseif ($damager->hasPermission("killmoney.d")){ $this->ecoAPI->setMoney($damager, $d); $damager->sendMessage(TF::GREEN . "You just got " . $d . "$ for killing " . $player); } else { // WHEN PLAYER HAS NONE OF THESE PERMISSIONS AN ERROR MESSAGE WILL COME $damager->sendMessage($this->getCfg()->get("error")); } } }}}