Fixed bug with fishing treasures throwing an error when treasures list

is empty.
This commit is contained in:
GJ 2012-04-17 15:21:23 -04:00
parent 35f62d4e45
commit f6a6316b7a
2 changed files with 8 additions and 6 deletions

View File

@ -14,7 +14,8 @@ Version 1.3.06-dev
= Fixed bug where {0} would be displayed in front of your power level in mcstats = Fixed bug where {0} would be displayed in front of your power level in mcstats
= Fixed mmoupdate not being useable from console = Fixed mmoupdate not being useable from console
= Fixed bug with repairing wooden tools = Fixed bug with repairing wooden tools
= Fixed bug with Nether Wart not awarding XP = Fixed bug with Nether Wart not awarding XP
= Fixed bug with fishing treasures when treasures list is empty
! Changed mcremove to no longer kick players when they are removed from database ! Changed mcremove to no longer kick players when they are removed from database
! Changed mcremove to work on offline users for FlatFile ! Changed mcremove to work on offline users for FlatFile
! Changed PlayerProfile constructor to always take a boolean ! Changed PlayerProfile constructor to always take a boolean

View File

@ -98,11 +98,13 @@ public class Fishing {
} }
if (LoadProperties.fishingDrops) { if (LoadProperties.fishingDrops) {
FishingTreasure treasure = rewards.get(random.nextInt(rewards.size())); if (rewards.size() > 0) {
FishingTreasure treasure = rewards.get(random.nextInt(rewards.size()));
if (random.nextDouble() * 100 <= treasure.getDropChance()) { if (random.nextDouble() * 100 <= treasure.getDropChance()) {
Users.getProfile(player).addXP(SkillType.FISHING, treasure.getXp()); Users.getProfile(player).addXP(SkillType.FISHING, treasure.getXp());
theCatch.setItemStack(treasure.getDrop()); theCatch.setItemStack(treasure.getDrop());
}
} }
} }
else { else {
@ -115,7 +117,6 @@ public class Fishing {
theCatch.getItemStack().setDurability((short) (random.nextInt(maxDurability))); //Change durability to random value theCatch.getItemStack().setDurability((short) (random.nextInt(maxDurability))); //Change durability to random value
} }
m.mcDropItem(player.getLocation(), new ItemStack(Material.RAW_FISH)); //Always drop a fish
PP.addXP(SkillType.FISHING, LoadProperties.mfishing); PP.addXP(SkillType.FISHING, LoadProperties.mfishing);
Skills.XpCheckSkill(SkillType.FISHING, player); Skills.XpCheckSkill(SkillType.FISHING, player);
} }