diff --git a/Changelog.txt b/Changelog.txt index b48053a26..0b72d2357 100644 --- a/Changelog.txt +++ b/Changelog.txt @@ -9,6 +9,7 @@ Key: Version 1.5.02-dev + Added option to config.yml for Chimaera Wings to stop using bed spawn points + ! Changed Flux Mining mechanics. In order to use the ability, you need to infuse a pickaxe with furnace powers first. Version 1.5.01 + Added new child skill; Salvage diff --git a/src/main/java/com/gmail/nossr50/config/Config.java b/src/main/java/com/gmail/nossr50/config/Config.java index 4fec60488..0c2d49982 100644 --- a/src/main/java/com/gmail/nossr50/config/Config.java +++ b/src/main/java/com/gmail/nossr50/config/Config.java @@ -378,11 +378,15 @@ public class Config extends AutoUpdateConfigLoader { public int getChimaeraRecentlyHurtCooldown() { return config.getInt("Items.Chimaera_Wing.RecentlyHurt_Cooldown", 60); } public boolean getChimaeraSoundEnabled() { return config.getBoolean("Items.Chimaera_Wing.Sound_Enabled", true); } + public boolean getFluxPickaxeEnabled() { return config.getBoolean("Items.Flux_Pickaxe.Enabled", true); } + public boolean getFluxPickaxeSoundEnabled() { return config.getBoolean("Items.Flux_Pickaxe.Sound_Enabled", true); } + /* Particles */ public boolean getAbilityActivationEffectEnabled() { return config.getBoolean("Particles.Ability_Activation", true); } public boolean getAbilityDeactivationEffectEnabled() { return config.getBoolean("Particles.Ability_Deactivation", true); } - public boolean getDodgeEffectEnabled() { return config.getBoolean("Particles.Dodge", true); } public boolean getBleedEffectEnabled() { return config.getBoolean("Particles.Bleed", true); } + public boolean getDodgeEffectEnabled() { return config.getBoolean("Particles.Dodge", true); } + public boolean getFluxEffectEnabled() { return config.getBoolean("Particles.Flux", true); } public boolean getGreaterImpactEffectEnabled() { return config.getBoolean("Particles.Greater_Impact", true); } public boolean getCallOfTheWildEffectEnabled() { return config.getBoolean("Particles.Call_of_the_Wild", true); } public boolean getLevelUpEffectsEnabled() { return config.getBoolean("Particles.LevelUp_Enabled", true); } diff --git a/src/main/java/com/gmail/nossr50/listeners/BlockListener.java b/src/main/java/com/gmail/nossr50/listeners/BlockListener.java index 6380402a3..72b4676ac 100644 --- a/src/main/java/com/gmail/nossr50/listeners/BlockListener.java +++ b/src/main/java/com/gmail/nossr50/listeners/BlockListener.java @@ -260,7 +260,7 @@ public class BlockListener implements Listener { } } } - else if (ItemUtils.isPickaxe(heldItem) && !heldItem.containsEnchantment(Enchantment.SILK_TOUCH)) { + else if (ItemUtils.isFluxPickaxe(heldItem) && !heldItem.containsEnchantment(Enchantment.SILK_TOUCH)) { SmeltingManager smeltingManager = UserManager.getPlayer(player).getSmeltingManager(); if (smeltingManager.canUseFluxMining(blockState)) { diff --git a/src/main/java/com/gmail/nossr50/mcMMO.java b/src/main/java/com/gmail/nossr50/mcMMO.java index a4389ab21..32ddc88e7 100644 --- a/src/main/java/com/gmail/nossr50/mcMMO.java +++ b/src/main/java/com/gmail/nossr50/mcMMO.java @@ -5,6 +5,7 @@ import java.io.IOException; import java.util.ArrayList; import java.util.List; +import org.bukkit.Material; import org.bukkit.entity.Player; import org.bukkit.event.HandlerList; import org.bukkit.metadata.FixedMetadataValue; @@ -51,6 +52,7 @@ import com.gmail.nossr50.skills.repair.repairables.SimpleRepairableManager; import com.gmail.nossr50.skills.salvage.salvageables.Salvageable; import com.gmail.nossr50.skills.salvage.salvageables.SalvageableManager; import com.gmail.nossr50.skills.salvage.salvageables.SimpleSalvageableManager; +import com.gmail.nossr50.skills.smelting.SmeltingManager; import com.gmail.nossr50.util.ChimaeraWing; import com.gmail.nossr50.util.HolidayManager; import com.gmail.nossr50.util.LogFilter; @@ -455,6 +457,14 @@ public class mcMMO extends JavaPlugin { if (Config.getInstance().getChimaeraEnabled()) { getServer().addRecipe(ChimaeraWing.getChimaeraWingRecipe()); } + + if (Config.getInstance().getFluxPickaxeEnabled()) { + getServer().addRecipe(SmeltingManager.getFluxPickaxeRecipe(Material.DIAMOND_PICKAXE)); + getServer().addRecipe(SmeltingManager.getFluxPickaxeRecipe(Material.GOLD_PICKAXE)); + getServer().addRecipe(SmeltingManager.getFluxPickaxeRecipe(Material.IRON_PICKAXE)); + getServer().addRecipe(SmeltingManager.getFluxPickaxeRecipe(Material.STONE_PICKAXE)); + getServer().addRecipe(SmeltingManager.getFluxPickaxeRecipe(Material.WOOD_PICKAXE)); + } } private void scheduleTasks() { diff --git a/src/main/java/com/gmail/nossr50/skills/smelting/SmeltingManager.java b/src/main/java/com/gmail/nossr50/skills/smelting/SmeltingManager.java index 2bc8ff8f2..9a204abb2 100644 --- a/src/main/java/com/gmail/nossr50/skills/smelting/SmeltingManager.java +++ b/src/main/java/com/gmail/nossr50/skills/smelting/SmeltingManager.java @@ -1,12 +1,20 @@ package com.gmail.nossr50.skills.smelting; +import java.util.ArrayList; +import java.util.List; + +import org.bukkit.ChatColor; import org.bukkit.Material; +import org.bukkit.Sound; import org.bukkit.block.BlockState; import org.bukkit.entity.Player; import org.bukkit.event.inventory.FurnaceBurnEvent; +import org.bukkit.inventory.FurnaceRecipe; import org.bukkit.inventory.ItemStack; +import org.bukkit.inventory.meta.ItemMeta; import com.gmail.nossr50.mcMMO; +import com.gmail.nossr50.config.Config; import com.gmail.nossr50.datatypes.player.McMMOPlayer; import com.gmail.nossr50.datatypes.skills.SecondaryAbility; import com.gmail.nossr50.datatypes.skills.SkillType; @@ -18,6 +26,7 @@ import com.gmail.nossr50.skills.smelting.Smelting.Tier; import com.gmail.nossr50.util.BlockUtils; import com.gmail.nossr50.util.Misc; import com.gmail.nossr50.util.Permissions; +import com.gmail.nossr50.util.skills.ParticleEffectUtils; import com.gmail.nossr50.util.skills.SkillUtils; public class SmeltingManager extends SkillManager { @@ -64,16 +73,43 @@ public class SmeltingManager extends SkillManager { return false; } + SkillUtils.handleDurabilityChange(getPlayer().getItemInHand(), Config.getInstance().getAbilityToolDamage()); + Misc.dropItems(blockState.getLocation(), item, isSecondSmeltSuccessful() ? 2 : 1); blockState.setType(Material.AIR); - player.sendMessage(LocaleLoader.getString("Smelting.FluxMining.Success")); + + if (Config.getInstance().getFluxPickaxeSoundEnabled()) { + player.playSound(blockState.getLocation(), Sound.FIZZ, Misc.FIZZ_VOLUME, Misc.getFizzPitch()); + } + + ParticleEffectUtils.playFluxEffect(blockState.getLocation()); return true; } return false; } + public static ItemStack getFluxPickaxe(Material material, int amount) { + ItemStack itemStack = new ItemStack(material, amount); + + ItemMeta itemMeta = itemStack.getItemMeta(); + itemMeta.setDisplayName(ChatColor.GOLD + LocaleLoader.getString("Item.FluxPickaxe.Name")); + + List itemLore = new ArrayList(); + itemLore.add("mcMMO Item"); + itemLore.add(LocaleLoader.getString("Item.FluxPickaxe.Lore.1")); + itemLore.add(LocaleLoader.getString("Item.FluxPickaxe.Lore.2", Smelting.fluxMiningUnlockLevel)); + itemMeta.setLore(itemLore); + + itemStack.setItemMeta(itemMeta); + return itemStack; + } + + public static FurnaceRecipe getFluxPickaxeRecipe(Material material) { + return new FurnaceRecipe(getFluxPickaxe(material, 1), material); + } + /** * Increases burn time for furnace fuel. * diff --git a/src/main/java/com/gmail/nossr50/util/ItemUtils.java b/src/main/java/com/gmail/nossr50/util/ItemUtils.java index c05ea4380..44e6ea5a2 100644 --- a/src/main/java/com/gmail/nossr50/util/ItemUtils.java +++ b/src/main/java/com/gmail/nossr50/util/ItemUtils.java @@ -694,4 +694,13 @@ public final class ItemUtils { ItemMeta itemMeta = item.getItemMeta(); return itemMeta.hasDisplayName() && itemMeta.getDisplayName().equals(ChatColor.GOLD + LocaleLoader.getString("Item.ChimaeraWing.Name")); } + + public static boolean isFluxPickaxe(ItemStack item) { + if (!isMcMMOItem(item)) { + return false; + } + + ItemMeta itemMeta = item.getItemMeta(); + return itemMeta.hasDisplayName() && itemMeta.getDisplayName().equals(ChatColor.GOLD + LocaleLoader.getString("Item.FluxPickaxe.Name")); + } } diff --git a/src/main/java/com/gmail/nossr50/util/skills/ParticleEffectUtils.java b/src/main/java/com/gmail/nossr50/util/skills/ParticleEffectUtils.java index f1ca98166..8979a3048 100644 --- a/src/main/java/com/gmail/nossr50/util/skills/ParticleEffectUtils.java +++ b/src/main/java/com/gmail/nossr50/util/skills/ParticleEffectUtils.java @@ -37,6 +37,14 @@ public final class ParticleEffectUtils { playSmokeEffect(player); } + public static void playFluxEffect(Location location) { + if (!Config.getInstance().getFluxEffectEnabled()) { + return; + } + + location.getWorld().playEffect(location, Effect.MOBSPAWNER_FLAMES, 1); + } + public static void playSmokeEffect(LivingEntity livingEntity) { Location location = livingEntity.getEyeLocation(); World world = livingEntity.getWorld(); diff --git a/src/main/resources/config.yml b/src/main/resources/config.yml index e14208a25..21caca829 100644 --- a/src/main/resources/config.yml +++ b/src/main/resources/config.yml @@ -213,6 +213,9 @@ Items: Recipe_Cost: 5 Item_Name: FEATHER Sound_Enabled: true + Flux_Pickaxe: + Enabled: true + Sound_Enabled: true # # Settings for Parties @@ -481,8 +484,9 @@ Particles: LargeFireworks: true # Use particle effect when these abilities trigger - Dodge: true Bleed: true + Dodge: true + Flux: true Greater_Impact: true Call_of_the_Wild: true diff --git a/src/main/resources/locale/locale_en_US.properties b/src/main/resources/locale/locale_en_US.properties index bca452e6e..153bd509b 100644 --- a/src/main/resources/locale/locale_en_US.properties +++ b/src/main/resources/locale/locale_en_US.properties @@ -835,6 +835,9 @@ Item.ChimaeraWing.Name=Chimaera Wing Item.ChimaeraWing.Lore=[[GRAY]]Teleports you to your bed. Item.Generic.Wait=[[RED]]You need to wait before you can use this again! [[YELLOW]]({0}s) Item.Injured.Wait=You were injured recently and must wait to use this. [[YELLOW]]({0}s) +Item.FluxPickaxe.Name=Flux Pickaxe +Item.FluxPickaxe.Lore.1=[[GRAY]]Has a chance of instantly smelting ores. +Item.FluxPickaxe.Lore.2=[[GRAY]]Requires Smelting level {0}+ #TELEPORTATION Teleport.Commencing=[[GRAY]]Commencing teleport in [[GOLD]]({0}) [[GRAY]]seconds, please stand still... @@ -908,7 +911,6 @@ Smelting.Effect.4=Vanilla XP Boost Smelting.Effect.5=Increase vanilla XP gained while smelting Smelting.Effect.6=Flux Mining Smelting.Effect.7=Chance for ores to be instantly smelted while mining -Smelting.FluxMining.Success=[[GREEN]]That ore smelted itself! Smelting.Listener=Smelting: Smelting.SkillName=SMELTING