PlayerBountyLostEvent   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 65
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 0
Metric Value
wmc 5
lcom 0
cbo 1
dl 0
loc 65
rs 10
c 0
b 0
f 0

5 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 7 1
A getKilled() 0 4 1
A getKiller() 0 4 1
A getGold() 0 4 1
A getType() 0 4 1
1
<?php
2
/**
3
 * Copyright (c) 2018 VectorNetworkProject. All rights reserved. MIT license.
4
 *
5
 * GitHub: https://github.com/VectorNetworkProject/TheMix
6
 * Website: https://www.vector-network.tk
7
 */
8
9
namespace VectorNetworkProject\TheMix\game\event\player;
10
11
use pocketmine\event\Cancellable;
12
use pocketmine\event\Event;
13
use pocketmine\Player;
14
15
class PlayerBountyLostEvent extends Event implements Cancellable
16
{
17
    public const TYPE_SUICIDE = 0;
18
    public const TYPE_KILLED = 1;
19
20
    /** @var Player $Killed */
21
    private $killed;
22
23
    /* @var Player $killer */
24
    private $killer = null;
25
26
    /* @var int $gold */
27
    private $gold;
28
29
    /* @var int $type */
30
    private $type = self::TYPE_SUICIDE;
31
32
    /**
33
     * PlayerBountyLostEvent constructor.
34
     *
35
     * @param Player      $killed
36
     * @param int         $gold
37
     * @param Player|null $killer
38
     * @param int         $type
39
     */
40
    public function __construct(Player $killed, int $gold, Player $killer = null, int $type = self::TYPE_SUICIDE)
41
    {
42
        $this->killed = $killed;
43
        $this->killer = $killer;
44
        $this->gold = $gold;
45
        $this->type = $type;
46
    }
47
48
    /**
49
     * @return Player
50
     */
51
    public function getKilled(): Player
52
    {
53
        return $this->killed;
54
    }
55
56
    /**
57
     * @return Player|null
58
     */
59
    public function getKiller(): ?Player
60
    {
61
        return $this->killer;
62
    }
63
64
    /**
65
     * @return int
66
     */
67
    public function getGold(): int
68
    {
69
        return $this->gold;
70
    }
71
72
    /**
73
     * @return int
74
     */
75
    public function getType(): int
76
    {
77
        return $this->type;
78
    }
79
}
80