mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-25 06:36:45 +01:00
Multiple items can be specified as a detonator
This commit is contained in:
parent
abda53641f
commit
ee90780d7b
@ -84,6 +84,7 @@ Version 2.2.0
|
||||
Super Ability conifg options will now be found in "skill_super_abilities.conf"
|
||||
Super Abilities now have a default max length cap of one minute
|
||||
Blast Mining default cooldown increased from 60 seconds to 120 seconds
|
||||
You can now configure multiple items as detonators for Blast Mining
|
||||
|
||||
Exploit related config options will now be found in "exploit-prevention"
|
||||
Exploit Prevention's "EndermanEndermiteFarms" renamed -> "Endermen-Endermite-Fix"
|
||||
|
@ -48,7 +48,24 @@ public class ConfigMining {
|
||||
"\nUse Minecraft friendly names for entries, not Bukkit material names.")
|
||||
private ArrayList<String> bonusDrops = DEFAULT_BONUS_DROPS;
|
||||
|
||||
@Setting(value = "Sub-Skills")
|
||||
private ConfigMiningSubskills miningSubskills = new ConfigMiningSubskills();
|
||||
|
||||
public ConfigMiningSubskills getMiningSubskills() {
|
||||
return miningSubskills;
|
||||
}
|
||||
|
||||
public ConfigMiningBlastMining getBlastMining() {
|
||||
return miningSubskills.getBlastMining();
|
||||
}
|
||||
|
||||
public ArrayList<String> getDetonators() {
|
||||
return getBlastMining().getDetonators();
|
||||
}
|
||||
|
||||
public ArrayList<String> getBonusDrops() {
|
||||
return bonusDrops;
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,29 @@
|
||||
package com.gmail.nossr50.config.hocon.skills.mining;
|
||||
|
||||
import ninja.leaping.configurate.objectmapping.Setting;
|
||||
import ninja.leaping.configurate.objectmapping.serialize.ConfigSerializable;
|
||||
import org.bukkit.Material;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
@ConfigSerializable
|
||||
public class ConfigMiningBlastMining {
|
||||
|
||||
public static final ArrayList<String> DETONATORS_DEFAULT;
|
||||
|
||||
static {
|
||||
DETONATORS_DEFAULT = new ArrayList<>();
|
||||
DETONATORS_DEFAULT.add(Material.FLINT_AND_STEEL.getKey().toString());
|
||||
DETONATORS_DEFAULT.add(Material.DIAMOND_PICKAXE.getKey().toString());
|
||||
DETONATORS_DEFAULT.add(Material.GOLDEN_PICKAXE.getKey().toString());
|
||||
DETONATORS_DEFAULT.add(Material.IRON_PICKAXE.getKey().toString());
|
||||
DETONATORS_DEFAULT.add(Material.WOODEN_PICKAXE.getKey().toString());
|
||||
}
|
||||
|
||||
@Setting(value = "Detonators", comment = "Items that can be used to activate Blast-Mining")
|
||||
private ArrayList<String> detonators = DETONATORS_DEFAULT;
|
||||
|
||||
public ArrayList<String> getDetonators() {
|
||||
return detonators;
|
||||
}
|
||||
}
|
@ -0,0 +1,15 @@
|
||||
package com.gmail.nossr50.config.hocon.skills.mining;
|
||||
|
||||
import ninja.leaping.configurate.objectmapping.Setting;
|
||||
import ninja.leaping.configurate.objectmapping.serialize.ConfigSerializable;
|
||||
|
||||
@ConfigSerializable
|
||||
public class ConfigMiningSubskills {
|
||||
|
||||
@Setting(value = "Blast-Mining", comment = "Settings for Blast Mining")
|
||||
public ConfigMiningBlastMining blastMining = new ConfigMiningBlastMining();
|
||||
|
||||
public ConfigMiningBlastMining getBlastMining() {
|
||||
return blastMining;
|
||||
}
|
||||
}
|
@ -41,8 +41,6 @@ public class BlastMining {
|
||||
|
||||
}*/
|
||||
|
||||
public static Material detonator = MainConfig.getInstance().getDetonatorItem();
|
||||
|
||||
public final static int MAXIMUM_REMOTE_DETONATION_DISTANCE = 100;
|
||||
|
||||
public static double getBlastRadiusModifier(int rank) {
|
||||
|
@ -2,13 +2,51 @@ package com.gmail.nossr50.skills.mining;
|
||||
|
||||
import com.gmail.nossr50.config.experience.ExperienceConfig;
|
||||
import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import com.gmail.nossr50.util.ItemUtils;
|
||||
import com.gmail.nossr50.util.Misc;
|
||||
import net.royawesome.jlibnoise.module.combiner.Min;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.block.BlockState;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class Mining {
|
||||
|
||||
private List<Material> detonators;
|
||||
private static Mining instance;
|
||||
|
||||
public static Mining getInstance() {
|
||||
if(instance == null)
|
||||
instance = new Mining();
|
||||
|
||||
return instance;
|
||||
}
|
||||
|
||||
public Mining() {
|
||||
//Init detonators
|
||||
this.detonators = ItemUtils.matchMaterials(mcMMO.getConfigManager().getConfigMining().getDetonators());
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve a list of Blast Mining detonator types
|
||||
* @return blast mining detonator materials
|
||||
*/
|
||||
public List<Material> getDetonators() {
|
||||
return detonators;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if an itemStack is a valid blast mining detonator
|
||||
* @param itemStack target itemstack
|
||||
* @return true if valid blast mining detonator
|
||||
*/
|
||||
public Boolean isDetonator(ItemStack itemStack)
|
||||
{
|
||||
return getDetonators().contains(itemStack.getType());
|
||||
}
|
||||
|
||||
/**
|
||||
* Calculate XP gain for Mining.
|
||||
*
|
||||
|
@ -43,7 +43,7 @@ public class MiningManager extends SkillManager {
|
||||
Player player = getPlayer();
|
||||
|
||||
return canUseBlastMining() && player.isSneaking()
|
||||
&& (ItemUtils.isPickaxe(getPlayer().getInventory().getItemInMainHand()) || player.getInventory().getItemInMainHand().getType() == Config.getInstance().getDetonatorItem())
|
||||
&& Mining.getInstance().isDetonator(player.getInventory().getItemInMainHand())
|
||||
&& Permissions.remoteDetonation(player);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user