Fixing some bugs !

This commit is contained in:
Adsooi 2017-03-06 20:01:02 +01:00
parent d6ed965925
commit dcd26a0fbf
No known key found for this signature in database
GPG key ID: 77DA9F4999AE26AC
2 changed files with 7 additions and 6 deletions

View file

@ -26,7 +26,7 @@ use Ad5001\HideAndSeek\GameManager;
class Game extends PluginTask /* Allows easy game running */ implements Listener { class Game extends PluginTask /* Allows easy game running */ implements Listener {
const STEP_WAIT = 0; const STEP_WAIT = 0;
const STEP_STARTING = 1; const STEP_START = 1;
const STEP_HIDE = 2; const STEP_HIDE = 2;
const STEP_SEEK = 3; const STEP_SEEK = 3;
const STEP_WIN = 4; const STEP_WIN = 4;
@ -46,9 +46,9 @@ class Game extends PluginTask /* Allows easy game running */ implements Listener
protected $spectators = []; protected $spectators = [];
// Game based informations // Game based informations
protected $step = self::STEP_WAIT; public $step = self::STEP_WAIT;
protected $win = self::NO_WIN; protected $win = self::NO_WIN;
public $stepTick; protected $stepTick;
protected $hidersLeft; protected $hidersLeft;
protected $seekersCount; protected $seekersCount;
@ -70,7 +70,7 @@ class Game extends PluginTask /* Allows easy game running */ implements Listener
// Loading timer. // Loading timer.
parent::__construct($this->getMain()); parent::__construct($this->getMain());
// $this->getMain()->getServer()->getScheduler()->scheduleRepeatingTask($this, 1); $this->getMain()->getServer()->getScheduler()->scheduleRepeatingTask($this, 1);
} }
/* /*
@ -122,7 +122,7 @@ class Game extends PluginTask /* Allows easy game running */ implements Listener
} }
} }
break; break;
case self:STEP_SEEK: case self::STEP_SEEK:
$tickWaited = $tick - $this->stepTick; $tickWaited = $tick - $this->stepTick;
if($tickWaited % 20*60 == 0) { if($tickWaited % 20*60 == 0) {
foreach(array_merge($this->getPlayers(), $this->getSpectators()) as $p) { foreach(array_merge($this->getPlayers(), $this->getSpectators()) as $p) {
@ -145,7 +145,7 @@ class Game extends PluginTask /* Allows easy game running */ implements Listener
} else { } else {
$p->sendMessage(Main::PREFIX . "§aGame cancelled !"); $p->sendMessage(Main::PREFIX . "§aGame cancelled !");
} }
$p->teleport($this->getLobbyWorld()); $p->teleport($this->getMain()->getLobbyWorld()->getSafeSpawn());
$p->setGamemode($this->getMain()->getServer()->getDefaultGamemode()); $p->setGamemode($this->getMain()->getServer()->getDefaultGamemode());
} }
$this->step = self::STEP_WAIT; $this->step = self::STEP_WAIT;

View file

@ -198,6 +198,7 @@ A
case "stop": case "stop":
if(!is_null($game)) { if(!is_null($game)) {
$sender->sendMessage(self::PREFIX . "§aStoping game...."); $sender->sendMessage(self::PREFIX . "§aStoping game....");
$game->step = Game::STEP_WIN;
return true; return true;
} else { } else {
$sender->sendMessage(self::PREFIX . "§cYou're not in an hide and seek game world."); $sender->sendMessage(self::PREFIX . "§cYou're not in an hide and seek game world.");