Cleanup formatting.

This commit is contained in:
Grant 2012-12-24 16:56:25 -05:00
parent 6b3bde585d
commit 36d5344ded
67 changed files with 894 additions and 849 deletions

View File

@ -7,7 +7,7 @@ Key:
! Change ! Change
- Removal - Removal
Version 1.3.13 Version 1.3.13-dev
+ Added Craftbukkit 1.4.6 compatibility + Added Craftbukkit 1.4.6 compatibility
= Fixed issue with missing default cases from several switch/case statements = Fixed issue with missing default cases from several switch/case statements
= Fixed issue with Mining using actual skill level rather than max skill level = Fixed issue with Mining using actual skill level rather than max skill level

View File

@ -36,13 +36,13 @@ public class AcrobaticsCommand extends SkillCommand {
DecimalFormat df = new DecimalFormat("#.0"); DecimalFormat df = new DecimalFormat("#.0");
// DODGE // DODGE
if(skillValue >= dodgeMaxBonusLevel) dodgeChance = df.format(dodgeChanceMax); if(skillValue >= dodgeMaxBonusLevel) dodgeChance = df.format(dodgeChanceMax);
else dodgeChance = df.format(((double) dodgeChanceMax / (double) dodgeMaxBonusLevel) * (double) skillValue); else dodgeChance = df.format(((double) dodgeChanceMax / (double) dodgeMaxBonusLevel) * skillValue);
// ROLL // ROLL
if(skillValue >= rollMaxBonusLevel) rollChance = df.format(rollChanceMax); if(skillValue >= rollMaxBonusLevel) rollChance = df.format(rollChanceMax);
else rollChance = df.format(((double) rollChanceMax / (double) rollMaxBonusLevel) * (double) skillValue); else rollChance = df.format(((double) rollChanceMax / (double) rollMaxBonusLevel) * skillValue);
// GRACEFULROLL // GRACEFULROLL
if(skillValue >= gracefulRollMaxBonusLevel) gracefulRollChance = df.format(gracefulRollChanceMax); if(skillValue >= gracefulRollMaxBonusLevel) gracefulRollChance = df.format(gracefulRollChanceMax);
else gracefulRollChance = df.format(((double) gracefulRollChanceMax / (double) gracefulRollMaxBonusLevel) * (double) skillValue); else gracefulRollChance = df.format(((double) gracefulRollChanceMax / (double) gracefulRollMaxBonusLevel) * skillValue);
} }
@Override @Override

View File

@ -39,17 +39,17 @@ public class ArcheryCommand extends SkillCommand {
protected void dataCalculations() { protected void dataCalculations() {
DecimalFormat df = new DecimalFormat("#.0"); DecimalFormat df = new DecimalFormat("#.0");
// SkillShot // SkillShot
double bonus = (int)((double) skillValue / (double) skillShotIncreaseLevel) * (double) skillShotIncreasePercentage; double bonus = (int)((double) skillValue / (double) skillShotIncreaseLevel) * skillShotIncreasePercentage;
if (bonus > skillShotBonusMax) skillShotBonus = percent.format(skillShotBonusMax); if (bonus > skillShotBonusMax) skillShotBonus = percent.format(skillShotBonusMax);
else skillShotBonus = percent.format(bonus); else skillShotBonus = percent.format(bonus);
// Daze // Daze
if(skillValue >= dazeMaxBonusLevel) dazeChance = df.format(dazeBonusMax); if(skillValue >= dazeMaxBonusLevel) dazeChance = df.format(dazeBonusMax);
else dazeChance = df.format(((double) dazeBonusMax / (double) dazeMaxBonusLevel) * (double) skillValue); else dazeChance = df.format(((double) dazeBonusMax / (double) dazeMaxBonusLevel) * skillValue);
// Retrieve // Retrieve
if(skillValue >= retrieveMaxBonusLevel) retrieveChance = df.format(retrieveBonusMax); if(skillValue >= retrieveMaxBonusLevel) retrieveChance = df.format(retrieveBonusMax);
else retrieveChance = df.format(((double) retrieveBonusMax / (double) retrieveMaxBonusLevel) * (double) skillValue); else retrieveChance = df.format(((double) retrieveBonusMax / (double) retrieveMaxBonusLevel) * skillValue);
} }
@Override @Override

View File

@ -47,9 +47,9 @@ public class AxesCommand extends SkillCommand {
greaterImpactDamage = "2"; greaterImpactDamage = "2";
if (skillValue >= critMaxBonusLevel) critChance = df.format(critMaxChance); if (skillValue >= critMaxBonusLevel) critChance = df.format(critMaxChance);
else critChance = String.valueOf(((double) critMaxChance / (double) critMaxBonusLevel) * (double) skillCheck); else critChance = String.valueOf((critMaxChance / critMaxBonusLevel) * skillCheck);
if (skillValue >= bonusDamageAxesMaxBonusLevel) bonusDamage = String.valueOf(bonusDamageAxesBonusMax); if (skillValue >= bonusDamageAxesMaxBonusLevel) bonusDamage = String.valueOf(bonusDamageAxesBonusMax);
else bonusDamage = String.valueOf((double) skillValue / ((double) bonusDamageAxesMaxBonusLevel / (double) bonusDamageAxesBonusMax)); else bonusDamage = String.valueOf(skillValue / ((double) bonusDamageAxesMaxBonusLevel / (double) bonusDamageAxesBonusMax));
} }
@Override @Override

