├── .gitignore ├── README.md ├── plugin.yml └── src └── MiniGamesTree ├── API └── game.php ├── Event.php ├── GameEvent └── Team │ └── TeamDamageEvent.php ├── Listnerr └── Eventt.php ├── Score ├── PlayerScore.php └── TeamScore.php ├── Singles.php ├── Status.php ├── Team.php ├── Time.php ├── arena └── RegArena.php └── extendss └── info.php /.gitignore: -------------------------------------------------------------------------------- 1 | # Object files 2 | *.o 3 | *.ko 4 | *.obj 5 | *.elf 6 | 7 | # Precompiled Headers 8 | *.gch 9 | *.pch 10 | 11 | # Libraries 12 | *.lib 13 | *.a 14 | *.la 15 | *.lo 16 | 17 | # Shared objects (inc. Windows DLLs) 18 | *.dll 19 | *.so 20 | *.so.* 21 | *.dylib 22 | 23 | # Executables 24 | *.exe 25 | *.out 26 | *.app 27 | *.i*86 28 | *.x86_64 29 | *.hex 30 | 31 | # Debug files 32 | *.dSYM/ 33 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # MiniGamesAPI 2 | MiniGamesAPI IN MCPE 3 | ------------------------ 4 | By @Nawaf_Craft1b 5 | --------------------- 6 | What Can I Make With This API ! 7 | 8 | 1 - GunGame 9 | 10 | 2 - LuckyWars 11 | 12 | 3 - SG 13 | 14 | 4 - SkyWars 15 | 16 | And More 17 | || This API Will be updated soon || 18 | -------------------------------------------------------------------------------- /plugin.yml: -------------------------------------------------------------------------------- 1 | name: MiniGames-API 2 | main: MiniGamesTree\Time 3 | version: 2.0.0 4 | author: Nawaf_Craft1b 5 | api: [3.0.0-Alpha12] 6 | -------------------------------------------------------------------------------- /src/MiniGamesTree/API/game.php: -------------------------------------------------------------------------------- 1 | main = $a; 11 | } 12 | 13 | public function onDamage(Damage $event){ 14 | 15 | $b = 0; 16 | 17 | if ($event instanceof EntityDamageByEntityEvent) { 18 | 19 | if ($event->getEntity() instanceof Player) { 20 | 21 | if( $this->main->api->tst()->getTeam("",$event->getEntity()->getName())->getTeam() 22 | == $this->main->api->tst()->getTeam("",$event->getDamager()->getName())->getTeam() ) { 23 | 24 | if( $b == ( 0 ) ){ 25 | 26 | $event->setCancelled(true); 27 | 28 | } 29 | } 30 | $this->main->getServer()->getPluginManager()->callEvent(new MiniGamesTree\GameEvent\Team\TeamDamageEvent($event->getEntity(), $event->getDamager(), $b , $this->main->api->getGame()->getTeam("",$event->getDamager()->getName())->getTeam() , $this->main->api->getGame()->getTeam("",$event->getEntity()->getName())->getTeam())); 31 | }}} 32 | 33 | } 34 | -------------------------------------------------------------------------------- /src/MiniGamesTree/GameEvent/Team/TeamDamageEvent.php: -------------------------------------------------------------------------------- 1 | player = $player; 18 | $this->damager = $dm; 19 | $this->bool = $bool; 20 | $this->tdn = $tdn; 21 | $this->tpn = $tpn; 22 | } 23 | 24 | public function getEntity(){ 25 | return $this->player; 26 | } 27 | 28 | public function getDamager(){ 29 | return $this->damager; 30 | } 31 | 32 | public function setDamageEnabled($bool = true) { 33 | if( $bool == true ) { 34 | $this->bool = 0; 35 | } else { 36 | $this->bool = 1; 37 | } 38 | } 39 | 40 | public function getDamagerTeam(){ 41 | return $this->tdn; 42 | } 43 | 44 | public function getEntityTeam(){ 45 | return $this->tpn; 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /src/MiniGamesTree/Listnerr/Eventt.php: -------------------------------------------------------------------------------- 1 | main = $a; 15 | } 16 | 17 | public function onDamage(Damage $event){ 18 | 19 | $b = 0; 20 | 21 | if ($event instanceof EntityDamageByEntityEvent) { 22 | 23 | if ($event->getEntity() instanceof Player) { 24 | 25 | if( $this->main->api->getGame()->getTeam("",$event->getEntity()->getName())->getTeam() == $this->main->api->getGame()->getTeam("",$event->getDamager()->getName())->getTeam() ) { 26 | 27 | if( $b == ( 0 ) ){ 28 | 29 | $event->setCancelled(true); 30 | 31 | } 32 | 33 | $this->main->getServer()->getPluginManager()->callEvent(new \MiniGamesTree\GameEvent\Team\TeamDamageEvent($event->getEntity(), $event->getDamager(), $b , $this->main->api->getGame()->getTeam("",$event->getDamager()->getName())->getTeam() , $this->main->api->getGame()->getTeam("",$event->getEntity()->getName())->getTeam())); 34 | 35 | }}}}} 36 | -------------------------------------------------------------------------------- /src/MiniGamesTree/Score/PlayerScore.php: -------------------------------------------------------------------------------- 1 | is($this->usn)){ 13 | $this->score[$this->usn] = $amount; 14 | }else{ 15 | unset($this->score{$this->usn}); 16 | $output = $this->usn." IS Not In Game , Canot Set Score"; 17 | $output .= " "; 18 | {$this->eror = $output;} 19 | } 20 | } 21 | 22 | public function getScore(){ 23 | if($this->is($this->usn)){ 24 | $this->score[$this->usn]; 25 | }else{ 26 | $output = $this->usn." IS Not In Game , Canot get Score"; 27 | $output .= " "; 28 | {$this->eror = $output;} 29 | } 30 | } 31 | 32 | public function getError(){ 33 | return $this->eror; 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /src/MiniGamesTree/Score/TeamScore.php: -------------------------------------------------------------------------------- 1 | score[strtolower($this->ust)] = $amount; 11 | } 12 | 13 | public function getScore(){ 14 | return $this->score[strtolower($this->ust)]; 15 | } 16 | 17 | public function DisableScore(){ 18 | unset($this->score[$this->ust]); 19 | } 20 | 21 | } 22 | -------------------------------------------------------------------------------- /src/MiniGamesTree/Singles.php: -------------------------------------------------------------------------------- 1 | usn = $usn; 12 | } 13 | 14 | public function add(){ 15 | $this->game{"Num"}[$this->usn] = $this->getCount(); 16 | return $this->game{"Game"}[$this->usn] = $this->usn; 17 | } 18 | 19 | public function remove(){ 20 | unset($this->game{"Game"}[$this->usn]); 21 | unset($this->game{"Num"}[$this->usn]); 22 | } 23 | 24 | public function inGame($name){ 25 | return in_array($name, $this->game["Game"]); 26 | } 27 | 28 | public function getPlayers(\pocketmine\Server $server){ 29 | foreach ($this->game["Game"] as $p): 30 | return $server->getPlayer($p); 31 | endforeach; 32 | } 33 | 34 | public function getCount(){ 35 | return count($this->game["Game"]); 36 | } 37 | 38 | public function ListPlayer($glue = " .*. "){ 39 | return join($glue, $this->game); 40 | } 41 | 42 | public function getNumber(){ 43 | return $this->game{"Num"}[$this->usn]; 44 | } 45 | 46 | public function getScore(){ 47 | $a = new Score\PlayerScore(); 48 | return $a; 49 | } 50 | 51 | } 52 | -------------------------------------------------------------------------------- /src/MiniGamesTree/Status.php: -------------------------------------------------------------------------------- 1 | status{"Step"} = "start"; 11 | } 12 | 13 | public function setStop(){ 14 | return $this->status{"Step"} = "stop"; 15 | } 16 | 17 | public function setWaiting(){ 18 | return $this->status{"Step"} = "waiting"; 19 | } 20 | 21 | public function MakeNewMode($strings){ 22 | $this->status["Last"] = $strings; 23 | return $this->status{"Step"} = $strings; 24 | } 25 | 26 | public function getMode(){ 27 | return $this->status{"Step"}; 28 | } 29 | 30 | public function isStart(){ 31 | return $this->status{"Step"} == "start"; 32 | } 33 | 34 | public function isStop(){ 35 | return $this->status{"Step"} == "stop"; 36 | } 37 | 38 | public function isWaiting(){ 39 | return $this->status{"Step"} == "waiting"; 40 | } 41 | 42 | public function getNewMode(){ 43 | return $this->status["Last"]; 44 | } 45 | 46 | } 47 | -------------------------------------------------------------------------------- /src/MiniGamesTree/Team.php: -------------------------------------------------------------------------------- 1 | usn = $usn; 13 | $this->ust = $ust; 14 | } 15 | 16 | public function add(){ 17 | $this->get{$this->usn} = $this->ust; 18 | return $this->teams[strtolower($this->ust)][] = $this->usn; 19 | } 20 | 21 | public function getPlayerTeam(){ 22 | return $this->get{$this->usn}; 23 | } 24 | 25 | public function remove(){ 26 | unset($this->get[$this->usn]); 27 | unset($this->teams[array_search($this->usn, $this->teams[strtolower($this->ust)])]); 28 | } 29 | 30 | public function getCount(){ 31 | if($this->ust == ""){ 32 | return count($this->teams); 33 | }else{ 34 | return count($this->teams[strtolower($this->ust)]); 35 | } 36 | } 37 | 38 | public function isInTeam(){ 39 | if($this->ust == ""){ 40 | return in_array($this->usn, $this->teams); 41 | } else { 42 | return in_array($this->usn, $this->teams[strtolower($this->ust)]); 43 | } 44 | } 45 | 46 | public function getPlayers(\pocketmine\Server $server){ 47 | if($this->ust == ""){ 48 | foreach ($this->teams[$this->getPlayerTeam()] as $p): 49 | return $server->getPlayer($p); 50 | endforeach; 51 | } else { 52 | foreach ($this->teams[strtolower($this->ust)] as $p): 53 | return $server->getPlayer($p); 54 | endforeach; 55 | } 56 | } 57 | 58 | public function getScore(){ 59 | $a = new Score\TeamScore(); 60 | return $a; 61 | } 62 | 63 | public function listPlayers($glue = " .*. "){ 64 | if($this->ust == ""){ 65 | return implode($glue, $this->teams); 66 | } else { 67 | return join($glue, $this->teams[strtolower($this->ust)]); 68 | }} 69 | 70 | } 71 | -------------------------------------------------------------------------------- /src/MiniGamesTree/Time.php: -------------------------------------------------------------------------------- 1 | Time; 21 | } 22 | 23 | public function getMinute(){ 24 | return !is_int($this->Time) ? : round($this->Time / 60); 25 | } 26 | 27 | public function getMovePeriod(){ 28 | return $this->moveperiod; 29 | } 30 | 31 | public function setMovePeriod($amount){ 32 | return $this->moveperiod = $amount; 33 | } 34 | 35 | public function setTime($amount){ 36 | return $this->Time = $amount + 1; 37 | } 38 | 39 | public function setSpeed($amount){ 40 | return self::$speed = $amount * (2); 41 | } 42 | 43 | public function setTimeMove($move = "-"){ 44 | if($move == "-"){ 45 | $this->move = "-"; 46 | } 47 | if($move == "+"){ 48 | $this->move = "+"; 49 | } 50 | } 51 | 52 | /* 53 | public function sendPopup($player,$msg = "none",$time = 2){ 54 | $i = 0; 55 | do{ 56 | $i++; 57 | $player->sendPopup($msg); 58 | } while ($i = $time * 100 / 2); 59 | } 60 | * 61 | */ 62 | 63 | public function getMove(){ 64 | return $this->move; 65 | } 66 | 67 | public function getSpeed(){ 68 | return self::$speed; 69 | } 70 | 71 | public function onEnable() { 72 | 73 | $this->getServer()->getPluginManager()->registerEvents(new Event($this), $this); 74 | 75 | $api = new \MiniGamesTree\API\game; 76 | $this->api = $api; 77 | $this->getLogger()->info(\pocketmine\utils\TextFormat::GREEN.$this->getDescription()->getName()." IS Worked".PHP_EOL."Version : ".$this->getDescription()->getVersion()); 78 | 79 | $this->getServer()->getScheduler()->scheduleRepeatingTask(new Run ( $this ), self::$speed); 80 | 81 | if($this->getDescription()->getVersion() !== $api->getInfo("version")->getInfo() || $this->getDescription()->getAuthors()[0] !== $api->getInfo("name")->getInfo()){ 82 | $this->getServer()->getPluginManager()->disablePlugin($this->getServer()->getPluginManager()->getPlugin($this->getDescription()->getName())); 83 | } 84 | 85 | 86 | } 87 | 88 | } 89 | class Run extends PluginTask{ 90 | 91 | public $run; 92 | 93 | public function __construct(Time $run){ 94 | parent::__construct($run); 95 | $this->run = $run; 96 | } 97 | 98 | public function onRun($currentTick){ 99 | if($this->run->getMove() == "-"){ 100 | $this->run->setTime($this->run->getSec() - $this->run->getMovePeriod()); 101 | } 102 | if($this->run->getMove() == "+"){ 103 | $this->run->setTime($this->run->getSec() + $this->run->getMovePeriod()); 104 | } 105 | } 106 | } 107 | -------------------------------------------------------------------------------- /src/MiniGamesTree/arena/RegArena.php: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /src/MiniGamesTree/extendss/info.php: -------------------------------------------------------------------------------- 1 |