Fixing bugs.

This commit is contained in:
Ad5001 2016-08-03 12:22:06 +03:00
parent e09914ef19
commit 9974a7da03
3 changed files with 19 additions and 7 deletions

View file

@ -136,10 +136,10 @@ abstract class Game {
public function onBreak(\pocketmine\event\block\BlockBreakEvent $event) {} public function onBreak(\pocketmine\event\block\BlockBreakEvent $event) {}
public function onBlockPlace(\pocketmine\event\entit\block\BlockPlaceEvent $event) {} public function onBlockPlace(\pocketmine\event\block\BlockPlaceEvent $event) {}
public function onPlace(\pocketmine\event\entit\block\BlockPlaceEvent $event) {} public function onPlace(\pocketmine\event\block\BlockPlaceEvent $event) {}
public function onEntityDamage(\pocketmine\event\entity\EntityDamageEvent $event) {} public function onEntityDamage(\pocketmine\event\entity\EntityDamageEvent $event) {}

View file

@ -88,15 +88,15 @@ class GameManager {
public function restoreBackup(Level $level) { public function restoreBackup(Level $level) {
$this->rrmdir($this->server->getFilePath() . "worlds/{$level->getName()}"); $this->rrmdir($level->getFolderName());
$this->copydir($this->server->getFilePath() . "worldsBackups/{$level->getName()}", $this->server->getFilePath() . "worlds/{$level->getName()}"); $this->copydir($this->server->getFilePath() . "worldsBackups/{$level->getName()}", $level->getFolderName());
} }
public function backup(Level $level) { public function backup(Level $level) {
$this->rrmdir($this->server->getFilePath() . "worldsBackups/{$level->getName()}"); $this->rrmdir($this->server->getFilePath() . "worldsBackups/{$level->getName()}");
$this->copydir($this->server->getFilePath() . "worlds/{$level->getName()}", $this->server->getFilePath() . "worldsBackup/{$level->getName()}"); $this->copydir($level->getFolderName(), $this->server->getFilePath() . "worldsBackup/{$level->getName()}");
} }

View file

@ -167,7 +167,7 @@ public function onInteract(PlayerInteractEvent $event) {
} }
public function onBlockBreak(\pocketmine\event\player\PlayerBreakEvent $event) { public function onBlockBreak(\pocketmine\event\block\BlockBreakEvent $event) {
if(isset($this->manager->getLevels()[$event->getPlayer()->getLevel()->getName()])) { if(isset($this->manager->getLevels()[$event->getPlayer()->getLevel()->getName()])) {
$this->manager->getLevels()[$event->getPlayer()->getLevel()->getName()]->onBlockBreak($event); $this->manager->getLevels()[$event->getPlayer()->getLevel()->getName()]->onBlockBreak($event);
$this->manager->getLevels()[$event->getPlayer()->getLevel()->getName()]->onBreak($event); $this->manager->getLevels()[$event->getPlayer()->getLevel()->getName()]->onBreak($event);
@ -175,7 +175,7 @@ public function onInteract(PlayerInteractEvent $event) {
} }
public function onBlockPlace(\pocketmine\event\player\PlayerPlaceEvent $event) { public function onBlockPlace(\pocketmine\event\block\BlockPlaceEvent $event) {
if(isset($this->manager->getLevels()[$event->getPlayer()->getLevel()->getName()])) { if(isset($this->manager->getLevels()[$event->getPlayer()->getLevel()->getName()])) {
$this->manager->getLevels()[$event->getPlayer()->getLevel()->getName()]->onBlockPlace($event); $this->manager->getLevels()[$event->getPlayer()->getLevel()->getName()]->onBlockPlace($event);
$this->manager->getLevels()[$event->getPlayer()->getLevel()->getName()]->onPlace($event); $this->manager->getLevels()[$event->getPlayer()->getLevel()->getName()]->onPlace($event);
@ -209,4 +209,16 @@ public function onInteract(PlayerInteractEvent $event) {
$class->onServerCommand($event); $class->onServerCommand($event);
} }
} }
public function onPlayerJoin(\pocketmine\event\player\PlayerJoinEvent $event) {
if(isset($this->manager->getLevels()[$event->getPlayer()->getLevel()->getName()])) {
$this->manager->getLevels()[$event->getPlayer()->getLevel()->getName()]->onJoin($player);
}
}
public function onPlayerQuit(\pocketmine\event\player\PlayerQuitEvent $event) {
if(isset($this->manager->getLevels()[$event->getPlayer()->getLevel()->getName()])) {
$this->manager->getLevels()[$event->getPlayer()->getLevel()->getName()]->onQuit($player);
}
}
} }