View File

@ -30,10 +30,10 @@ public class FishingCommand extends SkillCommand {
@Override @Override
protected void dataCalculations() { protected void dataCalculations() {
lootTier = Fishing.getFishingLootTier(profile); lootTier = Fishing.getFishingLootTier(profile);
magicChance = percent.format((double) lootTier / 15D); magicChance = percent.format(lootTier / 15D);
int dropChance = Fishing.getShakeChance(lootTier); int dropChance = Fishing.getShakeChance(lootTier);
if (player.hasPermission("mcmmo.perks.lucky.fishing")) { if (player.hasPermission("mcmmo.perks.lucky.fishing")) {
dropChance = (int) ((double) dropChance * 1.25D); dropChance = (int) (dropChance * 1.25D);
} }
shakeChance = String.valueOf(dropChance); shakeChance = String.valueOf(dropChance);

View File

@ -53,10 +53,10 @@ public class HerbalismCommand extends SkillCommand {
if(skillValue >= greenThumbMaxLevel) greenThumbChance = String.valueOf(greenThumbMaxBonus); if(skillValue >= greenThumbMaxLevel) greenThumbChance = String.valueOf(greenThumbMaxBonus);
else greenThumbChance = String.valueOf(((double) greenThumbMaxBonus / (double) greenThumbMaxLevel) * (double) skillValue); else greenThumbChance = String.valueOf((greenThumbMaxBonus / greenThumbMaxLevel) * skillValue);
//DOUBLE DROPS //DOUBLE DROPS
if(skillValue >= doubleDropsMaxLevel) doubleDropChance = df.format(doubleDropsMaxBonus); if(skillValue >= doubleDropsMaxLevel) doubleDropChance = df.format(doubleDropsMaxBonus);
else doubleDropChance = df.format(((double) doubleDropsMaxBonus / (double) doubleDropsMaxLevel) * (double) skillValue); else doubleDropChance = df.format((doubleDropsMaxBonus / doubleDropsMaxLevel) * skillValue);
} }
@Override @Override

View File

@ -48,7 +48,7 @@ public class MiningCommand extends SkillCommand {
DecimalFormat df = new DecimalFormat("#.0"); DecimalFormat df = new DecimalFormat("#.0");
superBreakerLength = String.valueOf(2 + (int) ((double) skillValue / (double) abilityLengthIncreaseLevel)); superBreakerLength = String.valueOf(2 + (int) ((double) skillValue / (double) abilityLengthIncreaseLevel));
if(skillValue >= doubleDropsMaxLevel) doubleDropChance = df.format(doubleDropsMaxBonus); if(skillValue >= doubleDropsMaxLevel) doubleDropChance = df.format(doubleDropsMaxBonus);
else doubleDropChance = df.format(((double) doubleDropsMaxBonus / (double) doubleDropsMaxLevel) * (double) skillValue); else doubleDropChance = df.format((doubleDropsMaxBonus / doubleDropsMaxLevel) * skillValue);
if (skillValue >= blastMiningRank8) { if (skillValue >= blastMiningRank8) {
blastMiningRank = "8"; blastMiningRank = "8";

View File

@ -64,10 +64,10 @@ public class RepairCommand extends SkillCommand {
salvageLevel = Config.getInstance().getSalvageUnlockLevel(); salvageLevel = Config.getInstance().getSalvageUnlockLevel();
if(skillValue >= repairMasteryMaxBonusLevel) repairMasteryBonus = df.format(repairMasteryChanceMax); if(skillValue >= repairMasteryMaxBonusLevel) repairMasteryBonus = df.format(repairMasteryChanceMax);
else repairMasteryBonus = df.format(((double) repairMasteryChanceMax / (double) repairMasteryMaxBonusLevel) * (double) skillValue); else repairMasteryBonus = df.format(((double) repairMasteryChanceMax / (double) repairMasteryMaxBonusLevel) * skillValue);
if(skillValue >= superRepairMaxBonusLevel) superRepairChance = df.format(superRepairChanceMax); if(skillValue >= superRepairMaxBonusLevel) superRepairChance = df.format(superRepairChanceMax);
else superRepairChance = df.format(((double) superRepairChanceMax / (double) superRepairMaxBonusLevel) * (double) skillValue); else superRepairChance = df.format(((double) superRepairChanceMax / (double) superRepairMaxBonusLevel) * skillValue);
arcaneForgingRank = Repair.getArcaneForgingRank(profile); arcaneForgingRank = Repair.getArcaneForgingRank(profile);
} }

View File

@ -43,10 +43,10 @@ public class SwordsCommand extends SkillCommand {
else bleedLength = String.valueOf(bleedBaseTicks); else bleedLength = String.valueOf(bleedBaseTicks);
if(skillValue >= bleedMaxLevel) bleedChance = df.format(bleedChanceMax); if(skillValue >= bleedMaxLevel) bleedChance = df.format(bleedChanceMax);
else bleedChance = df.format(((double) bleedChanceMax / (double) bleedMaxLevel) * (double) skillValue); else bleedChance = df.format(((double) bleedChanceMax / (double) bleedMaxLevel) * skillValue);
if(skillValue >= counterMaxLevel) counterAttackChance = df.format(counterChanceMax); if(skillValue >= counterMaxLevel) counterAttackChance = df.format(counterChanceMax);
else counterAttackChance = df.format(((double) counterChanceMax / (double) counterMaxLevel) * (double) skillValue); else counterAttackChance = df.format(((double) counterChanceMax / (double) counterMaxLevel) * skillValue);
serratedStrikesLength = String.valueOf(serratedBleedTicks); serratedStrikesLength = String.valueOf(serratedBleedTicks);
} }

View File

@ -40,7 +40,7 @@ public class TamingCommand extends SkillCommand {
protected void dataCalculations() { protected void dataCalculations() {
DecimalFormat df = new DecimalFormat("#.0"); DecimalFormat df = new DecimalFormat("#.0");
if(skillValue >= goreMaxLevel) goreChance = df.format(goreChanceMax); if(skillValue >= goreMaxLevel) goreChance = df.format(goreChanceMax);
else goreChance = df.format(((double) goreChanceMax / (double) goreMaxLevel) * (double) skillValue); else goreChance = df.format(((double) goreChanceMax / (double) goreMaxLevel) * skillValue);
} }
@Override @Override

View File

@ -39,10 +39,10 @@ public class UnarmedCommand extends SkillCommand {
berserkLength = String.valueOf(2 + (int) ((double) skillValue / (double) abilityLengthIncreaseLevel)); berserkLength = String.valueOf(2 + (int) ((double) skillValue / (double) abilityLengthIncreaseLevel));
if(skillValue >= disarmMaxLevel) disarmChance = df.format(disarmChanceMax); if(skillValue >= disarmMaxLevel) disarmChance = df.format(disarmChanceMax);
else disarmChance = df.format(((double) disarmChanceMax / (double) disarmMaxLevel) * (double) skillValue); else disarmChance = df.format(((double) disarmChanceMax / (double) disarmMaxLevel) * skillValue);
if(skillValue >= deflectMaxLevel) deflectChance = df.format(deflectChanceMax); if(skillValue >= deflectMaxLevel) deflectChance = df.format(deflectChanceMax);
else deflectChance = df.format(((double) deflectChanceMax / (double) deflectMaxLevel) * (double) skillValue); else deflectChance = df.format(((double) deflectChanceMax / (double) deflectMaxLevel) * skillValue);
if (skillValue >= 250) ironArmBonus = String.valueOf(ironArmMaxBonus); if (skillValue >= 250) ironArmBonus = String.valueOf(ironArmMaxBonus);
else ironArmBonus = String.valueOf(3 + ((double) skillValue / (double) ironArmIncreaseLevel)); else ironArmBonus = String.valueOf(3 + ((double) skillValue / (double) ironArmIncreaseLevel));

View File

@ -35,7 +35,7 @@ public class WoodcuttingCommand extends SkillCommand {
treeFellerLength = String.valueOf(2 + (int) ((double) skillValue / (double) abilityLengthIncreaseLevel)); treeFellerLength = String.valueOf(2 + (int) ((double) skillValue / (double) abilityLengthIncreaseLevel));
if(skillValue >= doubleDropsMaxLevel) doubleDropChance = df.format(doubleDropsMaxBonus); if(skillValue >= doubleDropsMaxLevel) doubleDropChance = df.format(doubleDropsMaxBonus);
else doubleDropChance = df.format(((double) doubleDropsMaxBonus / (double) doubleDropsMaxLevel) * (double) skillValue); else doubleDropChance = df.format((doubleDropsMaxBonus / doubleDropsMaxLevel) * skillValue);
} }
@Override @Override

View File

@ -32,6 +32,7 @@ public class BlockStoreConversionMain implements Runnable {
return; return;
} }
@Override
public void run() { public void run() {
if(!this.dataDir.exists()) { if(!this.dataDir.exists()) {
softStop(); softStop();

View File

@ -33,6 +33,7 @@ public class BlockStoreConversionXDirectory implements Runnable {
return; return;
} }
@Override
public void run() { public void run() {
if(!this.dataDir.exists()) { if(!this.dataDir.exists()) {
stop(); stop();

View File

@ -47,6 +47,7 @@ public class BlockStoreConversionZDirectory implements Runnable {
return; return;
} }
@Override
public void run() { public void run() {
if(!this.dataDir.exists()) { if(!this.dataDir.exists()) {
stop(); stop();

View File

@ -57,7 +57,7 @@ public class ArcheryManager {
if (player.hasPermission("mcmmo.perks.lucky.archery")) { if (player.hasPermission("mcmmo.perks.lucky.archery")) {
randomChance = (int) (randomChance * 0.75); randomChance = (int) (randomChance * 0.75);
} }
final float chance = (float) (((double) retrieveBonusMax / (double) retrieveMaxBonusLevel) * (double) skillLevel); final float chance = (float) (((double) retrieveBonusMax / (double) retrieveMaxBonusLevel) * skillLevel);
if (chance > Archery.getRandom().nextInt(randomChance)) { if (chance > Archery.getRandom().nextInt(randomChance)) {
eventHandler.addToTracker(); eventHandler.addToTracker();
} }
@ -88,7 +88,7 @@ public class ArcheryManager {
randomChance = (int) (randomChance * 0.75); randomChance = (int) (randomChance * 0.75);
} }
final float chance = (float) (((double) dazeBonusMax / (double) dazeMaxBonusLevel) * (double) skillLevel); final float chance = (float) (((double) dazeBonusMax / (double) dazeMaxBonusLevel) * skillLevel);
if (chance > Archery.getRandom().nextInt(randomChance)) { if (chance > Archery.getRandom().nextInt(randomChance)) {
eventHandler.handleDazeEffect(); eventHandler.handleDazeEffect();
eventHandler.sendAbilityMessages(); eventHandler.sendAbilityMessages();

View File

@ -87,7 +87,7 @@ public class Axes {
int skillCheck = Misc.skillCheck(skillLevel, MAX_BONUS_LEVEL); int skillCheck = Misc.skillCheck(skillLevel, MAX_BONUS_LEVEL);
int randomChance = 100; int randomChance = 100;
double chance = ((double) MAX_CHANCE / (double) MAX_BONUS_LEVEL) * (double) skillCheck; double chance = (MAX_CHANCE / MAX_BONUS_LEVEL) * skillCheck;
if (attacker.hasPermission("mcmmo.perks.lucky.axes")) { if (attacker.hasPermission("mcmmo.perks.lucky.axes")) {
randomChance = (int) (randomChance * 0.75); randomChance = (int) (randomChance * 0.75);

View File

@ -41,7 +41,8 @@ public class Fishing {
/** /**
* Get the player's current fishing loot tier. * Get the player's current fishing loot tier.
* *
* @param profile The profile of the player * @param profile
* The profile of the player
* @return the player's current fishing rank * @return the player's current fishing rank
*/ */
public static int getFishingLootTier(PlayerProfile profile) { public static int getFishingLootTier(PlayerProfile profile) {
@ -50,17 +51,13 @@ public class Fishing {
if (level >= Config.getInstance().getFishingTierLevelsTier5()) { if (level >= Config.getInstance().getFishingTierLevelsTier5()) {
fishingTier = 5; fishingTier = 5;
} } else if (level >= Config.getInstance().getFishingTierLevelsTier4()) {
else if (level >= Config.getInstance().getFishingTierLevelsTier4()) {
fishingTier = 4; fishingTier = 4;
} } else if (level >= Config.getInstance().getFishingTierLevelsTier3()) {
else if (level >= Config.getInstance().getFishingTierLevelsTier3()) {
fishingTier = 3; fishingTier = 3;
} } else if (level >= Config.getInstance().getFishingTierLevelsTier2()) {
else if (level >= Config.getInstance().getFishingTierLevelsTier2()) {
fishingTier = 2; fishingTier = 2;
} } else {
else {
fishingTier = 1; fishingTier = 1;
} }
@ -70,8 +67,10 @@ public class Fishing {
/** /**
* Get item results from Fishing. * Get item results from Fishing.
* *
* @param player The player that was fishing * @param player
* @param event The event to modify * The player that was fishing
* @param event
* The event to modify
*/ */
private static void getFishingResults(Player player, PlayerFishEvent event) { private static void getFishingResults(Player player, PlayerFishEvent event) {
if (player == null) if (player == null)
@ -106,8 +105,10 @@ public class Fishing {
break; break;
} }
if (Config.getInstance().getFishingDropsEnabled() && rewards.size() > 0 && Permissions.getInstance().fishingTreasures(player)) { if (Config.getInstance().getFishingDropsEnabled() && rewards.size() > 0
FishingTreasure treasure = rewards.get(random.nextInt(rewards.size())); && Permissions.getInstance().fishingTreasures(player)) {
FishingTreasure treasure = rewards.get(random.nextInt(rewards
.size()));
int randomChance = 100; int randomChance = 100;
@ -116,27 +117,33 @@ public class Fishing {
} }
if (random.nextDouble() * randomChance <= treasure.getDropChance()) { 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()); theCatch.setItemStack(treasure.getDrop());
} }
} } else {
else {
theCatch.setItemStack(new ItemStack(Material.RAW_FISH)); theCatch.setItemStack(new ItemStack(Material.RAW_FISH));
} }
short maxDurability = theCatch.getItemStack().getType().getMaxDurability(); short maxDurability = theCatch.getItemStack().getType()
.getMaxDurability();
if (maxDurability > 0) { 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());
} }
/** /**
* Process results from Fishing. * Process results from Fishing.
* *
* @param event The event to modify * @param event
* The event to modify
*/ */
public static void processResults(PlayerFishEvent event) { public static void processResults(PlayerFishEvent event) {
Player player = event.getPlayer(); Player player = event.getPlayer();
@ -149,7 +156,8 @@ public class Fishing {
Item theCatch = (Item) event.getCaught(); Item theCatch = (Item) event.getCaught();
if (theCatch.getItemStack().getType() != Material.RAW_FISH) { if (theCatch.getItemStack().getType() != Material.RAW_FISH) {
final int ENCHANTMENT_CHANCE = advancedConfig.getFishingEnchantmentChance(); final int ENCHANTMENT_CHANCE = advancedConfig
.getFishingEnchantmentChance();
boolean enchanted = false; boolean enchanted = false;
ItemStack fishingResults = theCatch.getItemStack(); ItemStack fishingResults = theCatch.getItemStack();
@ -162,29 +170,40 @@ public class Fishing {
randomChance = (int) (randomChance * 0.75); 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()) { for (Enchantment newEnchant : Enchantment.values()) {
if (newEnchant.canEnchantItem(fishingResults)) { 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)) if (oldEnchant.conflictsWith(newEnchant))
continue; continue;
} }
/* Actual chance to have an enchantment is related to your fishing skill */ /*
if (random.nextInt(15) < Fishing.getFishingLootTier(profile)) { * Actual chance to have an enchantment is related
* to your fishing skill
*/
if (random.nextInt(15) < Fishing
.getFishingLootTier(profile)) {
enchanted = true; enchanted = true;
int randomEnchantLevel = random.nextInt(newEnchant.getMaxLevel()) + 1; int randomEnchantLevel = random
.nextInt(newEnchant.getMaxLevel()) + 1;
if (randomEnchantLevel < newEnchant.getStartLevel()) { if (randomEnchantLevel < newEnchant
randomEnchantLevel = newEnchant.getStartLevel(); .getStartLevel()) {
randomEnchantLevel = newEnchant
.getStartLevel();
} }
if (randomEnchantLevel >= 1000) if (randomEnchantLevel >= 1000)
continue; continue;
fishingResults.addEnchantment(newEnchant, randomEnchantLevel); fishingResults.addEnchantment(newEnchant,
randomEnchantLevel);
} }
} }
} }
@ -200,7 +219,8 @@ public class Fishing {
/** /**
* Shake a mob, have them drop an item. * Shake a mob, have them drop an item.
* *
* @param event The event to modify * @param event
* The event to modify
*/ */
public static void shakeMob(PlayerFishEvent event) { public static void shakeMob(PlayerFishEvent event) {
int randomChance = 100; int randomChance = 100;
@ -216,7 +236,8 @@ public class Fishing {
int dropChance = getShakeChance(lootTier); int dropChance = getShakeChance(lootTier);
if (event.getPlayer().hasPermission("mcmmo.perks.lucky.fishing")) { 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); final int DROP_CHANCE = random.nextInt(100);
@ -263,7 +284,8 @@ public class Fishing {
case CREEPER: case CREEPER:
if (DROP_NUMBER > 97) { if (DROP_NUMBER > 97) {
Misc.dropItem(location, new ItemStack(Material.SKULL_ITEM, 1, (short) 4)); Misc.dropItem(location, new ItemStack(Material.SKULL_ITEM,
1, (short) 4));
} else { } else {
Misc.dropItem(location, new ItemStack(Material.SULPHUR)); Misc.dropItem(location, new ItemStack(Material.SULPHUR));
} }
@ -299,14 +321,17 @@ public class Fishing {
if (DROP_NUMBER > 95) { if (DROP_NUMBER > 95) {
Misc.dropItem(location, new ItemStack(Material.MILK_BUCKET)); Misc.dropItem(location, new ItemStack(Material.MILK_BUCKET));
} else if (DROP_NUMBER > 90) { } else if (DROP_NUMBER > 90) {
Misc.dropItem(location, new ItemStack(Material.MUSHROOM_SOUP)); Misc.dropItem(location, new ItemStack(
Material.MUSHROOM_SOUP));
} else if (DROP_NUMBER > 60) { } else if (DROP_NUMBER > 60) {
Misc.dropItem(location, new ItemStack(Material.LEATHER)); Misc.dropItem(location, new ItemStack(Material.LEATHER));
} else if (DROP_NUMBER > 30) { } else if (DROP_NUMBER > 30) {
Misc.dropItem(location, new ItemStack(Material.RAW_BEEF)); Misc.dropItem(location, new ItemStack(Material.RAW_BEEF));
} else { } else {
Misc.dropItem(location, new ItemStack(Material.RED_MUSHROOM)); Misc.dropItem(location,
Misc.randomDropItems(location, new ItemStack(Material.RED_MUSHROOM), 50, 2); new ItemStack(Material.RED_MUSHROOM));
Misc.randomDropItems(location, new ItemStack(
Material.RED_MUSHROOM), 50, 2);
} }
break; break;
@ -316,7 +341,8 @@ public class Fishing {
case PIG_ZOMBIE: case PIG_ZOMBIE:
if (DROP_NUMBER > 50) { if (DROP_NUMBER > 50) {
Misc.dropItem(location, new ItemStack(Material.ROTTEN_FLESH)); Misc.dropItem(location,
new ItemStack(Material.ROTTEN_FLESH));
} else { } else {
Misc.dropItem(location, new ItemStack(Material.GOLD_NUGGET)); Misc.dropItem(location, new ItemStack(Material.GOLD_NUGGET));
} }
@ -340,21 +366,25 @@ public class Fishing {
case SKELETON: case SKELETON:
if (((Skeleton) le).getSkeletonType() == SkeletonType.WITHER) { if (((Skeleton) le).getSkeletonType() == SkeletonType.WITHER) {
if (DROP_NUMBER > 97) { if (DROP_NUMBER > 97) {
Misc.dropItem(location, new ItemStack(Material.SKULL_ITEM, 1, (short) 1)); Misc.dropItem(location, new ItemStack(
Material.SKULL_ITEM, 1, (short) 1));
} else if (DROP_NUMBER > 50) { } else if (DROP_NUMBER > 50) {
Misc.dropItem(location, new ItemStack(Material.BONE)); Misc.dropItem(location, new ItemStack(Material.BONE));
} else { } else {
Misc.dropItem(location, new ItemStack(Material.COAL)); Misc.dropItem(location, new ItemStack(Material.COAL));
Misc.randomDropItems(location, new ItemStack(Material.COAL), 50, 2); Misc.randomDropItems(location, new ItemStack(
Material.COAL), 50, 2);
} }
} else { } else {
if (DROP_NUMBER > 97) { if (DROP_NUMBER > 97) {
Misc.dropItem(location, new ItemStack(Material.SKULL_ITEM)); Misc.dropItem(location, new ItemStack(
Material.SKULL_ITEM));
} else if (DROP_NUMBER > 50) { } else if (DROP_NUMBER > 50) {
Misc.dropItem(location, new ItemStack(Material.BONE)); Misc.dropItem(location, new ItemStack(Material.BONE));
} else { } else {
Misc.dropItem(location, new ItemStack(Material.ARROW)); Misc.dropItem(location, new ItemStack(Material.ARROW));
Misc.randomDropItems(location, new ItemStack(Material.ARROW), 50, 2); Misc.randomDropItems(location, new ItemStack(
Material.ARROW), 50, 2);
} }
} }
break; break;
@ -368,7 +398,8 @@ public class Fishing {
Misc.dropItem(location, new ItemStack(Material.PUMPKIN)); Misc.dropItem(location, new ItemStack(Material.PUMPKIN));
} else { } else {
Misc.dropItem(location, new ItemStack(Material.SNOW_BALL)); Misc.dropItem(location, new ItemStack(Material.SNOW_BALL));
Misc.randomDropItems(location, new ItemStack(Material.SNOW_BALL), 50, 4); Misc.randomDropItems(location, new ItemStack(
Material.SNOW_BALL), 50, 4);
} }
break; break;
@ -381,30 +412,38 @@ public class Fishing {
break; break;
case SQUID: case SQUID:
Misc.dropItem(location, new ItemStack(Material.INK_SACK, 1, (short) 0)); Misc.dropItem(location, new ItemStack(Material.INK_SACK, 1,
(short) 0));
break; break;
case WITCH: case WITCH:
final int DROP_NUMBER_2 = random.nextInt(randomChance) + 1; final int DROP_NUMBER_2 = random.nextInt(randomChance) + 1;
if (DROP_NUMBER > 95) { if (DROP_NUMBER > 95) {
if (DROP_NUMBER_2 > 66) { if (DROP_NUMBER_2 > 66) {
Misc.dropItem(location, new ItemStack(Material.POTION, 1, (short) 8197)); Misc.dropItem(location, new ItemStack(Material.POTION,
1, (short) 8197));
} else if (DROP_NUMBER_2 > 33) { } else if (DROP_NUMBER_2 > 33) {
Misc.dropItem(location, new ItemStack(Material.POTION, 1, (short) 8195)); Misc.dropItem(location, new ItemStack(Material.POTION,
1, (short) 8195));
} else { } else {
Misc.dropItem(location, new ItemStack(Material.POTION, 1, (short) 8194)); Misc.dropItem(location, new ItemStack(Material.POTION,
1, (short) 8194));
} }
} else { } else {
if (DROP_NUMBER_2 > 88) { if (DROP_NUMBER_2 > 88) {
Misc.dropItem(location, new ItemStack(Material.GLASS_BOTTLE)); Misc.dropItem(location, new ItemStack(
Material.GLASS_BOTTLE));
} else if (DROP_NUMBER_2 > 75) { } else if (DROP_NUMBER_2 > 75) {
Misc.dropItem(location, new ItemStack(Material.GLOWSTONE_DUST)); Misc.dropItem(location, new ItemStack(
Material.GLOWSTONE_DUST));
} else if (DROP_NUMBER_2 > 63) { } else if (DROP_NUMBER_2 > 63) {
Misc.dropItem(location, new ItemStack(Material.SULPHUR)); Misc.dropItem(location, new ItemStack(Material.SULPHUR));
} else if (DROP_NUMBER_2 > 50) { } else if (DROP_NUMBER_2 > 50) {
Misc.dropItem(location, new ItemStack(Material.REDSTONE)); Misc.dropItem(location,
new ItemStack(Material.REDSTONE));
} else if (DROP_NUMBER_2 > 38) { } else if (DROP_NUMBER_2 > 38) {
Misc.dropItem(location, new ItemStack(Material.SPIDER_EYE)); Misc.dropItem(location, new ItemStack(
Material.SPIDER_EYE));
} else if (DROP_NUMBER_2 > 25) { } else if (DROP_NUMBER_2 > 25) {
Misc.dropItem(location, new ItemStack(Material.STICK)); Misc.dropItem(location, new ItemStack(Material.STICK));
} else if (DROP_NUMBER_2 > 13) { } else if (DROP_NUMBER_2 > 13) {
@ -417,9 +456,11 @@ public class Fishing {
case ZOMBIE: case ZOMBIE:
if (DROP_NUMBER > 97) { if (DROP_NUMBER > 97) {
Misc.dropItem(location, new ItemStack(Material.SKULL_ITEM, 1, (short) 2)); Misc.dropItem(location, new ItemStack(Material.SKULL_ITEM,
1, (short) 2));
} else { } else {
Misc.dropItem(location, new ItemStack(Material.ROTTEN_FLESH)); Misc.dropItem(location,
new ItemStack(Material.ROTTEN_FLESH));
} }
break; break;
@ -430,10 +471,12 @@ public class Fishing {
Combat.dealDamage(le, 1); Combat.dealDamage(le, 1);
} }
/** /**
* Gets chance of shake success. * Gets chance of shake success.
* *
* @param rank Treasure hunter rank * @param rank
* Treasure hunter rank
* @return The chance of a successful shake * @return The chance of a successful shake
*/ */
public static int getShakeChance(int lootTier) { public static int getShakeChance(int lootTier) {

View File

@ -205,7 +205,7 @@ public class Herbalism {
break; break;
case COCOA: case COCOA:
if ((((byte) data) & 0x8) == 0x8) { if (((data) & 0x8) == 0x8) {
mat = Material.COCOA; mat = Material.COCOA;
xp = Config.getInstance().getHerbalismXPCocoa(); xp = Config.getInstance().getHerbalismXPCocoa();

View File

@ -329,7 +329,7 @@ public class Mining {
int skillCheck = Misc.skillCheck(skillLevel, MAX_BONUS_LEVEL); int skillCheck = Misc.skillCheck(skillLevel, MAX_BONUS_LEVEL);
int randomChance = 100; int randomChance = 100;
int chance = (int) (((double) MAX_CHANCE / (double) MAX_BONUS_LEVEL) * (double) skillCheck); int chance = (int) (((double) MAX_CHANCE / (double) MAX_BONUS_LEVEL) * skillCheck);
if (player.hasPermission("mcmmo.perks.lucky.mining")) { if (player.hasPermission("mcmmo.perks.lucky.mining")) {
randomChance = (int) (randomChance * 0.75); randomChance = (int) (randomChance * 0.75);

View File

@ -345,7 +345,7 @@ public class WoodCutting {
Material mat = Material.getMaterial(block.getTypeId()); Material mat = Material.getMaterial(block.getTypeId());
int randomChance = 100; int randomChance = 100;
int chance = (int) (((double) MAX_CHANCE / (double) MAX_BONUS_LEVEL) * (double) skillLevel); int chance = (int) (((double) MAX_CHANCE / (double) MAX_BONUS_LEVEL) * skillLevel);
if (player.hasPermission("mcmmo.perks.lucky.woodcutting")) { if (player.hasPermission("mcmmo.perks.lucky.woodcutting")) {
randomChance = (int) (randomChance * 0.75); randomChance = (int) (randomChance * 0.75);

View File

@ -248,7 +248,7 @@ public class Repair {
int skillLevel = Users.getProfile(player).getSkillLevel(SkillType.REPAIR); int skillLevel = Users.getProfile(player).getSkillLevel(SkillType.REPAIR);
int randomChance = 100; int randomChance = 100;
int chance = (int) (((double) MAX_CHANCE / (double) MAX_BONUS_LEVEL) * (double) skillLevel); int chance = (int) (((double) MAX_CHANCE / (double) MAX_BONUS_LEVEL) * skillLevel);
if (skillLevel >= MAX_BONUS_LEVEL) chance = MAX_CHANCE; if (skillLevel >= MAX_BONUS_LEVEL) chance = MAX_CHANCE;
if (player.hasPermission("mcmmo.perks.lucky.repair")) randomChance = (int) (randomChance * 0.75); if (player.hasPermission("mcmmo.perks.lucky.repair")) randomChance = (int) (randomChance * 0.75);

View File

@ -50,7 +50,7 @@ public class SwordsManager {
randomChance = (int) (randomChance * 0.75); randomChance = (int) (randomChance * 0.75);
} }
final float chance = (float) (((double) bleedChanceMax / (double) bleedMaxLevel) * (double) skillLevel); final float chance = (float) (((double) bleedChanceMax / (double) bleedMaxLevel) * skillLevel);
if (chance > Swords.getRandom().nextInt(randomChance)) { if (chance > Swords.getRandom().nextInt(randomChance)) {
eventHandler.addBleedTicks(); eventHandler.addBleedTicks();
eventHandler.sendAbilityMessages(); eventHandler.sendAbilityMessages();
@ -81,7 +81,7 @@ public class SwordsManager {
randomChance = (int) (randomChance * 0.75); randomChance = (int) (randomChance * 0.75);
} }
final float chance = (float) (((double) counterChanceMax / (double) counterMaxLevel) * (double) skillLevel); final float chance = (float) (((double) counterChanceMax / (double) counterMaxLevel) * skillLevel);
if (chance > Swords.getRandom().nextInt(randomChance)) { if (chance > Swords.getRandom().nextInt(randomChance)) {
eventHandler.dealDamage(); eventHandler.dealDamage();
eventHandler.sendAbilityMessages(); eventHandler.sendAbilityMessages();

View File

@ -111,7 +111,7 @@ public class TamingManager {
randomChance = (int) (randomChance * 0.75); randomChance = (int) (randomChance * 0.75);
} }
final float chance = (float) (((double) goreChanceMax / (double) goreMaxLevel) * (double) skillLevel); final float chance = (float) (((double) goreChanceMax / (double) goreMaxLevel) * skillLevel);
if (chance > Taming.getRandom().nextInt(randomChance)) { if (chance > Taming.getRandom().nextInt(randomChance)) {
eventHandler.modifyEventDamage(); eventHandler.modifyEventDamage();
eventHandler.applyBleed(); eventHandler.applyBleed();

View File

@ -51,7 +51,7 @@ public class UnarmedManager {
randomChance = (int) (randomChance * 0.75); randomChance = (int) (randomChance * 0.75);
} }
final float chance = (float) (((double) disarmChanceMax / (double) disarmMaxLevel) * (double) skillLevel); final float chance = (float) (((double) disarmChanceMax / (double) disarmMaxLevel) * skillLevel);
if (chance > Unarmed.getRandom().nextInt(randomChance)) { if (chance > Unarmed.getRandom().nextInt(randomChance)) {
if (!hasIronGrip(defender)) { if (!hasIronGrip(defender)) {
eventHandler.sendAbilityMessage(); eventHandler.sendAbilityMessage();
@ -88,7 +88,7 @@ public class UnarmedManager {
randomChance = (int) (randomChance * 0.75); randomChance = (int) (randomChance * 0.75);
} }
final float chance = (float) (((double) deflectChanceMax / (double) deflectMaxLevel) * (double) skillLevel); final float chance = (float) (((double) deflectChanceMax / (double) deflectMaxLevel) * skillLevel);
if (chance > Unarmed.getRandom().nextInt(randomChance)) { if (chance > Unarmed.getRandom().nextInt(randomChance)) {
eventHandler.cancelEvent(); eventHandler.cancelEvent();
eventHandler.sendAbilityMessage(); eventHandler.sendAbilityMessage();
@ -144,7 +144,7 @@ public class UnarmedManager {
randomChance = (int) (randomChance * 0.75); randomChance = (int) (randomChance * 0.75);
} }
final float chance = (float) (((double) ironGripChanceMax / (double) ironGripMaxLevel) * (double) skillLevel); final float chance = (float) (((double) ironGripChanceMax / (double) ironGripMaxLevel) * skillLevel);
if (chance > Unarmed.getRandom().nextInt(randomChance)) { if (chance > Unarmed.getRandom().nextInt(randomChance)) {
eventHandler.sendAbilityMessages(); eventHandler.sendAbilityMessages();
return true; return true;

View File

@ -289,4 +289,3 @@ public class Misc {
} }
} }
} }

View File

@ -112,7 +112,7 @@ public class HashChunkManager implements ChunkManager {
int rx = x >> 5; int rx = x >> 5;
int rz = z >> 5; int rz = z >> 5;
long key2 = (((long) rx) << 32) | (((long) rz) & 0xFFFFFFFFL); long key2 = (((long) rx) << 32) | ((rz) & 0xFFFFFFFFL);
mcMMOSimpleRegionFile regionFile = worldRegions.get(key2); mcMMOSimpleRegionFile regionFile = worldRegions.get(key2);