mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2025-06-25 18:24:43 +02:00
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:
@ -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); }
|
||||
|
@ -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)) {
|
||||
|
@ -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() {
|
||||
|
@ -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<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.
|
||||
*
|
||||
|
@ -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"));
|
||||
}
|
||||
}
|
||||
|
@ -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();
|
||||
|
Reference in New Issue
Block a user