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

Help with my plugin

Comments in 'Plugin Development' started by minecraft090, Apr 21, 2015.

  1. minecraft090
    Offline

    minecraft090 New Member

    Joined:
    Oct 31, 2014
    Posts:
    9
    Minecraft User:
    minecraft090
    I need if game not start, player cant destroy blocks and run

    public function onRun($currentTick) {
    // $this->log ( "starting skywars game countdown timer " );
    if ($this->plugin->countDownCounter>0) {
    $this->plugin->countDownCounter --;
    }
    if ($this->plugin->countDownCounter != null && $this->plugin->countDownCounter > 0) {
    $message = 'Skywars play starting in ' . $this->plugin->countDownCounter . ' minute(s) ';
    $this->plugin->getServer ()->broadcastMessage ( $message );
    } else {
    // handle case only one player join the game
    if ($this->plugin->gamemode == 1) {
    if (count ( $this->plugin->skywarsPlayersWithShell ) == 1) {
    $this->plugin->gamemode = 0;
    $builder = new BlockBuilder ( $this->plugin );
    $cmd = new SkyWarsCommand ( $this->plugin );
    foreach ( $this->plugin->skyplayers as $player ) {
    $pos = $this->plugin->skywarsPlayersWithShell [$player->getName ()];
    $builder->removeShell ( $player->level, 4, $pos->x, $pos->y, $pos->z );
    $cmd->gotolobby ( $player );
    }
    $this->plugin->getServer ()->broadcastMessage ( "---------------------------------" );
    $this->plugin->getServer ()->broadcastMessage ( "Not enough players join Skywars, please start over!" );
    $this->plugin->getServer ()->broadcastMessage ( "---------------------------------" );
    }
    }

    // more playes
    if ($this->plugin->gamemode == 1) {
    if (count ( $this->plugin->skywarsPlayersWithShell ) > 1) {
    $this->plugin->getServer ()->broadcastMessage ( "Skywars started!" );
    $this->plugin->countDownCounter=0;
    // remove timer
    $this->plugin->startPlayTime = null;
    // update game mode
    $this->plugin->gamemode = 2;
    // remove player shell and start the game
    $builder = new BlockBuilder ( $this->plugin );
    foreach ( $this->plugin->skyplayers as $player ) {
    if (isset ( $this->plugin->skywarsPlayersWithShell [$player->getName ()] )) {
    $pos = $this->plugin->skywarsPlayersWithShell [$player->getName ()];
    $builder->removeShell ( $player->level, 4, $pos->x, $pos->y+10, $pos->z );
    $this->log ( TextFormat::RED . 'players :' . $player->getName () );
    // equip player
    ArenaKit::getSkywarKit ( $player );
    unset ( $this->plugin->skywarsPlayersWithShell [$player->getName ()] );
    // change player gamemode to speculator
    // $player->setGamemode ( 0 );
    }
    }
    $this->plugin->getServer ()->broadcastMessage ( "Go!" );
    }
    }
    }
    }
    public function log($message) {
    $this->plugin->getLogger ()->info ( $message );
    }
    }
  2. minecraft090
    Offline

    minecraft090 New Member

    Joined:
    Oct 31, 2014
    Posts:
    9
    Minecraft User:
    minecraft090
    P.S. send correct code.
  3. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,306
    Plugins:
    11
    Minecraft User:
    PEMapModder
    Can you edit your main post to use [php][/php] and proper indenting?
    EvolSoft and Jon like this.

Share This Page

Advertisement