Changed Flux Mining mechanics

Previously, Flux Mining would get unlocked at a specified level with a
specified chance. Once unlocked, the player would have no control over
this ability and some players complained they would like to be able to
turn it on and off.

By adding a new furnace recipe, to craft a special pickaxe - a Flux
Pickaxe - this issue is solved. If a player doesn’t want to use Flux
Mining, they simply shouldn’t mine using a Flux Pickaxe.

Crafting a Flux Pickaxe is simple, just place one of the vanilla
pickaxes in a furnace and cook it up.

Every time the ability is successful, extra durability damage is dealt
to the tool. Just like with other abilities.

Adds #2320
This commit is contained in:
TfT_02 2014-12-22 16:58:22 +01:00
parent 93013b2db1
commit 3ea845cfd9
9 changed files with 79 additions and 5 deletions

View File

@ -9,6 +9,7 @@ Key:
Version 1.5.02-dev Version 1.5.02-dev
+ Added option to config.yml for Chimaera Wings to stop using bed spawn points + 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 Version 1.5.01
+ Added new child skill; Salvage + Added new child skill; Salvage

View File

@ -378,11 +378,15 @@ public class Config extends AutoUpdateConfigLoader {
public int getChimaeraRecentlyHurtCooldown() { return config.getInt("Items.Chimaera_Wing.RecentlyHurt_Cooldown", 60); } 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 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 */ /* Particles */
public boolean getAbilityActivationEffectEnabled() { return config.getBoolean("Particles.Ability_Activation", true); } public boolean getAbilityActivationEffectEnabled() { return config.getBoolean("Particles.Ability_Activation", true); }
public boolean getAbilityDeactivationEffectEnabled() { return config.getBoolean("Particles.Ability_Deactivation", 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 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 getGreaterImpactEffectEnabled() { return config.getBoolean("Particles.Greater_Impact", true); }
public boolean getCallOfTheWildEffectEnabled() { return config.getBoolean("Particles.Call_of_the_Wild", true); } public boolean getCallOfTheWildEffectEnabled() { return config.getBoolean("Particles.Call_of_the_Wild", true); }
public boolean getLevelUpEffectsEnabled() { return config.getBoolean("Particles.LevelUp_Enabled", true); } public boolean getLevelUpEffectsEnabled() { return config.getBoolean("Particles.LevelUp_Enabled", true); }

View File

@ -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(); SmeltingManager smeltingManager = UserManager.getPlayer(player).getSmeltingManager();
if (smeltingManager.canUseFluxMining(blockState)) { if (smeltingManager.canUseFluxMining(blockState)) {

View File

@ -5,6 +5,7 @@ import java.io.IOException;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import org.bukkit.Material;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.event.HandlerList; import org.bukkit.event.HandlerList;
import org.bukkit.metadata.FixedMetadataValue; 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.Salvageable;
import com.gmail.nossr50.skills.salvage.salvageables.SalvageableManager; import com.gmail.nossr50.skills.salvage.salvageables.SalvageableManager;
import com.gmail.nossr50.skills.salvage.salvageables.SimpleSalvageableManager; 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.ChimaeraWing;
import com.gmail.nossr50.util.HolidayManager; import com.gmail.nossr50.util.HolidayManager;
import com.gmail.nossr50.util.LogFilter; import com.gmail.nossr50.util.LogFilter;
@ -455,6 +457,14 @@ public class mcMMO extends JavaPlugin {
if (Config.getInstance().getChimaeraEnabled()) { if (Config.getInstance().getChimaeraEnabled()) {
getServer().addRecipe(ChimaeraWing.getChimaeraWingRecipe()); 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() { private void scheduleTasks() {

View File

@ -1,12 +1,20 @@
package com.gmail.nossr50.skills.smelting; 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.Material;
import org.bukkit.Sound;
import org.bukkit.block.BlockState; import org.bukkit.block.BlockState;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.event.inventory.FurnaceBurnEvent; import org.bukkit.event.inventory.FurnaceBurnEvent;
import org.bukkit.inventory.FurnaceRecipe;
import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.ItemMeta;
import com.gmail.nossr50.mcMMO; import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.config.Config;
import com.gmail.nossr50.datatypes.player.McMMOPlayer; import com.gmail.nossr50.datatypes.player.McMMOPlayer;
import com.gmail.nossr50.datatypes.skills.SecondaryAbility; import com.gmail.nossr50.datatypes.skills.SecondaryAbility;
import com.gmail.nossr50.datatypes.skills.SkillType; 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.BlockUtils;
import com.gmail.nossr50.util.Misc; import com.gmail.nossr50.util.Misc;
import com.gmail.nossr50.util.Permissions; import com.gmail.nossr50.util.Permissions;
import com.gmail.nossr50.util.skills.ParticleEffectUtils;
import com.gmail.nossr50.util.skills.SkillUtils; import com.gmail.nossr50.util.skills.SkillUtils;
public class SmeltingManager extends SkillManager { public class SmeltingManager extends SkillManager {
@ -64,16 +73,43 @@ public class SmeltingManager extends SkillManager {
return false; return false;
} }
SkillUtils.handleDurabilityChange(getPlayer().getItemInHand(), Config.getInstance().getAbilityToolDamage());
Misc.dropItems(blockState.getLocation(), item, isSecondSmeltSuccessful() ? 2 : 1); Misc.dropItems(blockState.getLocation(), item, isSecondSmeltSuccessful() ? 2 : 1);
blockState.setType(Material.AIR); 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 true;
} }
return false; 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<String> itemLore = new ArrayList<String>();
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. * Increases burn time for furnace fuel.
* *

View File

@ -694,4 +694,13 @@ public final class ItemUtils {
ItemMeta itemMeta = item.getItemMeta(); ItemMeta itemMeta = item.getItemMeta();
return itemMeta.hasDisplayName() && itemMeta.getDisplayName().equals(ChatColor.GOLD + LocaleLoader.getString("Item.ChimaeraWing.Name")); 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"));
}
} }

View File

@ -37,6 +37,14 @@ public final class ParticleEffectUtils {
playSmokeEffect(player); 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) { public static void playSmokeEffect(LivingEntity livingEntity) {
Location location = livingEntity.getEyeLocation(); Location location = livingEntity.getEyeLocation();
World world = livingEntity.getWorld(); World world = livingEntity.getWorld();

View File

@ -213,6 +213,9 @@ Items:
Recipe_Cost: 5 Recipe_Cost: 5
Item_Name: FEATHER Item_Name: FEATHER
Sound_Enabled: true Sound_Enabled: true
Flux_Pickaxe:
Enabled: true
Sound_Enabled: true
# #
# Settings for Parties # Settings for Parties
@ -481,8 +484,9 @@ Particles:
LargeFireworks: true LargeFireworks: true
# Use particle effect when these abilities trigger # Use particle effect when these abilities trigger
Dodge: true
Bleed: true Bleed: true
Dodge: true
Flux: true
Greater_Impact: true Greater_Impact: true
Call_of_the_Wild: true Call_of_the_Wild: true

View File

@ -835,6 +835,9 @@ Item.ChimaeraWing.Name=Chimaera Wing
Item.ChimaeraWing.Lore=[[GRAY]]Teleports you to your bed. 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.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.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 #TELEPORTATION
Teleport.Commencing=[[GRAY]]Commencing teleport in [[GOLD]]({0}) [[GRAY]]seconds, please stand still... 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.5=Increase vanilla XP gained while smelting
Smelting.Effect.6=Flux Mining Smelting.Effect.6=Flux Mining
Smelting.Effect.7=Chance for ores to be instantly smelted while 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.Listener=Smelting:
Smelting.SkillName=SMELTING Smelting.SkillName=SMELTING