mirror of
https://github.com/Auxilor/EcoEnchants.git
synced 2025-02-17 04:41:21 +01:00
Added Extraction
This commit is contained in:
parent
0454d25008
commit
abdfd2438a
@ -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();
|
||||
}
|
||||
}
|
25
Plugin/src/main/resources/enchants/normal/extraction.yml
Normal file
25
Plugin/src/main/resources/enchants/normal/extraction.yml
Normal file
@ -0,0 +1,25 @@
|
||||
#
|
||||
# Extraction EcoEnchant
|
||||
#
|
||||
|
||||
name: "Extraction"
|
||||
description: Breaking ores can drop a nugget of the material.
|
||||
enabled: true
|
||||
|
||||
obtaining:
|
||||
table: true
|
||||
villager: true
|
||||
loot: true
|
||||
rarity: legendary
|
||||
|
||||
general-config:
|
||||
targets:
|
||||
- pickaxe
|
||||
grindstoneable: true
|
||||
conflicts:
|
||||
- stone_switcher
|
||||
- silk_touch
|
||||
maximum-level: 6
|
||||
|
||||
config:
|
||||
chance-per-level: 2.5 # Chance for dropping a nugget
|
@ -258,6 +258,7 @@ permissions:
|
||||
ecoenchants.fromtable.ashartifact: true
|
||||
ecoenchants.fromtable.tearartifact: true
|
||||
ecoenchants.fromtable.backstab: true
|
||||
ecoenchants.fromtable.extracting: true
|
||||
|
||||
ecoenchants.updateannounce:
|
||||
description: Informs admins of a new update
|
||||
@ -895,4 +896,7 @@ permissions:
|
||||
default: true
|
||||
ecoenchants.fromtable.backstab:
|
||||
description: Allows getting backstab from an enchanting table
|
||||
default: true
|
||||
ecoenchants.fromtable.extracting:
|
||||
description: Allows getting extracting from an enchanting table
|
||||
default: true
|
Loading…
Reference in New Issue
Block a user