diff --git a/src/main/java/com/gmail/nossr50/commands/skills/AlchemyCommand.java b/src/main/java/com/gmail/nossr50/commands/skills/AlchemyCommand.java index e44001efc..c9ed5118e 100644 --- a/src/main/java/com/gmail/nossr50/commands/skills/AlchemyCommand.java +++ b/src/main/java/com/gmail/nossr50/commands/skills/AlchemyCommand.java @@ -17,7 +17,8 @@ public class AlchemyCommand extends SkillCommand { private String brewSpeedLucky; private int tier; - private String ingredients; + private int ingredientCount; + private String ingredientList; private boolean canCatalysis; private boolean canConcoctions; @@ -37,17 +38,18 @@ public class AlchemyCommand extends SkillCommand { @Override protected void dataCalculations(Player player, float skillValue, boolean isLucky) { - // DODGE + // CATALYSIS if (canCatalysis) { String[] catalysisStrings = calculateAbilityDisplayValues(player, skillValue, isLucky); brewSpeed = catalysisStrings[0]; brewSpeedLucky = catalysisStrings[1]; } - // ROLL + // CONCOCTIONS if (canConcoctions) { tier = UserManager.getPlayer(player).getAlchemyManager().getTier(); - ingredients = UserManager.getPlayer(player).getAlchemyManager().getIngredientList(); + ingredientCount = UserManager.getPlayer(player).getAlchemyManager().getIngredients().size(); + ingredientList = UserManager.getPlayer(player).getAlchemyManager().getIngredientList(); } } @@ -88,8 +90,8 @@ public class AlchemyCommand extends SkillCommand { } if (canConcoctions) { - messages.add(LocaleLoader.getString("Alchemy.Concoctions.Rank", tier, Tier.FIVE.toNumerical())); - messages.add(LocaleLoader.getString("Alchemy.Concoctions.Ingredients", ingredients)); + messages.add(LocaleLoader.getString("Alchemy.Concoctions.Rank", tier, Tier.values().length)); + messages.add(LocaleLoader.getString("Alchemy.Concoctions.Ingredients", ingredientCount, ingredientList)); } return messages; diff --git a/src/main/java/com/gmail/nossr50/config/AdvancedConfig.java b/src/main/java/com/gmail/nossr50/config/AdvancedConfig.java index f7280c78f..040f1c218 100644 --- a/src/main/java/com/gmail/nossr50/config/AdvancedConfig.java +++ b/src/main/java/com/gmail/nossr50/config/AdvancedConfig.java @@ -100,7 +100,7 @@ public class AdvancedConfig extends AutoUpdateConfigLoader { reason.add("Skills.Alchemy.Rank_Levels.Rank_" + tier.toNumerical() + " should be at least 0!"); } - if (tier != Alchemy.Tier.FIVE) { + if (tier != Alchemy.Tier.fromNumerical(Alchemy.Tier.values().length)) { Alchemy.Tier nextTier = alchemyTierList.get(alchemyTierList.indexOf(tier) - 1); if (getConcoctionsTierLevel(tier) >= getConcoctionsTierLevel(nextTier)) { diff --git a/src/main/java/com/gmail/nossr50/config/potion/PotionConfig.java b/src/main/java/com/gmail/nossr50/config/potion/PotionConfig.java index 32ec94270..3a12d6790 100644 --- a/src/main/java/com/gmail/nossr50/config/potion/PotionConfig.java +++ b/src/main/java/com/gmail/nossr50/config/potion/PotionConfig.java @@ -23,6 +23,9 @@ public class PotionConfig extends ConfigLoader { public List concoctionsIngredientsTierThree = new ArrayList(); public List concoctionsIngredientsTierFour = new ArrayList(); public List concoctionsIngredientsTierFive = new ArrayList(); + public List concoctionsIngredientsTierSix = new ArrayList(); + public List concoctionsIngredientsTierSeven = new ArrayList(); + public List concoctionsIngredientsTierEight = new ArrayList(); public Map potionMap = new HashMap(); @@ -53,11 +56,17 @@ public class PotionConfig extends ConfigLoader { loadConcoctionsTier(concoctionsIngredientsTierThree, concoctionSection.getStringList("Tier_Three_Ingredients")); loadConcoctionsTier(concoctionsIngredientsTierFour, concoctionSection.getStringList("Tier_Four_Ingredients")); loadConcoctionsTier(concoctionsIngredientsTierFive, concoctionSection.getStringList("Tier_Five_Ingredients")); + loadConcoctionsTier(concoctionsIngredientsTierSix, concoctionSection.getStringList("Tier_Six_Ingredients")); + loadConcoctionsTier(concoctionsIngredientsTierSeven, concoctionSection.getStringList("Tier_Seven_Ingredients")); + loadConcoctionsTier(concoctionsIngredientsTierEight, concoctionSection.getStringList("Tier_Eight_Ingredients")); concoctionsIngredientsTierTwo.addAll(concoctionsIngredientsTierOne); concoctionsIngredientsTierThree.addAll(concoctionsIngredientsTierTwo); concoctionsIngredientsTierFour.addAll(concoctionsIngredientsTierThree); concoctionsIngredientsTierFive.addAll(concoctionsIngredientsTierFour); + concoctionsIngredientsTierSix.addAll(concoctionsIngredientsTierFive); + concoctionsIngredientsTierSeven.addAll(concoctionsIngredientsTierSix); + concoctionsIngredientsTierEight.addAll(concoctionsIngredientsTierSeven); } private void loadConcoctionsTier(List ingredientList, List ingredientStrings) { diff --git a/src/main/java/com/gmail/nossr50/datatypes/skills/SkillType.java b/src/main/java/com/gmail/nossr50/datatypes/skills/SkillType.java index 5a0ad2076..95421fe9e 100644 --- a/src/main/java/com/gmail/nossr50/datatypes/skills/SkillType.java +++ b/src/main/java/com/gmail/nossr50/datatypes/skills/SkillType.java @@ -31,6 +31,7 @@ import com.gmail.nossr50.skills.woodcutting.WoodcuttingManager; import com.gmail.nossr50.util.Permissions; import com.gmail.nossr50.util.StringUtils; import com.gmail.nossr50.util.skills.ParticleEffectUtils; + import com.google.common.collect.ImmutableList; public enum SkillType { diff --git a/src/main/java/com/gmail/nossr50/listeners/BlockListener.java b/src/main/java/com/gmail/nossr50/listeners/BlockListener.java index 455746a9c..f7983654f 100644 --- a/src/main/java/com/gmail/nossr50/listeners/BlockListener.java +++ b/src/main/java/com/gmail/nossr50/listeners/BlockListener.java @@ -138,7 +138,7 @@ public class BlockListener implements Listener { /* ALCHEMY - Cancel any brew in progress for that BrewingStand */ if (blockState instanceof BrewingStand && Alchemy.brewingStandMap.containsKey(event.getBlock())) { - Alchemy.brewingStandMap.get(event.getBlock()).cancel(); + Alchemy.brewingStandMap.get(event.getBlock()).cancelBrew(); } Player player = event.getPlayer(); diff --git a/src/main/java/com/gmail/nossr50/runnables/skills/AlchemyBrewCheckTask.java b/src/main/java/com/gmail/nossr50/runnables/skills/AlchemyBrewCheckTask.java index 8ebdaf5a5..7abcbd11e 100644 --- a/src/main/java/com/gmail/nossr50/runnables/skills/AlchemyBrewCheckTask.java +++ b/src/main/java/com/gmail/nossr50/runnables/skills/AlchemyBrewCheckTask.java @@ -6,11 +6,12 @@ import org.bukkit.block.Block; import org.bukkit.block.BrewingStand; import org.bukkit.entity.Player; import org.bukkit.inventory.ItemStack; +import org.bukkit.scheduler.BukkitRunnable; import com.gmail.nossr50.skills.alchemy.Alchemy; import com.gmail.nossr50.skills.alchemy.AlchemyPotionBrewer; -public class AlchemyBrewCheckTask implements Runnable { +public class AlchemyBrewCheckTask extends BukkitRunnable { private final static int INGREDIENT_SLOT = 3; private Player player; @@ -30,7 +31,7 @@ public class AlchemyBrewCheckTask implements Runnable { if (Alchemy.brewingStandMap.containsKey(brewingStand)) { if (oldInventory[INGREDIENT_SLOT] == null || newInventory[INGREDIENT_SLOT] == null || !oldInventory[INGREDIENT_SLOT].isSimilar(newInventory[INGREDIENT_SLOT]) || !AlchemyPotionBrewer.isValidBrew(player, newInventory)) { - Alchemy.brewingStandMap.get(brewingStand).cancel(); + Alchemy.brewingStandMap.get(brewingStand).cancelBrew(); } } if (!Alchemy.brewingStandMap.containsKey(brewingStand) && AlchemyPotionBrewer.isValidBrew(player, newInventory)) { diff --git a/src/main/java/com/gmail/nossr50/runnables/skills/AlchemyBrewTask.java b/src/main/java/com/gmail/nossr50/runnables/skills/AlchemyBrewTask.java index a6769eea1..ff77b334b 100644 --- a/src/main/java/com/gmail/nossr50/runnables/skills/AlchemyBrewTask.java +++ b/src/main/java/com/gmail/nossr50/runnables/skills/AlchemyBrewTask.java @@ -4,6 +4,7 @@ import org.bukkit.Bukkit; import org.bukkit.block.Block; import org.bukkit.block.BrewingStand; import org.bukkit.entity.Player; +import org.bukkit.scheduler.BukkitRunnable; import com.gmail.nossr50.mcMMO; import com.gmail.nossr50.datatypes.skills.SkillType; @@ -15,12 +16,10 @@ import com.gmail.nossr50.util.Misc; import com.gmail.nossr50.util.Permissions; import com.gmail.nossr50.util.player.UserManager; -public class AlchemyBrewTask implements Runnable { +public class AlchemyBrewTask extends BukkitRunnable { private final double DEFAULT_BREW_SPEED = 1.0; private final int DEFAULT_BREW_TICKS = 400; - - private int taskId = -1; - + private Block brewingStand; private double brewSpeed; private double brewTimer; @@ -52,20 +51,20 @@ public class AlchemyBrewTask implements Runnable { } Alchemy.brewingStandMap.put(brewingStand, this); - taskId = Bukkit.getScheduler().scheduleSyncDelayedTask(mcMMO.p, this, 1); + this.runTaskTimer(mcMMO.p, 1, 1); } @Override public void run() { brewTimer -= brewSpeed; + // Vanilla potion brewing completes when BrewingTime == 1 if (brewTimer < Math.max(brewSpeed, 2)) { - taskId = -1; + this.cancel(); finish(); } else { ((BrewingStand) brewingStand.getState()).setBrewingTime((int) brewTimer); - taskId = Bukkit.getScheduler().scheduleSyncDelayedTask(mcMMO.p, this, 1); } } @@ -81,16 +80,16 @@ public class AlchemyBrewTask implements Runnable { } public void finishImmediately() { - AlchemyPotionBrewer.finishBrewing(brewingStand, player, true); + this.cancel(); + AlchemyPotionBrewer.finishBrewing(brewingStand, player, true); Alchemy.brewingStandMap.remove(brewingStand); } - - public void cancel() { - Bukkit.getScheduler().cancelTask(taskId); + + public void cancelBrew() { + this.cancel(); ((BrewingStand) brewingStand.getState()).setBrewingTime(-1); - Alchemy.brewingStandMap.remove(brewingStand); } } diff --git a/src/main/java/com/gmail/nossr50/skills/alchemy/Alchemy.java b/src/main/java/com/gmail/nossr50/skills/alchemy/Alchemy.java index 72e17a84c..676ec4e6b 100644 --- a/src/main/java/com/gmail/nossr50/skills/alchemy/Alchemy.java +++ b/src/main/java/com/gmail/nossr50/skills/alchemy/Alchemy.java @@ -13,6 +13,9 @@ import com.gmail.nossr50.runnables.skills.AlchemyBrewTask; public final class Alchemy { public enum Tier { + EIGHT(8), + SEVEN(7), + SIX(6), FIVE(5), FOUR(4), THREE(3), diff --git a/src/main/java/com/gmail/nossr50/skills/alchemy/AlchemyManager.java b/src/main/java/com/gmail/nossr50/skills/alchemy/AlchemyManager.java index f3f984d3b..abacfc923 100644 --- a/src/main/java/com/gmail/nossr50/skills/alchemy/AlchemyManager.java +++ b/src/main/java/com/gmail/nossr50/skills/alchemy/AlchemyManager.java @@ -44,6 +44,12 @@ public class AlchemyManager extends SkillManager { public List getIngredients() { switch (Alchemy.Tier.fromNumerical(getTier())) { + case EIGHT: + return PotionConfig.getInstance().concoctionsIngredientsTierEight; + case SEVEN: + return PotionConfig.getInstance().concoctionsIngredientsTierSeven; + case SIX: + return PotionConfig.getInstance().concoctionsIngredientsTierSix; case FIVE: return PotionConfig.getInstance().concoctionsIngredientsTierFive; case FOUR: diff --git a/src/main/resources/advanced.yml b/src/main/resources/advanced.yml index e2fc8bda5..2e2fff9bf 100644 --- a/src/main/resources/advanced.yml +++ b/src/main/resources/advanced.yml @@ -64,10 +64,13 @@ Skills: # Rank_Levels: Alchemy level where rank gets unlocked Rank_Levels: Rank_1: 0 - Rank_2: 200 - Rank_3: 400 - Rank_4: 600 - Rank_5: 800 + Rank_2: 125 + Rank_3: 250 + Rank_4: 375 + Rank_5: 500 + Rank_6: 625 + Rank_7: 750 + Rank_8: 875 # # Settings for Archery ### diff --git a/src/main/resources/locale/locale_en_US.properties b/src/main/resources/locale/locale_en_US.properties index 298f6b965..890349619 100644 --- a/src/main/resources/locale/locale_en_US.properties +++ b/src/main/resources/locale/locale_en_US.properties @@ -41,7 +41,7 @@ Alchemy.Listener=Alchemy: Alchemy.Ability.Locked.0=LOCKED UNTIL {0}+ SKILL (CATALYSIS) Alchemy.Catalysis.Speed=[[RED]]Brewing Speed: [[YELLOW]]{0} Alchemy.Concoctions.Rank=[[RED]]Concoctions Rank: [[YELLOW]]{0} -Alchemy.Concoctions.Ingredients=[[RED]]Ingredients: [[YELLOW]]{0} +Alchemy.Concoctions.Ingredients=[[RED]]Ingredients [[[YELLOW]]{0}[[RED]]]: [[YELLOW]]{1} Alchemy.SkillName=ALCHEMY Alchemy.Skillup=[[YELLOW]]Alchemy skill increased by {0}. Total ({1}) diff --git a/src/main/resources/potions.yml b/src/main/resources/potions.yml index 04dd3de12..c99d49e26 100644 --- a/src/main/resources/potions.yml +++ b/src/main/resources/potions.yml @@ -23,15 +23,18 @@ Concoctions: Tier_Three_Ingredients: - QUARTZ - RED_MUSHROOM - - ROTTEN_FLESH Tier_Four_Ingredients: - APPLE + - ROTTEN_FLESH + Tier_Five_Ingredients: - BROWN_MUSHROOM - 'INK_SACK:0' - Tier_Five_Ingredients: - - 'GOLDEN_APPLE:0' + Tier_Six_Ingredients: - 'LONG_GRASS:2' + Tier_Seven_Ingredients: - POISONOUS_POTATO + Tier_Eight_Ingredients: + - 'GOLDEN_APPLE:0' # # Settings for Potions @@ -43,6 +46,17 @@ Concoctions: # : The ingredient used, and resultant potion's new data value # Effects: List of strings for the potion's effects (section is optional) # - " [EFFECT_TIER] [DURATION_TICKS]" +# +# DataValues - These potions follow the normal data value pattern except for bits 8-12: +# Bits 0-3: Liquid Color (http://minecraft.gamepedia.com/Data_values#Potions) +# Bit 4: (Unused) +# Bit 5: Power +# Bit 6: Extended +# Bit 7: (Unused) +# Bits 8-12: Custom Status Effect (http://minecraft.gamepedia.com/Data_values#Status_effects) +# Bit 13: Can become splash +# Bit 14: Splash +# Bit 15: (Unused) ### Potions: @@ -50,16 +64,16 @@ Potions: 0: # Water Bottle Children: - BLAZE_POWDER: 128 # Mundane Potion + BLAZE_POWDER: 8192 # Mundane Potion FERMENTED_SPIDER_EYE: 4616 # Potion of Weakness - GHAST_TEAR: 128 # Mundane Potion + GHAST_TEAR: 8192 # Mundane Potion GLOWSTONE_DUST: 32 # Thick Potion - MAGMA_CREAM: 128 # Mundane Potion + MAGMA_CREAM: 8192 # Mundane Potion NETHER_STALK: 16 # Awkward Potion REDSTONE: 64 # Mundane Potion Extended - SPECKLED_MELON: 128 # Mundane Potion - SPIDER_EYE: 128 # Mundane Potion - SUGAR: 128 # Mundane Potion + SPECKLED_MELON: 8192 # Mundane Potion + SPIDER_EYE: 8192 # Mundane Potion + SUGAR: 8192 # Mundane Potion 16: # Awkward Potion Children: @@ -93,7 +107,7 @@ Potions: Children: FERMENTED_SPIDER_EYE: 4680 - 128: # Mundane Potion + 8192: # Mundane Potion Children: FERMENTED_SPIDER_EYE: 4616 SULPHUR: 16384 @@ -611,11 +625,11 @@ Potions: 19725: # Splash Potion of Water Breathing Effects: ["WATER_BREATHING 0 2700"] Children: - REDSTONE: 19776 + REDSTONE: 19789 19789: # Splash Potion of Water Breathing Extended Effects: ["WATER_BREATHING 0 7200"] Children: - GLOWSTONE_DUST: 19712 + GLOWSTONE_DUST: 19725 19982: # Splash Potion of Invisibility Effects: ["INVISIBILITY 0 2700"]