I only have one protector plugin. Plus, I think I really need to edit the .php because it is turning on edit-protection in areas. I'll try and do the same thing on god mode, turn it on too. But I'm not sure how.
I think I need to change something in the PHP: PHP: public function canTouch($p,$t) { if($p->hasPermission("iprotector") || $p->hasPermission("iprotector.access")) { return true; } $o = true; $g = (isset($this->levels[$t->getLevel()->getName()]) ? $this->levels[$t->getLevel()->getName()]["Touch"] : $this->touch); if($g) { $o = false; } foreach($this->areas as $area) { if($area->contains(new Vector3($t->getX(),$t->getY(),$t->getZ()),$t->getLevel()->getName())) { if($area->getFlag("touch")) { $o = false; } if($area->isWhitelisted(strtolower($p->getName()))) { $o = true; break; } if(!$area->getFlag("touch") && $g) { $o = true; break; } } } return $o; } public function canGetHurt($p) { $o = true; $g = (isset($this->levels[$p->getLevel()->getName()]) ? $this->levels[$p->getLevel()->getName()]["God"] : $this->god); if($g) { $o = false; } foreach($this->areas as $area) { if($area->contains(new Vector3($p->getX(),$p->getY(),$p->getZ()),$p->getLevel()->getName())) { if(!$area->getFlag("god") && $g) { $o = true; break; } if($area->getFlag("god")) { $o = false; } } } return $o; }
I tried turning god to true and false in the config and also in the areas.json, but nothing worked. I experimented around and tried everything, but it won't let me do this: god mode on in protected areas, god mode off in unprotected areas. I think there must be something wrong with the whole plugin, or the .php file (see code above). Or maybe I'm not using the newest version?
I need to fix this or PvP won't work correctly and etc. Please help me fix this. There must be a way.
I was testing really around a lot. I finally fixed the problem by doing this (at bit confusing with all these true and false). In Main.php: PHP: public function onHurt(EntityDamageEvent $event) { if($event->getEntity() instanceof Player) { $p = $event->getEntity(); $x = false; if($this->canGetHurt($p)) { // removed the ! (not) $event->setCancelled(); } } } In config.yml: (I'm changing settings for the worlds on my server: PvP1 and Farming) Code: # Settings for unprotected areas in individual worlds: Worlds: PvP1: # Keep players from getting hurt? God: true # here, 'true' means "false" # Keep players from editing the world? Edit: true # Keep players from touching blocks and activating things like chests? Touch: false Farming: # Keep players from getting hurt? God: true # here, 'true' means "false" # Keep players from editing the world? Edit: false # Keep players from touching blocks and activating things like chests? Touch: false In areas.json: I set God-Mode to true. I don't really understand it, but at least it works now. iProtector is a bit glitchy with God-Mode.