1
mirror of https://github.com/StarWishsama/Slimefun4.git synced 2024-09-20 03:35:51 +00:00

Move classes out

This commit is contained in:
RobotHanzo 2021-04-02 21:53:05 +08:00
parent f9201b648a
commit 6d12d1f7ac
2 changed files with 34 additions and 23 deletions

View File

@ -0,0 +1,32 @@
package io.github.thebusybiscuit.slimefun4.testing.mocks;
import io.github.thebusybiscuit.slimefun4.core.attributes.DamageableItem;
import me.mrCookieSlime.Slimefun.Lists.RecipeType;
import me.mrCookieSlime.Slimefun.Objects.Category;
import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.SlimefunItem;
import me.mrCookieSlime.Slimefun.api.SlimefunItemStack;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
public class DamageableMock extends SlimefunItem implements DamageableItem {
boolean itemDamageable;
public DamageableMock(Category category, SlimefunItemStack item, RecipeType recipeType, ItemStack[] recipe, boolean damageable) {
super(category, item, recipeType, recipe);
itemDamageable = damageable;
}
@Override
public boolean isDamageable() {
return itemDamageable;
}
@Override
public void damageItem(@Nonnull Player p, @Nullable ItemStack item) {
DamageableItem.super.damageItem(p, item);
}
}

View File

@ -2,12 +2,11 @@ package io.github.thebusybiscuit.slimefun4.testing.tests.items;
import be.seeseemelk.mockbukkit.MockBukkit;
import be.seeseemelk.mockbukkit.ServerMock;
import io.github.thebusybiscuit.slimefun4.core.attributes.DamageableItem;
import io.github.thebusybiscuit.slimefun4.implementation.SlimefunPlugin;
import io.github.thebusybiscuit.slimefun4.testing.TestUtilities;
import io.github.thebusybiscuit.slimefun4.testing.mocks.DamageableMock;
import me.mrCookieSlime.Slimefun.Lists.RecipeType;
import me.mrCookieSlime.Slimefun.Objects.Category;
import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.SlimefunItem;
import me.mrCookieSlime.Slimefun.api.SlimefunItemStack;
import org.bukkit.Material;
import org.bukkit.enchantments.Enchantment;
@ -21,7 +20,6 @@ import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Test;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
class TestDamageableItem {
@ -104,23 +102,4 @@ class TestDamageableItem {
Assertions.assertTrue(((Damageable) iiiUnbreakingItemIS.getItemMeta()).getDamage() < ((Damageable) noUnbreakingItemIS.getItemMeta()).getDamage());
}
private static class DamageableMock extends SlimefunItem implements DamageableItem {
boolean itemDamageable;
public DamageableMock(Category category, SlimefunItemStack item, RecipeType recipeType, ItemStack[] recipe, boolean damageable) {
super(category, item, recipeType, recipe);
itemDamageable = damageable;
}
@Override
public boolean isDamageable() {
return itemDamageable;
}
@Override
public void damageItem(@Nonnull Player p, @Nullable ItemStack item) {
DamageableItem.super.damageItem(p, item);
}
}
}