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

@ -24,7 +24,7 @@ public class AxesCommand extends SkillCommand {
private double critMaxChance = advancedConfig.getAxesCriticalChance(); private double critMaxChance = advancedConfig.getAxesCriticalChance();
private int critMaxBonusLevel = advancedConfig.getAxesCriticalMaxBonusLevel(); private int critMaxBonusLevel = advancedConfig.getAxesCriticalMaxBonusLevel();
private int greaterImpactIncreaseLevel = advancedConfig.getArmorImpactIncreaseLevel(); private int greaterImpactIncreaseLevel = advancedConfig.getArmorImpactIncreaseLevel();
// private double greaterImpactModifier = advancedConfig.getGreaterImpactModifier(); // private double greaterImpactModifier = advancedConfig.getGreaterImpactModifier();
private int abilityLengthIncreaseLevel = advancedConfig.getAbilityLength(); private int abilityLengthIncreaseLevel = advancedConfig.getAbilityLength();
private boolean canSkullSplitter; private boolean canSkullSplitter;
@ -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

@ -148,6 +148,6 @@ public class AdvancedConfig extends ConfigLoader {
public int getSpoutNotificationTier3() { return config.getInt("Spout.Notifications.Tier3", 600); } public int getSpoutNotificationTier3() { return config.getInt("Spout.Notifications.Tier3", 600); }
public int getSpoutNotificationTier4() { return config.getInt("Spout.Notifications.Tier4", 800); } public int getSpoutNotificationTier4() { return config.getInt("Spout.Notifications.Tier4", 800); }
//TODO Make the sounds configurable! :D //TODO Make the sounds configurable! :D
// public String getSpoutSoundRepair() { return config.getString("Spout.Sounds.RepairSound", "url here"); } // public String getSpoutSoundRepair() { return config.getString("Spout.Sounds.RepairSound", "url here"); }
// public String getSpoutSoundLevelUp() { return config.getString("Spout.Sounds.LevelUp", "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> excavationTreasures = config.getStringList("Excavation.Treasure");
List<String> fishingTreasures = config.getStringList("Fishing.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(); Iterator<Entry<String,Treasure>> treasureIterator = treasures.entrySet().iterator();
while (treasureIterator.hasNext()) { while (treasureIterator.hasNext()) {

View File

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

View File

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

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,14 +87,14 @@ 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);
} }
if (chance > random.nextInt(randomChance) && !entity.isDead()){ 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(); int damage = event.getDamage();
if (entity instanceof Player){ if (entity instanceof Player){

View File

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

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,11 +67,13 @@ 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)
return; return;
PlayerProfile profile = Users.getProfile(player); PlayerProfile profile = Users.getProfile(player);
@ -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,31 +117,37 @@ 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();
if(player == null) if (player == null)
return; return;
PlayerProfile profile = Users.getProfile(player); PlayerProfile profile = Users.getProfile(player);
@ -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));
} }
@ -338,23 +364,27 @@ public class Fishing {
break; break;
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);