onDeath InternalSE

Discussion in 'Plugin Help' started by Pqoster, Mar 16, 2021.

  1. Pqoster

    Pqoster Spider Jockey

    Messages:
    28
    PHP:
        public function onDeath(PlayerDeathEvent $event): void {

            
    $p $event->getPlayer();

            
    $playerHandler PracticeCore::getPlayerHandler();

            
    $level $p->getLevel();

            
    $duelHandler PracticeCore::getDuelHandler();

            if(
    $playerHandler->isPlayerOnline($p)) {

                
    $player $playerHandler->getPlayer($p);

                if(
    $player->isFishing()) $player->stopFishing(false);

                
    $lastDamageCause $p->getLastDamageCause();
                
    $addToStats $player->isInArena() and ($player->getCurrentArenaType() === PracticeArena::FFA_ARENA);

                
    $diedFairly true;

                if(
    $lastDamageCause != null) {

                    if (
    $lastDamageCause->getCause() === EntityDamageEvent::CAUSE_VOID) {
                        
    $diedFairly false;
                        
    //if($player->isInDuel())
                    
    } elseif ($lastDamageCause->getCause() === EntityDamageEvent::CAUSE_SUICIDE) {
                        
    $diedFairly false;
                    } elseif (
    $lastDamageCause->getCause() === EntityDamageEvent::CAUSE_SUFFOCATION) {
                        if (
    $p->isInsideOfSolid()) {
                            
    $pos $p->getPosition();
                            
    $block $level->getBlock($pos);
                            if (
    PracticeUtil::isGravityBlock($block))
                                
    $diedFairly false;
                        }
                    }
                }

                if(
    $addToStats === true) {

                    if(
    $diedFairly === true) {

                        if(
    $lastDamageCause instanceof EntityDamageByEntityEvent) {

                            
    $damgr $lastDamageCause->getDamager();

                            if(
    $playerHandler->isPlayerOnline($damgr)) {

                                
    $attacker $playerHandler->getPlayer($damgr);

                                
    $p $attacker->getPlayer();

                                if(!
    $attacker->equals($player)) {

                                    
    $arena $attacker->getCurrentArena();

                                    if(
    $arena->doesHaveKit()) {
                                        
    $event->setDrops([]);
                                        
    $kit $arena->getFirstKit();
                                        
    $kit->giveTo($p);
                                    }

                                    
    $p->setHealth($p->getMaxHealth());

                                    
    $kills $playerHandler->addKillFor($attacker->getPlayerName());
                                    
    $killsStr PracticeUtil::str_replace(PracticeUtil::getName('scoreboard.arena-ffa.kills'), ['%num%' => $kills]);
                                    
    $attacker->updateLineOfScoreboard(4' ' $killsStr);
                                }
                            }
                        }
                        
    $playerHandler->addDeathFor($player->getPlayerName());
                        
    //$player->updateScoreboard();
                    
    }
                } else {

                    if(
    $player->isInDuel()) {

                        
    $duel $duelHandler->getDuel($p);

                        
    $msg $event->getDeathMessage();

                        
    $winner = ($duel->isPlayer($p) ? $duel->getOpponent()->getPlayerName() : $duel->getPlayer()->getPlayerName());
                        
    $loser $p->getName();

                        
    $randMsg PracticeUtil::getRandomDeathMsg($winner$loser);

                        
    $msg = (!is_null($randMsg)) ? $randMsg $msg;

                        
    $duel->broadcastMsg($msgtrue);

                        if(
    $diedFairly === true)
                            
    $duel->setResults($winner$loser);
                        else 
    $duel->setResults();

                        
    $event->setDrops([]);

                        
    $event->setDeathMessage('');
                    }
                }
            }
        }
    ERROR:

    PHP:
    [23:36:31] [Server thread/CRITICAL]: #0 pmsrc/src/pocketmine/plugin/MethodEventExecutor(42): old\practice\PracticeListener->onDeath(object pocketmine\event\player\PlayerDeathEvent)

    [23:36:31] [Server thread/CRITICAL]: #1 pmsrc/src/pocketmine/plugin/RegisteredListener(80): pocketmine\plugin\MethodEventExecutor->execute(object old\practice\PracticeListener, object pocketmine\event\player\PlayerDeathEvent)

    [23:36:31] [Server thread/CRITICAL]: #2 pmsrc/src/pocketmine/event/Event(88): pocketmine\plugin\RegisteredListener->callEvent(object pocketmine\event\player\PlayerDeathEvent)

    [23:36:31] [Server thread/CRITICAL]: #3 pmsrc/src/pocketmine/Player(3833): pocketmine\event\Event->call()

    [23:36:31] [Server thread/CRITICAL]: #4 pmsrc/src/pocketmine/entity/Living(612): pocketmine\Player->onDeath()

    [23:36:31] [Server thread/CRITICAL]: #5 pmsrc/src/pocketmine/Player(3822): pocketmine\entity\Living->kill()

    [23:36:31] [Server thread/CRITICAL]: #6 pmsrc/src/pocketmine/entity/Entity(982): pocketmine\Player->kill()

    [23:36:31] [Server thread/CRITICAL]: #7 pmsrc/src/pocketmine/entity/Living(145): pocketmine\entity\Entity->setHealth(double -0.3531033776295)

    [23:36:31] [Server thread/CRITICAL]: #8 pmsrc/src/pocketmine/entity/Entity(939): pocketmine\entity\Living->setHealth(double -0.3531033776295)

    [23:36:31] [Server thread/CRITICAL]: #9 pmsrc/src/pocketmine/entity/Living(552): pocketmine\entity\Entity->attack(object pocketmine\event\entity\EntityDamageByEntityEvent)

    [23:36:31] [Server thread/CRITICAL]: #10 pmsrc/src/pocketmine/Player(3919): pocketmine\entity\Living->attack(object pocketmine\event\entity\EntityDamageByEntityEvent)

    [23:36:31] [Server thread/CRITICAL]: #11 plugins/KnockbackCore_v2.0.2/src/jkorn/pvpcore/player/PvPCPlayer(137): pocketmine\Player->attack(object pocketmine\event\entity\EntityDamageByEntityEvent)

    [23:36:31] [Server thread/CRITICAL]: #12 pmsrc/src/pocketmine/Player(2725): jkorn\pvpcore\player\PvPCPlayer->attack(object pocketmine\event\entity\EntityDamageByEntityEvent)

    [23:36:31] [Server thread/CRITICAL]: #13 pmsrc/src/pocketmine/network/mcpe/PlayerNetworkSessionAdapter(149): pocketmine\Player->handleInventoryTransaction(object pocketmine\network\mcpe\protocol\InventoryTransactionPacket)

    [23:36:31] [Server thread/CRITICAL]: #14 pmsrc/src/pocketmine/network/mcpe/protocol/InventoryTransactionPacket(173): pocketmine\network\mcpe\PlayerNetworkSessionAdapter->handleInventoryTransaction(object pocketmine\network\mcpe\protocol\InventoryTransactionPacket)

    [23:36:31] [Server thread/CRITICAL]: #15 pmsrc/src/pocketmine/network/mcpe/PlayerNetworkSessionAdapter(109): pocketmine\network\mcpe\protocol\InventoryTransactionPacket->handle(object pocketmine\network\mcpe\PlayerNetworkSessionAdapter)

    [23:36:31] [Server thread/CRITICAL]: #16 pmsrc/src/pocketmine/network/mcpe/protocol/BatchPacket(130): pocketmine\network\mcpe\PlayerNetworkSessionAdapter->handleDataPacket(object pocketmine\network\mcpe\protocol\InventoryTransactionPacket)

    [23:36:31] [Server thread/CRITICAL]: #17 pmsrc/src/pocketmine/network/mcpe/PlayerNetworkSessionAdapter(109): pocketmine\network\mcpe\protocol\BatchPacket->handle(object pocketmine\network\mcpe\PlayerNetworkSessionAdapter)

    [23:36:31] [Server thread/CRITICAL]: #18 pmsrc/src/pocketmine/Player(3299): pocketmine\network\mcpe\PlayerNetworkSessionAdapter->handleDataPacket(object pocketmine\network\mcpe\protocol\BatchPacket)

    [23:36:31] [Server thread/CRITICAL]: #19 pmsrc/src/pocketmine/network/mcpe/RakLibInterface(169): pocketmine\Player->handleDataPacket(object pocketmine\network\mcpe\protocol\BatchPacket)

    [23:36:31] [Server thread/CRITICAL]: #20 pmsrc/vendor/pocketmine/raklib/src/server/ServerHandler(95): pocketmine\network\mcpe\RakLibInterface->handleEncapsulated(string[19] 45.166.154.204 9420, object raklib\protocol\EncapsulatedPacket, integer 0)

    [23:36:31] [Server thread/CRITICAL]: #21 pmsrc/src/pocketmine/network/mcpe/RakLibInterface(109): raklib\server\ServerHandler->handlePacket()

    [23:36:31] [Server thread/CRITICAL]: #22 pmsrc/src/pocketmine/network/mcpe/RakLibInterface(99): pocketmine\network\mcpe\RakLibInterface->process()

    [23:36:31] [Server thread/CRITICAL]: #23 pmsrc/vendor/pocketmine/snooze/src/SleeperHandler(113): pocketmine\network\mcpe\RakLibInterface->pocketmine\network\mcpe\{closure}()

    [23:36:31] [Server thread/CRITICAL]: #24 pmsrc/vendor/pocketmine/snooze/src/SleeperHandler(75): pocketmine\snooze\SleeperHandler->processNotifications()

    [23:36:31] [Server thread/CRITICAL]: #25 pmsrc/src/pocketmine/Server(2155): pocketmine\snooze\SleeperHandler->sleepUntil(double 1615937791.0972)

    [23:36:31] [Server thread/CRITICAL]: #26 pmsrc/src/pocketmine/Server(1992): pocketmine\Server->tickProcessor()

    [23:36:31] [Server thread/CRITICAL]: #27 pmsrc/src/pocketmine/Server(1586): pocketmine\Server->start()

    [23:36:31] [Server thread/CRITICAL]: #28 pmsrc/src/pocketmine/PocketMine(291): pocketmine\Server->__construct(object BaseClassLoader, object pocketmine\utils\MainLogger, string[15] /home/gs-40507/, string[23] /home/gs-40507/plugins/)

    [23:36:31] [Server thread/CRITICAL]: #29 pmsrc/src/pocketmine/PocketMine(321): pocketmine\server()

    [23:36:31] [Server thread/CRITICAL]: #30 pmsrc(11): require(string[96] phar:///pro/bin/mcpe/pocketmine-stable-1.16.210/PocketMine-MP.phar/src/pocketmin)
     
  2. mmm545

    mmm545 Baby Zombie

    Messages:
    154
    GitHub:
    mmm545
    you just sent the stack trace, not the error itself
     
    IvanCraft623, Pqoster and minijaham like this.
  3. Pqoster

    Pqoster Spider Jockey

    Messages:
    28
    Sorry. basically when i kill (he doesn’t die he gets 1hp) in the duel I disconnect for internal server error duel and the duel doesn’t end
     
  4. mmm545

    mmm545 Baby Zombie

    Messages:
    154
    GitHub:
    mmm545
    send the whole red wall of text on the console...
     

Share This Page

  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.