Changed bonus to float

Fixes bug where only 1 diamond was needed to fully repair an almost
broken diamond pickaxe
This commit is contained in:
TfT_02 2012-12-24 13:00:50 +01:00
parent bb1dbab984
commit cdb5fed5a5
2 changed files with 4 additions and 6 deletions

View File

@ -14,8 +14,6 @@ import org.bukkit.plugin.PluginDescriptionFile;
import org.bukkit.plugin.PluginManager;
import org.bukkit.plugin.java.JavaPlugin;
import org.bukkit.scheduler.BukkitScheduler;
import org.bukkit.World;
import com.gmail.nossr50.commands.general.AddlevelsCommand;
import com.gmail.nossr50.commands.general.AddxpCommand;
import com.gmail.nossr50.commands.general.InspectCommand;

View File

@ -210,12 +210,12 @@ public class Repair {
* @return The final amount of durability repaired to the item
*/
protected static short repairCalculate(Player player, int skillLevel, short durability, int repairAmount) {
double bonus;
if(skillLevel >= repairMasteryMaxBonusLevel) bonus = (double) repairMasteryChanceMax;
else bonus = ((double) skillLevel / (double) repairMasteryMaxBonusLevel) * (double) repairMasteryChanceMax;
float bonus;
if(skillLevel >= repairMasteryMaxBonusLevel) bonus = repairMasteryChanceMax;
else bonus = (skillLevel / repairMasteryMaxBonusLevel) * repairMasteryChanceMax;
if (permInstance.repairMastery(player)) {
bonus = ((double) repairAmount * bonus);
bonus = (repairAmount * bonus);
repairAmount += (int) bonus;
}