Merge remote-tracking branch 'origin/master' into master

This commit is contained in:
Auxilor 2021-03-04 18:12:37 +00:00
commit eb87c1dc06
4 changed files with 52 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,12 @@
package com.willfp.ecoenchants.enchantments.ecoenchants.special;
import com.willfp.ecoenchants.enchantments.EcoEnchant;
import com.willfp.ecoenchants.enchantments.meta.EnchantmentType;
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,17 @@ public class Soulbound extends EcoEnchant {
return;
}
if (player.getKiller() instanceof Player) {
Player killer = (Player) player.getKiller();
if (EnchantChecks.mainhand(killer, EcoEnchants.REAPER)) {
if (!(EcoEnchants.REAPER.getDisabledWorlds().contains(killer.getWorld()))) {
int points = EnchantChecks.getMainhandLevel(killer, 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 @@
#
# Reaper EcoEnchant
#
name: "Reaper"
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