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

Disable Menu

Discussion in 'Development' started by freakingdev, Apr 3, 2017.

  1. freakingdev

    freakingdev Spider Jockey

    Messages:
    33
    GitHub:
    imjayl
    How to disable menu? When died in pvp
     
  2. EdwardHamHam

    EdwardHamHam Skeleton

    Messages:
    962
    GitHub:
    edwardhamham
    You mean the one where it asks you if you want to respawn, or quit?
     
  3. Sandertv

    Sandertv Zombie Pigman Poggit Reviewer

    Messages:
    786
    GitHub:
    Sandertv
    I think what you could do is make a listener for PlayerQuitEvent, then check if($player->spawned) {}
     
  4. Aviv

    Aviv Baby Zombie

    Messages:
    156
    PHP:
    public function onDamageDeath(EntityDamgeEvent $event){
      if((
    $player $event->getEntity()) instanceof Player && $event->getFinalDamage() - $player->getHealth() <= 0){
        
    $player->teleport($this->getServer()->getDefaultLevel()->getSpawnLocation());
      }
    }
     
  5. Aviv

    Aviv Baby Zombie

    Messages:
    156
    oh and dont forget to remove items and experience
    EDIT:
    PHP:
    public function onDamageDeath(EntityDamgeEvent $event){
      if((
    $player $event->getEntity()) instanceof Player && $event->getFinalDamage() - $player->getHealth() <= 0){
        
    $player->teleport($this->getServer()->getDefaultLevel()->getSpawnLocation());
        
    $player->getInventory()->setContents([]);
        
    // i belive there is no exp system with api in pocketmine
      
    }
    }
     
  6. Aviv

    Aviv Baby Zombie

    Messages:
    156
    wait when i tried cancelling death event the respawn screen still appeared o_O
     
  7. Aviv

    Aviv Baby Zombie

    Messages:
    156
    i used pocketmine, i tested a few monthes ago, lemme test again
     
  8. Sandertv

    Sandertv Zombie Pigman Poggit Reviewer

    Messages:
    786
    GitHub:
    Sandertv
    My bad, my idea won't work, as PlayerQuitEvent isn't cancellable (neither is EntityDeathEvent). It's still quite a bad idea to make the EntityDeathEvent never appear, but it actually seems like that's the only way. (?) This'll be annoying for other plugins that use EntityDeathEvent though.
     
  9. corytortoise

    corytortoise Skeleton

    Messages:
    825
    GitHub:
    corytortoise
    This has been answered here.
    Correction: here is a better method.
     
  10. freakingdev

    freakingdev Spider Jockey

    Messages:
    33
    GitHub:
    imjayl
    Yes! Is it possible to disable the Menu/Quit button?

     
  11. freakingdev

    freakingdev Spider Jockey

    Messages:
    33
    GitHub:
    imjayl
    It's a auto respawn? Not disabling the Menu/Quit button


     
  12. Thunder33345

    Thunder33345 Moderator Staff Member

    Messages:
    2,137
    GitHub:
    Thunder33345
    you cant disable the pause menu i think
     
  13. freakingdev

    freakingdev Spider Jockey

    Messages:
    33
    GitHub:
    imjayl
  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.