WeaponSlot(Dispatcher,ItemStorage,GamePlayer)   A
last analyzed

Complexity

Conditions 1

Size

Total Lines 11

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 1
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
dl 0
loc 11
ccs 1
cts 1
cp 1
crap 1
rs 9.85
c 0
b 0
f 0
1
/*
2
 * This file is part of Araknemu.
3
 *
4
 * Araknemu is free software: you can redistribute it and/or modify
5
 * it under the terms of the GNU Lesser General Public License as published by
6
 * the Free Software Foundation, either version 3 of the License, or
7
 * (at your option) any later version.
8
 *
9
 * Araknemu is distributed in the hope that it will be useful,
10
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12
 * GNU Lesser General Public License for more details.
13
 *
14
 * You should have received a copy of the GNU Lesser General Public License
15
 * along with Araknemu.  If not, see <https://www.gnu.org/licenses/>.
16
 *
17
 * Copyright (c) 2017-2019 Vincent Quatrevieux
18
 */
19
20
package fr.quatrevieux.araknemu.game.player.inventory.slot;
21
22
import fr.quatrevieux.araknemu.core.event.Dispatcher;
23
import fr.quatrevieux.araknemu.game.item.inventory.ItemStorage;
24
import fr.quatrevieux.araknemu.game.item.type.Weapon;
25
import fr.quatrevieux.araknemu.game.player.GamePlayer;
26
import fr.quatrevieux.araknemu.game.player.inventory.InventoryEntry;
27
import fr.quatrevieux.araknemu.game.player.inventory.slot.constraint.EquipmentLevelConstraint;
28
import fr.quatrevieux.araknemu.game.player.inventory.slot.constraint.ItemClassConstraint;
29
import fr.quatrevieux.araknemu.game.player.inventory.slot.constraint.SingleItemConstraint;
30
import fr.quatrevieux.araknemu.game.player.inventory.slot.constraint.SlotConstraint;
31
32
/**
33
 * Slot for weapons
34
 */
35
public final class WeaponSlot extends AbstractEquipmentSlot {
36
    public static final int SLOT_ID = 1;
37
38
    public WeaponSlot(Dispatcher dispatcher, ItemStorage<InventoryEntry> storage, GamePlayer owner) {
39 1
        super(
40
            dispatcher,
41
            new SimpleSlot(
42
                SLOT_ID,
43
                new SlotConstraint[] {
44
                    new SingleItemConstraint(),
45
                    new ItemClassConstraint(Weapon.class),
46
                    new EquipmentLevelConstraint(owner),
47
                },
48
                storage
49
            )
50
        );
51 1
    }
52
}
53