Completed
Push — master ( 4cc80e...c361a4 )
by De Cramer
13s
created

TotoPlugin::onPlayerConnect()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 1
1
<?php
2
3
namespace eXpansion\Bundle\Acme\Plugins;
4
5
use eXpansion\Bundle\Acme\Plugins\Gui\WindowFactory;
6
use eXpansion\Framework\Core\DataProviders\Listener\ListenerInterfaceExpApplication;
7
use eXpansion\Framework\Core\Model\UserGroups\Group;
8
use eXpansion\Framework\Core\Plugins\StatusAwarePluginInterface;
9
use eXpansion\Framework\Core\Services\Console;
10
use eXpansion\Framework\Core\Storage\Data\Player;
11
use eXpansion\Framework\GameManiaplanet\DataProviders\Listener\ListenerInterfaceMpLegacyPlayer;
12
use eXpansion\Framework\Notifications\Services\Notifications;
13
14
/**
15
 * TotoPlugin is a test plugin to be removed.
16
 *
17
 * @package eXpansion\Framework\Core\Plugins
18
 */
19
class TotoPlugin implements ListenerInterfaceExpApplication, StatusAwarePluginInterface, ListenerInterfaceMpLegacyPlayer
20
{
21
    /** @var Console */
22
    protected $console;
23
24
    /** @var WindowFactory */
25
    protected $mlFactory;
26
27
    /** @var Group */
28
    protected $playersGroup;
29
    /**
30
     * @var Notifications
31
     */
32
    private $notifications;
33
34
    /**
35
     * TotoPlugin constructor.
36
     * @param Group         $players
37
     * @param Console       $console
38
     * @param Notifications $notifications
39
     */
40
    function __construct(
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
41
        Group $players,
42
        Console $console,
43
        Notifications $notifications
44
    ) {
45
        $this->console = $console;
46
        $this->playersGroup = $players;
47
        $this->notifications = $notifications;
48
    }
49
50
    /**
51
     * Set the status of the plugin
52
     *
53
     * @param boolean $status
54
     *
55
     * @return null
56
     */
57
    public function setStatus($status)
58
    {
59
60
    }
61
62
    /**
63
     * called at eXpansion init
64
     *
65
     * @return void
66
     */
67
    public function onApplicationInit()
68
    {
69
        // do nothing
70
    }
71
72
    /**
73
     * called when init is done and callbacks are enabled
74
     *
75
     * @return void
76
     */
77
    public function onApplicationReady()
78
    {
79
        $this->notifications->info("expansion_acme.notification.start");
80
    }
81
82
    /**
83
     * called when requesting application stop
84
     *
85
     * @return void
86
     */
87
    public function onApplicationStop()
88
    {
89
        // do nothing
90
    }
91
92
    /**
93
     * @param Player $player
94
     * @return void
95
     */
96
    public function onPlayerConnect(Player $player)
97
    {
98
        $this->notifications->info("expansion_acme.notification.join", ["%player%" => $player->getNickName()]);
99
    }
100
101
    /**
102
     * @param Player $player
103
     * @param string $disconnectionReason
104
     * @return void
105
     */
106
    public function onPlayerDisconnect(Player $player, $disconnectionReason)
107
    {
108
        $this->notifications->info("expansion_acme.notification.leave", ["%player%" => $player->getNickName()]);
109
    }
110
111
    /**
112
     * @param Player $oldPlayer
113
     * @param Player $player
114
     * @return void
115
     */
116
    public function onPlayerInfoChanged(Player $oldPlayer, Player $player)
117
    {
118
        // TODO: Implement onPlayerInfoChanged() method.
119
    }
120
121
    /**
122
     * @param Player $oldPlayer
123
     * @param Player $player
124
     * @return void
125
     */
126
    public function onPlayerAlliesChanged(Player $oldPlayer, Player $player)
127
    {
128
        // TODO: Implement onPlayerAlliesChanged() method.
129
    }
130
}
131