UHC/src/Ad5001/UHC/UHCWorld.php
2016-06-10 07:19:40 +02:00

62 lines
1.9 KiB
PHP

<?php
# _ _ _ _ _____
# | | | | | | |/ ____|
# | | | | |__| | |
# | | | | __ | |
# | |__| | | | | |____
# \____/|_| |_|\_____|
# The most customisable UHC plugin for Minecraft PE !
namespace Ad5001\UHC ;
use pocketmine\command\CommandSender;
use pocketmine\command\Command;
use pocketmine\event\Listener;
use pocketmine\Server;
use pocketmine\level\Level;
use pocketmine\plugin\Plugin;
use pocketmine\level\particle\FloatingTextParticle;
use pocketmine\Player;
use pocketmine\utils\TextFormat as C;
use Ad5001\UHC\Main;
use Ad5001\UHC\Utils\TextParticle;
class UHCWorld {
public function __construct(Plugin $main, Level $level, string $name, int $maxplayers, int $radius) {
$this->p = $main;
$this->lvl = $level;
$this->name = $name;
$this->maxplayers = $maxplayers;
$this->players = [];
$this->cfg = $main->getConfig();
$this->radius = $radius;
}
public function getLevel() {
return $this->level;
}
public function getName() {
return $this->name;
}
public function getPlayers() {
return $this->players;
}
public function getMaxPlayers() {
return $this->maxplayers;
}
public function setPlayers(array $players) {
foreach($players as $player) {
if(!in_array($player, $this->players)){
foreach($this->players as $pl) {
$pl->sendMessage(Main::PREFIX . C::YELLOW . "{$player->getName()} leaved the game.");
}
}
}
foreach($this->players as $player) {
if(!in_array($player, $players)){
foreach($this->players as $pl) {
$pl->sendMessage(Main::PREFIX . C::YELLOW . "{$player->getName()} joined the game.");
}
}
}
$this->players = $players;
return true;
}
}