So me and my friend made a soccer plugin but we both lost our motivation. Could anybody complete it? There is a guy here who would steal the code and sell it *cough* @SonsaYT *cough* We tried our best: https://www81.zippyshare.com/v/BqTY89iO/file.html
Everytime a player moves you loop through a folder just to get an arena name, that's way more than terrible. Just don't run it if you're thinking about it. PHP: public function onMove(PlayerMoveEvent $event) : void{ $player = $event->getPlayer(); $distance = 0.5; $speed = $event->getFrom()->distanceSquared($event->getTo()) * 5; foreach($player->getLevel()->getNearByEntities($player->getBoundingBox()->expandedCopy($distance, $distance, $distance), $player) as $entity){ if($entity instanceof Ball){ $this->lastTouch[$this->getArena($player)] = $player->getName(); } } } public function getArena(Player $player) : ?string{ $files = scandir($this->getDataFolder() . "arenas"); return null; foreach($files as $arenaFile){ $check = explode(".", $arenaFile); if($check[1] == "yml"){ $arenaName = $check[0]; if(in_array($player->getName(), $this->blue[$arenaName]) || in_array($player->getName(), $this->red[$arenaName])){ return $arenaName; } else { return null; } } } }
I said we lost our motivation... we are not going to update the plugin. Credit to you by the way for the ball's code. It isn't open source because it is a request. But it could be...
Uhh, I don't know... It's better to keep it here for now because some annoying kids will spam the issues with "Not working" and other stuff.