mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-12-27 02:58:03 +01:00
Fixing formatting
This commit is contained in:
parent
9ae74e0fba
commit
cdd9745341
@ -106,10 +106,8 @@ public class Fishing {
|
||||
break;
|
||||
}
|
||||
|
||||
if (Config.getInstance().getFishingDropsEnabled() && rewards.size() > 0
|
||||
&& Permissions.getInstance().fishingTreasures(player)) {
|
||||
FishingTreasure treasure = rewards.get(random.nextInt(rewards
|
||||
.size()));
|
||||
if (Config.getInstance().getFishingDropsEnabled() && rewards.size() > 0 && Permissions.getInstance().fishingTreasures(player)) {
|
||||
FishingTreasure treasure = rewards.get(random.nextInt(rewards.size()));
|
||||
|
||||
int randomChance = 100;
|
||||
|
||||
@ -118,26 +116,20 @@ public class Fishing {
|
||||
}
|
||||
|
||||
if (random.nextDouble() * randomChance <= treasure.getDropChance()) {
|
||||
Users.getPlayer(player).addXP(SkillType.FISHING,
|
||||
treasure.getXp());
|
||||
Users.getPlayer(player).addXP(SkillType.FISHING,treasure.getXp());
|
||||
theCatch.setItemStack(treasure.getDrop());
|
||||
}
|
||||
} else {
|
||||
theCatch.setItemStack(new ItemStack(Material.RAW_FISH));
|
||||
}
|
||||
|
||||
short maxDurability = theCatch.getItemStack().getType()
|
||||
.getMaxDurability();
|
||||
short maxDurability = theCatch.getItemStack().getType().getMaxDurability();
|
||||
|
||||
if (maxDurability > 0) {
|
||||
theCatch.getItemStack().setDurability(
|
||||
(short) (random.nextInt(maxDurability))); // Change
|
||||
// durability to
|
||||
// random value
|
||||
theCatch.getItemStack().setDurability((short) (random.nextInt(maxDurability))); // Change durability to random value
|
||||
}
|
||||
|
||||
Skills.xpProcessing(player, profile, SkillType.FISHING, Config
|
||||
.getInstance().getFishingBaseXP());
|
||||
Skills.xpProcessing(player, profile, SkillType.FISHING, Config.getInstance().getFishingBaseXP());
|
||||
}
|
||||
|
||||
/**
|
||||
@ -157,8 +149,7 @@ public class Fishing {
|
||||
Item theCatch = (Item) event.getCaught();
|
||||
|
||||
if (theCatch.getItemStack().getType() != Material.RAW_FISH) {
|
||||
final int ENCHANTMENT_CHANCE = advancedConfig
|
||||
.getFishingEnchantmentChance();
|
||||
final int ENCHANTMENT_CHANCE = advancedConfig.getFishingEnchantmentChance();
|
||||
boolean enchanted = false;
|
||||
ItemStack fishingResults = theCatch.getItemStack();
|
||||
|
||||
@ -171,15 +162,12 @@ public class Fishing {
|
||||
randomChance = (int) (randomChance * 0.75);
|
||||
}
|
||||
|
||||
if (random.nextInt(randomChance) <= ENCHANTMENT_CHANCE
|
||||
&& Permissions.getInstance().fishingMagic(player)) {
|
||||
if (random.nextInt(randomChance) <= ENCHANTMENT_CHANCE && Permissions.getInstance().fishingMagic(player)) {
|
||||
for (Enchantment newEnchant : Enchantment.values()) {
|
||||
if (newEnchant.canEnchantItem(fishingResults)) {
|
||||
Map<Enchantment, Integer> resultEnchantments = fishingResults
|
||||
.getEnchantments();
|
||||
Map<Enchantment, Integer> resultEnchantments = fishingResults.getEnchantments();
|
||||
|
||||
for (Enchantment oldEnchant : resultEnchantments
|
||||
.keySet()) {
|
||||
for (Enchantment oldEnchant : resultEnchantments.keySet()) {
|
||||
if (oldEnchant.conflictsWith(newEnchant))
|
||||
continue;
|
||||
}
|
||||
@ -188,23 +176,18 @@ public class Fishing {
|
||||
* Actual chance to have an enchantment is related
|
||||
* to your fishing skill
|
||||
*/
|
||||
if (random.nextInt(15) < Fishing
|
||||
.getFishingLootTier(profile)) {
|
||||
if (random.nextInt(15) < Fishing.getFishingLootTier(profile)) {
|
||||
enchanted = true;
|
||||
int randomEnchantLevel = random
|
||||
.nextInt(newEnchant.getMaxLevel()) + 1;
|
||||
int randomEnchantLevel = random.nextInt(newEnchant.getMaxLevel()) + 1;
|
||||
|
||||
if (randomEnchantLevel < newEnchant
|
||||
.getStartLevel()) {
|
||||
randomEnchantLevel = newEnchant
|
||||
.getStartLevel();
|
||||
if (randomEnchantLevel < newEnchant.getStartLevel()) {
|
||||
randomEnchantLevel = newEnchant.getStartLevel();
|
||||
}
|
||||
|
||||
if (randomEnchantLevel >= 1000)
|
||||
continue;
|
||||
|
||||
fishingResults.addEnchantment(newEnchant,
|
||||
randomEnchantLevel);
|
||||
fishingResults.addEnchantment(newEnchant,randomEnchantLevel);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -237,8 +220,7 @@ public class Fishing {
|
||||
int dropChance = getShakeChance(lootTier);
|
||||
|
||||
if (event.getPlayer().hasPermission("mcmmo.perks.lucky.fishing")) {
|
||||
dropChance = (int) (dropChance * 1.25); // With lucky perk on max
|
||||
// level tier, its 100%
|
||||
dropChance = (int) (dropChance * 1.25); // With lucky perk on max level tier, its 100%
|
||||
}
|
||||
|
||||
final int DROP_CHANCE = random.nextInt(100);
|
||||
|
Loading…
Reference in New Issue
Block a user