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

how to fix the error?

Comments in 'Plugin Development' started by BlackJIeBPlayer, Jun 27, 2015.

  1. BlackJIeBPlayer
    Offline

    BlackJIeBPlayer New Member

    Joined:
    May 19, 2015
    Posts:
    18
    Minecraft User:
    BlackJIeB
    The idea of a plug-in that began after the issuance of a timer , after which the player could take over the whale . However , something went wrong :(

    Errror:
    Code:
    2015-06-27 [17:20:16] [Server thread / NOTICE]: Information Player "___julia___" is not found, creates a new profile
    2015-06-27 [17:20:16] [Server thread / INFO]: ___ JULIA ___ [/ 81.177.127.62:26013] entered with id entity 240 (world, -23, 77 , 139 )
    2015-06-27 [17:20:16] [Server thread / CRITICAL]: Could not execute task pocketmine \ scheduler \ CallbackTask: Undefined index: ___JULIA___
    2015-06-27 [17:20:16] [Server thread / NOTICE]: ArrayOutOfBoundsException: "Undefined index: ___JULIA___" (E_NOTICE) in "/ UltraKit / src / BlackJIeB / UltraKit" at line 60
    Code:

    PHP:
    public function onEnable(){
    $this->getServer()->getPluginManager()->registerEvents($this$this);
    $this->particles[] = new FloatingTextParticle(new Vector3(-47.474.7131.6), ""TextFormat::GOLD TextFormat::BOLD "- Kit Start -" TextFormat::RESET "\n"TextFormat::WHITE ."   tap to give");
    $this->particles[] = new FloatingTextParticle(new Vector3(-44.674.7129.6), ""TextFormat::GOLD TextFormat::BOLD "- Kit Vip -" TextFormat::RESET "\n"TextFormat::WHITE ." tap to give");
    $this->particles[] = new FloatingTextParticle(new Vector3(-41.574.7128.5), ""TextFormat::GOLD TextFormat::BOLD "- Kit Premium -" TextFormat::RESET "\n"TextFormat::WHITE ."     tap to give");
      
    $this->getServer()->getScheduler()->scheduleRepeatingTask(new CallbackTask(array($this,"schedule")),20);
             @
    mkdir($this->getDataFolder());
            @
    mkdir($this->getDataFolder() . "data/");
    }

         public function 
    schedule(){
         foreach(
    $this->getServer()->getOnlinePlayers() as $p){
         
    $this->playTimer[$p->getPlayer()->getName()] = $this->playTimer[$p->getPlayer()->getName()] + 1;
         if(
    $this->playTimer[$p->getPlayer()->getName()] == 1200){
         
    $this->giveKit[$p->getPlayer()->getName()] = 1;
         }
             if(
    $this->playTimer[$p->getPlayer()->getName()] == 1500){
         
    $this->playTimer[$p->getPlayer()->getName()] = 1200;
         }
         }
         }

    public function 
    onPlayerJoin(PlayerJoinEvent $event){
      foreach(
    $this->particles as $particle){
       
    $event->getPlayer()->getLevel()->addParticle($particle, [$event->getPlayer()]);
      }
      
    $player $event->getPlayer();
                  if(
    file_exists($this->getDataFolder() . "data/" strtolower($player->getName() . ".dat"))){
                                           
    $this->playTimer[$event->getPlayer()->getName()] = 0;
         
    $this->giveKit[$event->getPlayer()->getName()] = 0;
            } else {
                       
    $cfg = new Config($this->getDataFolder() . "data/" strtolower($player->getName() . ".dat"));
            
    $cfg->save();
            @
    mkdir($this->getDataFolder() . "data/" $player->getName() . ".dat");
            
    $this->playTimer[$event->getPlayer()->getName()] = 0;
         
    $this->giveKit[$event->getPlayer()->getName()] = 1;
            }
    }
  2. CraftYourBukkit
    Offline

    CraftYourBukkit Notable Member Plugin Developer

    Joined:
    Jan 20, 2015
    Posts:
    1,022
    Plugins:
    2
    Minecraft User:
    CraftYourBukkit
    Which one is line 60?
    Svile likes this.
  3. BlackJIeBPlayer
    Offline

    BlackJIeBPlayer New Member

    Joined:
    May 19, 2015
    Posts:
    18
    Minecraft User:
    BlackJIeB
    Code:
         $this->playTimer[$p->getPlayer()->getName()] = $this->playTimer[$p->getPlayer()->getName()] + 1;
  4. CraftYourBukkit
    Offline

    CraftYourBukkit Notable Member Plugin Developer

    Joined:
    Jan 20, 2015
    Posts:
    1,022
    Plugins:
    2
    Minecraft User:
    CraftYourBukkit
    The Player is not set in the array
  5. Svile
    Offline

    Svile Active Member

    Joined:
    Mar 30, 2015
    Posts:
    239
    Minecraft User:
    svile
    Should is :
    PHP:
    $this->playTimer[$p->getName()]++;
  6. BlackJIeBPlayer
    Offline

    BlackJIeBPlayer New Member

    Joined:
    May 19, 2015
    Posts:
    18
    Minecraft User:
    BlackJIeB
    do not tell , for some reason the player is not registered in an array ? because it is listed in onJoin
  7. Svile
    Offline

    Svile Active Member

    Joined:
    Mar 30, 2015
    Posts:
    239
    Minecraft User:
    svile
    onJoin() is executed after so the player name doesn' t exist in the array
  8. BlackJIeBPlayer
    Offline

    BlackJIeBPlayer New Member

    Joined:
    May 19, 2015
    Posts:
    18
    Minecraft User:
    BlackJIeB
    You can detail?
  9. Svile
    Offline

    Svile Active Member

    Joined:
    Mar 30, 2015
    Posts:
    239
    Minecraft User:
    svile
  10. Svile
    Offline

    Svile Active Member

    Joined:
    Mar 30, 2015
    Posts:
    239
    Minecraft User:
    svile
    And try to use in_array();
  11. BlackJIeBPlayer
    Offline

    BlackJIeBPlayer New Member

    Joined:
    May 19, 2015
    Posts:
    18
    Minecraft User:
    BlackJIeB
    Frankly , it's not very helpful .
  12. Svile
    Offline

    Svile Active Member

    Joined:
    Mar 30, 2015
    Posts:
    239
    Minecraft User:
    svile

Share This Page

Advertisement