Add new enchant reaper

This commit is contained in:
kireevm96
2021-03-02 13:51:26 +03:00
parent 77b27bb00d
commit 2878446808
4 changed files with 55 additions and 0 deletions

View File

@@ -223,6 +223,7 @@ import com.willfp.ecoenchants.enchantments.ecoenchants.special.Pentashot;
import com.willfp.ecoenchants.enchantments.ecoenchants.special.Preservation;
import com.willfp.ecoenchants.enchantments.ecoenchants.special.Prosperity;
import com.willfp.ecoenchants.enchantments.ecoenchants.special.Razor;
import com.willfp.ecoenchants.enchantments.ecoenchants.special.Reaper;
import com.willfp.ecoenchants.enchantments.ecoenchants.special.Repairing;
import com.willfp.ecoenchants.enchantments.ecoenchants.special.Soulbound;
import com.willfp.ecoenchants.enchantments.ecoenchants.special.Spring;
@@ -486,6 +487,7 @@ public class EcoEnchants {
public static final EcoEnchant ANGER_ARTIFACT = new AngerArtifact();
public static final EcoEnchant NAUTILUS_ARTIFACT = new NautilusArtifact();
public static final EcoEnchant SWEEP_ARTIFACT = new SweepArtifact();
public static final EcoEnchant REAPER = new Reaper();
/**
* Get all registered {@link EcoEnchant}s.

View File

@@ -0,0 +1,14 @@
package com.willfp.ecoenchants.enchantments.ecoenchants.special;
import com.willfp.ecoenchants.enchantments.EcoEnchant;
import com.willfp.ecoenchants.enchantments.EcoEnchants;
import com.willfp.ecoenchants.enchantments.meta.EnchantmentType;
import org.jetbrains.annotations.NotNull;
public class Reaper extends EcoEnchant {
public Reaper() {
super(
"reaper", EnchantmentType.SPECIAL
);
}
}

View File

@@ -1,7 +1,10 @@
package com.willfp.ecoenchants.enchantments.ecoenchants.special;
import com.willfp.ecoenchants.enchantments.EcoEnchant;
import com.willfp.ecoenchants.enchantments.EcoEnchants;
import com.willfp.ecoenchants.enchantments.meta.EnchantmentType;
import com.willfp.ecoenchants.enchantments.util.EnchantChecks;
import com.willfp.ecoenchants.enchantments.util.EnchantmentUtils;
import org.bukkit.Material;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
@@ -39,6 +42,18 @@ public class Soulbound extends EcoEnchant {
return;
}
if (player.getKiller() instanceof Player) {
Player killer = (Player) player.getKiller();
ItemStack item = killer.getInventory().getItemInMainHand();
if (EnchantChecks.item(item, EcoEnchants.REAPER)) {
if (!(EcoEnchants.REAPER.getDisabledWorlds().contains(player.getWorld()))) {
final int points = EnchantChecks.getItemLevel(item, EcoEnchants.REAPER);
if (EnchantmentUtils.passedChance(EcoEnchants.REAPER, points)) {
return;
}
}
}
}
for (ItemStack itemStack : player.getInventory().getContents()) {
if (itemStack == null) {
continue;

View File

@@ -0,0 +1,24 @@
#
# Frozen EcoEnchant
#
name: "Reaper of souls"
description: Gives you a chance to knock out things with a soulbound.
enabled: true
obtaining:
table: true
villager: false
loot: false
rarity: veryspecial
general-config:
targets:
- hoe
grindstoneable: true
disabled-in-worlds: []
conflicts: []
maximum-level: 5
config:
chance-per-level: 2