This commit is contained in:
William Burns 2015-07-14 12:20:48 +01:00
parent d36dd26f42
commit d6d7ac93c1
4 changed files with 10 additions and 10 deletions

View File

@ -22,17 +22,17 @@ class ChestLoot {
$this->totalLoot = 0;
}
function addItem(int $id, int $chance, int $size, String $name)
function addItem($id, $chance, $size, $name)
{
$this->addLoot(new RandomItem(new Item($id, 0, 1, $name), $chance, $size, $size));
}
function addItemFull(int $id, int $chance, int $min, int $max, String $name)
function addItemFull($id, $chance, $min, $max, $name)
{
$this->addLoot(new RandomItem(new Item($id, 0, 1, $name), $chance, $min, $max));
}
function addLoot(RandomItem $ri)
function addLoot($ri)
{
array_push($this->randomItems, $ri);
$this->totalLoot += $ri->getChance();

View File

@ -18,7 +18,7 @@ class RandomItem {
private $min;
private $max;
function __construct(Item $item, int $chance, int $min, int $max)
function __construct(Item $item, $chance, $min, $max)
{
$this->chance = $chance;
$this->item = $item;
@ -33,7 +33,7 @@ class RandomItem {
function getItem()
{
return new Item($this->item->getId(), 0, UtilMath::randBetween($this->min, $this-max), $this->item->getName());
return new Item($this->item->getId(), 0, UtilMath::randBetween($this->min, $this->max), $this->item->getName());
}
}

View File

@ -10,22 +10,22 @@ namespace mineplex\plugin\util;
class UtilMath {
static function random(int $num)
static function random($num)
{
return rand(0, ($num - 1));
}
static function randInclusive(int $num)
static function randInclusive($num)
{
return rand(0, $num);
}
static function randBetween(int $min, int $max)
static function randBetween($min, $max)
{
return rand($min, ($max - 1));
}
static function randBetweenInclusive(int $min, int $max)
static function randBetweenInclusive($min, $max)
{
return rand($min, $max);
}

View File

@ -1,5 +1,5 @@
#Properties Config file
#Mon Jul 13 05:54:15 ACT 2015
#Tue Jul 14 11:17:25 UTC 2015
motd=Box
server-port=19132
memory-limit=-1