mirror of
https://gitlab.com/phoenix-dvpmt/mmoitems.git
synced 2024-12-23 04:47:34 +01:00
Autosmelt supports latest ores
This commit is contained in:
parent
454c74996b
commit
37b131f25c
@ -16,6 +16,8 @@ import org.bukkit.inventory.ItemStack;
|
|||||||
import org.bukkit.scheduler.BukkitRunnable;
|
import org.bukkit.scheduler.BukkitRunnable;
|
||||||
import org.bukkit.util.Vector;
|
import org.bukkit.util.Vector;
|
||||||
|
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
public class Tool extends UseItem {
|
public class Tool extends UseItem {
|
||||||
public Tool(Player player, NBTItem item) {
|
public Tool(Player player, NBTItem item) {
|
||||||
super(player, item);
|
super(player, item);
|
||||||
@ -33,15 +35,16 @@ public class Tool extends UseItem {
|
|||||||
public boolean miningEffects(Block block) {
|
public boolean miningEffects(Block block) {
|
||||||
boolean cancel = false;
|
boolean cancel = false;
|
||||||
|
|
||||||
if (getNBTItem().getBoolean("MMOITEMS_AUTOSMELT"))
|
if (getNBTItem().getBoolean("MMOITEMS_AUTOSMELT")) {
|
||||||
if (block.getType() == Material.IRON_ORE || block.getType() == Material.GOLD_ORE) {
|
Map<Material, Material> oreDrops = MythicLib.plugin.getVersion().getWrapper().getOreDrops();
|
||||||
ItemStack item = new ItemStack(Material.valueOf(block.getType().name().replace("_ORE", "_INGOT")));
|
Material drop = oreDrops.get(block.getType());
|
||||||
|
if (drop != null) {
|
||||||
UtilityMethods.dropItemNaturally(block.getLocation(), item);
|
UtilityMethods.dropItemNaturally(block.getLocation(), new ItemStack(drop));
|
||||||
block.getWorld().spawnParticle(Particle.CLOUD, block.getLocation().add(.5, .5, .5), 0);
|
block.getWorld().spawnParticle(Particle.CLOUD, block.getLocation().add(.5, .5, .5), 0);
|
||||||
block.setType(Material.AIR);
|
block.setType(Material.AIR);
|
||||||
cancel = true;
|
cancel = true;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (getNBTItem().getBoolean("MMOITEMS_BOUNCING_CRACK"))
|
if (getNBTItem().getBoolean("MMOITEMS_BOUNCING_CRACK"))
|
||||||
new BukkitRunnable() {
|
new BukkitRunnable() {
|
||||||
|
Loading…
Reference in New Issue
Block a user