From 7a503ea76c68a883da8fde1bd8402695e890ae40 Mon Sep 17 00:00:00 2001 From: TfT_02 Date: Mon, 31 Dec 2012 02:24:07 +0100 Subject: [PATCH 01/18] Updated the changelog This hasen't got any major attention since the 14th of August, untill now. --- Changelog.txt | 46 +++++++++++++++++++++++++++++++++++++++------- 1 file changed, 39 insertions(+), 7 deletions(-) diff --git a/Changelog.txt b/Changelog.txt index a498432cf..0b3d9c57a 100644 --- a/Changelog.txt +++ b/Changelog.txt @@ -10,34 +10,66 @@ Key: Version 1.3.13-dev + Added Craftbukkit 1.4.6 compatibility + Added a configurable durability cap for ArmorImpact to advanced.yml - + Added version number to /mcmmo + + Added the version number to /mcmmo + + Added wooden button to the list of items that shouldn't trigger abilities = 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 some issues with static access = Fixed ItemStack deprecation issues = Fixed Async deprecation issues - = Fixed some issues with mySQL databases (non-alphanumeric characters preventing MySQL) - = Fixed skill commands displaying .x% instead of 0.x% - = Fixed Unbreaking enchantments being ignored when using Treefelling and when hit by Armor Impact + = Fixed a bug with MySQL databases (non-alphanumeric characters preventing MySQL access) + = Fixed a bug where the /skillreset command was broken + = Fixed a bug where skill commands displaying .x% instead of 0.x% + = Fixed a bug Unbreaking enchantments being ignored when using Treefelling and when hit by Armor Impact + = Fixed a bug where only 1 diamond was needed to fully repair a broken item: Repaired the Repair skill! + = Fixed a bug where a infinite loop of errors caused by mySQL database could cause the server to crash + = Fixed a bug where PartyChangeEvent was fired even when a player isn't able to change parties + = Fixed a NPE with custom blocks ! GJ stopped being a lazy slacker and got stuff done + ! Changed code that uses SpoutPlugin to make it compatible with the latest version + ! Changed Reimplemented skill level and power level caps. - Removed dead code relating to null profiles - Removed unused imports Version 1.3.12 + Added Craftbukkit 1.4.5 compatibility + + Added the new 1.3.2 items, xp and double drops for Cocao beans & Emeralds, EnderChest to the list of blocks that shouldn't trigger abilities + Added new items from Minecraft 1.4 to Herbalism (potatoes & carrots) + + Added new configuration file for advanced users. + + Added new permission nodes to greenthumb for the 1.4 items + Added new mobs from Minecraft 1.4 checks for every ability + Added new active ability for Repair: Salvage + Added options to 'config.yml' configure shake chance + Added the option to negate experience earned for Herbalism while in a minecart to prevent afk leveling + Added Green thumb now converts cobble walls to mossy cobble walls + Added beacons and anvils to list of blocks that don't trigger abilities + + Added a configuration option to disable experience gains when in a minecraft for Acrobatics and Herbalism, to prevent AFK leveling + + Added a new passive ability for Fishing, Fishermans diet. Increases hunger restored from fish + + Added a feature to display all active perks on login ! Changed Fishing, Shake drops changed from guaranteed to based upon fishing level and perks ! Changed Woodcutting, the amount of experience earned when using Tree Feller on jungle trees has increased + ! Changed Herbalism double drop rates for melons and netherwart ! Changed filesystem usage, it's reduced a lot. Should help reduce lag on larger servers - = Fixed Woodcutting bug, excessive null chunk before earning Woodcutting experience - = Fixed a null pointer error related to skill cooldowns - = Fixed more NPE ?? Needs better explanation + ! Changed database connection handling. Support for aggressive connection timeouts, with exponential backoff for multiple failures + ! Changed Cobblestone walls are now mossy-able with Greenthumb + ! Changed the skull drop rates of the shake ability to 3% + = Fixed a NPE when Citizens perform certain tasks + = Fixed a NPE with Woodcutting, excessive null chunk before earning Woodcutting experience + = Fixed a NPE related to skill cooldowns + = Fixed a NPE when a players profile was null + = Fixed a NPE involving certain explosions + = Fixed a dupe bug when for players who were using a 'nuker' client + = Fixed a dupe bug where pistons were used to dupe ores + = Fixed a dupe bug with Salvage when players were in Creative mode + = Fixed a bug where the player was displayed an incorrect cooldown time + = Fixed a bug where players could earn experience when they were dealing 0 damage + = Fixed a bug where players could get double drops from mossified Cobblestone + = Fixed a bug where Herablism magically converted potatoes to carrots + = Fixed a bug where you couldn't modify the stats of offline players + = Fixed a bug where treefeller didn't work properly on tree's with side-way logs + = Fixed a bug where the Arcane forging downgrade chance should've been 0, but actually wasn't + = Fixed a bug where Fishing would sometimes give items with empty enchantments + = Fixed a bug where the lucky perk for Fishing was actually an unlucky perk - Removed nothing Version 1.3.11 From cc18794a9353ee04250bac4ca487becfa4a96f74 Mon Sep 17 00:00:00 2001 From: TfT_02 Date: Mon, 31 Dec 2012 11:00:27 +0100 Subject: [PATCH 02/18] Don't damage the tool more than it's max durability --- .../java/com/gmail/nossr50/skills/gathering/WoodCutting.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/gmail/nossr50/skills/gathering/WoodCutting.java b/src/main/java/com/gmail/nossr50/skills/gathering/WoodCutting.java index c588ceb37..6e0886f8f 100644 --- a/src/main/java/com/gmail/nossr50/skills/gathering/WoodCutting.java +++ b/src/main/java/com/gmail/nossr50/skills/gathering/WoodCutting.java @@ -97,7 +97,8 @@ public class WoodCutting { } /* Damage the tool */ - inHand.setDurability((short) (inHand.getDurability() + durabilityLoss)); + if (inHand.getDurability() + durabilityLoss > inHand.getType().getMaxDurability()) inHand.setDurability((short) (inHand.getType().getMaxDurability())); + else inHand.setDurability((short) (inHand.getDurability() + durabilityLoss)); //Prepare ItemStacks ItemStack item = null; From 00279502e486f9244953cad60fab4a791f51e53b Mon Sep 17 00:00:00 2001 From: TfT_02 Date: Mon, 31 Dec 2012 11:04:01 +0100 Subject: [PATCH 03/18] This does prevent using wood axes everytime you tree fell --- .../com/gmail/nossr50/skills/gathering/WoodCutting.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/gmail/nossr50/skills/gathering/WoodCutting.java b/src/main/java/com/gmail/nossr50/skills/gathering/WoodCutting.java index 6e0886f8f..5a11558d2 100644 --- a/src/main/java/com/gmail/nossr50/skills/gathering/WoodCutting.java +++ b/src/main/java/com/gmail/nossr50/skills/gathering/WoodCutting.java @@ -84,6 +84,8 @@ public class WoodCutting { if (health >= 2) { Combat.dealDamage(player, random.nextInt(health - 1)); } + inHand.setDurability((short) (inHand.getType().getMaxDurability())); + return; } } else if ((inHand.getDurability() + durabilityLoss >= inHand.getType().getMaxDurability()) || inHand.getType().equals(Material.AIR)) { @@ -94,11 +96,12 @@ public class WoodCutting { if (health >= 2) { Combat.dealDamage(player, random.nextInt(health - 1)); } + inHand.setDurability((short) (inHand.getType().getMaxDurability())); + return; } /* Damage the tool */ - if (inHand.getDurability() + durabilityLoss > inHand.getType().getMaxDurability()) inHand.setDurability((short) (inHand.getType().getMaxDurability())); - else inHand.setDurability((short) (inHand.getDurability() + durabilityLoss)); + inHand.setDurability((short) (inHand.getDurability() + durabilityLoss)); //Prepare ItemStacks ItemStack item = null; From 802d1dfa8ecddfe83ce3b78ebc6e01b2278f05cc Mon Sep 17 00:00:00 2001 From: TfT_02 Date: Mon, 31 Dec 2012 18:40:15 +0100 Subject: [PATCH 04/18] Fixed some mistakes with the path names #404 --- Changelog.txt | 1 + .../gmail/nossr50/config/AdvancedConfig.java | 18 +++++++++--------- src/main/resources/advanced.yml | 4 ++-- 3 files changed, 12 insertions(+), 11 deletions(-) diff --git a/Changelog.txt b/Changelog.txt index 0b3d9c57a..27e8943d4 100644 --- a/Changelog.txt +++ b/Changelog.txt @@ -24,6 +24,7 @@ Version 1.3.13-dev = Fixed a bug where only 1 diamond was needed to fully repair a broken item: Repaired the Repair skill! = Fixed a bug where a infinite loop of errors caused by mySQL database could cause the server to crash = Fixed a bug where PartyChangeEvent was fired even when a player isn't able to change parties + = Fixed a bug which caused advanced.yml not to work for Swords = Fixed a NPE with custom blocks ! GJ stopped being a lazy slacker and got stuff done ! Changed code that uses SpoutPlugin to make it compatible with the latest version diff --git a/src/main/java/com/gmail/nossr50/config/AdvancedConfig.java b/src/main/java/com/gmail/nossr50/config/AdvancedConfig.java index f9a32ce3d..7ab839a42 100644 --- a/src/main/java/com/gmail/nossr50/config/AdvancedConfig.java +++ b/src/main/java/com/gmail/nossr50/config/AdvancedConfig.java @@ -99,17 +99,17 @@ public class AdvancedConfig extends ConfigLoader { public int getSuperRepairMaxLevel() { return config.getInt("Skills.Repair.SuperRepair_MaxBonusLevel", 1000); } /* SWORDS */ - public int getBleedChanceMax() { return config.getInt("Skills.Sword.Bleed_ChanceMax", 75); } - public int getBleedMaxBonusLevel() { return config.getInt("Skills.Sword.Bleed_MaxBonusLevel", 750); } - public int getBleedMaxTicks() { return config.getInt("Skills.Sword.Bleed_MaxTicks", 3); } - public int getBleedBaseTicks() { return config.getInt("Skills.Sword.Bleed_BaseTicks", 2); } + public int getBleedChanceMax() { return config.getInt("Skills.Swords.Bleed_ChanceMax", 75); } + public int getBleedMaxBonusLevel() { return config.getInt("Skills.Swords.Bleed_MaxBonusLevel", 750); } + public int getBleedMaxTicks() { return config.getInt("Skills.Swords.Bleed_MaxTicks", 3); } + public int getBleedBaseTicks() { return config.getInt("Skills.Swords.Bleed_BaseTicks", 2); } - public int getCounterChanceMax() { return config.getInt("Skills.Sword.Counter_ChanceMax", 30); } - public int getCounterMaxBonusLevel() { return config.getInt("Skills.Sword.Counter_MaxBonusLevel", 600); } - public int getCounterModifier() { return config.getInt("Skills.Sword.Counter_DamageModifier", 2); } + public int getCounterChanceMax() { return config.getInt("Skills.Swords.Counter_ChanceMax", 30); } + public int getCounterMaxBonusLevel() { return config.getInt("Skills.Swords.Counter_MaxBonusLevel", 600); } + public int getCounterModifier() { return config.getInt("Skills.Swords.Counter_DamageModifier", 2); } - public int getSerratedStrikesModifier() { return config.getInt("Skills.Sword.SerratedStrikes_DamageModifier", 4); } - public int getSerratedStrikesTicks() { return config.getInt("Skills.Sword.SerratedStrikes_BleedTicks", 5); } + public int getSerratedStrikesModifier() { return config.getInt("Skills.Swords.SerratedStrikes_DamageModifier", 4); } + public int getSerratedStrikesTicks() { return config.getInt("Skills.Swords.SerratedStrikes_BleedTicks", 5); } /* TAMING */ public int getGoreChanceMax() { return config.getInt("Skills.Taming.Gore_ChanceMax", 100); } public int getGoreMaxBonusLevel() { return config.getInt("Skills.Taming.Gore_MaxBonusLevel", 1000); } diff --git a/src/main/resources/advanced.yml b/src/main/resources/advanced.yml index 1191f3f79..10b3bebd3 100644 --- a/src/main/resources/advanced.yml +++ b/src/main/resources/advanced.yml @@ -77,8 +77,8 @@ Skills: Bleed_MaxBonusLevel: 750 Bleed_MaxTicks: 3 Bleed_BaseTicks: 2 - CounterAttack_ChanceMax: 30 - CounterAttack_MaxBonusLevel: 600 + Counter_ChanceMax: 30 + Counter_MaxBonusLevel: 600 Counter_DamageModifier: 2 SerratedStrikes_DamageModifier: 4 SerratedStrikes_BleedTicks: 5 From c598f202f8f3a6008025f3c5ccc4af85203a5fee Mon Sep 17 00:00:00 2001 From: TfT_02 Date: Mon, 31 Dec 2012 19:09:10 +0100 Subject: [PATCH 05/18] Updated the changelog --- Changelog.txt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Changelog.txt b/Changelog.txt index 27e8943d4..c74e9fee8 100644 --- a/Changelog.txt +++ b/Changelog.txt @@ -11,6 +11,8 @@ Version 1.3.13-dev + Added Craftbukkit 1.4.6 compatibility + Added a configurable durability cap for ArmorImpact to advanced.yml + Added the version number to /mcmmo + + Added bats, giants, witches, withers, and wither skeletons to the mcMMO combat experience list, and makes their experience drops configurable + + Added the ability to track mobs spawned by mob spawners or the Taming ability when the chunks they are in unload and reload + Added wooden button to the list of items that shouldn't trigger abilities = Fixed issue with missing default cases from several switch/case statements = Fixed issue with Mining using actual skill level rather than max skill level From ef6d47b8017de0c5b4c53624603f9c64fac4043f Mon Sep 17 00:00:00 2001 From: gmcferrin Date: Tue, 1 Jan 2013 15:39:58 -0500 Subject: [PATCH 06/18] Update for Mining refactoring. --- src/main/java/com/gmail/nossr50/listeners/BlockListener.java | 2 +- .../java/com/gmail/nossr50/skills/gathering/BlastMining.java | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/gmail/nossr50/listeners/BlockListener.java b/src/main/java/com/gmail/nossr50/listeners/BlockListener.java index ec683a906..62d4ccd83 100644 --- a/src/main/java/com/gmail/nossr50/listeners/BlockListener.java +++ b/src/main/java/com/gmail/nossr50/listeners/BlockListener.java @@ -30,7 +30,7 @@ import com.gmail.nossr50.events.fake.FakePlayerAnimationEvent; import com.gmail.nossr50.runnables.StickyPistonTracker; import com.gmail.nossr50.skills.gathering.Excavation; import com.gmail.nossr50.skills.gathering.Herbalism; -import com.gmail.nossr50.skills.gathering.Mining; +import com.gmail.nossr50.skills.mining.Mining; import com.gmail.nossr50.skills.gathering.WoodCutting; import com.gmail.nossr50.skills.repair.Repair; import com.gmail.nossr50.skills.repair.Salvage; diff --git a/src/main/java/com/gmail/nossr50/skills/gathering/BlastMining.java b/src/main/java/com/gmail/nossr50/skills/gathering/BlastMining.java index 8259d31a8..c1856f32c 100644 --- a/src/main/java/com/gmail/nossr50/skills/gathering/BlastMining.java +++ b/src/main/java/com/gmail/nossr50/skills/gathering/BlastMining.java @@ -22,6 +22,7 @@ import com.gmail.nossr50.datatypes.AbilityType; import com.gmail.nossr50.datatypes.PlayerProfile; import com.gmail.nossr50.datatypes.SkillType; import com.gmail.nossr50.locale.LocaleLoader; +import com.gmail.nossr50.skills.mining.Mining; import com.gmail.nossr50.util.BlockChecks; import com.gmail.nossr50.util.Misc; import com.gmail.nossr50.util.Skills; From 11468abc983898d9511cbc7bfa47baaafd3ff437 Mon Sep 17 00:00:00 2001 From: gmcferrin Date: Tue, 1 Jan 2013 16:01:51 -0500 Subject: [PATCH 07/18] Fixed update for Mining refactoring --- src/main/java/com/gmail/nossr50/listeners/EntityListener.java | 2 +- src/main/java/com/gmail/nossr50/listeners/PlayerListener.java | 2 +- .../nossr50/skills/{gathering => mining}/BlastMining.java | 3 +-- .../gmail/nossr50/skills/{gathering => mining}/Mining.java | 2 +- .../nossr50/util/blockmeta/chunkmeta/PrimitiveChunkStore.java | 4 ++-- 5 files changed, 6 insertions(+), 7 deletions(-) rename src/main/java/com/gmail/nossr50/skills/{gathering => mining}/BlastMining.java (96%) rename src/main/java/com/gmail/nossr50/skills/{gathering => mining}/Mining.java (96%) diff --git a/src/main/java/com/gmail/nossr50/listeners/EntityListener.java b/src/main/java/com/gmail/nossr50/listeners/EntityListener.java index f831b4819..d5d4d1ee1 100644 --- a/src/main/java/com/gmail/nossr50/listeners/EntityListener.java +++ b/src/main/java/com/gmail/nossr50/listeners/EntityListener.java @@ -36,7 +36,7 @@ import com.gmail.nossr50.party.PartyManager; import com.gmail.nossr50.runnables.BleedTimer; import com.gmail.nossr50.skills.acrobatics.AcrobaticsManager; import com.gmail.nossr50.skills.archery.Archery; -import com.gmail.nossr50.skills.gathering.BlastMining; +import com.gmail.nossr50.skills.mining.BlastMining; import com.gmail.nossr50.skills.taming.TamingManager; import com.gmail.nossr50.util.Combat; import com.gmail.nossr50.util.Misc; diff --git a/src/main/java/com/gmail/nossr50/listeners/PlayerListener.java b/src/main/java/com/gmail/nossr50/listeners/PlayerListener.java index 379ce0545..2bc013fe3 100644 --- a/src/main/java/com/gmail/nossr50/listeners/PlayerListener.java +++ b/src/main/java/com/gmail/nossr50/listeners/PlayerListener.java @@ -35,9 +35,9 @@ import com.gmail.nossr50.events.chat.McMMOPartyChatEvent; import com.gmail.nossr50.locale.LocaleLoader; import com.gmail.nossr50.party.Party; import com.gmail.nossr50.runnables.BleedTimer; -import com.gmail.nossr50.skills.gathering.BlastMining; import com.gmail.nossr50.skills.gathering.Fishing; import com.gmail.nossr50.skills.gathering.Herbalism; +import com.gmail.nossr50.skills.mining.BlastMining; import com.gmail.nossr50.skills.repair.Salvage; import com.gmail.nossr50.skills.taming.TamingManager; import com.gmail.nossr50.util.BlockChecks; diff --git a/src/main/java/com/gmail/nossr50/skills/gathering/BlastMining.java b/src/main/java/com/gmail/nossr50/skills/mining/BlastMining.java similarity index 96% rename from src/main/java/com/gmail/nossr50/skills/gathering/BlastMining.java rename to src/main/java/com/gmail/nossr50/skills/mining/BlastMining.java index c1856f32c..f4f73ea09 100644 --- a/src/main/java/com/gmail/nossr50/skills/gathering/BlastMining.java +++ b/src/main/java/com/gmail/nossr50/skills/mining/BlastMining.java @@ -1,4 +1,4 @@ -package com.gmail.nossr50.skills.gathering; +package com.gmail.nossr50.skills.mining; import java.util.ArrayList; import java.util.HashSet; @@ -22,7 +22,6 @@ import com.gmail.nossr50.datatypes.AbilityType; import com.gmail.nossr50.datatypes.PlayerProfile; import com.gmail.nossr50.datatypes.SkillType; import com.gmail.nossr50.locale.LocaleLoader; -import com.gmail.nossr50.skills.mining.Mining; import com.gmail.nossr50.util.BlockChecks; import com.gmail.nossr50.util.Misc; import com.gmail.nossr50.util.Skills; diff --git a/src/main/java/com/gmail/nossr50/skills/gathering/Mining.java b/src/main/java/com/gmail/nossr50/skills/mining/Mining.java similarity index 96% rename from src/main/java/com/gmail/nossr50/skills/gathering/Mining.java rename to src/main/java/com/gmail/nossr50/skills/mining/Mining.java index d389078e8..cc44741f0 100644 --- a/src/main/java/com/gmail/nossr50/skills/gathering/Mining.java +++ b/src/main/java/com/gmail/nossr50/skills/mining/Mining.java @@ -1,4 +1,4 @@ -package com.gmail.nossr50.skills.gathering; +package com.gmail.nossr50.skills.mining; import java.util.Random; diff --git a/src/main/java/com/gmail/nossr50/util/blockmeta/chunkmeta/PrimitiveChunkStore.java b/src/main/java/com/gmail/nossr50/util/blockmeta/chunkmeta/PrimitiveChunkStore.java index 56ea9af44..59f1a45f1 100755 --- a/src/main/java/com/gmail/nossr50/util/blockmeta/chunkmeta/PrimitiveChunkStore.java +++ b/src/main/java/com/gmail/nossr50/util/blockmeta/chunkmeta/PrimitiveChunkStore.java @@ -214,8 +214,8 @@ public class PrimitiveChunkStore implements ChunkStore { } if(fileVersionNumber >= 6) { - spawnedMobs = (ArrayList) in.readObject(); - spawnedPets = (ArrayList) in.readObject(); + spawnedMobs = (ArrayList) in.readObject(); + spawnedPets = (ArrayList) in.readObject(); } } From 146fa474a12dedaf6e834804b849ca946a9e747b Mon Sep 17 00:00:00 2001 From: gmcferrin Date: Tue, 1 Jan 2013 16:02:39 -0500 Subject: [PATCH 08/18] Removed unused import --- .../gmail/nossr50/util/blockmeta/chunkmeta/HashChunkManager.java | 1 - 1 file changed, 1 deletion(-) diff --git a/src/main/java/com/gmail/nossr50/util/blockmeta/chunkmeta/HashChunkManager.java b/src/main/java/com/gmail/nossr50/util/blockmeta/chunkmeta/HashChunkManager.java index cc81573ff..d965df694 100755 --- a/src/main/java/com/gmail/nossr50/util/blockmeta/chunkmeta/HashChunkManager.java +++ b/src/main/java/com/gmail/nossr50/util/blockmeta/chunkmeta/HashChunkManager.java @@ -19,7 +19,6 @@ import org.bukkit.block.Block; import org.bukkit.entity.Entity; import org.bukkit.entity.LivingEntity; -import com.gmail.nossr50.mcMMO; import com.gmail.nossr50.runnables.ChunkletUnloader; import com.gmail.nossr50.runnables.blockstoreconversion.BlockStoreConversionZDirectory; From 15cdf3bfd6131524f47cad438df4c699c012ba1d Mon Sep 17 00:00:00 2001 From: gmcferrin Date: Tue, 1 Jan 2013 16:03:33 -0500 Subject: [PATCH 09/18] More unused imports --- src/main/java/com/gmail/nossr50/listeners/EntityListener.java | 1 - .../gmail/nossr50/skills/taming/CallOfTheWildEventHandler.java | 1 - 2 files changed, 2 deletions(-) diff --git a/src/main/java/com/gmail/nossr50/listeners/EntityListener.java b/src/main/java/com/gmail/nossr50/listeners/EntityListener.java index d5d4d1ee1..7208fd793 100644 --- a/src/main/java/com/gmail/nossr50/listeners/EntityListener.java +++ b/src/main/java/com/gmail/nossr50/listeners/EntityListener.java @@ -23,7 +23,6 @@ import org.bukkit.event.entity.EntityExplodeEvent; import org.bukkit.event.entity.EntityTameEvent; import org.bukkit.event.entity.ExplosionPrimeEvent; import org.bukkit.event.entity.FoodLevelChangeEvent; -import org.bukkit.metadata.FixedMetadataValue; import com.gmail.nossr50.mcMMO; import com.gmail.nossr50.config.AdvancedConfig; diff --git a/src/main/java/com/gmail/nossr50/skills/taming/CallOfTheWildEventHandler.java b/src/main/java/com/gmail/nossr50/skills/taming/CallOfTheWildEventHandler.java index 7a38fa8cc..3bc6b1e4f 100644 --- a/src/main/java/com/gmail/nossr50/skills/taming/CallOfTheWildEventHandler.java +++ b/src/main/java/com/gmail/nossr50/skills/taming/CallOfTheWildEventHandler.java @@ -9,7 +9,6 @@ import org.bukkit.entity.Ocelot; import org.bukkit.entity.Player; import org.bukkit.entity.Tameable; import org.bukkit.inventory.ItemStack; -import org.bukkit.metadata.FixedMetadataValue; import com.gmail.nossr50.mcMMO; import com.gmail.nossr50.locale.LocaleLoader; From aeaad41c452ef30fe1e9f691e8bd6de655d2dce1 Mon Sep 17 00:00:00 2001 From: gmcferrin Date: Tue, 1 Jan 2013 16:04:53 -0500 Subject: [PATCH 10/18] Fix static access issues. --- .../java/com/gmail/nossr50/listeners/EntityListener.java | 8 ++++---- .../java/com/gmail/nossr50/listeners/WorldListener.java | 2 +- .../nossr50/skills/taming/CallOfTheWildEventHandler.java | 2 +- src/main/java/com/gmail/nossr50/util/Combat.java | 4 ++-- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/main/java/com/gmail/nossr50/listeners/EntityListener.java b/src/main/java/com/gmail/nossr50/listeners/EntityListener.java index 7208fd793..0e2493c2e 100644 --- a/src/main/java/com/gmail/nossr50/listeners/EntityListener.java +++ b/src/main/java/com/gmail/nossr50/listeners/EntityListener.java @@ -183,8 +183,8 @@ public class EntityListener implements Listener { entity.setFireTicks(0); BleedTimer.remove(entity); Archery.arrowRetrievalCheck(entity); - mcMMO.p.placeStore.removeSpawnedMob(((Entity) entity)); - mcMMO.p.placeStore.removeSpawnedPet(((Entity) entity)); + mcMMO.placeStore.removeSpawnedMob(((Entity) entity)); + mcMMO.placeStore.removeSpawnedPet(((Entity) entity)); } /** @@ -197,7 +197,7 @@ public class EntityListener implements Listener { SpawnReason reason = event.getSpawnReason(); if ((reason.equals(SpawnReason.SPAWNER) || reason.equals(SpawnReason.SPAWNER_EGG)) && !Config.getInstance().getExperienceGainsMobspawnersEnabled()) { - mcMMO.p.placeStore.addSpawnedMob(((Entity) event.getEntity())); + mcMMO.placeStore.addSpawnedMob(((Entity) event.getEntity())); } } @@ -398,7 +398,7 @@ public class EntityListener implements Listener { if(player.hasMetadata("NPC")) return; // Check if this player is a Citizens NPC - if (Permissions.getInstance().taming(player) && !mcMMO.p.placeStore.isSpawnedPet((Entity) event.getEntity())) { + if (Permissions.getInstance().taming(player) && !mcMMO.placeStore.isSpawnedPet((Entity) event.getEntity())) { PlayerProfile profile = Users.getProfile(player); EntityType type = event.getEntityType(); int xp = 0; diff --git a/src/main/java/com/gmail/nossr50/listeners/WorldListener.java b/src/main/java/com/gmail/nossr50/listeners/WorldListener.java index d35007f60..bd44a463f 100644 --- a/src/main/java/com/gmail/nossr50/listeners/WorldListener.java +++ b/src/main/java/com/gmail/nossr50/listeners/WorldListener.java @@ -51,6 +51,6 @@ public class WorldListener implements Listener { @EventHandler public void onChunkLoad(ChunkLoadEvent event) { if(event.getChunk().getEntities().length > 0) - mcMMO.p.placeStore.loadChunk(event.getChunk().getX(), event.getChunk().getZ(), event.getWorld()); + mcMMO.placeStore.loadChunk(event.getChunk().getX(), event.getChunk().getZ(), event.getWorld()); } } diff --git a/src/main/java/com/gmail/nossr50/skills/taming/CallOfTheWildEventHandler.java b/src/main/java/com/gmail/nossr50/skills/taming/CallOfTheWildEventHandler.java index 3bc6b1e4f..a99f25b18 100644 --- a/src/main/java/com/gmail/nossr50/skills/taming/CallOfTheWildEventHandler.java +++ b/src/main/java/com/gmail/nossr50/skills/taming/CallOfTheWildEventHandler.java @@ -67,7 +67,7 @@ public class CallOfTheWildEventHandler { return; LivingEntity entity = (LivingEntity) player.getWorld().spawnEntity(player.getLocation(), type); - mcMMO.p.placeStore.addSpawnedPet((Entity) entity); + mcMMO.placeStore.addSpawnedPet((Entity) entity); ((Tameable) entity).setOwner(player); diff --git a/src/main/java/com/gmail/nossr50/util/Combat.java b/src/main/java/com/gmail/nossr50/util/Combat.java index 819967a75..7b09183b3 100644 --- a/src/main/java/com/gmail/nossr50/util/Combat.java +++ b/src/main/java/com/gmail/nossr50/util/Combat.java @@ -399,8 +399,8 @@ public class Combat { baseXP = 20 * configInstance.getPlayerVersusPlayerXP(); } } - else if (!mcMMO.p.placeStore.isSpawnedMob(((Entity) target))) { - if (target instanceof Animals && !mcMMO.p.placeStore.isSpawnedPet((Entity) target)) { + else if (!mcMMO.placeStore.isSpawnedMob(((Entity) target))) { + if (target instanceof Animals && !mcMMO.placeStore.isSpawnedPet((Entity) target)) { baseXP = configInstance.getAnimalsXP(); } else { From 1ff17046971943a1a801b9d7e0764509423a25ff Mon Sep 17 00:00:00 2001 From: gmcferrin Date: Tue, 1 Jan 2013 16:13:33 -0500 Subject: [PATCH 11/18] Fixed some parameterization issues. --- .../util/blockmeta/chunkmeta/PrimitiveChunkStore.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/gmail/nossr50/util/blockmeta/chunkmeta/PrimitiveChunkStore.java b/src/main/java/com/gmail/nossr50/util/blockmeta/chunkmeta/PrimitiveChunkStore.java index 59f1a45f1..a97cd7fa9 100755 --- a/src/main/java/com/gmail/nossr50/util/blockmeta/chunkmeta/PrimitiveChunkStore.java +++ b/src/main/java/com/gmail/nossr50/util/blockmeta/chunkmeta/PrimitiveChunkStore.java @@ -22,8 +22,8 @@ public class PrimitiveChunkStore implements ChunkStore { private int cx; private int cz; private UUID worldUid; - private List spawnedMobs = new ArrayList(); - private List spawnedPets = new ArrayList(); + private List spawnedMobs = new ArrayList(); + private List spawnedPets = new ArrayList(); transient private int worldHeight; transient private int xBitShifts; transient private int zBitShifts; @@ -214,6 +214,7 @@ public class PrimitiveChunkStore implements ChunkStore { } if(fileVersionNumber >= 6) { + //What do we want to do about this? These casts are unchecked. spawnedMobs = (ArrayList) in.readObject(); spawnedPets = (ArrayList) in.readObject(); } From 7a49fbb0bb32c85cd03335f48e53605e7fcb92b3 Mon Sep 17 00:00:00 2001 From: TfT_02 Date: Tue, 1 Jan 2013 22:42:27 +0100 Subject: [PATCH 12/18] Update the changelog with recent changes by Glitchfinder --- Changelog.txt | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Changelog.txt b/Changelog.txt index c74e9fee8..578abaf87 100644 --- a/Changelog.txt +++ b/Changelog.txt @@ -27,6 +27,9 @@ Version 1.3.13-dev = Fixed a bug where a infinite loop of errors caused by mySQL database could cause the server to crash = Fixed a bug where PartyChangeEvent was fired even when a player isn't able to change parties = Fixed a bug which caused advanced.yml not to work for Swords + = Fixed a bug where Repair would remove enchantments but the glow effect remained + = Fixed a bug where dropped items did not retain custom NBT data + = Fixed a bug which caused a potentially infinite recursion in a btree structure = Fixed a NPE with custom blocks ! GJ stopped being a lazy slacker and got stuff done ! Changed code that uses SpoutPlugin to make it compatible with the latest version From 3194baffd7644bdfa2f43fe995b0b9d9da10b59e Mon Sep 17 00:00:00 2001 From: gmcferrin Date: Tue, 1 Jan 2013 17:12:15 -0500 Subject: [PATCH 13/18] Use finals rather than local variables. --- .../com/gmail/nossr50/skills/archery/Archery.java | 2 ++ .../gmail/nossr50/skills/archery/ArcheryManager.java | 12 ++---------- 2 files changed, 4 insertions(+), 10 deletions(-) diff --git a/src/main/java/com/gmail/nossr50/skills/archery/Archery.java b/src/main/java/com/gmail/nossr50/skills/archery/Archery.java index 8579deed2..08093959c 100644 --- a/src/main/java/com/gmail/nossr50/skills/archery/Archery.java +++ b/src/main/java/com/gmail/nossr50/skills/archery/Archery.java @@ -18,12 +18,14 @@ public class Archery { private static List trackedEntities = new ArrayList(); public static final int ARROW_TRACKING_MAX_BONUS_LEVEL = advancedConfig.getRetrieveMaxBonusLevel(); + public static final int ARROW_TRACKING_MAX_BONUS = advancedConfig.getRetrieveBonusMax(); public static final int BONUS_DAMAGE_INCREASE_LEVEL = advancedConfig.getSkillShotIncreaseLevel(); public static final double BONUS_DAMAGE_INCREASE_PERCENT = advancedConfig.getSkillShotIncreasePercentage(); public static final double BONUS_DAMAGE_MAX_BONUS_PERCENTAGE = advancedConfig.getSkillShotBonusMax(); public static final int DAZE_MAX_BONUS_LEVEL = advancedConfig.getDazeMaxBonusLevel(); + public static final int DAZE_MAX_BONUS = advancedConfig.getDazeBonusMax(); public static final int DAZE_MODIFIER = advancedConfig.getDazeModifier(); protected static void incrementTrackerValue(LivingEntity livingEntity) { diff --git a/src/main/java/com/gmail/nossr50/skills/archery/ArcheryManager.java b/src/main/java/com/gmail/nossr50/skills/archery/ArcheryManager.java index 3faf7080f..3f26b5e87 100644 --- a/src/main/java/com/gmail/nossr50/skills/archery/ArcheryManager.java +++ b/src/main/java/com/gmail/nossr50/skills/archery/ArcheryManager.java @@ -4,25 +4,17 @@ import org.bukkit.entity.LivingEntity; import org.bukkit.entity.Player; import org.bukkit.event.entity.EntityDamageEvent; -import com.gmail.nossr50.config.AdvancedConfig; import com.gmail.nossr50.datatypes.PlayerProfile; import com.gmail.nossr50.datatypes.SkillType; import com.gmail.nossr50.util.Permissions; import com.gmail.nossr50.util.Users; public class ArcheryManager { - AdvancedConfig advancedConfig = AdvancedConfig.getInstance(); - private Player player; private PlayerProfile profile; private int skillLevel; private Permissions permissionsInstance; - private float dazeBonusMax = advancedConfig.getDazeBonusMax(); - private float dazeMaxBonusLevel = advancedConfig.getDazeMaxBonusLevel(); - private float retrieveBonusMax = advancedConfig.getRetrieveBonusMax(); - private float retrieveMaxBonusLevel = advancedConfig.getRetrieveMaxBonusLevel(); - public ArcheryManager (Player player) { this.player = player; this.profile = Users.getProfile(player); @@ -57,7 +49,7 @@ public class ArcheryManager { if (player.hasPermission("mcmmo.perks.lucky.archery")) { randomChance = (int) (randomChance * 0.75); } - final float chance = (float) (((double) retrieveBonusMax / (double) retrieveMaxBonusLevel) * skillLevel); + final float chance = (float) (((double) Archery.ARROW_TRACKING_MAX_BONUS / (double) Archery.ARROW_TRACKING_MAX_BONUS_LEVEL) * skillLevel); if (chance > Archery.getRandom().nextInt(randomChance)) { eventHandler.addToTracker(); } @@ -88,7 +80,7 @@ public class ArcheryManager { randomChance = (int) (randomChance * 0.75); } - final float chance = (float) (((double) dazeBonusMax / (double) dazeMaxBonusLevel) * skillLevel); + final float chance = (float) (((double) Archery.DAZE_MAX_BONUS / (double) Archery.DAZE_MAX_BONUS_LEVEL) * skillLevel); if (chance > Archery.getRandom().nextInt(randomChance)) { eventHandler.handleDazeEffect(); eventHandler.sendAbilityMessages(); From 48150e20021fe6f5be40edb8247e6ef34aae15e9 Mon Sep 17 00:00:00 2001 From: gmcferrin Date: Tue, 1 Jan 2013 17:32:22 -0500 Subject: [PATCH 14/18] Move permissions declaration to the constructor. --- .../com/gmail/nossr50/skills/acrobatics/AcrobaticsManager.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/gmail/nossr50/skills/acrobatics/AcrobaticsManager.java b/src/main/java/com/gmail/nossr50/skills/acrobatics/AcrobaticsManager.java index 241b042a6..cfe6fe8fb 100644 --- a/src/main/java/com/gmail/nossr50/skills/acrobatics/AcrobaticsManager.java +++ b/src/main/java/com/gmail/nossr50/skills/acrobatics/AcrobaticsManager.java @@ -13,12 +13,13 @@ public class AcrobaticsManager { private Player player; private PlayerProfile profile; private int skillLevel; - private Permissions permissionInstance = Permissions.getInstance(); + private Permissions permissionInstance; public AcrobaticsManager (Player player) { this.player = player; this.profile = Users.getProfile(player); this.skillLevel = profile.getSkillLevel(SkillType.ACROBATICS); + this.permissionInstance = Permissions.getInstance(); } /** From 6d76a14ed0f7920e233aafdf833dc18fa35c663a Mon Sep 17 00:00:00 2001 From: TfT_02 Date: Wed, 2 Jan 2013 00:18:41 +0100 Subject: [PATCH 15/18] Update the README Added link to the mcMMO jenkins and removed the link to the dead forums --- README.creole | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/README.creole b/README.creole index 952bcef16..2342a9bf2 100644 --- a/README.creole +++ b/README.creole @@ -1,8 +1,8 @@ == mcMMO **The RPG lovers mod** -=== Forums -http://forums.mcmmo.info Talk with developers and the community about mcMMO here +=== Dev builds +http://nuclearw.com:8080/job/mcMMO/ Download the latest dev build of mcMMO here. === Brief Description mcMMO takes core Minecraft game mechanics and expands them to add an extensive RPG experience, the goal of the project has always been a quality RPG experience. Everything in mcMMO is carefully thought out and is constantly improving. mcMMO adds eleven skills to train in and level in, while also offering a high level of customization for server admins. There are countless features, including custom sounds, graphical elements, and more added when running mcMMO in conjunction with Spout. I carefully read feedback and evaluate the mechanics of mcMMO in every update to provide an ever-evolving experience. @@ -20,6 +20,7 @@ Hearing that people enjoy mcMMO and seeing the daily youtube videos about my mod Required Libraries: * Spout API +* JUnit Required to Run: * Bukkit From 3aee334fbd97db3ff3521ad0d8c7d81da2df09d6 Mon Sep 17 00:00:00 2001 From: TfT_02 Date: Wed, 2 Jan 2013 00:34:32 +0100 Subject: [PATCH 16/18] Fixed Arcobatics & Archery ignoring ChanceMax settings from advanced config --- .../nossr50/skills/acrobatics/Acrobatics.java | 7 ++++++- .../skills/acrobatics/AcrobaticsManager.java | 18 ++++++++++++++---- .../skills/acrobatics/RollEventHandler.java | 2 +- .../nossr50/skills/archery/ArcheryManager.java | 9 +++++++-- 4 files changed, 28 insertions(+), 8 deletions(-) diff --git a/src/main/java/com/gmail/nossr50/skills/acrobatics/Acrobatics.java b/src/main/java/com/gmail/nossr50/skills/acrobatics/Acrobatics.java index 1af3cc8c5..c9883433d 100644 --- a/src/main/java/com/gmail/nossr50/skills/acrobatics/Acrobatics.java +++ b/src/main/java/com/gmail/nossr50/skills/acrobatics/Acrobatics.java @@ -6,12 +6,17 @@ import com.gmail.nossr50.config.AdvancedConfig; public class Acrobatics { static AdvancedConfig advancedConfig = AdvancedConfig.getInstance(); + public static final int DODGE_MAX_CHANCE = advancedConfig.getDodgeChanceMax(); public static final int DODGE_MAX_BONUS_LEVEL = advancedConfig.getDodgeMaxBonusLevel(); public static final int DODGE_XP_MODIFIER = advancedConfig.getDodgeXPModifier(); - public static final int FALL_XP_MODIFIER = advancedConfig.getFallXPModifier(); + public static final int ROLL_MAX_CHANCE = advancedConfig.getRollChanceMax(); public static final int ROLL_MAX_BONUS_LEVEL = advancedConfig.getRollMaxBonusLevel(); + public static final int GRACEFUL_MAX_CHANCE = advancedConfig.getGracefulRollChanceMax(); + public static final int GRACEFUL_MAX_BONUS_LEVEL = advancedConfig.getGracefulRollMaxBonusLevel(); + public static final int ROLL_XP_MODIFIER = advancedConfig.getRollXPModifier(); + public static final int FALL_XP_MODIFIER = advancedConfig.getFallXPModifier(); private static Random random = new Random(); diff --git a/src/main/java/com/gmail/nossr50/skills/acrobatics/AcrobaticsManager.java b/src/main/java/com/gmail/nossr50/skills/acrobatics/AcrobaticsManager.java index cfe6fe8fb..2b417369f 100644 --- a/src/main/java/com/gmail/nossr50/skills/acrobatics/AcrobaticsManager.java +++ b/src/main/java/com/gmail/nossr50/skills/acrobatics/AcrobaticsManager.java @@ -40,13 +40,20 @@ public class AcrobaticsManager { RollEventHandler eventHandler = new RollEventHandler(this, event); - int randomChance = 1000; + int randomChance = 100; if (player.hasPermission("mcmmo.perks.lucky.acrobatics")) { randomChance = (int) (randomChance * 0.75); } - if (Acrobatics.getRandom().nextInt(randomChance) <= eventHandler.skillModifier && !eventHandler.isFatal(eventHandler.modifiedDamage)) { + float chance = (float) (((double) Acrobatics.ROLL_MAX_CHANCE / (double) Acrobatics.ROLL_MAX_BONUS_LEVEL) * skillLevel); + if (chance > Acrobatics.ROLL_MAX_CHANCE) chance = Acrobatics.ROLL_MAX_CHANCE; + if (eventHandler.isGraceful) { + chance = (float) (((double) Acrobatics.GRACEFUL_MAX_CHANCE / (double) Acrobatics.GRACEFUL_MAX_BONUS_LEVEL) * skillLevel); + if (chance > Acrobatics.GRACEFUL_MAX_CHANCE) chance = Acrobatics.GRACEFUL_MAX_CHANCE; + } + + if (chance > Acrobatics.getRandom().nextInt(randomChance) && !eventHandler.isFatal(eventHandler.modifiedDamage)) { eventHandler.modifyEventDamage(); eventHandler.sendAbilityMessage(); eventHandler.processXPGain(eventHandler.damage * Acrobatics.ROLL_XP_MODIFIER); @@ -71,13 +78,16 @@ public class AcrobaticsManager { DodgeEventHandler eventHandler = new DodgeEventHandler(this, event); - int randomChance = 4000; + int randomChance = 100; if (player.hasPermission("mcmmo.perks.lucky.acrobatics")) { randomChance = (int) (randomChance * 0.75); } - if (Acrobatics.getRandom().nextInt(randomChance) <= eventHandler.skillModifier && !eventHandler.isFatal(eventHandler.modifiedDamage)) { + float chance = (float) (((double) Acrobatics.DODGE_MAX_CHANCE / (double) Acrobatics.DODGE_MAX_BONUS_LEVEL) * skillLevel); + if (chance > Acrobatics.DODGE_MAX_CHANCE) chance = Acrobatics.DODGE_MAX_CHANCE; + + if (chance > Acrobatics.getRandom().nextInt(randomChance) && !eventHandler.isFatal(eventHandler.modifiedDamage)) { eventHandler.modifyEventDamage(); eventHandler.sendAbilityMessage(); eventHandler.processXPGain(eventHandler.damage * Acrobatics.DODGE_XP_MODIFIER); diff --git a/src/main/java/com/gmail/nossr50/skills/acrobatics/RollEventHandler.java b/src/main/java/com/gmail/nossr50/skills/acrobatics/RollEventHandler.java index 4ef6f39d4..1ca82153f 100644 --- a/src/main/java/com/gmail/nossr50/skills/acrobatics/RollEventHandler.java +++ b/src/main/java/com/gmail/nossr50/skills/acrobatics/RollEventHandler.java @@ -9,7 +9,7 @@ import com.gmail.nossr50.util.Permissions; import com.gmail.nossr50.util.Skills; public class RollEventHandler extends AcrobaticsEventHandler { - private boolean isGraceful; + public boolean isGraceful; private int damageThreshold; protected RollEventHandler(AcrobaticsManager manager, EntityDamageEvent event) { diff --git a/src/main/java/com/gmail/nossr50/skills/archery/ArcheryManager.java b/src/main/java/com/gmail/nossr50/skills/archery/ArcheryManager.java index 3f26b5e87..1f56eb3a4 100644 --- a/src/main/java/com/gmail/nossr50/skills/archery/ArcheryManager.java +++ b/src/main/java/com/gmail/nossr50/skills/archery/ArcheryManager.java @@ -49,7 +49,10 @@ public class ArcheryManager { if (player.hasPermission("mcmmo.perks.lucky.archery")) { randomChance = (int) (randomChance * 0.75); } - final float chance = (float) (((double) Archery.ARROW_TRACKING_MAX_BONUS / (double) Archery.ARROW_TRACKING_MAX_BONUS_LEVEL) * skillLevel); + + float chance = (float) (((double) Archery.ARROW_TRACKING_MAX_BONUS / (double) Archery.ARROW_TRACKING_MAX_BONUS_LEVEL) * skillLevel); + if (chance > Archery.ARROW_TRACKING_MAX_BONUS) chance = Archery.ARROW_TRACKING_MAX_BONUS; + if (chance > Archery.getRandom().nextInt(randomChance)) { eventHandler.addToTracker(); } @@ -80,7 +83,9 @@ public class ArcheryManager { randomChance = (int) (randomChance * 0.75); } - final float chance = (float) (((double) Archery.DAZE_MAX_BONUS / (double) Archery.DAZE_MAX_BONUS_LEVEL) * skillLevel); + float chance = (float) (((double) Archery.DAZE_MAX_BONUS / (double) Archery.DAZE_MAX_BONUS_LEVEL) * skillLevel); + if (chance > Archery.DAZE_MAX_BONUS) chance = Archery.DAZE_MAX_BONUS; + if (chance > Archery.getRandom().nextInt(randomChance)) { eventHandler.handleDazeEffect(); eventHandler.sendAbilityMessages(); From 4f8337c11a4acca1c54280d9cec9e2e5960e0ce3 Mon Sep 17 00:00:00 2001 From: TfT_02 Date: Wed, 2 Jan 2013 01:27:50 +0100 Subject: [PATCH 17/18] Fixed a bug which caused advanced.yml not to respect every MaxChance node --- Changelog.txt | 1 + .../com/gmail/nossr50/skills/combat/Axes.java | 1 + .../nossr50/skills/gathering/Herbalism.java | 36 +++++++++++++------ .../nossr50/skills/gathering/WoodCutting.java | 1 + .../gmail/nossr50/skills/repair/Repair.java | 19 +++++----- .../gmail/nossr50/skills/swords/Swords.java | 2 ++ .../nossr50/skills/swords/SwordsManager.java | 14 ++++---- .../gmail/nossr50/skills/taming/Taming.java | 1 + .../nossr50/skills/taming/TamingManager.java | 7 ++-- .../gmail/nossr50/skills/unarmed/Unarmed.java | 3 ++ .../skills/unarmed/UnarmedManager.java | 19 +++++----- 11 files changed, 61 insertions(+), 43 deletions(-) diff --git a/Changelog.txt b/Changelog.txt index 578abaf87..e9bc63488 100644 --- a/Changelog.txt +++ b/Changelog.txt @@ -27,6 +27,7 @@ Version 1.3.13-dev = Fixed a bug where a infinite loop of errors caused by mySQL database could cause the server to crash = Fixed a bug where PartyChangeEvent was fired even when a player isn't able to change parties = Fixed a bug which caused advanced.yml not to work for Swords + = Fixed a bug which caused advanced.yml not to respect every MaxChance node = Fixed a bug where Repair would remove enchantments but the glow effect remained = Fixed a bug where dropped items did not retain custom NBT data = Fixed a bug which caused a potentially infinite recursion in a btree structure diff --git a/src/main/java/com/gmail/nossr50/skills/combat/Axes.java b/src/main/java/com/gmail/nossr50/skills/combat/Axes.java index 22ac29c55..230e285b3 100644 --- a/src/main/java/com/gmail/nossr50/skills/combat/Axes.java +++ b/src/main/java/com/gmail/nossr50/skills/combat/Axes.java @@ -89,6 +89,7 @@ public class Axes { int randomChance = 100; double chance = (MAX_CHANCE / MAX_BONUS_LEVEL) * skillCheck; + if (chance > MAX_CHANCE) chance = MAX_CHANCE; if (attacker.hasPermission("mcmmo.perks.lucky.axes")) { randomChance = (int) (randomChance * 0.75); diff --git a/src/main/java/com/gmail/nossr50/skills/gathering/Herbalism.java b/src/main/java/com/gmail/nossr50/skills/gathering/Herbalism.java index 7cddc3d41..6a14c1a44 100644 --- a/src/main/java/com/gmail/nossr50/skills/gathering/Herbalism.java +++ b/src/main/java/com/gmail/nossr50/skills/gathering/Herbalism.java @@ -13,6 +13,7 @@ import org.bukkit.inventory.PlayerInventory; import org.bukkit.material.MaterialData; import com.gmail.nossr50.mcMMO; +import com.gmail.nossr50.config.AdvancedConfig; import com.gmail.nossr50.config.Config; import com.gmail.nossr50.config.mods.CustomBlocksConfig; import com.gmail.nossr50.datatypes.AbilityType; @@ -30,6 +31,7 @@ import com.gmail.nossr50.util.Users; public class Herbalism { private static Random random = new Random(); + static AdvancedConfig advancedConfig = AdvancedConfig.getInstance(); /** * Activate the Green Terra ability. @@ -85,7 +87,8 @@ public class Herbalism { return; final PlayerProfile profile = Users.getProfile(player); - final int MAX_BONUS_LEVEL = 1000; + final double MAX_CHANCE = advancedConfig.getHerbalismDoubleDropsChanceMax(); + final int MAX_BONUS_LEVEL = advancedConfig.getHerbalismDoubleDropsMaxLevel(); int herbLevel = profile.getSkillLevel(SkillType.HERBALISM); int id = block.getTypeId(); @@ -101,12 +104,15 @@ public class Herbalism { boolean customPlant = false; - int randomChance = 1000; + int randomChance = 100; if (player.hasPermission("mcmmo.perks.lucky.herbalism")) { randomChance = (int) (randomChance * 0.75); } + float chance = (float) (((double) MAX_CHANCE / (double) MAX_BONUS_LEVEL) * herbLevel); + if (chance > MAX_CHANCE) chance = (float) MAX_CHANCE; + switch (type) { case BROWN_MUSHROOM: case RED_MUSHROOM: @@ -122,7 +128,7 @@ public class Herbalism { if (b.getType().equals(Material.CACTUS)) { mat = Material.CACTUS; if (!mcMMO.placeStore.isTrue(b)) { - if (herbLevel > MAX_BONUS_LEVEL || random.nextInt(randomChance) <= herbLevel) { + if (chance > random.nextInt(randomChance)) { catciDrops++; } xp += Config.getInstance().getHerbalismXPCactus(); @@ -182,7 +188,7 @@ public class Herbalism { if (b.getType().equals(Material.SUGAR_CANE_BLOCK)) { mat = Material.SUGAR_CANE; if (!mcMMO.placeStore.isTrue(b)) { - if (herbLevel > MAX_BONUS_LEVEL || random.nextInt(randomChance) <= herbLevel) { + if (chance > random.nextInt(randomChance)) { caneDrops++; } xp += Config.getInstance().getHerbalismXPSugarCane(); @@ -275,7 +281,7 @@ public class Herbalism { } } - if (herbLevel > MAX_BONUS_LEVEL || random.nextInt(randomChance) <= herbLevel) { + if (chance > random.nextInt(randomChance)) { Config configInstance = Config.getInstance(); switch (type) { @@ -399,7 +405,8 @@ public class Herbalism { * @param plugin mcMMO plugin instance */ private static void greenThumbWheat(Block block, Player player, BlockBreakEvent event, mcMMO plugin) { - final int MAX_BONUS_LEVEL = 1500; + final int MAX_CHANCE = advancedConfig.getGreenThumbChanceMax(); + final int MAX_BONUS_LEVEL = advancedConfig.getGreenThumbMaxLevel(); PlayerProfile profile = Users.getProfile(player); int herbLevel = profile.getSkillLevel(SkillType.HERBALISM); @@ -429,13 +436,16 @@ public class Herbalism { break; } - int randomChance = 1500; + int randomChance = 100; if (player.hasPermission("mcmmo.perks.lucky.herbalism")) { randomChance = (int) (randomChance * 0.75); } - if (hasSeeds && profile.getAbilityMode(AbilityType.GREEN_TERRA) || hasSeeds && (herbLevel > MAX_BONUS_LEVEL || random.nextInt(randomChance) <= herbLevel)) { + float chance = (float) (((double) MAX_CHANCE / (double) MAX_BONUS_LEVEL) * herbLevel); + if (chance > MAX_CHANCE) chance = (float) MAX_CHANCE; + + if (hasSeeds && profile.getAbilityMode(AbilityType.GREEN_TERRA) || hasSeeds && (chance > random.nextInt(randomChance))) { event.setCancelled(true); switch(type) { @@ -481,7 +491,8 @@ public class Herbalism { * @param block The block being used in the ability */ public static void greenThumbBlocks(ItemStack is, Player player, Block block) { - final int MAX_BONUS_LEVEL = 1500; + final int MAX_CHANCE = advancedConfig.getGreenThumbChanceMax(); + final int MAX_BONUS_LEVEL = advancedConfig.getGreenThumbMaxLevel(); PlayerProfile profile = Users.getProfile(player); int skillLevel = profile.getSkillLevel(SkillType.HERBALISM); @@ -489,13 +500,16 @@ public class Herbalism { player.setItemInHand(new ItemStack(Material.SEEDS, seeds - 1)); - int randomChance = 1500; + int randomChance = 100; if (player.hasPermission("mcmmo.perks.lucky.herbalism")) { randomChance = (int) (randomChance * 0.75); } - if (skillLevel > MAX_BONUS_LEVEL || random.nextInt(randomChance) <= skillLevel) { + float chance = (float) (((double) MAX_CHANCE / (double) MAX_BONUS_LEVEL) * skillLevel); + if (chance > MAX_CHANCE) chance = (float) MAX_CHANCE; + + if (chance > random.nextInt(randomChance)) { greenTerraConvert(player, block); } else { diff --git a/src/main/java/com/gmail/nossr50/skills/gathering/WoodCutting.java b/src/main/java/com/gmail/nossr50/skills/gathering/WoodCutting.java index 5a11558d2..ac5231252 100644 --- a/src/main/java/com/gmail/nossr50/skills/gathering/WoodCutting.java +++ b/src/main/java/com/gmail/nossr50/skills/gathering/WoodCutting.java @@ -356,6 +356,7 @@ public class WoodCutting { int randomChance = 100; int chance = (int) (((double) MAX_CHANCE / (double) MAX_BONUS_LEVEL) * skillLevel); + if (chance > MAX_CHANCE) chance = MAX_CHANCE; if (player.hasPermission("mcmmo.perks.lucky.woodcutting")) { randomChance = (int) (randomChance * 0.75); diff --git a/src/main/java/com/gmail/nossr50/skills/repair/Repair.java b/src/main/java/com/gmail/nossr50/skills/repair/Repair.java index 019ac2cf3..47580266c 100644 --- a/src/main/java/com/gmail/nossr50/skills/repair/Repair.java +++ b/src/main/java/com/gmail/nossr50/skills/repair/Repair.java @@ -31,10 +31,10 @@ public class Repair { static AdvancedConfig advancedConfig = AdvancedConfig.getInstance(); - private static int repairMasteryChanceMax = advancedConfig.getRepairMasteryChanceMax(); - private static int repairMasteryMaxBonusLevel = advancedConfig.getRepairMasteryMaxLevel(); - private static int superRepairChanceMax = advancedConfig.getSuperRepairChanceMax(); - private static int superRepairMaxBonusLevel = advancedConfig.getSuperRepairMaxLevel(); + public static final int REPAIR_MASTERY_CHANCE_MAX = advancedConfig.getRepairMasteryChanceMax(); + public static final int REPAIR_MASTERY_MAX_BONUS_LEVEL = advancedConfig.getRepairMasteryMaxLevel(); + public static final int SUPER_REPAIR_CHANCE_MAX = advancedConfig.getSuperRepairChanceMax(); + public static final int SUPER_REPAIR_MAX_BONUS_LEVEL = advancedConfig.getSuperRepairMaxLevel(); /** * Handle the XP gain for repair events. @@ -241,8 +241,8 @@ public class Repair { */ protected static short repairCalculate(Player player, int skillLevel, short durability, int repairAmount) { float bonus; - if(skillLevel >= repairMasteryMaxBonusLevel) bonus = ((float) repairMasteryChanceMax / 100F); - else bonus = (((float) skillLevel) / ((float) repairMasteryMaxBonusLevel)) * (((float) repairMasteryChanceMax) / 100F); + if(skillLevel >= REPAIR_MASTERY_MAX_BONUS_LEVEL) bonus = ((float) REPAIR_MASTERY_CHANCE_MAX / 100F); + else bonus = (((float) skillLevel) / ((float) REPAIR_MASTERY_MAX_BONUS_LEVEL)) * (((float) REPAIR_MASTERY_CHANCE_MAX) / 100F); if (permInstance.repairMastery(player)) { bonus = (((float) repairAmount) * bonus); @@ -272,14 +272,11 @@ public class Repair { * @return true if bonus granted, false otherwise */ public static boolean checkPlayerProcRepair(Player player) { - final int MAX_CHANCE = superRepairChanceMax; - final int MAX_BONUS_LEVEL = superRepairMaxBonusLevel; - int skillLevel = Users.getProfile(player).getSkillLevel(SkillType.REPAIR); int randomChance = 100; - int chance = (int) (((double) MAX_CHANCE / (double) MAX_BONUS_LEVEL) * skillLevel); - if (skillLevel >= MAX_BONUS_LEVEL) chance = MAX_CHANCE; + int chance = (int) (((double) SUPER_REPAIR_CHANCE_MAX / (double) SUPER_REPAIR_MAX_BONUS_LEVEL) * skillLevel); + if (skillLevel >= SUPER_REPAIR_MAX_BONUS_LEVEL) chance = SUPER_REPAIR_CHANCE_MAX; if (player.hasPermission("mcmmo.perks.lucky.repair")) randomChance = (int) (randomChance * 0.75); diff --git a/src/main/java/com/gmail/nossr50/skills/swords/Swords.java b/src/main/java/com/gmail/nossr50/skills/swords/Swords.java index c72c739c8..16afa0d57 100644 --- a/src/main/java/com/gmail/nossr50/skills/swords/Swords.java +++ b/src/main/java/com/gmail/nossr50/skills/swords/Swords.java @@ -7,10 +7,12 @@ import com.gmail.nossr50.config.AdvancedConfig; public class Swords { static AdvancedConfig advancedConfig = AdvancedConfig.getInstance(); + public static final int BLEED_CHANCE_MAX = AdvancedConfig.getInstance().getBleedChanceMax(); public static final int BLEED_MAX_BONUS_LEVEL = advancedConfig.getBleedMaxBonusLevel(); public static final int MAX_BLEED_TICKS = advancedConfig.getBleedMaxTicks(); public static final int BASE_BLEED_TICKS = advancedConfig.getBleedBaseTicks(); + public static final int COUNTER_ATTACK_CHANCE_MAX = advancedConfig.getCounterChanceMax(); public static final int COUNTER_ATTACK_MAX_BONUS_LEVEL = advancedConfig.getCounterMaxBonusLevel(); public static final int COUNTER_ATTACK_MODIFIER = advancedConfig.getCounterModifier(); diff --git a/src/main/java/com/gmail/nossr50/skills/swords/SwordsManager.java b/src/main/java/com/gmail/nossr50/skills/swords/SwordsManager.java index f3dec39e6..c9c43e9ee 100644 --- a/src/main/java/com/gmail/nossr50/skills/swords/SwordsManager.java +++ b/src/main/java/com/gmail/nossr50/skills/swords/SwordsManager.java @@ -3,7 +3,6 @@ package com.gmail.nossr50.skills.swords; import org.bukkit.entity.LivingEntity; import org.bukkit.entity.Player; -import com.gmail.nossr50.config.AdvancedConfig; import com.gmail.nossr50.datatypes.PlayerProfile; import com.gmail.nossr50.datatypes.SkillType; import com.gmail.nossr50.util.Combat; @@ -42,15 +41,15 @@ public class SwordsManager { if (Combat.shouldBeAffected(player, defender)) { BleedEventHandler eventHandler = new BleedEventHandler(this, defender); - int bleedChanceMax = AdvancedConfig.getInstance().getBleedChanceMax(); - int bleedMaxLevel = AdvancedConfig.getInstance().getBleedMaxBonusLevel(); int randomChance = 100; if (player.hasPermission("mcmmo.perks.lucky.swords")) { randomChance = (int) (randomChance * 0.75); } - final float chance = (float) (((double) bleedChanceMax / (double) bleedMaxLevel) * skillLevel); + float chance = (float) (((double) Swords.BLEED_CHANCE_MAX / (double) Swords.BLEED_MAX_BONUS_LEVEL) * skillLevel); + if (chance > Swords.BLEED_CHANCE_MAX) chance = Swords.BLEED_CHANCE_MAX; + if (chance > Swords.getRandom().nextInt(randomChance)) { eventHandler.addBleedTicks(); eventHandler.sendAbilityMessages(); @@ -73,15 +72,16 @@ public class SwordsManager { if (eventHandler.isHoldingSword()) { eventHandler.calculateSkillModifier(); - int counterChanceMax = AdvancedConfig.getInstance().getCounterChanceMax(); - int counterMaxLevel = AdvancedConfig.getInstance().getCounterMaxBonusLevel(); + int randomChance = 100; if (player.hasPermission("mcmmo.perks.lucky.swords")) { randomChance = (int) (randomChance * 0.75); } - final float chance = (float) (((double) counterChanceMax / (double) counterMaxLevel) * skillLevel); + float chance = (float) (((double) Swords.COUNTER_ATTACK_CHANCE_MAX / (double) Swords.COUNTER_ATTACK_MAX_BONUS_LEVEL) * skillLevel); + if (chance > Swords.COUNTER_ATTACK_CHANCE_MAX) chance = Swords.COUNTER_ATTACK_CHANCE_MAX; + if (chance > Swords.getRandom().nextInt(randomChance)) { eventHandler.dealDamage(); eventHandler.sendAbilityMessages(); diff --git a/src/main/java/com/gmail/nossr50/skills/taming/Taming.java b/src/main/java/com/gmail/nossr50/skills/taming/Taming.java index 903a970d5..13cb89529 100644 --- a/src/main/java/com/gmail/nossr50/skills/taming/Taming.java +++ b/src/main/java/com/gmail/nossr50/skills/taming/Taming.java @@ -12,6 +12,7 @@ public class Taming { public static final int FAST_FOOD_SERVICE_ACTIVATION_CHANCE = advancedConfig.getFastFoodChance(); public static final int FAST_FOOD_SERVICE_ACTIVATION_LEVEL = advancedConfig.getFastFoodUnlock(); + public static final int GORE_CHANCE_MAX = AdvancedConfig.getInstance().getGoreChanceMax(); public static final int GORE_BLEED_TICKS = advancedConfig.getGoreBleedTicks(); public static final int GORE_MAX_BONUS_LEVEL = advancedConfig.getGoreMaxBonusLevel(); public static final int GORE_MULTIPLIER = advancedConfig.getGoreModifier(); diff --git a/src/main/java/com/gmail/nossr50/skills/taming/TamingManager.java b/src/main/java/com/gmail/nossr50/skills/taming/TamingManager.java index aa93d7bd5..9a9394f00 100644 --- a/src/main/java/com/gmail/nossr50/skills/taming/TamingManager.java +++ b/src/main/java/com/gmail/nossr50/skills/taming/TamingManager.java @@ -8,7 +8,6 @@ import org.bukkit.event.entity.EntityDamageEvent; import org.bukkit.event.entity.EntityDamageEvent.DamageCause; import org.bukkit.inventory.ItemStack; -import com.gmail.nossr50.config.AdvancedConfig; import com.gmail.nossr50.config.Config; import com.gmail.nossr50.datatypes.PlayerProfile; import com.gmail.nossr50.datatypes.SkillType; @@ -103,15 +102,15 @@ public class TamingManager { GoreEventHandler eventHandler = new GoreEventHandler(this, event); - int goreChanceMax = AdvancedConfig.getInstance().getGoreChanceMax(); - int goreMaxLevel = AdvancedConfig.getInstance().getGoreMaxBonusLevel(); int randomChance = 100; if (player.hasPermission("mcmmo.perks.lucky.taming")) { randomChance = (int) (randomChance * 0.75); } - final float chance = (float) (((double) goreChanceMax / (double) goreMaxLevel) * skillLevel); + float chance = (float) (((double) Taming.GORE_CHANCE_MAX / (double) Taming.GORE_MAX_BONUS_LEVEL) * skillLevel); + if (chance > Taming.GORE_CHANCE_MAX) chance = Taming.GORE_CHANCE_MAX; + if (chance > Taming.getRandom().nextInt(randomChance)) { eventHandler.modifyEventDamage(); eventHandler.applyBleed(); diff --git a/src/main/java/com/gmail/nossr50/skills/unarmed/Unarmed.java b/src/main/java/com/gmail/nossr50/skills/unarmed/Unarmed.java index 203af802a..69ae2d9ba 100644 --- a/src/main/java/com/gmail/nossr50/skills/unarmed/Unarmed.java +++ b/src/main/java/com/gmail/nossr50/skills/unarmed/Unarmed.java @@ -9,10 +9,13 @@ public class Unarmed { public static final int BONUS_DAMAGE_MAX_BONUS_MODIFIER = advancedConfig.getIronArmBonus(); public static final int BONUS_DAMAGE_INCREASE_LEVEL = advancedConfig.getIronArmIncreaseLevel(); + public static final int DEFLECT_MAX_CHANCE = advancedConfig.getDisarmChanceMax() ; public static final int DEFLECT_MAX_BONUS_LEVEL = advancedConfig.getDisarmMaxBonusLevel(); + public static final int DISARM_MAX_CHANCE = advancedConfig.getDeflectChanceMax(); public static final int DISARM_MAX_BONUS_LEVEL = advancedConfig.getDeflectMaxBonusLevel(); + public static final int IRON_GRIP_MAX_CHANCE = advancedConfig.getIronGripChanceMax(); public static final int IRON_GRIP_MAX_BONUS_LEVEL = advancedConfig.getIronGripMaxBonusLevel(); diff --git a/src/main/java/com/gmail/nossr50/skills/unarmed/UnarmedManager.java b/src/main/java/com/gmail/nossr50/skills/unarmed/UnarmedManager.java index 7cbaa3c07..47b3d007a 100644 --- a/src/main/java/com/gmail/nossr50/skills/unarmed/UnarmedManager.java +++ b/src/main/java/com/gmail/nossr50/skills/unarmed/UnarmedManager.java @@ -3,7 +3,6 @@ package com.gmail.nossr50.skills.unarmed; import org.bukkit.entity.Player; import org.bukkit.event.entity.EntityDamageEvent; -import com.gmail.nossr50.config.AdvancedConfig; import com.gmail.nossr50.datatypes.PlayerProfile; import com.gmail.nossr50.datatypes.SkillType; import com.gmail.nossr50.util.Permissions; @@ -43,15 +42,15 @@ public class UnarmedManager { if (eventHandler.isHoldingItem()) { eventHandler.calculateSkillModifier(); - int disarmChanceMax = AdvancedConfig.getInstance().getDisarmChanceMax(); - int disarmMaxLevel = AdvancedConfig.getInstance().getDisarmMaxBonusLevel(); int randomChance = 100; if (player.hasPermission("mcmmo.perks.lucky.unarmed")) { randomChance = (int) (randomChance * 0.75); } - final float chance = (float) (((double) disarmChanceMax / (double) disarmMaxLevel) * skillLevel); + float chance = (float) (((double) Unarmed.DISARM_MAX_CHANCE / (double) Unarmed.DISARM_MAX_BONUS_LEVEL) * skillLevel); + if (chance > Unarmed.DISARM_MAX_CHANCE) chance = Unarmed.DISARM_MAX_CHANCE; + if (chance > Unarmed.getRandom().nextInt(randomChance)) { if (!hasIronGrip(defender)) { eventHandler.sendAbilityMessage(); @@ -80,15 +79,15 @@ public class UnarmedManager { DeflectEventHandler eventHandler = new DeflectEventHandler(this, event); - int deflectChanceMax = AdvancedConfig.getInstance().getDeflectChanceMax(); - int deflectMaxLevel = AdvancedConfig.getInstance().getDeflectMaxBonusLevel(); int randomChance = 100; if (player.hasPermission("mcmmo.perks.lucky.unarmed")) { randomChance = (int) (randomChance * 0.75); } - final float chance = (float) (((double) deflectChanceMax / (double) deflectMaxLevel) * skillLevel); + float chance = (float) (((double) Unarmed.DEFLECT_MAX_CHANCE / (double) Unarmed.DEFLECT_MAX_BONUS_LEVEL) * skillLevel); + if (chance > Unarmed.DEFLECT_MAX_CHANCE) chance = Unarmed.DEFLECT_MAX_CHANCE; + if (chance > Unarmed.getRandom().nextInt(randomChance)) { eventHandler.cancelEvent(); eventHandler.sendAbilityMessage(); @@ -136,15 +135,15 @@ public class UnarmedManager { IronGripEventHandler eventHandler = new IronGripEventHandler(this, defender); - int ironGripChanceMax = AdvancedConfig.getInstance().getIronGripChanceMax(); - int ironGripMaxLevel = AdvancedConfig.getInstance().getIronGripMaxBonusLevel(); int randomChance = 100; if (defender.hasPermission("mcmmo.perks.lucky.unarmed")) { randomChance = (int) (randomChance * 0.75); } - final float chance = (float) (((double) ironGripChanceMax / (double) ironGripMaxLevel) * skillLevel); + float chance = (float) (((double) Unarmed.IRON_GRIP_MAX_CHANCE / (double) Unarmed.IRON_GRIP_MAX_BONUS_LEVEL) * skillLevel); + if (chance > Unarmed.IRON_GRIP_MAX_CHANCE) chance = Unarmed.IRON_GRIP_MAX_CHANCE; + if (chance > Unarmed.getRandom().nextInt(randomChance)) { eventHandler.sendAbilityMessages(); return true; From 66cc9bc6db29b4b84e12c5bb35d9f553424b63ca Mon Sep 17 00:00:00 2001 From: TfT_02 Date: Wed, 2 Jan 2013 02:10:16 +0100 Subject: [PATCH 18/18] Fixed a bug where GreenThumb_StageChange wasn't read from advanced.yml --- Changelog.txt | 1 + .../nossr50/runnables/GreenThumbTimer.java | 23 +++++++++++++------ 2 files changed, 17 insertions(+), 7 deletions(-) diff --git a/Changelog.txt b/Changelog.txt index e9bc63488..9eb7bc3a7 100644 --- a/Changelog.txt +++ b/Changelog.txt @@ -28,6 +28,7 @@ Version 1.3.13-dev = Fixed a bug where PartyChangeEvent was fired even when a player isn't able to change parties = Fixed a bug which caused advanced.yml not to work for Swords = Fixed a bug which caused advanced.yml not to respect every MaxChance node + = Fixed a bug where GreenThumb_StageChange wasn't read from advanced.yml = Fixed a bug where Repair would remove enchantments but the glow effect remained = Fixed a bug where dropped items did not retain custom NBT data = Fixed a bug which caused a potentially infinite recursion in a btree structure diff --git a/src/main/java/com/gmail/nossr50/runnables/GreenThumbTimer.java b/src/main/java/com/gmail/nossr50/runnables/GreenThumbTimer.java index 57f04bd3d..568f7c98f 100644 --- a/src/main/java/com/gmail/nossr50/runnables/GreenThumbTimer.java +++ b/src/main/java/com/gmail/nossr50/runnables/GreenThumbTimer.java @@ -4,11 +4,13 @@ import org.bukkit.CropState; import org.bukkit.Material; import org.bukkit.block.Block; +import com.gmail.nossr50.config.AdvancedConfig; import com.gmail.nossr50.datatypes.AbilityType; import com.gmail.nossr50.datatypes.PlayerProfile; import com.gmail.nossr50.datatypes.SkillType; public class GreenThumbTimer implements Runnable { + AdvancedConfig advancedConfig = AdvancedConfig.getInstance(); private Block block; private PlayerProfile profile; private Material type; @@ -24,19 +26,26 @@ public class GreenThumbTimer implements Runnable { if(this.block.getType() != this.type) this.block.setType(this.type); + int skillLevel = this.profile.getSkillLevel(SkillType.HERBALISM); + + final int STAGE_CHANGE = advancedConfig.getGreenThumbStageChange(); + + int greenThumbStage = (int) ((double) skillLevel / (double) STAGE_CHANGE); + if (greenThumbStage > 4) greenThumbStage = 4; + switch(this.type) { case CROPS: case CARROT: case POTATO: //This replants the wheat at a certain stage in development based on Herbalism Skill if (!this.profile.getAbilityMode(AbilityType.GREEN_TERRA)) { - if (this.profile.getSkillLevel(SkillType.HERBALISM) >= 600) { + if (greenThumbStage == 3) { this.block.setData(CropState.MEDIUM.getData()); } - else if (this.profile.getSkillLevel(SkillType.HERBALISM) >= 400) { + else if (greenThumbStage == 2) { this.block.setData(CropState.SMALL.getData()); } - else if (this.profile.getSkillLevel(SkillType.HERBALISM) >= 200) { + else if (greenThumbStage == 1) { this.block.setData(CropState.VERY_SMALL.getData()); } else { @@ -49,10 +58,10 @@ public class GreenThumbTimer implements Runnable { break; case NETHER_WARTS: if (!this.profile.getAbilityMode(AbilityType.GREEN_TERRA)) { - if (this.profile.getSkillLevel(SkillType.HERBALISM) >= 600) { + if (greenThumbStage == 3) { this.block.setData((byte) 2); } - else if (this.profile.getSkillLevel(SkillType.HERBALISM) >= 400) { + else if (greenThumbStage == 2) { this.block.setData((byte) 1); } else { @@ -65,10 +74,10 @@ public class GreenThumbTimer implements Runnable { break; case COCOA: if (!this.profile.getAbilityMode(AbilityType.GREEN_TERRA)) { - if (this.profile.getSkillLevel(SkillType.HERBALISM) >= 600) { + if (greenThumbStage == 3) { this.block.setData((byte) ((this.block.getData() ^ ((byte) 0xc)) | ((byte) 4))); } - else if (this.profile.getSkillLevel(SkillType.HERBALISM) >= 400) { + else if (greenThumbStage == 2) { this.block.setData((byte) ((this.block.getData() ^ ((byte) 0xc)) | ((byte) 4))); } else {