Search in sources :

Example 1 with SeasonalItemGroup

use of io.github.thebusybiscuit.slimefun4.api.items.groups.SeasonalItemGroup in project Slimefun4 by Slimefun.

the class TestItemGroups method ItemGroups.

@Test
@DisplayName("Test a seasonal ItemGroup")
void ItemGroups() {
    // ItemGroup with current Month
    Month month = LocalDate.now().getMonth();
    SeasonalItemGroup group = new SeasonalItemGroup(new NamespacedKey(plugin, "seasonal"), month, 1, new CustomItemStack(Material.NETHER_STAR, "&cSeasonal Test"));
    SlimefunItem item = TestUtilities.mockSlimefunItem(plugin, "SEASONAL_ITEM", new CustomItemStack(Material.NETHER_STAR, "&dSeasonal Test Star"));
    item.setItemGroup(group);
    item.register(plugin);
    item.load();
    Player player = server.addPlayer();
    Assertions.assertEquals(month, group.getMonth());
    Assertions.assertFalse(group.isHidden(player));
    // ItemGroup with future Month
    SeasonalItemGroup itemGroup2 = new SeasonalItemGroup(group.getKey(), month.plus(6), 1, new CustomItemStack(Material.MILK_BUCKET, "&dSeasonal Test"));
    Assertions.assertTrue(itemGroup2.isHidden(player));
}
Also used : Month(java.time.Month) SeasonalItemGroup(io.github.thebusybiscuit.slimefun4.api.items.groups.SeasonalItemGroup) Player(org.bukkit.entity.Player) NamespacedKey(org.bukkit.NamespacedKey) CustomItemStack(io.github.bakedlibs.dough.items.CustomItemStack) SlimefunItem(io.github.thebusybiscuit.slimefun4.api.items.SlimefunItem) Test(org.junit.jupiter.api.Test) DisplayName(org.junit.jupiter.api.DisplayName)

Aggregations

CustomItemStack (io.github.bakedlibs.dough.items.CustomItemStack)1 SlimefunItem (io.github.thebusybiscuit.slimefun4.api.items.SlimefunItem)1 SeasonalItemGroup (io.github.thebusybiscuit.slimefun4.api.items.groups.SeasonalItemGroup)1 Month (java.time.Month)1 NamespacedKey (org.bukkit.NamespacedKey)1 Player (org.bukkit.entity.Player)1 DisplayName (org.junit.jupiter.api.DisplayName)1 Test (org.junit.jupiter.api.Test)1