1. The forums will be archived and moved to a read only mode in about 2 weeks (mid march).

How to disable flying in survival?

Discussion in 'Help' started by Rocco Germani, Jun 2, 2020.

  1. Rocco Germani

    Rocco Germani Spider

    Messages:
    6
    Hey everyone, I've encountered an issue with my server, my players that are in survival are able to fly. I have no idea if this is due to a plugin allowing it or something in the server files. How do I change this?
     
  2. NutXzG

    NutXzG Baby Zombie

    Messages:
    132
    GitHub:
    NutXzG
    I think can it work
    PHP:
    use pocketmine\event\player\PlayerMoveEvent;

    public function 
    onMove(PlayerMoveEvent $ev){
      
    $p $ev->getPlayer();
    if(
    $p->getGamemode() === 0){
     
    $p->setAllowFight(false);
    }
    }
     
  3. Rocco Germani

    Rocco Germani Spider

    Messages:
    6
    Alright cool, but where do I put this? In a file?
     
  4. NutXzG

    NutXzG Baby Zombie

    Messages:
    132
    GitHub:
    NutXzG
    PHP:
    <?php

    namespace Yournamespace;

    use 
    pocketmine\plugin\PluginBase;
    use 
    pocketmine\event\Listener;
    use 
    pocketmine\evenr\player\PlayerMoveEvent;
    use 
    pocketmine\Player;
    use 
    pocketmine\Server
    class YourClass extends PluginBase implements Listener{
          public function 
    onEnable (){
          
    $this->getServer()->getPluginManager()->registerEvents($this$this);
        }
    public  function 
    onMove(PlayerMoveEvent $ev){
      
    $p $ev->getPlayer();
    if(
    $p->getGamemode() === 0){
     
    $p->setAllowFight(false);
        }
      }
    }
     
  5. Diduhless

    Diduhless Baby Zombie

    Messages:
    199
    GitHub:
    Diduhless
    Dude, he's not a programmer don't you see it's the Help thread? Also what does your answer have to do with what he asked? You're just giving useless code.

    There is probably a plugin allowing them to. Check running the server without any plugins and see what happens.
     
  6. Rocco Germani

    Rocco Germani Spider

    Messages:
    6
    Alright I will try that. Thanks for the advice
     
  7. Rocco Germani

    Rocco Germani Spider

    Messages:
    6
    Ok so I went through all my plugins, removing them and putting them back in and seeing if they allowed it and the one that did it is Festival. I had plans to use that plugin to build out PVP zones and non PVP zones but I'm not going to use it until they fix this flying in survival issue.
     
    Diduhless likes this.
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.