Hi, im developing a plugin for my hub on my server, wich disable any Damage, but it dont disable the dmg only in one world, rather in all worlds... Id tried this... PHP: //NoDMG public function NoDMG(EntityDamageEvent $event){ if($this->getServer()->getLevelByName("HUB")){ $event->setCancelled(); } } This cancel the DMG in all Worlds at my Server... Edit: Cause tht check if the lvl exist Is tht right? PHP: //NoDMG public function NoDMG(EntityDamageEvent $event){ $p = $event->getEntity(); $lvl = $this->getServer()->getLevelByName("HUB"); if ($p->getLevel($lvl)){ $event->setCancelled(); } } I dont tried it, but i think tht make no sense... (idk why) Or does a PlayerDamageEvent exist? Thx for Help!
You need to compare the player's level to the level you want, please learn the basics of programming before writing a plugin. PHP: if ($p->getLevel()->getFolderName() === "blah") {// do stuff}