Skip to content

Commit

Permalink
Fixed iTXTech#889
Browse files Browse the repository at this point in the history
  • Loading branch information
PeratX committed Apr 30, 2016
1 parent 2e44f94 commit 7c3a49a
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/pocketmine/inventory/EnchantInventory.php
Original file line number Diff line number Diff line change
Expand Up @@ -220,15 +220,14 @@ public function onEnchant(Player $who, Item $before, Item $after){
if($this->checkEnts($enchantments, $this->entries[$i]->getEnchantments())){
$lapis = $this->getItem(1);
$level = $who->getExpLevel();
$cost = $this->entries[$i]->getCost();
if($lapis->getId() == Item::DYE and $lapis->getDamage() == Dye::BLUE and $lapis->getCount() > $i and $level >= $cost){
if($lapis->getId() == Item::DYE and $lapis->getDamage() == Dye::BLUE and $lapis->getCount() > $i and $level >= $i){
foreach($enchantments as $enchantment){
$result->addEnchantment($enchantment);
}
$this->setItem(0, $result);
$lapis->setCount($lapis->getCount() - $i - 1);
$this->setItem(1, $lapis);
$who->setExpLevel($level - $cost);
$who->setExpLevel($level - $i);
break;
}
}
Expand Down

0 comments on commit 7c3a49a

Please sign in to comment.