mirror of
https://github.com/alexcrea/CustomAnvil.git
synced 2026-06-23 16:16:17 +02:00
update MockBukkit to 4.5.0
This commit is contained in:
parent
f5d607212d
commit
71dd823d3e
3 changed files with 2 additions and 60 deletions
|
|
@ -65,7 +65,7 @@ dependencies {
|
|||
implementation(kotlin("stdlib"))
|
||||
|
||||
// Test dependency
|
||||
testImplementation("org.mockbukkit.mockbukkit:mockbukkit-v1.21:4.3.1")
|
||||
testImplementation("org.mockbukkit.mockbukkit:mockbukkit-v1.21:4.5.0")
|
||||
testRuntimeOnly("commons-lang:commons-lang:2.6")
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,57 +0,0 @@
|
|||
package xyz.alexcrea.cuanvil.mock;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.enchantments.Enchantment;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.mockbukkit.mockbukkit.inventory.ItemStackMock;
|
||||
|
||||
public class EnchantedItemStackMock extends ItemStackMock {
|
||||
|
||||
public EnchantedItemStackMock(@NotNull Material type, int amount) {
|
||||
super(type, amount);
|
||||
}
|
||||
|
||||
public EnchantedItemStackMock(@NotNull Material type) {
|
||||
this(type, 1);
|
||||
}
|
||||
|
||||
public EnchantedItemStackMock(@NotNull ItemStack stack) {
|
||||
super(stack);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int removeEnchantment(@NotNull Enchantment ench) {
|
||||
if(!this.hasItemMeta()) return 0;
|
||||
|
||||
int level = this.getEnchantmentLevel(ench);
|
||||
this.getItemMeta().removeEnchant(ench);
|
||||
|
||||
return level;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeEnchantments() {
|
||||
if(!this.hasItemMeta()) return;
|
||||
|
||||
this.getItemMeta().removeEnchantments();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if(!super.equals(obj)) return false;
|
||||
|
||||
return getItemMeta().equals(((ItemStack)obj).getItemMeta());
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NotNull ItemStack clone() {
|
||||
EnchantedItemStackMock clone = new EnchantedItemStackMock(this.getType());
|
||||
|
||||
clone.setAmount(this.getAmount());
|
||||
clone.setItemMeta(this.getItemMeta());
|
||||
clone.setDurability(this.getDurability());
|
||||
return clone;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -14,7 +14,6 @@ import org.junit.jupiter.api.Assertions;
|
|||
import xyz.alexcrea.cuanvil.enchant.CAEnchantment;
|
||||
import xyz.alexcrea.cuanvil.listener.PrepareAnvilListener;
|
||||
import xyz.alexcrea.cuanvil.mock.AnvilViewMock;
|
||||
import xyz.alexcrea.cuanvil.mock.EnchantedItemStackMock;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
|
|
@ -39,7 +38,7 @@ public class AnvilFuseTestUtil {
|
|||
enchantmentMap.put(enchantments.get(i), level.get(i));
|
||||
}
|
||||
|
||||
ItemStack item = new EnchantedItemStackMock(material);
|
||||
ItemStack item = new ItemStack(material);
|
||||
ItemUtil.INSTANCE.setEnchantmentsUnsafe(item, enchantmentMap);
|
||||
|
||||
ItemMeta meta = item.getItemMeta();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue