|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
|
|
4
|
|
|
namespace eXpansion\Bundle\Dedimania\ChatCommands; |
|
5
|
|
|
|
|
6
|
|
|
use eXpansion\Bundle\Dedimania\Plugins\Gui\DedirecsWindow; |
|
7
|
|
|
use eXpansion\Bundle\Dedimania\Services\DedimaniaService; |
|
8
|
|
|
use eXpansion\Framework\Core\Model\ChatCommand\AbstractChatCommand; |
|
9
|
|
|
use eXpansion\Framework\Notifications\Services\Notifications; |
|
10
|
|
|
use Symfony\Component\Console\Input\InputInterface; |
|
11
|
|
|
|
|
12
|
|
|
|
|
13
|
|
|
/** |
|
14
|
|
|
* Class Records |
|
15
|
|
|
* |
|
16
|
|
|
* @package eXpansion\Bundle\LocalRecords\ChatCommand; |
|
17
|
|
|
* @author reaby |
|
18
|
|
|
*/ |
|
19
|
|
|
class DediRecs extends AbstractChatCommand |
|
20
|
|
|
{ |
|
21
|
|
|
/** |
|
22
|
|
|
* @var DedirecsWindow |
|
23
|
|
|
*/ |
|
24
|
|
|
private $dedirecsWindow; |
|
25
|
|
|
/** |
|
26
|
|
|
* @var DedimaniaService |
|
27
|
|
|
*/ |
|
28
|
|
|
private $dedimaniaService; |
|
29
|
|
|
/** |
|
30
|
|
|
* @var Notifications |
|
31
|
|
|
*/ |
|
32
|
|
|
private $notifications; |
|
33
|
|
|
|
|
34
|
|
|
/** |
|
35
|
|
|
* MapsList constructor. |
|
36
|
|
|
* |
|
37
|
|
|
* @param $command |
|
38
|
|
|
* @param array $aliases |
|
39
|
|
|
* @param DedirecsWindow $dedirecsWindow |
|
40
|
|
|
* @param DedimaniaService $dedimaniaService |
|
41
|
|
|
* @param Notifications $notifications |
|
42
|
|
|
*/ |
|
43
|
|
|
public function __construct( |
|
44
|
|
|
$command, |
|
45
|
|
|
array $aliases = [], |
|
46
|
|
|
DedirecsWindow $dedirecsWindow, |
|
47
|
|
|
DedimaniaService $dedimaniaService, |
|
48
|
|
|
Notifications $notifications |
|
49
|
|
|
) { |
|
50
|
|
|
parent::__construct($command, $aliases); |
|
51
|
|
|
|
|
52
|
|
|
$this->dedirecsWindow = $dedirecsWindow; |
|
53
|
|
|
$this->dedimaniaService = $dedimaniaService; |
|
54
|
|
|
$this->notifications = $notifications; |
|
55
|
|
|
} |
|
56
|
|
|
|
|
57
|
|
|
/** |
|
58
|
|
|
* @inheritdoc |
|
59
|
|
|
*/ |
|
60
|
|
|
public function execute($login, InputInterface $input) |
|
61
|
|
|
{ |
|
62
|
|
|
$recs = $this->dedimaniaService->getDedimaniaRecords(); |
|
63
|
|
|
|
|
64
|
|
|
if (empty($recs)) { |
|
65
|
|
|
$this->notifications->error("No dedimania records for this map", [], "Error", 5500, $login); |
|
66
|
|
|
return; |
|
67
|
|
|
} |
|
68
|
|
|
|
|
69
|
|
|
$this->dedirecsWindow->setRecords($recs); |
|
70
|
|
|
$this->dedirecsWindow->create($login); |
|
71
|
|
|
} |
|
72
|
|
|
} |
|
73
|
|
|
|