use of io.github.thebusybiscuit.slimefun4.implementation.Slimefun in project Slimefun4 by Slimefun.
the class TestChargeCommand method testCommand.
@Test
@DisplayName("Test if /sf charge charges the item the player is holding")
void testCommand() {
ItemGroup itemGroup = TestUtilities.getItemGroup(plugin, "rechargeable");
SlimefunItemStack RECHARGEABLE_ITEM = new SlimefunItemStack("SF_CHARGE_TEST_ITEM", Material.REDSTONE_BLOCK, "Rechargeable Item", "This isn't real", LoreBuilder.powerCharged(0, 100));
new RechargeableMock(itemGroup, RECHARGEABLE_ITEM, RecipeType.NULL, new ItemStack[9]).register(plugin);
Player player = server.addPlayer();
player.setOp(true);
player.getInventory().setItemInMainHand(RECHARGEABLE_ITEM.clone());
ItemStack chargedItemStack = player.getInventory().getItemInMainHand();
Rechargeable chargedItem = (Rechargeable) SlimefunItem.getByItem(chargedItemStack);
Assertions.assertEquals(chargedItem.getItemCharge(chargedItemStack), 0);
server.execute("slimefun", player, "charge");
chargedItemStack = player.getInventory().getItemInMainHand();
chargedItem = (Rechargeable) SlimefunItem.getByItem(chargedItemStack);
Assertions.assertEquals(chargedItem.getItemCharge(chargedItemStack), chargedItem.getMaxItemCharge(chargedItemStack));
}
use of io.github.thebusybiscuit.slimefun4.implementation.Slimefun in project Slimefun4 by Slimefun.
the class TestResearchCommand method load.
@BeforeAll
public static void load() {
server = MockBukkit.mock();
Slimefun plugin = MockBukkit.load(Slimefun.class);
research = new Research(new NamespacedKey(plugin, "command_test"), 999, "Test", 10);
research.register();
research2 = new Research(new NamespacedKey(plugin, "command_test_two"), 1000, "Test Two", 10);
research2.register();
}
use of io.github.thebusybiscuit.slimefun4.implementation.Slimefun in project Slimefun4 by Slimefun.
the class TestResearchCommand method testResearchAll.
@Test
@DisplayName("Test /sf research all")
void testResearchAll() throws InterruptedException {
Slimefun.getRegistry().setResearchingEnabled(true);
Player player = server.addPlayer();
PlayerProfile profile = TestUtilities.awaitProfile(player);
server.executeConsole("slimefun", "research", player.getName(), "all").assertSucceeded();
Assertions.assertTrue(profile.hasUnlocked(research));
Assertions.assertTrue(profile.hasUnlocked(research2));
}
use of io.github.thebusybiscuit.slimefun4.implementation.Slimefun in project Slimefun4 by Slimefun.
the class TestGuideOpening method testOpenMainMenu.
@Test
@DisplayName("Test if the Slimefun Guide Main Menu can be opened from the History")
void testOpenMainMenu() throws InterruptedException {
SlimefunGuideImplementation guide = Mockito.mock(SlimefunGuideImplementation.class);
PlayerProfile profile = prepare(guide, history -> {
});
Mockito.verify(guide).openMainMenu(profile, 1);
}
use of io.github.thebusybiscuit.slimefun4.implementation.Slimefun in project Slimefun4 by Slimefun.
the class TestGuideOpening method testOpenSearch.
@Test
@DisplayName("Test if the Slimefun Search can be opened from the History")
void testOpenSearch() throws InterruptedException {
String query = "electric";
SlimefunGuideImplementation guide = Mockito.mock(SlimefunGuideImplementation.class);
PlayerProfile profile = prepare(guide, history -> history.add(query));
Mockito.verify(guide).openSearch(profile, query, false);
}
Aggregations