some fixes....

This commit is contained in:
Ad5001 2016-08-18 08:39:28 +03:00
parent 343275eb74
commit 93003a2da6

View file

@ -30,7 +30,7 @@ class TNTRun extends Game {
if(!file_exists($this->getDataFolder() . "/config.yml")) { if(!file_exists($this->getDataFolder() . "/config.yml")) {
file_put_contents($this->getDataFolder()."/config.yml", $text); file_put_contents($this->getDataFolder()."/config.yml", $text);
} }
if($this->getConfig()->get($this->getLevel()->getName()) == null) { if(!is_array($this->getConfig()->get($this->getLevel()->getName()))) {
$this->getConfig()->set($this->getLevel()->getName(), ["minplayers" => 2, "maxplayers" => 8, "center" =>[0, 0], "TNTBlock" => 13, "WinCommand" => "give {winner} diamond"]); $this->getConfig()->set($this->getLevel()->getName(), ["minplayers" => 2, "maxplayers" => 8, "center" =>[0, 0], "TNTBlock" => 13, "WinCommand" => "give {winner} diamond"]);
} }
$this->doubleJump = []; $this->doubleJump = [];
@ -229,7 +229,7 @@ class TNTRun extends Game {
public function onBreak(\pocketmine\event\block\BlockBreakEvent $event) { public function onBreak(\pocketmine\event\block\BlockBreakEvent $event) {
$event->setCancelled(); $event->setCancelled();
if($event->getPlayer()->isOp() and $player->isCreative() and !$this->isStarted()) { if($event->getPlayer()->isOp() and $event->getPlayer()->isCreative() and !$this->isStarted()) {
$event->setCancelled(false); $event->setCancelled(false);
} }
} }
@ -249,7 +249,8 @@ class TNTRun extends Game {
case "start": case "start":
if(isset($this->gm->getLevels()[$sender->getLevel()->getName()])) { if(isset($this->gm->getLevels()[$sender->getLevel()->getName()])) {
if(!$this->gm->getLevels()[$sender->getLevel()->getName()]->isStarted() and $this->gm->getLevels()[$sender->getLevel()->getName()]->getName() == "TNTRun") { if(!$this->gm->getLevels()[$sender->getLevel()->getName()]->isStarted() and $this->gm->getLevels()[$sender->getLevel()->getName()]->getName() == "TNTRun") {
$this->start(); $h = $this->getServer()->getScheduler()->scheduleRepeatingTask($t = new TNTRunStartTask($this), 20);
$t->setHandler($h);
} }
} }
break; break;