Code Duplication    Length = 45-45 lines in 2 locations

src/VectorNetworkProject/TheMix/game/kit/BlueKit.php 1 location

@@ 17-61 (lines=45) @@
14
use pocketmine\Player;
15
use pocketmine\utils\Color;
16
17
class BlueKit
18
{
19
    /**
20
     * @param Player $player
21
     */
22
    public static function sendItems(Player $player): void
23
    {
24
        $armors = [
25
            'leather_cap'   => Item::get(Item::LEATHER_CAP),
26
            'leather_tunic' => Item::get(Item::LEATHER_TUNIC),
27
            'leather_pants' => Item::get(Item::LEATHER_PANTS),
28
            'leather_boots' => Item::get(Item::LEATHER_BOOTS),
29
        ];
30
        $weapons = [
31
            'wooden_sword'  => Item::get(Item::WOODEN_SWORD),
32
            'bow'           => Item::get(Item::BOW),
33
            'stone_pickaxe' => Item::get(Item::STONE_PICKAXE),
34
            'stone_axe'     => Item::get(Item::STONE_AXE),
35
            'stone_shovel'  => Item::get(Item::STONE_SHOVEL),
36
        ];
37
        foreach ($armors as $armor) {
38
            if ($armor instanceof Durable and $armor instanceof Armor) {
39
                $armor->setUnbreakable(true);
40
                $armor->setCustomColor(new Color(0, 150, 255));
41
            }
42
        }
43
        foreach ($weapons as $weapon) {
44
            if ($weapon instanceof Durable) {
45
                $weapon->setUnbreakable(true);
46
            }
47
        }
48
        $player->getInventory()->clearAll();
49
        $armor = $player->getArmorInventory();
50
        $armor->setHelmet($armors['leather_cap']);
51
        $armor->setChestplate($armors['leather_tunic']);
52
        $armor->setLeggings($armors['leather_pants']);
53
        $armor->setBoots($armors['leather_boots']);
54
        $player->getInventory()->addItem($weapons['wooden_sword']);
55
        $player->getInventory()->addItem($weapons['bow']);
56
        $player->getInventory()->addItem($weapons['stone_pickaxe']);
57
        $player->getInventory()->addItem($weapons['stone_axe']);
58
        $player->getInventory()->addItem($weapons['stone_shovel']);
59
        $player->getInventory()->setItem(8, Item::get(Item::ARROW, 0, 64));
60
    }
61
}
62

src/VectorNetworkProject/TheMix/game/kit/RedKit.php 1 location

@@ 17-61 (lines=45) @@
14
use pocketmine\Player;
15
use pocketmine\utils\Color;
16
17
class RedKit
18
{
19
    /**
20
     * @param Player $player
21
     */
22
    public static function sendItem(Player $player)
23
    {
24
        $armors = [
25
            'leather_cap'   => Item::get(Item::LEATHER_CAP),
26
            'leather_tunic' => Item::get(Item::LEATHER_TUNIC),
27
            'leather_pants' => Item::get(Item::LEATHER_PANTS),
28
            'leather_boots' => Item::get(Item::LEATHER_BOOTS),
29
        ];
30
        $weapons = [
31
            'wooden_sword'  => Item::get(Item::WOODEN_SWORD),
32
            'bow'           => Item::get(Item::BOW),
33
            'stone_pickaxe' => Item::get(Item::STONE_PICKAXE),
34
            'stone_axe'     => Item::get(Item::STONE_AXE),
35
            'stone_shovel'  => Item::get(Item::STONE_SHOVEL),
36
        ];
37
        foreach ($armors as $armor) {
38
            if ($armor instanceof Durable and $armor instanceof Armor) {
39
                $armor->setUnbreakable(true);
40
                $armor->setCustomColor(new Color(255, 0, 50));
41
            }
42
        }
43
        foreach ($weapons as $weapon) {
44
            if ($weapon instanceof Durable) {
45
                $weapon->setUnbreakable(true);
46
            }
47
        }
48
        $player->getInventory()->clearAll();
49
        $armor = $player->getArmorInventory();
50
        $armor->setHelmet($armors['leather_cap']);
51
        $armor->setChestplate($armors['leather_tunic']);
52
        $armor->setLeggings($armors['leather_pants']);
53
        $armor->setBoots($armors['leather_boots']);
54
        $player->getInventory()->addItem($weapons['wooden_sword']);
55
        $player->getInventory()->addItem($weapons['bow']);
56
        $player->getInventory()->addItem($weapons['stone_pickaxe']);
57
        $player->getInventory()->addItem($weapons['stone_axe']);
58
        $player->getInventory()->addItem($weapons['stone_shovel']);
59
        $player->getInventory()->setItem(8, Item::get(Item::ARROW, 0, 64));
60
    }
61
}
62