Search in sources :

Example 21 with Slimefun

use of io.github.thebusybiscuit.slimefun4.implementation.Slimefun in project Slimefun4 by Slimefun.

the class TestCauldronListener method testCauldronWithVanillaLeatherArmor.

@Test
@DisplayName("Test Cauldron working as normal with vanilla slimefun leather armor")
void testCauldronWithVanillaLeatherArmor() {
    VanillaItem item = TestUtilities.mockVanillaItem(plugin, Material.LEATHER_CHESTPLATE, true);
    item.register(plugin);
    PlayerInteractEvent event = mockCauldronEvent(item.getItem());
    Assertions.assertEquals(Result.DEFAULT, event.useItemInHand());
}
Also used : PlayerInteractEvent(org.bukkit.event.player.PlayerInteractEvent) VanillaItem(io.github.thebusybiscuit.slimefun4.implementation.items.VanillaItem) Test(org.junit.jupiter.api.Test) DisplayName(org.junit.jupiter.api.DisplayName)

Example 22 with Slimefun

use of io.github.thebusybiscuit.slimefun4.implementation.Slimefun in project Slimefun4 by Slimefun.

the class TestCoolerListener method load.

@BeforeAll
public static void load() {
    server = MockBukkit.mock();
    Slimefun plugin = MockBukkit.load(Slimefun.class);
    ItemGroup itemGroup = new ItemGroup(new NamespacedKey(plugin, "cooler_test"), new CustomItemStack(Material.SNOWBALL, "Mr. Freeze"));
    SlimefunItemStack item = new SlimefunItemStack("TEST_COOLER", Material.SNOWBALL, "&6Test Cooler", "", "&7ID: <ID>");
    cooler = new Cooler(18, itemGroup, item, RecipeType.NULL, new ItemStack[9]);
    cooler.register(plugin);
    SlimefunItemStack juiceItem = new SlimefunItemStack("TEST_JUICE", Color.RED, new PotionEffect(PotionEffectType.HEALTH_BOOST, 6, 0), "&4Test Juice");
    juice = new Juice(itemGroup, juiceItem, RecipeType.NULL, new ItemStack[9]);
    juice.register(plugin);
    listener = new CoolerListener(plugin, cooler);
}
Also used : Cooler(io.github.thebusybiscuit.slimefun4.implementation.items.backpacks.Cooler) ItemGroup(io.github.thebusybiscuit.slimefun4.api.items.ItemGroup) PotionEffect(org.bukkit.potion.PotionEffect) NamespacedKey(org.bukkit.NamespacedKey) CustomItemStack(io.github.bakedlibs.dough.items.CustomItemStack) Slimefun(io.github.thebusybiscuit.slimefun4.implementation.Slimefun) Juice(io.github.thebusybiscuit.slimefun4.implementation.items.food.Juice) ItemStack(org.bukkit.inventory.ItemStack) SlimefunItemStack(io.github.thebusybiscuit.slimefun4.api.items.SlimefunItemStack) CustomItemStack(io.github.bakedlibs.dough.items.CustomItemStack) SlimefunItemStack(io.github.thebusybiscuit.slimefun4.api.items.SlimefunItemStack) BeforeAll(org.junit.jupiter.api.BeforeAll)

Example 23 with Slimefun

use of io.github.thebusybiscuit.slimefun4.implementation.Slimefun in project Slimefun4 by Slimefun.

the class TestArmorTask method testSlimefunArmor.

