Completed
Pull Request — master (#210)
by
unknown
03:50
created

WidgetCurrentMap::onEndRoundStart()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 4
ccs 0
cts 2
cp 0
rs 10
c 0
b 0
f 0
cc 1
eloc 1
nc 1
nop 2
crap 2
1
<?php
2
3
namespace eXpansion\Bundle\WidgetCurrentMap\Plugins;
4
5
use eXpansion\Bundle\WidgetCurrentMap\Plugins\Gui\CurrentMapWidgetFactory;
6
use eXpansion\Framework\Core\DataProviders\Listener\ListenerInterfaceExpApplication;
7
use eXpansion\Framework\Core\Model\UserGroups\Group;
8
use eXpansion\Framework\Core\Storage\PlayerStorage;
9
use eXpansion\Framework\GameManiaplanet\DataProviders\Listener\ListenerInterfaceMpLegacyMap;
10
use eXpansion\Framework\GameManiaplanet\DataProviders\Listener\ListenerInterfaceMpScriptMatch;
11
use Maniaplanet\DedicatedServer\Connection;
12
use Maniaplanet\DedicatedServer\Structures\Map;
13
14
15
class WidgetCurrentMap implements ListenerInterfaceExpApplication, ListenerInterfaceMpLegacyMap
16
{
17
    /** @var Connection */
18
    protected $connection;
19
    /**
20
     * @var PlayerStorage
21
     */
22
    private $playerStorage;
23
    /**
24
     * @var CurrentMapWidgetFactory
25
     */
26
    private $widget;
27
    /**
28
     * @var Group
29
     */
30
    private $players;
31
32
    /**
33
     * Debug constructor.
34
     *
35
     * @param Connection              $connection
36
     * @param PlayerStorage           $playerStorage
37
     * @param CurrentMapWidgetFactory $widget
38
     * @param Group                   $players
39
     */
40
    public function __construct(
41
        Connection $connection,
42
        PlayerStorage $playerStorage,
43
        CurrentMapWidgetFactory $widget,
44
        Group $players
45
    ) {
46
        $this->connection = $connection;
47
        $this->playerStorage = $playerStorage;
48
        $this->widget = $widget;
49
        $this->players = $players;
50
    }
51
52
    /**
53
     * called at eXpansion init
54
     *
55
     * @return void
56
     */
57
    public function onApplicationInit()
58
    {
59
60
61
    }
62
63
    /**
64
     * called when init is done and callbacks are enabled
65
     *
66
     * @return void
67
     */
68
    public function onApplicationReady()
69
    {
70
        $this->widget->create($this->players);
71
    }
72
73
    /**
74
     * called when requesting application stop
75
     *
76
     * @return void
77
     */
78
    public function onApplicationStop()
79
    {
80
81
    }
82
83
     /**
84
     * @param Map $map
85
     *
86
     * @return void
87
     */
88
    public function onBeginMap(Map $map)
89
    {
90
        $this->widget->update($this->players);
91
    }
92
93
    /**
94
     * @param Map $map
95
     *
96
     * @return void
97
     */
98
    public function onEndMap(Map $map)
99
    {
100
        // TODO: Implement onEndMap() method.
101
    }
102
}
103