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

Plugin Crashes

Comments in 'Plugin Development' started by iFootball, Jun 21, 2014.

  1. swagboy47
    Offline

    swagboy47 Active Member

    Joined:
    Jun 10, 2014
    Posts:
    445
    Minecraft User:
    swagking
    oh. you are using the right plugin . i am sorry :p
    iFootball likes this.
  2. iFootball
    Offline

    iFootball Active Member

    Joined:
    Jun 9, 2014
    Posts:
    84
    Minecraft User:
    iFootball
    Hmmm, my client still crashes when I do any of the plugins initial functions, in any of the worlds. Is it right to use $player like I did in a console run command?
  3. swagboy47
    Offline

    swagboy47 Active Member

    Joined:
    Jun 10, 2014
    Posts:
    445
    Minecraft User:
    swagking
    what commend did crash the server ?
  4. swagboy47
    Offline

    swagboy47 Active Member

    Joined:
    Jun 10, 2014
    Posts:
    445
    Minecraft User:
    swagking
    why don't you use pockethungergames? its awesome
  5. iFootball
    Offline

    iFootball Active Member

    Joined:
    Jun 9, 2014
    Posts:
    84
    Minecraft User:
    iFootball
    It was just /hg
    It doesn't have multiworld support, which is the main reason I don't use it.
  6. swagboy47
    Offline

    swagboy47 Active Member

    Joined:
    Jun 10, 2014
    Posts:
    445
    Minecraft User:
    swagking
    sorry but can't help you now. i am working on A LOT of stuff i am working on enchanting pe and chat shop and herobrine old api and skywars for jon and updating my plugins to the new api and more. i am really really really sorry but i can't help :(
  7. iFootball
    Offline

    iFootball Active Member

    Joined:
    Jun 9, 2014
    Posts:
    84
    Minecraft User:
    iFootball
    You helped me get better then from where I started :D!
    swagboy47 likes this.
  8. swagboy47
    Offline

    swagboy47 Active Member

    Joined:
    Jun 10, 2014
    Posts:
    445
    Minecraft User:
    swagking
    no problem
  9. iFootball
    Offline

    iFootball Active Member

    Joined:
    Jun 9, 2014
    Posts:
    84
    Minecraft User:
    iFootball
    I have changed the if in world function as swagboy suggested but still crashes,
    PHP:
    <?php

    /*
    __Pocketmine Plugin__
    name=HungerGamesAPI
    description=Hunger Games API. Made for TheUnitedBallers
    version=1.01
    author=mclover152 & iFootball
    class=HGAPI
    apiversion=10,11,12
    */

    class HGAPI implements Plugin{
    private 
    $api;

        public function 
    __construct(ServerAPI $api$server false){
            
    $this->api $api;
        }
     
        public function 
    init(){
            
    $this->api->addHandler("HungerGames", array($this"HungerGames"));
            
    $this->api->console->register("hg""starts a match of hunger games", array($this"commandhandler"));
            
    $this->api->console->register("hgadmin""Bypasses hungergames limitations", array($this"commandHandler2"));
            
    $this->api->console->register("hglobby""Resets lobby & game and allows players to go into the game", array($this"commandHandler3"));
            
    $this->api->console->register("hgstop""Stops the HungerGames match", array($this"commandHandler4"));
            
    $this->api->addHandler("player.death", array($this"eventHandler"), 100);
            
    $this->api->addHandler("player.gamemode.change", array($this"eventHandler"), 100);
            
    $this->api->addHandler("player.quit", array($this"eventHandler"), 100);
        }
     
        public function 
    HungerGames($data$event$player){
        switch(
    $event){
          case 
    "HungerGames":
            if(
    $player->entity->level->getname() == "HungerGames"){
                
    $this->api->console->run("t f $player");
                
    $player->sendChat("You have joined this Hunger Games. The match will start soon.");
        }
        break;
        }
        }
     
        public function 
    commandHandler($cmd$data$player){
          switch(
    $cmd){
            case 
    "hg":
                
    $this->api->console->run("t f @all off");
                
    $this->api->console->run("mine reset hglobby1");
                
    $this->api->console->run("mine reset hglobby2");
                
    $this->api->console->run("mine reset hglobby3");
                
    $this->api->console->run("mine reset hglobby4");
                
    $this->api->chat->broadcast("[TheUnitedBallers] The HungerGames match as started!");
                
    $player->sendChat("Let the games begin!");
        }
        break;
        }
        public function 
    commandHandler2($data$player){
          switch(
    $cmd){
            case 
    "hgadmin":
                
    $this->api->console->run("t f $player off");
                
    $this->api->chat->broadcast("[TheUnitedBallers] $player is no longer in the game.");
                
    $player->sendChat("Admin bypass mode on");
        }
        break;
        }
      
        public function 
    commandHandler3($data$player){
                switch(
    $cmd){
            case 
    "hglobby":
                
    $this->api->console->run("hgstop");
                
    $this->api->chat->broadcast("[TheUnitedBallers] You can now enter the HungerGames arena!");
                
    $this->api->console->run("mine reset hglobby11");
                
    $this->api->console->run("mine reset hglobby21");
                
    $this->api->console->run("mine reset hglobby31");
                
    $this->api->console->run("mine reset hglobby41");
             
        }
        break;
        }
      
        public function 
    commandHandler4($data$player){
          switch(
    $cmd){
            case 
    "hgstop":
                if(
    $player->entity->level->getname() == "HungerGames"){
                
    $this->api->console->run("tp $player w:MainSpawn");
                
    $data["player"]->sendChat("The game has been declared a tie. Either the game went on to long or a Administrator has stoped the game");
                
    $this->api->chat->broadcast("[TheUnitedBallers] The HungerGames match has been declared a tie!");
             
        }
        break;
        }
        }
        public function 
    eventHandler($data$event){
        switch(
    $event){
            case 
    'player.death':
                if(
    $player->entity->level->getname() == "HungerGames"){
            
    $data["player"]->sendChat("Thank you for playing HungerGames, you have been killed and eliminated from the game. ");
            
    $this->api->chat->broadcast("[TheUnitedBallers] $player has been eliminated from the HungerGames!");
            
    $this->api->console->run("tp $player w:MainSpawn");
        }
        break;
      
            case 
    'player.gamemode.change':
                if(
    $data['player']->entity->level->getname() === "HungerGames"){
                
    $data['player']->sendChat("NO CHEATING! Players/Staff are not allowed to change gamemode in this world.");
                
    $this->api->console->run("tp $player w:MainSpawn");
        }
    break;
      
            case 
    'player.quit':
                if(
    $data['player']->entity->level->getname() === "HungerGames"){
                
    $this->api->chat->broadcast("[TheUnitedBallers] $player has left HungerGames.");
                
    $this->api->console->run("tp $player w:MainSpawn");
            }
            break;
        }

        }

        public function 
    __destruct(){
        }
        }
      
        
    ?>   ?>>
    When in a command TPing players run by the console, is it $this->api->console->run"tp $player w:MainSpawn" or $this->api->console->run"tp {$data["player"]} w:MainSpawn"?

Share This Page

Advertisement