|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace eXpansion\Bundle\Maps\Plugins; |
|
4
|
|
|
|
|
5
|
|
|
use eXpansion\Framework\AdminGroups\Helpers\AdminGroups; |
|
6
|
|
|
use eXpansion\Framework\Core\DataProviders\Listener\MapDataListenerInterface; |
|
7
|
|
|
use eXpansion\Framework\Core\Plugins\StatusAwarePluginInterface; |
|
8
|
|
|
use eXpansion\Framework\Core\Services\Console; |
|
9
|
|
|
use eXpansion\Framework\Core\Storage\MapStorage; |
|
10
|
|
|
use Maniaplanet\DedicatedServer\Connection; |
|
11
|
|
|
|
|
12
|
|
|
|
|
13
|
|
|
class Maps implements MapDataListenerInterface, StatusAwarePluginInterface |
|
14
|
|
|
{ |
|
15
|
|
|
/** @var Connection */ |
|
16
|
|
|
protected $connection; |
|
17
|
|
|
|
|
18
|
|
|
/** @var Console */ |
|
19
|
|
|
protected $console; |
|
20
|
|
|
|
|
21
|
|
|
/** @var AdminGroups */ |
|
22
|
|
|
protected $adminGroups; |
|
23
|
|
|
|
|
24
|
|
|
/** @var bool */ |
|
25
|
|
|
protected $enabled = true; |
|
26
|
|
|
|
|
27
|
|
|
/** @var MapStorage */ |
|
28
|
|
|
protected $mapStorage; |
|
29
|
|
|
|
|
30
|
|
|
function __construct(Connection $connection, Console $console, AdminGroups $adminGroups, MapStorage $mapStorage) |
|
|
|
|
|
|
31
|
|
|
{ |
|
32
|
|
|
$this->connection = $connection; |
|
33
|
|
|
$this->console = $console; |
|
34
|
|
|
$this->adminGroups = $adminGroups; |
|
35
|
|
|
$this->mapStorage = $mapStorage; |
|
36
|
|
|
} |
|
37
|
|
|
|
|
38
|
|
|
/** |
|
39
|
|
|
* Set the status of the plugin |
|
40
|
|
|
* |
|
41
|
|
|
* @param boolean $status |
|
42
|
|
|
* |
|
43
|
|
|
* @return void |
|
44
|
|
|
*/ |
|
45
|
|
|
public function setStatus($status) |
|
46
|
|
|
{ |
|
47
|
|
|
if (!$status) { |
|
|
|
|
|
|
48
|
|
|
|
|
49
|
|
|
} |
|
50
|
|
|
} |
|
51
|
|
|
|
|
52
|
|
|
/** |
|
53
|
|
|
* @return array |
|
54
|
|
|
*/ |
|
55
|
|
|
public function getMaps() |
|
56
|
|
|
{ |
|
57
|
|
|
return $this->mapStorage->getMaps(); |
|
58
|
|
|
} |
|
59
|
|
|
|
|
60
|
|
|
/** |
|
61
|
|
|
* @param \Maniaplanet\DedicatedServer\Structures\Map[] $oldMaps |
|
62
|
|
|
* @param string $currentMapUid |
|
63
|
|
|
* @param string $nextMapUid |
|
64
|
|
|
* @param bool $isListModified |
|
65
|
|
|
* @return mixed|void |
|
66
|
|
|
*/ |
|
67
|
|
|
public function onMapListModified($oldMaps, $currentMapUid, $nextMapUid, $isListModified) |
|
68
|
|
|
{ |
|
69
|
|
|
|
|
70
|
|
|
} |
|
71
|
|
|
|
|
72
|
|
|
public function onExpansionMapChange($currentMap, $previousMap) |
|
73
|
|
|
{ |
|
74
|
|
|
// TODO: Implement onExpansionMapChange() method. |
|
75
|
|
|
} |
|
76
|
|
|
|
|
77
|
|
|
public function onExpansionNextMapChange($nextMap, $previousNextMap) |
|
78
|
|
|
{ |
|
79
|
|
|
// TODO: Implement onExpansionNextMapChange() method. |
|
80
|
|
|
} |
|
81
|
|
|
} |
|
82
|
|
|
|
Adding explicit visibility (
private,protected, orpublic) is generally recommend to communicate to other developers how, and from where this method is intended to be used.