PHP: public function onInteract(PlayerInteractEvent $e): void{$block = $e->getBlock();//if player is not in claim faction doif($block instanceof Fence){ //idk if it’s fence sorry if file name is wrong go check$e->setCancelled();}}
So, you already have a faction plugin installed, right? Downloaded or self-made? If self made, some code could help. If downloaded a link would be great
In the FactionListener file https://github.com/Distoxicqted/FactionsPro/blob/master/src/FactionsPro/FactionListener.php you need to add a function like: Code: public function onInteract(PlayerInteractEvent $e ): void{ $block = $e->getBlock(); //if player is not in claim faction do if($this->plugin->inOwnPlot($e->getPlayer())) return; //allow opening it if($block instanceof FenceGate){ $e->setCancelled(); } }
Hmm, it could be that it can be opened if not standing exactly inside the claim.. sadly i can not debug it right now sorry
PHP: public function onInteract(PlayerInteractEvent $e) : void{ $block = $e->getBlock(); //if player is not in claim faction do if($this->plugin->inOwnPlot($e->getPlayer())) return; //allow opening it if($block instanceof \pocketmine\block\FenceGate){ $e->setCancelled(); } } Instanceof does not work correctly with not imported classes.