Pocketmine Git client !
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

Main.php 1.4KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. <?php
  2. namespace Ad5001\Gitable;
  3. use pocketmine\command\CommandSender;
  4. use pocketmine\command\Command;
  5. use pocketmine\event\Listener;
  6. use pocketmine\plugin\PluginBase;
  7. use pocketmine\Server;
  8. use pocketmine\utils\Utils;
  9. use pocketmine\Player;
  10. class Main extends PluginBase implements Listener {
  11. protected $git;
  12. public function onEnable() {
  13. $this->getServer()->getPluginManager()->registerEvents($this, $this);
  14. if(Utils::getOS() == "win") {
  15. $this->git = new Windows($this);
  16. } elseif(Utils::getOS() == "linux") {
  17. $this->git = new Linux($this);
  18. } elseif(Utils::getOS() == "mac") {
  19. $this->git = new Mac($this);
  20. }
  21. }
  22. public function onCommand(CommandSender $sender, Command $cmd, $label, array $args){
  23. switch($cmd->getName()){
  24. case 'git':
  25. if(count($args) >= 1) {
  26. if(isset(self::COMMANDS[$args[0]])) {
  27. $cmd = $args[0];
  28. unset($args[0]);
  29. $sender->sendMessage($this->git->{self::COMMANDS[$cmd][0]}(implode(" ", $args)));
  30. }
  31. }
  32. break;
  33. }
  34. return false;
  35. }
  36. public function getGitClient() {
  37. return $this->git;
  38. }
  39. public function setGitClient(GitClient $client) {
  40. $this->git = $client;
  41. return $this->git == $client;
  42. }
  43. }