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
- Removal
Version 1.3.13
Version 1.3.13-dev
+ Added Craftbukkit 1.4.6 compatibility
= Fixed issue with missing default cases from several switch/case statements
= 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");
// DODGE
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
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
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

View File

@ -39,17 +39,17 @@ public class ArcheryCommand extends SkillCommand {
protected void dataCalculations() {
DecimalFormat df = new DecimalFormat("#.0");
// 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);
else skillShotBonus = percent.format(bonus);
// Daze
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
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

View File

@ -24,7 +24,7 @@ public class AxesCommand extends SkillCommand {
private double critMaxChance = advancedConfig.getAxesCriticalChance();
private int critMaxBonusLevel = advancedConfig.getAxesCriticalMaxBonusLevel();
private int greaterImpactIncreaseLevel = advancedConfig.getArmorImpactIncreaseLevel();
// private double greaterImpactModifier = advancedConfig.getGreaterImpactModifier();
// private double greaterImpactModifier = advancedConfig.getGreaterImpactModifier();
private int abilityLengthIncreaseLevel = advancedConfig.getAbilityLength();
private boolean canSkullSplitter;
@ -47,9 +47,9 @@ public class AxesCommand extends SkillCommand {
greaterImpactDamage = "2";
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);
else bonusDamage = String.valueOf((double) skillValue / ((double) bonusDamageAxesMaxBonusLevel / (double) bonusDamageAxesBonusMax));
else bonusDamage = String.valueOf(skillValue / ((double) bonusDamageAxesMaxBonusLevel / (double) bonusDamageAxesBonusMax));
}
@Override

View File

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

View File

@ -53,10 +53,10 @@ public class HerbalismCommand extends SkillCommand {
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
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

View File

@ -48,7 +48,7 @@ public class MiningCommand extends SkillCommand {
DecimalFormat df = new DecimalFormat("#.0");
superBreakerLength = String.valueOf(2 + (int) ((double) skillValue / (double) abilityLengthIncreaseLevel));
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) {
blastMiningRank = "8";

View File

@ -64,10 +64,10 @@ public class RepairCommand extends SkillCommand {
salvageLevel = Config.getInstance().getSalvageUnlockLevel();
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);
else superRepairChance = df.format(((double) superRepairChanceMax / (double) superRepairMaxBonusLevel) * (double) skillValue);
else superRepairChance = df.format(((double) superRepairChanceMax / (double) superRepairMaxBonusLevel) * skillValue);
arcaneForgingRank = Repair.getArcaneForgingRank(profile);
}

View File

@ -43,10 +43,10 @@ public class SwordsCommand extends SkillCommand {
else bleedLength = String.valueOf(bleedBaseTicks);
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);
else counterAttackChance = df.format(((double) counterChanceMax / (double) counterMaxLevel) * (double) skillValue);
else counterAttackChance = df.format(((double) counterChanceMax / (double) counterMaxLevel) * skillValue);
serratedStrikesLength = String.valueOf(serratedBleedTicks);
}

View File

@ -40,7 +40,7 @@ public class TamingCommand extends SkillCommand {
protected void dataCalculations() {
DecimalFormat df = new DecimalFormat("#.0");
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

View File

@ -39,10 +39,10 @@ public class UnarmedCommand extends SkillCommand {
berserkLength = String.valueOf(2 + (int) ((double) skillValue / (double) abilityLengthIncreaseLevel));
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);
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);
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));
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

View File

@ -148,6 +148,6 @@ public class AdvancedConfig extends ConfigLoader {
public int getSpoutNotificationTier3() { return config.getInt("Spout.Notifications.Tier3", 600); }
public int getSpoutNotificationTier4() { return config.getInt("Spout.Notifications.Tier4", 800); }
//TODO Make the sounds configurable! :D
// public String getSpoutSoundRepair() { return config.getString("Spout.Sounds.RepairSound", "url here"); }
// public String getSpoutSoundLevelUp() { return config.getString("Spout.Sounds.LevelUp", "url here"); }
// public String getSpoutSoundRepair() { return config.getString("Spout.Sounds.RepairSound", "url here"); }
// public String getSpoutSoundLevelUp() { return config.getString("Spout.Sounds.LevelUp", "url here"); }
}

View File

@ -190,7 +190,7 @@ public class TreasuresConfig extends ConfigLoader{
List<String> excavationTreasures = config.getStringList("Excavation.Treasure");
List<String> fishingTreasures = config.getStringList("Fishing.Treasure");
// Iterator<String> treasureIterator = treasures.keySet().iterator();
// Iterator<String> treasureIterator = treasures.keySet().iterator();
Iterator<Entry<String,Treasure>> treasureIterator = treasures.entrySet().iterator();
while (treasureIterator.hasNext()) {

View File

@ -940,99 +940,99 @@ public class PlayerProfile {
save(false);
}
// /**
// * Adds XP to the player, doesn't calculate for XP Rate
// *
// * @param skillType The skill to add XP to
// * @param newValue The amount of XP to add
// */
// public void addXPOverride(SkillType skillType, int newValue) {
// if (skillType.equals(SkillType.ALL)) {
// for (SkillType x : SkillType.values()) {
// if (x.equals(SkillType.ALL)) {
// continue;
// }
//
// mcMMO.p.getServer().getPluginManager().callEvent(new McMMOPlayerXpGainEvent(player, x, newValue));
// skillsXp.put(x, skillsXp.get(x) + newValue);
// }
// }
// else {
// mcMMO.p.getServer().getPluginManager().callEvent(new McMMOPlayerXpGainEvent(player, skillType, newValue));
// skillsXp.put(skillType, skillsXp.get(skillType) + newValue);
// spoutHud.setLastGained(skillType);
// }
// }
// /**
// * Adds XP to the player, doesn't calculate for XP Rate
// *
// * @param skillType The skill to add XP to
// * @param newValue The amount of XP to add
// */
// public void addXPOverride(SkillType skillType, int newValue) {
// if (skillType.equals(SkillType.ALL)) {
// for (SkillType x : SkillType.values()) {
// if (x.equals(SkillType.ALL)) {
// continue;
// }
//
// mcMMO.p.getServer().getPluginManager().callEvent(new McMMOPlayerXpGainEvent(player, x, newValue));
// skillsXp.put(x, skillsXp.get(x) + newValue);
// }
// }
// else {
// mcMMO.p.getServer().getPluginManager().callEvent(new McMMOPlayerXpGainEvent(player, skillType, newValue));
// skillsXp.put(skillType, skillsXp.get(skillType) + newValue);
// spoutHud.setLastGained(skillType);
// }
// }
// /**
// * Adds XP to the player, this ignores skill modifiers.
// *
// * @param skillType The skill to add XP to
// * @param newValue The amount of XP to add
// */
// public void addXPOverrideBonus(SkillType skillType, int newValue) {
// int xp = newValue * Config.getInstance().xpGainMultiplier;
// addXPOverride(skillType, xp);
// }
// /**
// * Adds XP to the player, this ignores skill modifiers.
// *
// * @param skillType The skill to add XP to
// * @param newValue The amount of XP to add
// */
// public void addXPOverrideBonus(SkillType skillType, int newValue) {
// int xp = newValue * Config.getInstance().xpGainMultiplier;
// addXPOverride(skillType, xp);
// }
// /**
// * Adds XP to the player, this is affected by skill modifiers and XP Rate and Permissions
// *
// * @param skillType The skill to add XP to
// * @param newvalue The amount of XP to add
// */
// public void addXP(SkillType skillType, int newValue) {
// if (player.getGameMode().equals(GameMode.CREATIVE)) {
// return;
// }
//
// double bonusModifier = 0;
//
// if (inParty()) {
// bonusModifier = partyModifier(skillType);
// }
//
// int xp = (int) (newValue / skillType.getXpModifier()) * Config.getInstance().xpGainMultiplier;
//
// if (bonusModifier > 0) {
// if (bonusModifier >= 2) {
// bonusModifier = 2;
// }
//
// double trueBonus = bonusModifier * xp;
// xp += trueBonus;
// }
//
// if (Config.getInstance().getToolModsEnabled()) {
// ItemStack item = player.getItemInHand();
// CustomTool tool = ModChecks.getToolFromItemStack(item);
//
// if (tool != null) {
// xp = (int) (xp * tool.getXpMultiplier());
// }
// }
//
// //TODO: Can we make this so we do perks by doing "mcmmo.perks.xp.[multiplier]" ?
// if (player.hasPermission("mcmmo.perks.xp.quadruple")) {
// xp = xp * 4;
// }
// else if (player.hasPermission("mcmmo.perks.xp.triple")) {
// xp = xp * 3;
// }
// else if (player.hasPermission("mcmmo.perks.xp.150percentboost")) {
// xp = (int) (xp * 2.5);
// }
// else if (player.hasPermission("mcmmo.perks.xp.double")) {
// xp = xp * 2;
// }
// else if (player.hasPermission("mcmmo.perks.xp.50percentboost")) {
// xp = (int) (xp * 1.5);
// }
//
// mcMMO.p.getServer().getPluginManager().callEvent(new McMMOPlayerXpGainEvent(player, skillType, xp));
// skillsXp.put(skillType, skillsXp.get(skillType) + xp);
// spoutHud.setLastGained(skillType);
// }
// /**
// * Adds XP to the player, this is affected by skill modifiers and XP Rate and Permissions
// *
// * @param skillType The skill to add XP to
// * @param newvalue The amount of XP to add
// */
// public void addXP(SkillType skillType, int newValue) {
// if (player.getGameMode().equals(GameMode.CREATIVE)) {
// return;
// }
//
// double bonusModifier = 0;
//
// if (inParty()) {
// bonusModifier = partyModifier(skillType);
// }
//
// int xp = (int) (newValue / skillType.getXpModifier()) * Config.getInstance().xpGainMultiplier;
//
// if (bonusModifier > 0) {
// if (bonusModifier >= 2) {
// bonusModifier = 2;
// }
//
// double trueBonus = bonusModifier * xp;
// xp += trueBonus;
// }
//
// if (Config.getInstance().getToolModsEnabled()) {
// ItemStack item = player.getItemInHand();
// CustomTool tool = ModChecks.getToolFromItemStack(item);
//
// if (tool != null) {
// xp = (int) (xp * tool.getXpMultiplier());
// }
// }
//
// //TODO: Can we make this so we do perks by doing "mcmmo.perks.xp.[multiplier]" ?
// if (player.hasPermission("mcmmo.perks.xp.quadruple")) {
// xp = xp * 4;
// }
// else if (player.hasPermission("mcmmo.perks.xp.triple")) {
// xp = xp * 3;
// }
// else if (player.hasPermission("mcmmo.perks.xp.150percentboost")) {
// xp = (int) (xp * 2.5);
// }
// else if (player.hasPermission("mcmmo.perks.xp.double")) {
// xp = xp * 2;
// }
// else if (player.hasPermission("mcmmo.perks.xp.50percentboost")) {
// xp = (int) (xp * 1.5);
// }
//
// mcMMO.p.getServer().getPluginManager().callEvent(new McMMOPlayerXpGainEvent(player, skillType, xp));
// skillsXp.put(skillType, skillsXp.get(skillType) + xp);
// spoutHud.setLastGained(skillType);
// }
/**
* Remove XP from a skill.
@ -1114,49 +1114,49 @@ public class PlayerProfile {
return 1020 + (skills.get(skillType) * Config.getInstance().getFormulaMultiplierCurve());
}
// /**
// * Gets the power level of a player.
// *
// * @return the power level of the player
// */
// public int getPowerLevel() {
// int powerLevel = 0;
//
// for (SkillType type : SkillType.values()) {
// if (type.getPermissions(player)) {
// powerLevel += getSkillLevel(type);
// }
// }
//
// return powerLevel;
// }
// /**
// * Gets the power level of a player.
// *
// * @return the power level of the player
// */
// public int getPowerLevel() {
// int powerLevel = 0;
//
// for (SkillType type : SkillType.values()) {
// if (type.getPermissions(player)) {
// powerLevel += getSkillLevel(type);
// }
// }
//
// return powerLevel;
// }
// /**
// * Calculate the party XP modifier.
// *
// * @param skillType Type of skill to check
// * @return the party bonus multiplier
// */
// private double partyModifier(SkillType skillType) {
// double bonusModifier = 0.0;
//
// for (Player member : party.getOnlineMembers()) {
// if (party.getLeader().equals(member.getName())) {
// if (Misc.isNear(player.getLocation(), member.getLocation(), 25.0)) {
// PlayerProfile PartyLeader = Users.getProfile(member);
// int leaderSkill = PartyLeader.getSkillLevel(skillType);
// int playerSkill = getSkillLevel(skillType);
//
// if (leaderSkill >= playerSkill) {
// int difference = leaderSkill - playerSkill;
// bonusModifier = (difference * 0.75) / 100.0;
// }
// }
// }
// }
//
// return bonusModifier;
// }
// /**
// * Calculate the party XP modifier.
// *
// * @param skillType Type of skill to check
// * @return the party bonus multiplier
// */
// private double partyModifier(SkillType skillType) {
// double bonusModifier = 0.0;
//
// for (Player member : party.getOnlineMembers()) {
// if (party.getLeader().equals(member.getName())) {
// if (Misc.isNear(player.getLocation(), member.getLocation(), 25.0)) {
// PlayerProfile PartyLeader = Users.getProfile(member);
// int leaderSkill = PartyLeader.getSkillLevel(skillType);
// int playerSkill = getSkillLevel(skillType);
//
// if (leaderSkill >= playerSkill) {
// int difference = leaderSkill - playerSkill;
// bonusModifier = (difference * 0.75) / 100.0;
// }
// }
// }
// }
//
// return bonusModifier;
// }
/*
* Party Stuff

View File

@ -85,7 +85,7 @@ public class BlockListener implements Listener {
* @param event The event to monitor
*/
// Disabled until a better patch can be applied. This does nothing but flag the wrong block.
/*
/*
@EventHandler(priority = EventPriority.MONITOR)
public void onBlockPhysics(BlockPhysicsEvent event) {
//TODO: Figure out how to REMOVE metadata from the location the sand/gravel fell from.
@ -99,7 +99,7 @@ public class BlockListener implements Listener {
}
}
}
*/
*/
/**
* Monitor BlockPistonRetract events.

View File

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

View File

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

View File

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

View File

@ -57,7 +57,7 @@ public class ArcheryManager {
if (player.hasPermission("mcmmo.perks.lucky.archery")) {
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)) {
eventHandler.addToTracker();
}
@ -88,7 +88,7 @@ public class ArcheryManager {
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)) {
eventHandler.handleDazeEffect();
eventHandler.sendAbilityMessages();

View File

@ -87,14 +87,14 @@ public class Axes {
int skillCheck = Misc.skillCheck(skillLevel, MAX_BONUS_LEVEL);
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")) {
randomChance = (int) (randomChance * 0.75);
}
if (chance > random.nextInt(randomChance) && !entity.isDead()){
// if (random.nextInt(randomChance) <= skillCheck && !entity.isDead()){
// if (random.nextInt(randomChance) <= skillCheck && !entity.isDead()){
int damage = event.getDamage();
if (entity instanceof Player){

View File

@ -317,7 +317,7 @@ public class BlastMining {
player.sendMessage(LocaleLoader.getString("Mining.Blast.Boom"));
/* Create the TNT entity */
// TNTPrimed tnt = (TNTPrimed) player.getWorld().spawnEntity(block.getLocation(), EntityType.PRIMED_TNT);
// TNTPrimed tnt = (TNTPrimed) player.getWorld().spawnEntity(block.getLocation(), EntityType.PRIMED_TNT);
TNTPrimed tnt = player.getWorld().spawn(block.getLocation(), TNTPrimed.class);
plugin.addToTNTTracker(tnt.getEntityId(), player.getName());
tnt.setFuseTicks(0);

View File

@ -41,7 +41,8 @@ public class Fishing {
/**
* 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
*/
public static int getFishingLootTier(PlayerProfile profile) {
@ -50,17 +51,13 @@ public class Fishing {
if (level >= Config.getInstance().getFishingTierLevelsTier5()) {
fishingTier = 5;
}
else if (level >= Config.getInstance().getFishingTierLevelsTier4()) {
} else if (level >= Config.getInstance().getFishingTierLevelsTier4()) {
fishingTier = 4;
}
else if (level >= Config.getInstance().getFishingTierLevelsTier3()) {
} else if (level >= Config.getInstance().getFishingTierLevelsTier3()) {
fishingTier = 3;
}
else if (level >= Config.getInstance().getFishingTierLevelsTier2()) {
} else if (level >= Config.getInstance().getFishingTierLevelsTier2()) {
fishingTier = 2;
}
else {
} else {
fishingTier = 1;
}
@ -70,11 +67,13 @@ public class Fishing {
/**
* Get item results from Fishing.
*
* @param player The player that was fishing
* @param event The event to modify
* @param player
* The player that was fishing
* @param event
* The event to modify
*/
private static void getFishingResults(Player player, PlayerFishEvent event) {
if(player == null)
if (player == null)
return;
PlayerProfile profile = Users.getProfile(player);
@ -106,8 +105,10 @@ 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;
@ -116,31 +117,37 @@ 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 {
} 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());
}
/**
* Process results from Fishing.
*
* @param event The event to modify
* @param event
* The event to modify
*/
public static void processResults(PlayerFishEvent event) {
Player player = event.getPlayer();
if(player == null)
if (player == null)
return;
PlayerProfile profile = Users.getProfile(player);
@ -149,7 +156,8 @@ 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();
@ -162,29 +170,40 @@ 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;
}
/* 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;
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)
if (randomEnchantLevel >= 1000)
continue;
fishingResults.addEnchantment(newEnchant, randomEnchantLevel);
fishingResults.addEnchantment(newEnchant,
randomEnchantLevel);
}
}
}
@ -200,7 +219,8 @@ public class Fishing {
/**
* 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) {
int randomChance = 100;
@ -216,7 +236,8 @@ 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);
@ -263,7 +284,8 @@ public class Fishing {
case CREEPER:
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 {
Misc.dropItem(location, new ItemStack(Material.SULPHUR));
}
@ -299,14 +321,17 @@ public class Fishing {
if (DROP_NUMBER > 95) {
Misc.dropItem(location, new ItemStack(Material.MILK_BUCKET));
} 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) {
Misc.dropItem(location, new ItemStack(Material.LEATHER));
} else if (DROP_NUMBER > 30) {
Misc.dropItem(location, new ItemStack(Material.RAW_BEEF));
} else {
Misc.dropItem(location, new ItemStack(Material.RED_MUSHROOM));
Misc.randomDropItems(location, new ItemStack(Material.RED_MUSHROOM), 50, 2);
Misc.dropItem(location,
new ItemStack(Material.RED_MUSHROOM));
Misc.randomDropItems(location, new ItemStack(
Material.RED_MUSHROOM), 50, 2);
}
break;
@ -316,7 +341,8 @@ public class Fishing {
case PIG_ZOMBIE:
if (DROP_NUMBER > 50) {
Misc.dropItem(location, new ItemStack(Material.ROTTEN_FLESH));
Misc.dropItem(location,
new ItemStack(Material.ROTTEN_FLESH));
} else {
Misc.dropItem(location, new ItemStack(Material.GOLD_NUGGET));
}
@ -338,23 +364,27 @@ public class Fishing {
break;
case SKELETON:
if (((Skeleton)le).getSkeletonType() == SkeletonType.WITHER) {
if (((Skeleton) le).getSkeletonType() == SkeletonType.WITHER) {
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) {
Misc.dropItem(location, new ItemStack(Material.BONE));
} else {
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 {
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) {
Misc.dropItem(location, new ItemStack(Material.BONE));
} else {
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;
@ -368,7 +398,8 @@ public class Fishing {
Misc.dropItem(location, new ItemStack(Material.PUMPKIN));
} else {
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;
@ -381,30 +412,38 @@ public class Fishing {
break;
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;
case WITCH:
final int DROP_NUMBER_2 = random.nextInt(randomChance) + 1;
if (DROP_NUMBER > 95) {
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) {
Misc.dropItem(location, new ItemStack(Material.POTION, 1, (short) 8195));
Misc.dropItem(location, new ItemStack(Material.POTION,
1, (short) 8195));
} else {
Misc.dropItem(location, new ItemStack(Material.POTION, 1, (short) 8194));
Misc.dropItem(location, new ItemStack(Material.POTION,
1, (short) 8194));
}
} else {
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) {
Misc.dropItem(location, new ItemStack(Material.GLOWSTONE_DUST));
Misc.dropItem(location, new ItemStack(
Material.GLOWSTONE_DUST));
} else if (DROP_NUMBER_2 > 63) {
Misc.dropItem(location, new ItemStack(Material.SULPHUR));
} 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) {
Misc.dropItem(location, new ItemStack(Material.SPIDER_EYE));
Misc.dropItem(location, new ItemStack(
Material.SPIDER_EYE));
} else if (DROP_NUMBER_2 > 25) {
Misc.dropItem(location, new ItemStack(Material.STICK));
} else if (DROP_NUMBER_2 > 13) {
@ -417,9 +456,11 @@ public class Fishing {
case ZOMBIE:
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 {
Misc.dropItem(location, new ItemStack(Material.ROTTEN_FLESH));
Misc.dropItem(location,
new ItemStack(Material.ROTTEN_FLESH));
}
break;
@ -430,10 +471,12 @@ public class Fishing {
Combat.dealDamage(le, 1);
}
/**
* Gets chance of shake success.
*
* @param rank Treasure hunter rank
* @param rank
* Treasure hunter rank
* @return The chance of a successful shake
*/
public static int getShakeChance(int lootTier) {

View File

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

View File

@ -329,7 +329,7 @@ public class Mining {
int skillCheck = Misc.skillCheck(skillLevel, MAX_BONUS_LEVEL);
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")) {
randomChance = (int) (randomChance * 0.75);

View File

@ -345,7 +345,7 @@ public class WoodCutting {
Material mat = Material.getMaterial(block.getTypeId());
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")) {
randomChance = (int) (randomChance * 0.75);

View File

@ -248,7 +248,7 @@ public class Repair {
int skillLevel = Users.getProfile(player).getSkillLevel(SkillType.REPAIR);
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 (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);
}
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)) {
eventHandler.addBleedTicks();
eventHandler.sendAbilityMessages();
@ -81,7 +81,7 @@ public class SwordsManager {
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)) {
eventHandler.dealDamage();
eventHandler.sendAbilityMessages();

View File

@ -111,7 +111,7 @@ public class TamingManager {
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)) {
eventHandler.modifyEventDamage();
eventHandler.applyBleed();

View File

@ -51,7 +51,7 @@ public class UnarmedManager {
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 (!hasIronGrip(defender)) {
eventHandler.sendAbilityMessage();
@ -88,7 +88,7 @@ public class UnarmedManager {
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)) {
eventHandler.cancelEvent();
eventHandler.sendAbilityMessage();
@ -144,7 +144,7 @@ public class UnarmedManager {
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)) {
eventHandler.sendAbilityMessages();
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 rz = z >> 5;
long key2 = (((long) rx) << 32) | (((long) rz) & 0xFFFFFFFFL);
long key2 = (((long) rx) << 32) | ((rz) & 0xFFFFFFFFL);
mcMMOSimpleRegionFile regionFile = worldRegions.get(key2);