mirror of
https://github.com/StarWishsama/Slimefun4.git
synced 2024-09-20 03:35:51 +00:00
Fixed some unit tests
This commit is contained in:
parent
cc21fb8fe3
commit
974657fadc
@ -196,10 +196,7 @@ public final class Slimefun {
|
||||
* <code>false</code> otherwise.
|
||||
*/
|
||||
public static boolean isEnabled(Player p, SlimefunItem sfItem, boolean message) {
|
||||
if (sfItem.getState() == ItemState.VANILLA_FALLBACK) {
|
||||
return true;
|
||||
}
|
||||
else if (sfItem.isDisabled()) {
|
||||
if (sfItem.isDisabled()) {
|
||||
if (message) {
|
||||
SlimefunPlugin.getLocal().sendMessage(p, "messages.disabled-item", true);
|
||||
}
|
||||
|
@ -20,7 +20,6 @@ import io.github.thebusybiscuit.slimefun4.core.categories.FlexCategory;
|
||||
import io.github.thebusybiscuit.slimefun4.core.categories.LockedCategory;
|
||||
import io.github.thebusybiscuit.slimefun4.core.categories.SeasonalCategory;
|
||||
import io.github.thebusybiscuit.slimefun4.core.guide.SlimefunGuideLayout;
|
||||
import io.github.thebusybiscuit.slimefun4.implementation.items.VanillaItem;
|
||||
import io.github.thebusybiscuit.slimefun4.mocks.SlimefunMocks;
|
||||
import me.mrCookieSlime.Slimefun.SlimefunPlugin;
|
||||
import me.mrCookieSlime.Slimefun.Objects.Category;
|
||||
@ -61,16 +60,17 @@ public class TestCategories {
|
||||
|
||||
@Test
|
||||
public void testHidden() {
|
||||
Category category = new Category(new NamespacedKey(plugin, "testCategory2"), new ItemStack(Material.BEACON));
|
||||
Category category = new Category(new NamespacedKey(plugin, "hiddenCategory"), new ItemStack(Material.BEACON));
|
||||
Player player = server.addPlayer();
|
||||
|
||||
// Empty Categories are also hidden
|
||||
Assertions.assertTrue(category.isHidden(player));
|
||||
|
||||
VanillaItem vanillaItem = SlimefunMocks.mockVanillaItem(Material.BEETROOT, false);
|
||||
vanillaItem.setCategory(category);
|
||||
vanillaItem.register(plugin);
|
||||
vanillaItem.load();
|
||||
SlimefunItem disabledItem = SlimefunMocks.mockSlimefunItem("DISABLED_CATEGORY_ITEM", new CustomItem(Material.BEETROOT, "&4Disabled"));
|
||||
SlimefunPlugin.getItemCfg().setValue("DISABLED_CATEGORY_ITEM.enabled", false);
|
||||
disabledItem.setCategory(category);
|
||||
disabledItem.register(plugin);
|
||||
disabledItem.load();
|
||||
|
||||
// A disabled Item should also make the Category hide
|
||||
Assertions.assertTrue(category.isHidden(player));
|
||||
|
@ -68,6 +68,8 @@ public class TextCustomTextureService {
|
||||
|
||||
ItemStack stack = new ItemStack(Material.DIAMOND);
|
||||
service.setTexture(stack, item.getID());
|
||||
|
||||
Assertions.assertTrue(stack.getItemMeta().hasCustomModelData());
|
||||
Assertions.assertEquals(300, stack.getItemMeta().getCustomModelData());
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user