More changes!

This commit is contained in:
Shoghi Cervantes
2015-08-13 18:01:34 +02:00
parent 99df6f8edc
commit fabb632286
5 changed files with 137 additions and 11 deletions

View File

@ -155,6 +155,8 @@ class Enchantment{
public function setLevel($level){
$this->level = (int) $level;
return $this;
}
}

View File

@ -0,0 +1,55 @@
<?php
/*
*
* ____ _ _ __ __ _ __ __ ____
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
* | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) |
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* @author PocketMine Team
* @link http://www.pocketmine.net/
*
*
*/
namespace pocketmine\item\enchantment;
class EnchantmentEntry{
/** @var Enchantment[] */
private $enchantments;
private $cost;
private $randomName;
/**
* @param Enchantment[] $enchantments
* @param $cost
* @param $randomName
*/
public function __construct(array $enchantments, $cost, $randomName){
$this->enchantments = $enchantments;
$this->cost = (int) $cost;
$this->randomName = $randomName;
}
public function getEnchantments(){
return $this->enchantments;
}
public function getCost(){
return $this->cost;
}
public function getRandomName(){
return $this->randomName;
}
}

View File

@ -0,0 +1,54 @@
<?php
/*
*
* ____ _ _ __ __ _ __ __ ____
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
* | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) |
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* @author PocketMine Team
* @link http://www.pocketmine.net/
*
*
*/
namespace pocketmine\item\enchantment;
class EnchantmentList{
/** @var EnchantmentEntry[] */
private $enchantments;
public function __construct($size){
$this->enchantments = new \SplFixedArray($size);
}
/**
* @param $slot
* @param EnchantmentEntry $entry
*/
public function setSlot($slot, EnchantmentEntry $entry){
$this->enchantments[$slot] = $entry;
}
/**
* @param $slot
* @return EnchantmentEntry
*/
public function getSlot($slot){
return $this->enchantments[$slot];
}
public function getSize(){
return $this->enchantments->getSize();
}
}