Added Extraction
This commit is contained in:
@@ -235,6 +235,7 @@ public class EcoEnchants {
|
||||
public static final EcoEnchant WARPED_ARTIFACT = new WarpedArtifact();
|
||||
public static final EcoEnchant TEAR_ARTIFACT = new TearArtifact();
|
||||
public static final EcoEnchant BACKSTAB = new Backstab();
|
||||
public static final EcoEnchant EXTRACTION = new Extraction();
|
||||
|
||||
/**
|
||||
* Get all registered {@link EcoEnchant}s
|
||||
|
||||
@@ -0,0 +1,46 @@
|
||||
package com.willfp.ecoenchants.enchantments.ecoenchants.normal;
|
||||
|
||||
import com.willfp.ecoenchants.enchantments.EcoEnchant;
|
||||
import com.willfp.ecoenchants.enchantments.EcoEnchants;
|
||||
import com.willfp.ecoenchants.enchantments.util.EnchantmentUtils;
|
||||
import com.willfp.ecoenchants.queue.DropQueue;
|
||||
import com.willfp.ecoenchants.util.NumberUtils;
|
||||
import org.bukkit.GameMode;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.block.BlockBreakEvent;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
public final class Extraction extends EcoEnchant {
|
||||
public Extraction() {
|
||||
super(
|
||||
"extraction", EnchantmentType.NORMAL
|
||||
);
|
||||
}
|
||||
|
||||
// START OF LISTENERS
|
||||
|
||||
@Override
|
||||
public void onBlockBreak(Player player, Block block, int level, BlockBreakEvent event) {
|
||||
if (player.getGameMode() == GameMode.CREATIVE || player.getGameMode() == GameMode.SPECTATOR)
|
||||
return;
|
||||
|
||||
if(!EnchantmentUtils.passedChance(this, level))
|
||||
return;
|
||||
|
||||
Material material = null;
|
||||
|
||||
if(block.getType().equals(Material.GOLD_ORE)) material = Material.GOLD_NUGGET;
|
||||
if(block.getType().equals(Material.IRON_ORE)) material = Material.IRON_NUGGET;
|
||||
|
||||
if(material == null) return;
|
||||
|
||||
ItemStack item = new ItemStack(material, 1);
|
||||
|
||||
new DropQueue(player)
|
||||
.setLocation(block.getLocation())
|
||||
.addItem(item)
|
||||
.push();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user