Search in sources :

Example 36 with Slimefun

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

the class SlimefunSubCommands method getAllCommands.

@Nonnull
public static Collection<SubCommand> getAllCommands(@Nonnull SlimefunCommand cmd) {
    Slimefun plugin = cmd.getPlugin();
    List<SubCommand> commands = new LinkedList<>();
    commands.add(new HelpCommand(plugin, cmd));
    commands.add(new VersionsCommand(plugin, cmd));
    commands.add(new CheatCommand(plugin, cmd));
    commands.add(new GuideCommand(plugin, cmd));
    commands.add(new GiveCommand(plugin, cmd));
    commands.add(new ResearchCommand(plugin, cmd));
    commands.add(new StatsCommand(plugin, cmd));
    commands.add(new TimingsCommand(plugin, cmd));
    commands.add(new TeleporterCommand(plugin, cmd));
    commands.add(new OpenGuideCommand(plugin, cmd));
    commands.add(new SearchCommand(plugin, cmd));
    commands.add(new DebugFishCommand(plugin, cmd));
    commands.add(new BackpackCommand(plugin, cmd));
    commands.add(new ChargeCommand(plugin, cmd));
    commands.add(new DebugCommand(plugin, cmd));
    return commands;
}
Also used : SubCommand(io.github.thebusybiscuit.slimefun4.core.commands.SubCommand) Slimefun(io.github.thebusybiscuit.slimefun4.implementation.Slimefun) LinkedList(java.util.LinkedList) Nonnull(javax.annotation.Nonnull)

Example 37 with Slimefun

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

the class TestIronGolemListener method testWithSlimefunIron.

@Test
@DisplayName("Test Iron Golem Healing with Slimefun Items being cancelled")
void testWithSlimefunIron() {
    SlimefunItem slimefunItem = TestUtilities.mockSlimefunItem(plugin, "SLIMEFUN_IRON", new CustomItemStack(Material.IRON_INGOT, "&cSlimefun Iron"));
    slimefunItem.register(plugin);
    // The Event should be cancelled, we do not wanna use Slimefun Items for this
    PlayerInteractEntityEvent event = callIronGolemEvent(EquipmentSlot.HAND, slimefunItem.getItem());
    Assertions.assertTrue(event.isCancelled());
    PlayerInteractEntityEvent event2 = callIronGolemEvent(EquipmentSlot.OFF_HAND, slimefunItem.getItem());
    Assertions.assertTrue(event2.isCancelled());
}
Also used : CustomItemStack(io.github.bakedlibs.dough.items.CustomItemStack) SlimefunItem(io.github.thebusybiscuit.slimefun4.api.items.SlimefunItem) PlayerInteractEntityEvent(org.bukkit.event.player.PlayerInteractEntityEvent) Test(org.junit.jupiter.api.Test) DisplayName(org.junit.jupiter.api.DisplayName)

Example 38 with Slimefun

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

the class TestTapeMeasure method registerSlimefunItem.

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

Example 39 with Slimefun

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

the class TestCauldronListener method testCauldronWithSlimefunLeatherArmor.

@Test
@DisplayName("Test Cauldron being cancelled with slimefun leather armor")
void testCauldronWithSlimefunLeatherArmor() {
    SlimefunItem item = TestUtilities.mockSlimefunItem(plugin, "CAULDRON_TEST_MOCK_LEATHER", new CustomItemStack(Material.LEATHER_BOOTS, "&6Mock Leather Armor"));
    item.register(plugin);
    PlayerInteractEvent event = mockCauldronEvent(item.getItem());
    Assertions.assertEquals(Result.DENY, event.useItemInHand());
}
Also used : PlayerInteractEvent(org.bukkit.event.player.PlayerInteractEvent) 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)

Example 40 with Slimefun

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

the class TestSlimefunItem method testWikiPages.

@Test
@DisplayName("Test wiki pages getting assigned correctly")
void testWikiPages() {
    SlimefunItem item = TestUtilities.mockSlimefunItem(plugin, "WIKI_ITEM", new CustomItemStack(Material.BOOK, "&cTest"));
    item.register(plugin);
    Assertions.assertFalse(item.getWikipage().isPresent());
    // null should not be a valid argument
    Assertions.assertThrows(IllegalArgumentException.class, () -> item.addOfficialWikipage(null));
    item.addOfficialWikipage("Test");
    Optional<String> wiki = item.getWikipage();
    Assertions.assertTrue(wiki.isPresent());
    Assertions.assertEquals("https://github.com/Slimefun/Slimefun4/wiki/Test", wiki.get());
}
Also used : CustomItemStack(io.github.bakedlibs.dough.items.CustomItemStack) SlimefunItem(io.github.thebusybiscuit.slimefun4.api.items.SlimefunItem) Test(org.junit.jupiter.api.Test) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest) DisplayName(org.junit.jupiter.api.DisplayName)

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