Skip to content

Commit

Permalink
Fixed improperly reading drop stack chance as an int rather than a do…
Browse files Browse the repository at this point in the history
…uble.
  • Loading branch information
me4502 committed Feb 8, 2017
1 parent 29f1a3d commit 7961798
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
Expand Up @@ -65,7 +65,7 @@ public ItemStack[] getRandomDrops() {
List<ItemStack> ndrops = new ArrayList<ItemStack>();

for(DropItemStack drop : drops) {
if(drop.getChance() < CraftBookPlugin.inst().getRandom().nextInt(100)) continue;
if(drop.getChance() < CraftBookPlugin.inst().getRandom().nextDouble()*100d) continue;
ItemStack stack = drop.getStack().clone();
if(drop.getMaximum() >= 0 && drop.getMinimum() >= 0) {
int amount = drop.getMinimum() + CraftBookPlugin.inst().getRandom().nextInt(drop.getMaximum() - drop.getMinimum() + 1);
Expand Down
Expand Up @@ -76,7 +76,7 @@ public boolean load() {

stack.setName(drop);

stack.setChance(config.getInt("custom-drops." + key + ".drops." + drop + ".chance", 100));
stack.setChance(config.getDouble("custom-drops." + key + ".drops." + drop + ".chance", 100d));
stack.setMinimum(config.getInt("custom-drops." + key + ".drops." + drop + ".minimum-amount", -1));
stack.setMaximum(config.getInt("custom-drops." + key + ".drops." + drop + ".maximum-amount", -1));

Expand Down
Expand Up @@ -6,7 +6,7 @@ public class DropItemStack {

private ItemStack stack;

private double chance = 100;
private double chance = 100d;
private int minA = -1, maxA = -1;
private String name;

Expand Down

0 comments on commit 7961798

Please sign in to comment.