Merge branch 'master' of ssh://184.154.0.242:7999/min/Mineplex
This commit is contained in:
commit
581d58c313
@ -8,11 +8,9 @@
|
||||
|
||||
namespace mineplex\plugin\gameengine\game\components\feature;
|
||||
|
||||
|
||||
use mineplex\plugin\gameengine\arenas\Arena;
|
||||
use pocketmine\event\HandlerList;
|
||||
use pocketmine\event\Listener;
|
||||
use pocketmine\plugin\Plugin;
|
||||
use pocketmine\Server;
|
||||
|
||||
class ListenerFeature implements Feature, Listener {
|
||||
|
@ -10,9 +10,7 @@ namespace mineplex\plugin\gameengine\game\components\feature\features;
|
||||
|
||||
|
||||
use mineplex\plugin\gameengine\arenas\Arena;
|
||||
use mineplex\plugin\gameengine\arenas\events\ArenaJoinEvent;
|
||||
use mineplex\plugin\gameengine\game\components\feature\ListenerFeature;
|
||||
use mineplex\plugin\gameengine\game\components\spectate\SpectateComponent;
|
||||
use pocketmine\event\entity\EntityDamageEvent;
|
||||
use pocketmine\Server;
|
||||
|
||||
@ -23,24 +21,11 @@ class NoDamage extends ListenerFeature {
|
||||
parent::__construct($arena);
|
||||
}
|
||||
|
||||
function onJoin(EntityDamageEvent $event)
|
||||
function onDamage(EntityDamageEvent $event)
|
||||
{
|
||||
if (!$this->getArena()->hasPlayer($event->getEntity()))
|
||||
return;
|
||||
Server::getInstance()->broadcastMessage("Stopped!");
|
||||
$event->setCancelled();
|
||||
}
|
||||
|
||||
public function enable()
|
||||
{
|
||||
Server::getInstance()->broadcastMessage("Death enable!");
|
||||
parent::enable();
|
||||
}
|
||||
|
||||
public function disable()
|
||||
{
|
||||
Server::getInstance()->broadcastMessage("Death disable!");
|
||||
parent::disable();
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -105,6 +105,8 @@ class DuringGame extends ListenerFeature implements BenchTask {
|
||||
|
||||
if (!$this->spectateComponent->isSpectating($event->getPlayer()))
|
||||
array_push($this->rank, $event->getPlayer());
|
||||
|
||||
$this->checkEndGame();
|
||||
}
|
||||
|
||||
|
||||
@ -115,7 +117,8 @@ class DuringGame extends ListenerFeature implements BenchTask {
|
||||
|
||||
array_push($this->rank, $event->getPlayer());
|
||||
|
||||
$this->checkEndGame(true);
|
||||
//Meh, don't like doing things this way, but I need it to call sendWinners after the player is added to spectating from spectating.
|
||||
BenchSchedule::runTaskLater($this, 0);
|
||||
}
|
||||
|
||||
public function checkEndGame($subtract = false)
|
||||
|
@ -20,10 +20,12 @@ use mineplex\plugin\gameengine\game\components\feature\features\NoPickUpItem;
|
||||
use mineplex\plugin\gameengine\game\components\feature\managers\GameStateFeatureManager;
|
||||
use mineplex\plugin\gameengine\game\components\gamestate\GameState;
|
||||
use mineplex\plugin\gameengine\game\components\gamestate\GameStateComponent;
|
||||
use mineplex\plugin\gameengine\game\components\lobby\LobbyComponent;
|
||||
use mineplex\plugin\gameengine\game\components\spectate\GameModeSpectateComponent;
|
||||
use mineplex\plugin\gameengine\game\Game;
|
||||
|
||||
|
||||
use mineplex\plugin\gameengine\game\components\countdown\LobbyCountdown;
|
||||
use mineplex\plugin\gameengine\game\components\feature\Feature;
|
||||
use mineplex\plugin\gameengine\game\components\victorytype\LMSVictoryType;
|
||||
class SurvivalGames implements Game {
|
||||
|
||||
function start(Arena $arena)
|
||||
@ -42,7 +44,7 @@ class SurvivalGames implements Game {
|
||||
$features = array(
|
||||
|
||||
//Just here cause I'm not using LobbyComponent atm
|
||||
GameState::LOBBY => array( $stopEveryThing, $noDamage, ),
|
||||
//GameState::LOBBY => array( $stopEveryThing, $noDamage, ),
|
||||
|
||||
GameState::PRE_GAME => array( $stopEveryThing, $noDamage, $joinSpectate),
|
||||
|
||||
@ -52,16 +54,18 @@ class SurvivalGames implements Game {
|
||||
|
||||
);
|
||||
|
||||
new LobbyComponent($arena);
|
||||
|
||||
new GameStateFeatureManager($arena, $features);
|
||||
|
||||
//new LobbyCountdown( $arena, $gameStateComponent, null, GameState::LOBBY, GameState::PRE_GAME, 10, 2);
|
||||
new LobbyCountdown( $arena, $gameStateComponent, null, GameState::LOBBY, GameState::PRE_GAME, 10, 2);
|
||||
|
||||
new GameStateCountdown($arena, $gameStateComponent, 5, GameState::LOBBY, GameState::PRE_GAME);
|
||||
//new GameStateCountdown($arena, $gameStateComponent, 5, GameState::LOBBY, GameState::PRE_GAME);
|
||||
|
||||
new GameStateCountdown($arena, $gameStateComponent, 5, GameState::PRE_GAME, GameState::GAME);
|
||||
|
||||
new GameStateCountdown($arena, $gameStateComponent, 5, GameState::GAME, GameState::POST_GAME);
|
||||
//new LMSVictoryType( $arena, $spectateComponent, $gameStateComponent);
|
||||
//new GameStateCountdown($arena, $gameStateComponent, 5, GameState::GAME, GameState::POST_GAME);
|
||||
new LMSVictoryType( $arena, $spectateComponent, $gameStateComponent);
|
||||
|
||||
new GameStateCountdown($arena, $gameStateComponent, 5, GameState::POST_GAME, GameState::RESTARTING);
|
||||
|
||||
|
@ -18,7 +18,17 @@ class UtilArray {
|
||||
|
||||
public static function arrayDiff(array $array, array $subtract)
|
||||
{
|
||||
return array_udiff($array, $subtract, ['mineplex\plugin\util\UtilArray', 'comp']);
|
||||
//THIS IS TEMP FIX LATER!!
|
||||
$return = [];
|
||||
foreach ($array as $value)
|
||||
{
|
||||
if (!in_array($value, $subtract))
|
||||
array_push($return, $value);
|
||||
}
|
||||
|
||||
return $return;
|
||||
|
||||
//return array_udiff($array, $subtract, ['mineplex\plugin\util\UtilArray', 'comp']);
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user