Fixing bugs.
This commit is contained in:
parent
e09914ef19
commit
9974a7da03
3 changed files with 19 additions and 7 deletions
|
@ -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) {}
|
||||||
|
|
|
@ -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()}");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -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);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
Loading…
Reference in a new issue