Permalink
Browse files

Fixed improperly reading drop stack chance as an int rather than a do…

…uble.
  • Loading branch information...
me4502 committed Feb 8, 2017
1 parent 29f1a3d commit 7961798105a9dbf78f2f834e02321d9471ed3000
@@ -65,7 +65,7 @@ public void setRegions(List<String> regions) {
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);
@@ -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));
@@ -6,7 +6,7 @@
private ItemStack stack;
- private double chance = 100;
+ private double chance = 100d;
private int minA = -1, maxA = -1;
private String name;

0 comments on commit 7961798

Please sign in to comment.