@Test
@DisplayName("Test Slimefun Armor Effects")
void testSlimefunArmor() throws InterruptedException {
    Player player = server.addPlayer();
    TestUtilities.awaitProfile(player);
    // Setting the time to noon, to exclude the Solar Helmet check
    player.getWorld().setTime(16000);
    PotionEffect[] effects = { new PotionEffect(PotionEffectType.SPEED, 50, 3), new PotionEffect(PotionEffectType.SATURATION, 128, 12) };
    SlimefunItemStack helmet = new SlimefunItemStack("HELMET_FLEX", Material.IRON_HELMET, "&bSuper cool Helmet");
    SlimefunArmorPiece armor = new SlimefunArmorPiece(TestUtilities.getItemGroup(plugin, "armor_test"), helmet, RecipeType.NULL, new ItemStack[9], effects);
    armor.register(plugin);
    player.getInventory().setHelmet(helmet.clone());
    player.getInventory().setChestplate(new ItemStack(Material.DIAMOND_CHESTPLATE));
    new ArmorTask(false).run();
    // Check if all Potion Effects were applied
    Assertions.assertTrue(player.getActivePotionEffects().containsAll(Arrays.asList(effects)));
}
Also used : Player(org.bukkit.entity.Player) SlimefunArmorPiece(io.github.thebusybiscuit.slimefun4.implementation.items.armor.SlimefunArmorPiece) PotionEffect(org.bukkit.potion.PotionEffect) ItemStack(org.bukkit.inventory.ItemStack) SlimefunItemStack(io.github.thebusybiscuit.slimefun4.api.items.SlimefunItemStack) SlimefunItemStack(io.github.thebusybiscuit.slimefun4.api.items.SlimefunItemStack) Test(org.junit.jupiter.api.Test) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest) DisplayName(org.junit.jupiter.api.DisplayName)

Example 24 with Slimefun

use of io.github.thebusybiscuit.slimefun4.implementation.Slimefun in project Slimefun4 by Slimefun.

the class TestEnderBackpack method registerSlimefunItem.

@Override
public EnderBackpack registerSlimefunItem(Slimefun plugin, String id) {
    SlimefunItemStack item = new SlimefunItemStack(id, Material.ENDER_CHEST, "&5Test Ender Backpack");
    EnderBackpack backpack = new EnderBackpack(TestUtilities.getItemGroup(plugin, "ender_backpack"), item, RecipeType.NULL, new ItemStack[9]);
    backpack.register(plugin);
    return backpack;
}
Also used : SlimefunItemStack(io.github.thebusybiscuit.slimefun4.api.items.SlimefunItemStack)

Example 25 with Slimefun

use of io.github.thebusybiscuit.slimefun4.implementation.Slimefun in project Slimefun4 by Slimefun.

the class TestDietCookie method registerSlimefunItem.

@Override
public DietCookie registerSlimefunItem(Slimefun plugin, String id) {
    SlimefunItemStack item = new SlimefunItemStack(id, Material.COOKIE, "&5Test Cookie");
    DietCookie cookie = new DietCookie(TestUtilities.getItemGroup(plugin, "diet_cookie"), item, RecipeType.NULL, new ItemStack[9]);
    cookie.register(plugin);
    return cookie;
}
Also used : SlimefunItemStack(io.github.thebusybiscuit.slimefun4.api.items.SlimefunItemStack)

Aggregations

SlimefunItemStack (io.github.thebusybiscuit.slimefun4.api.items.SlimefunItemStack)17 SlimefunItem (io.github.thebusybiscuit.slimefun4.api.items.SlimefunItem)16 ItemStack (org.bukkit.inventory.ItemStack)14 DisplayName (org.junit.jupiter.api.DisplayName)14 Test (org.junit.jupiter.api.Test)14 Player (org.bukkit.entity.Player)12 CustomItemStack (io.github.bakedlibs.dough.items.CustomItemStack)10 Slimefun (io.github.thebusybiscuit.slimefun4.implementation.Slimefun)8 ParametersAreNonnullByDefault (javax.annotation.ParametersAreNonnullByDefault)7 NamespacedKey (org.bukkit.NamespacedKey)7 PlayerProfile (io.github.thebusybiscuit.slimefun4.api.player.PlayerProfile)6 ArrayList (java.util.ArrayList)6 Nonnull (javax.annotation.Nonnull)6 BeforeAll (org.junit.jupiter.api.BeforeAll)4 TagMisconfigurationException (io.github.thebusybiscuit.slimefun4.api.exceptions.TagMisconfigurationException)3 ItemGroup (io.github.thebusybiscuit.slimefun4.api.items.ItemGroup)3 Block (org.bukkit.block.Block)3 ItemMeta (org.bukkit.inventory.meta.ItemMeta)3 PotionEffect (org.bukkit.potion.PotionEffect)3 AndroidMineEvent (io.github.thebusybiscuit.slimefun4.api.events.AndroidMineEvent)2