Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- namespace moch\TopMoneys;
- use pocketmine\plugin\PluginBase;
- use pocketmine\utils\Config;
- use pocketmine\math\Vector3;
- use pocketmine\command\CommandSender;
- use pocketmine\command\Command;
- use pocketmine\Player;
- use pocketmine\event\entity\EntityLevelChangeEvent;
- use pocketmine\event\player\PlayerJoinEvent;
- use pocketmine\event\Listener;
- class Main extends PluginBase implements Listener{
- private $particles = [];
- private $particles1 = [];
- private $particles2 = [];
- private $particles3 = [];
- private $particles4 = [];
- private $particles5 = [];
- public function onEnable(){
- $this->config = (new Config($this->getDataFolder()."config.yml", Config::YAML))->getAll();
- if(empty($this->config["positions"])){
- $this->getServer()->getLogger()->Info(" Position is empty");
- return;
- }
- if(empty($this->config["positions1"])){
- $this->getServer()->getLogger()->Info("Position1 is empty");
- return;
- }
- if(empty($this->config["positions2"])){
- $this->getServer()->getLogger()->Info("Position3 is empty");
- return;
- }
- if(empty($this->config["positions3"])){
- $this->getServer()->getLogger()->Info("Position4 is empty");
- return;
- }
- if(empty($this->config["positions4"])){
- $this->getServer()->getLogger()->Info("Position5 is empty");
- return;
- }
- if(empty($this->config["positions5"])){
- $this->getServer()->getLogger()->Info("Position6 is empty");
- return;
- }
- $pos = $this->config["positions"];
- $this->particles[] = new FloatingText($this, new Vector3($pos[0], $pos[1], $pos[2]));
- $pos1 = $this->config["positions1"];
- $this->particles1[] = new FloatingText($this, new Vector3($pos1[0], $pos1[1], $pos1[2]));
- $pos2 = $this->config["positions2"];
- $this->particles2[] = new FloatingText($this, new Vector3($pos2[0], $pos2[1], $pos2[2]));
- $pos3 = $this->config["positions3"];
- $this->particles3[] = new FloatingText($this, new Vector3($pos3[0], $pos3[1], $pos3[2]));
- $pos4 = $this->config["positions4"];
- $this->particles4[] = new FloatingText($this, new Vector3($pos4[0], $pos4[1], $pos4[2]));
- $pos5 = $this->config["positions5"];
- $this->particles5[] = new FloatingText($this, new Vector3($pos5[0], $pos5[1], $pos5[2]));
- $this->getServer()->getLogger()->Info("floatingPlayerCounter enabled");
- $this->getServer()->getPluginManager()->registerEvents($this, $this);
- }
- public function onCommand(CommandSender $p, Command $command, string $label, array $args):bool{
- if($command->getName() === "setblockparty"){
- if(!$p instanceof Player) return false;
- if(!$p->isOp()) return false;
- $config = new Config($this->getDataFolder()."config.yml", Config::YAML);
- $config->set("positions", [round($p->getX()), round($p->getY()), round($p->getZ())]);
- $config->save();
- $p->sendMessage("§a* blockparty set§r§f!");
- } elseif ($command->getName() === "setplots"){
- if(!$p instanceof Player) return false;
- if(!$p->isOp()) return false;
- $config1 = new Config($this->getDataFolder()."config.yml", Config::YAML);
- $config1->set("positions1", [round($p->getX()), round($p->getY()), round($p->getZ())]);
- $config1->save();
- $p->sendMessage("§a* plots set§r§f!");
- } elseif ($command->getName() === "setrace"){
- if(!$p instanceof Player) return false;
- if(!$p->isOp()) return false;
- $config2 = new Config($this->getDataFolder()."config.yml", Config::YAML);
- $config2->set("positions2", [round($p->getX()), round($p->getY()), round($p->getZ())]);
- $config2->save();
- $p->sendMessage("§a* race set§r§f!");
- } elseif ($command->getName() === "setbridge"){
- if(!$p instanceof Player) return false;
- if(!$p->isOp()) return false;
- $config3 = new Config($this->getDataFolder()."config.yml", Config::YAML);
- $config3->set("positions3", [round($p->getX()), round($p->getY()), round($p->getZ())]);
- $config3->save();
- $p->sendMessage("§a* bridge set§r§f!");
- } elseif ($command->getName() === "setparkour"){
- if(!$p instanceof Player) return false;
- if(!$p->isOp()) return false;
- $config1 = new Config($this->getDataFolder()."config.yml", Config::YAML);
- $config1->set("positions4", [round($p->getX()), round($p->getY()), round($p->getZ())]);
- $config1->save();
- $p->sendMessage("§a* parkour set§r§f!");
- } elseif ($command->getName() === "setkoth"){
- if(!$p instanceof Player) return false;
- if(!$p->isOp()) return false;
- $config1 = new Config($this->getDataFolder()."config.yml", Config::YAML);
- $config1->set("positions5", [round($p->getX()), round($p->getY()), round($p->getZ())]);
- $config1->save();
- $p->sendMessage("§a* koth set§r§f!");
- }
- return true;
- }
- public function join(PlayerJoinEvent $e){
- $player = $e->getPlayer();
- $this->getScheduler()->scheduleTask(new UpdateTask($this));
- }
- public function levelChange(EntityLevelChangeEvent $event) {
- $pl = $event->getEntity();
- if($pl instanceof Player){
- $Origin = $event->getOrigin();
- $OriginName = $Origin->getFolderName();
- $Target = $event->getOrigin();
- $TargetName = $Target->getFolderName();
- $this->getScheduler()->scheduleTask(new UpdateTask($this));
- }
- }
- public function getLeaderBoard():string{
- $message = "playing: unknown";
- if ($this->getServer()->isLevelLoaded("blockparty")) {
- $playercount2 = count($this->getServer()->getLevelByName("blockparty")->getPlayers());
- $message = "§aPlaying:§f $playercount2";
- }
- $return = (string) $message;
- return $return;
- }
- public function getLeaderBoard1():string{
- $message = "playing: unknown";
- if ($this->getServer()->isLevelLoaded("p")) {
- $playercount1 = count($this->getServer()->getLevelByName("p")->getPlayers());
- $message = "§aPlaying:§f $playercount1";
- }
- $return = (string) $message;
- return $return;
- }
- public function getLeaderBoard2():string{
- $message = "playing: unknown";
- if ($this->getServer()->isLevelLoaded("race")) {
- $playercount1 = count($this->getServer()->getLevelByName("race")->getPlayers());
- $message = "§aPlaying:§f $playercount1";
- }
- $return = (string) $message;
- return $return;
- }
- public function getLeaderBoard3():string{
- $message = "playing: unknown";
- if (!$this->getServer()->isLevelLoaded("thebridge") OR !$this->getServer()->isLevelLoaded("thebridge1") OR !$this->getServer()->isLevelLoaded("thebridge-DUO")){
- $message = "playing: unknown";
- } else {
- $playercount1 = count($this->getServer()->getLevelByName("thebridge")->getPlayers());
- $playercount2 = count($this->getServer()->getLevelByName("thebridge1")->getPlayers());
- $playercount3 = count($this->getServer()->getLevelByName("thebridge-DUO")->getPlayers());
- $message = "§aPlaying:§f $playercount1 §7(SOLO Map1)\n§aPlaying:§f $playercount2 §7(SOLO Map2)\n§aPlaying:§f $playercount3 §7(DUO)";
- }
- $return = (string) $message;
- return $return;
- }
- public function getLeaderBoard4():string{
- $message = "playing: unknown";
- if ($this->getServer()->isLevelLoaded("par3")) {
- $playercount1 = count($this->getServer()->getLevelByName("par3")->getPlayers());
- $message = "§aPlaying:§f $playercount1";
- }
- $return = (string) $message;
- return $return;
- }
- public function getLeaderBoard5():string{
- $message = "playing: unknown";
- if ($this->getServer()->isLevelLoaded("koth")) {
- $playercount1 = count($this->getServer()->getLevelByName("koth")->getPlayers());
- $message = "§aPlaying:§f $playercount1";
- }
- $return = (string) $message;
- return $return;
- }
- public function getParticles():array{
- return $this->particles;
- }
- public function getParticles1():array{
- return $this->particles1;
- }
- public function getParticles2():array{
- return $this->particles2;
- }
- public function getParticles3():array{
- return $this->particles3;
- }
- public function getParticles4():array{
- return $this->particles4;
- }
- public function getParticles5():array{
- return $this->particles5;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement