Advertisement
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

setRespawnPosition chunk bug

Comments in 'Plugin Development' started by Creeperface, May 18, 2015.

  1. Creeperface
    Offline

    Creeperface Notable Member Plugin Developer

    Joined:
    Nov 8, 2014
    Posts:
    1,346
    Plugins:
    4
    Minecraft User:
    CreeperFace
    i use setRespawnPosition() and when player respawn

    1) server respawn him to specified coordinates but other chunks then the first don´t load

    2) server respawn player somewhere in air and player can´t move or chat.
  2. Sergey_D
    Offline

    Sergey_D Active Member

    Joined:
    Jan 19, 2014
    Posts:
    75
    Minecraft User:
    CLILLZ
    Try load target chunk
  3. EvolSoft
    Offline

    EvolSoft Notable Member Plugin Developer

    Joined:
    Sep 10, 2014
    Posts:
    821
    Plugins:
    15
    Minecraft User:
    Flavius12
    Can you post the code?
  4. Creeperface
    Offline

    Creeperface Notable Member Plugin Developer

    Joined:
    Nov 8, 2014
    Posts:
    1,346
    Plugins:
    4
    Minecraft User:
    CreeperFace
    I know this is not originaly my code.

    PHP:
    public function onPlayerRespawn(PlayerRespawnEvent $event) {
                
    $player $event->getPlayer();
              
                if (
    $event->getPlayer () instanceof Player) {
                    if(
    $this->getPlugIn()->ingame == true){
                if (
    $this->getManager () == null) {
                    
    $this->log " getManager is null!" );
                }                      
                if(
    $this->getPlugIn()->redBed == 0) {
                           
    $redTeamSpawnPos $this->getSetup ()->getGamePos CTFSetup::CTF_GAME_ARENA_POSITION_ENTRY_RED_TEAM );      
                if(isset(
    $this->getPlugIn()->redTeamPlayers[$player->getName()])){
                           
    $event->setRespawnPosition $redTeamSpawnPos );
                            }
            }
              
                if(
    $this->getPlugIn()->blueBed == 0) {
            
    $blueTeamSpawnPos $this->getSetup ()->getGamePos CTFSetup::CTF_GAME_ARENA_POSITION_ENTRY_BLUE_TEAM );
            if(isset(
    $this->getPlugIn()->blueTeamPlayers[$player->getName()])){
                           
    $event->setRespawnPosition $blueTeamSpawnPos );
                            }
                }
                if(
    $this->getPlugIn()->yellowBed == 0) {
            
    $yellowTeamSpawnPos $this->getSetup ()->getGamePos CTFSetup::CTF_GAME_ARENA_POSITION_ENTRY_YELLOW_TEAM );
            if(isset(
    $this->getPlugIn()->yellowTeamPlayers[$player->getName()])){
                           
    $event->setRespawnPosition $yellowTeamSpawnPos );
                            }
                }
                if(
    $this->getPlugIn()->greenBed == 0) {
            
    $greenTeamSpawnPos $this->getSetup ()->getGamePos CTFSetup::CTF_GAME_ARENA_POSITION_ENTRY_GREEN_TEAM );
            if(isset(
    $this->getPlugIn()->greenTeamPlayers[$player->getName()])){
                           
    $event->setRespawnPosition $greenTeamSpawnPos );
                            }
                }
                }
    }
    }
  5. Xenturio
    Offline

    Xenturio Active Member

    Joined:
    Sep 19, 2014
    Posts:
    333
    Minecraft User:
    Xenturio
    i have finish to 90% a bedwars plugin... how do u will go on with the invisible bug if player change nametag?
    or dont u change it?

    (with chunk loading i dont have problems, wich pocketmine version u use? or yml settings?)
    Creeperface likes this.
  6. Creeperface
    Offline

    Creeperface Notable Member Plugin Developer

    Joined:
    Nov 8, 2014
    Posts:
    1,346
    Plugins:
    4
    Minecraft User:
    CreeperFace
    im finishing bedwars right now and i haven´t fixed invisible bug :/ but server teleport players from lobby so they are visible :D and i fix it using something like /vanish in EssentialsPE and so how did you do respawning players?
  7. Creeperface
    Offline

    Creeperface Notable Member Plugin Developer

    Joined:
    Nov 8, 2014
    Posts:
    1,346
    Plugins:
    4
    Minecraft User:
    CreeperFace
    and dropping items overload the server :/
  8. Xenturio
    Offline

    Xenturio Active Member

    Joined:
    Sep 19, 2014
    Posts:
    333
    Minecraft User:
    Xenturio
    i have make a little network so 3 rounds at same time on one server. lobby is a other one...
    i setname tag all the time at the moment so the players are flashing xD

    why do u have so much dropped items?

    a idear is clearlagg... only let the code use the command after round
    Creeperface likes this.
  9. Xenturio
    Offline

    Xenturio Active Member

    Joined:
    Sep 19, 2014
    Posts:
    333
    Minecraft User:
    Xenturio
    i do it like this:
    Code:
                if(!(isset($this->team[$name])))
                {
                    $this->team[$name] = 0;
                }
                if($this->team[$name] == 1)
                {
                    if($this->bett['blau'] == 1)
                    {
                        $posblau = $this->bedwarswelt->get("TeamBlauStartBW");
                        $posb = explode(",", $posblau);
                      
                        $event->setRespawnPosition(new Position($posb[0], $posb[1], $posb[2]));
                    }
                }
    u can see the end product on survivalhive.de port 19133 0.11.0 build 10 (left portal)
    Creeperface likes this.
  10. Creeperface
    Offline

    Creeperface Notable Member Plugin Developer

    Joined:
    Nov 8, 2014
    Posts:
    1,346
    Plugins:
    4
    Minecraft User:
    CreeperFace
    so your code is the same as my. so IDK where is the problem :/
  11. Creeperface
    Offline

    Creeperface Notable Member Plugin Developer

    Joined:
    Nov 8, 2014
    Posts:
    1,346
    Plugins:
    4
    Minecraft User:
    CreeperFace
    and yes i added clear all items after game but if game is running and players don´t take bronze so server is so laggy XD
    Xenturio likes this.
  12. Xenturio
    Offline

    Xenturio Active Member

    Joined:
    Sep 19, 2014
    Posts:
    333
    Minecraft User:
    Xenturio
    ahh xD i do it on an other way - i dont drop the brnze - i give it to the players direcly

    its my own bedwars ^^ so not all is like pc version - i play it never befor xD

    with signs they can change the bronze into silver - the signs stands on other islands - finished xD
    Creeperface likes this.
  13. Creeperface
    Offline

    Creeperface Notable Member Plugin Developer

    Joined:
    Nov 8, 2014
    Posts:
    1,346
    Plugins:
    4
    Minecraft User:
    CreeperFace
    yes so i make it add bronze to chest :D
    Xenturio likes this.
  14. Xenturio
    Offline

    Xenturio Active Member

    Joined:
    Sep 19, 2014
    Posts:
    333
    Minecraft User:
    Xenturio
  15. Creeperface
    Offline

    Creeperface Notable Member Plugin Developer

    Joined:
    Nov 8, 2014
    Posts:
    1,346
    Plugins:
    4
    Minecraft User:
    CreeperFace
    and what about disable PVP?

    my code:
    PHP:
    public function onHurt(EntityDamageEvent $event){
                
    $blueTeamSpawnPos $this->getSetup ()->getGamePos BWSetup::BW_GAME_ARENA_POSITION_ENTRY_BLUE_TEAM );
                
    $redTeamSpawnPos $this->getSetup ()->getGamePos BWSetup::BW_GAME_ARENA_POSITION_ENTRY_RED_TEAM );
                
    $yellowTeamSpawnPos $this->getSetup ()->getGamePos BWSetup::BW_GAME_ARENA_POSITION_ENTRY_YELLOW_TEAM );
                
    $greenTeamSpawnPos $this->getSetup ()->getGamePos BWSetup::BW_GAME_ARENA_POSITION_ENTRY_GREEN_TEAM );
                if(
    $event instanceof EntityDamageByEntityEvent) {
                    
    $attacker $event->getDamager();
                    
    $victim $event->getEntity();
              
                if (
    $event->getEntity() instanceof Player && $event->getDamager() instanceof Player) {
                    if(
    $this->getPlugIn()->ingame == false){
                    
    $event->setCancelled(true);
                }
                     if ( isset(
    $this->getPlugin()->redTeamPlayers[$event->getEntity()->getName()]) && isset($this->getPlugin()->redTeamPlayers[$event->getDamager()->getName()])) {
                         
    $event->setCancelled(true);
                     } elseif( isset(
    $this->getPlugin()->blueTeamPlayers[$event->getEntity()->getName()]) && isset($this->getPlugin()->blueTeamPlayers[$event->getDamager()->getName()])) {
                        
    $event->setCancelled(true);
                    }
                    elseif( isset(
    $this->getPlugin()->yellowTeamPlayers[$event->getEntity()->getName()]) && isset($this->getPlugin()->yellowTeamPlayers[$event->getDamager()->getName()])) {
                        
    $event->setCancelled(true);
                    }
                    elseif( isset(
    $this->getPlugin()->greenTeamPlayers[$event->getEntity()->getName()]) && isset($this->getPlugin()->greenTeamPlayers[$event->getDamager()->getName()])) {
                        
    $event->setCancelled(true);
                    }
                    elseif(isset(
    $this->getPlugin()->lobbyPlayers[$event->getDamager()->getName()])) {
                        
    $event->setCancelled(true);
                    }
    }
    }
    }
    this code doesn´t work . players still can hit each other from their team :/
  16. Xenturio
    Offline

    Xenturio Active Member

    Joined:
    Sep 19, 2014
    Posts:
    333
    Minecraft User:
    Xenturio
    uff xD wtf sry xD thats all by me xD

    Code:
                if($event instanceof EntityDamageByEntityEvent)
                {       
                        if($event->getEntity() instanceof Player && $event->getDamager() instanceof Player)
                        {           
                            if($this->team[strtolower($event->getDamager()->getName())] == $this->team[strtolower($event->getEntity()->getName())])
                            {
                                $event->setCancelled(true);
                                $event->getDamager()->sendMessage(MT::GOLD ."Ihr seid im selben Team!");
                            }
                        }
                }
    Creeperface likes this.
  17. Creeperface
    Offline

    Creeperface Notable Member Plugin Developer

    Joined:
    Nov 8, 2014
    Posts:
    1,346
    Plugins:
    4
    Minecraft User:
    CreeperFace
    mmmmmmm it looks your code is same like my. :/ maybe bad version of pocketmine
  18. Calebuscus21
    Offline

    Calebuscus21 New Member

    Joined:
    Apr 6, 2015
    Posts:
    8
    Minecraft User:
    Calebuscus
    Hey umm... I no this is of topic but do you now how to log into realms
  19. Creeperface
    Offline

    Creeperface Notable Member Plugin Developer

    Joined:
    Nov 8, 2014
    Posts:
    1,346
    Plugins:
    4
    Minecraft User:
    CreeperFace
    realms dont work XD
  20. Calebuscus21
    Offline

    Calebuscus21 New Member

    Joined:
    Apr 6, 2015
    Posts:
    8
    Minecraft User:
    Calebuscus
    For minecraft pocket edition

Share This Page

Advertisement