mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-26 07:06:45 +01:00
Changed Fishing to always give a fish on a successful catch
This commit is contained in:
parent
d601496173
commit
188ad359fe
@ -25,9 +25,13 @@ Version 1.4.00-dev
|
||||
= Fixed Leaf Blower not respecting the unlock level set in advanced.yml
|
||||
= Fixed abilities activating with the wrong tool in hand
|
||||
= Fixed Experience.Gains.Mobspawners.Enabled not being used correctly (the check was inverted)
|
||||
<<<<<<< Upstream, based on origin/master
|
||||
= Fixed bug where Iron Grip was using the attacker's skill values rather than the defender's.
|
||||
= Fixed a bug where /party kick would trigger the PartyChangeEvent for the wrong player
|
||||
= Fixed a bug where party join messages weren't displayed
|
||||
=======
|
||||
! A Fishing catch will now always contains a fish even if a treasure is found
|
||||
>>>>>>> 1f7a94a Changed Fishing to always give a fish on a successful catch
|
||||
! Changed how Berserk handles not picking up items to avoid listening to PlayerPickupItemEvent
|
||||
! Moved Hylian Luck into a separate listener since it actually cancels the event and shouldn't just be on MONITOR.
|
||||
! Changed how Tree Feller is handled, it should now put less stress on the CPU
|
||||
|
@ -116,27 +116,27 @@ public class Fishing {
|
||||
}
|
||||
}
|
||||
|
||||
if (rewards.size() <= 0) {
|
||||
if (rewards.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
FishingTreasure foundTreasure = rewards.get(Misc.getRandom().nextInt(rewards.size()));
|
||||
FishingTreasure treasure = rewards.get(Misc.getRandom().nextInt(rewards.size()));
|
||||
ItemStack treasureDrop = treasure.getDrop();
|
||||
|
||||
int activationChance = Misc.calculateActivationChance(Permissions.luckyFishing(player));
|
||||
|
||||
if (Misc.getRandom().nextDouble() * activationChance <= foundTreasure.getDropChance()) {
|
||||
Users.getPlayer(player).addXP(SkillType.FISHING, foundTreasure.getXp());
|
||||
theCatch.setItemStack(foundTreasure.getDrop());
|
||||
}
|
||||
}
|
||||
else {
|
||||
theCatch.setItemStack(new ItemStack(Material.RAW_FISH));
|
||||
}
|
||||
if (Misc.getRandom().nextDouble() * activationChance <= treasure.getDropChance()) {
|
||||
player.getWorld().dropItem(player.getEyeLocation(), theCatch.getItemStack()); // Drop the original item
|
||||
|
||||
short maxDurability = theCatch.getItemStack().getType().getMaxDurability();
|
||||
short maxDurability = treasureDrop.getType().getMaxDurability();
|
||||
|
||||
if (maxDurability > 0) {
|
||||
theCatch.getItemStack().setDurability((short) (Misc.getRandom().nextInt(maxDurability))); // Change durability to random value
|
||||
treasureDrop.setDurability((short) (Misc.getRandom().nextInt(maxDurability))); // Change durability to random value
|
||||
}
|
||||
|
||||
theCatch.setItemStack(treasureDrop);
|
||||
Users.getPlayer(player).addXP(SkillType.FISHING, treasure.getXp());
|
||||
}
|
||||
}
|
||||
|
||||
Skills.xpProcessing(player, profile, SkillType.FISHING, Config.getInstance().getFishingBaseXP());
|
||||
|
Loading…
Reference in New Issue
Block a user