use of io.github.thebusybiscuit.slimefun4.api.items.SlimefunItemStack 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);
}
use of io.github.thebusybiscuit.slimefun4.api.items.SlimefunItemStack in project Slimefun4 by Slimefun.
the class TestBackpackListener method openMockBackpack.
private PlayerBackpack openMockBackpack(Player player, String id, int size) throws InterruptedException {
SlimefunItemStack item = new SlimefunItemStack(id, Material.CHEST, "&4Mock Backpack", "", "&7Size: &e" + BACKPACK_SIZE, "&7ID: <ID>", "", "&7&eRight Click&7 to open");
PlayerProfile profile = TestUtilities.awaitProfile(player);
PlayerBackpack backpack = profile.createBackpack(size);
listener.setBackpackId(player, item, 2, backpack.getId());
ItemGroup itemGroup = new ItemGroup(new NamespacedKey(plugin, "test_backpacks"), new CustomItemStack(Material.CHEST, "&4Test Backpacks"));
SlimefunBackpack slimefunBackpack = new SlimefunBackpack(size, itemGroup, item, RecipeType.NULL, new ItemStack[9]);
slimefunBackpack.register(plugin);
listener.openBackpack(player, item, slimefunBackpack);
return backpack;
}
use of io.github.thebusybiscuit.slimefun4.api.items.SlimefunItemStack in project Slimefun4 by Slimefun.
the class TestCargoNodeListener method testInvalidSidePlacement.
@Test
@DisplayName("Test placing Cargo nodes on invalid sides of blocks")
void testInvalidSidePlacement() {
Player player = server.addPlayer();
Location l = new Location(player.getWorld(), 190, 50, 400);
Block b = l.getBlock();
Block against = b.getRelative(BlockFace.DOWN);
ItemGroup itemGroup = TestUtilities.getItemGroup(plugin, "cargo_test");
SlimefunItemStack item = new SlimefunItemStack("MOCK_CARGO_NODE", new CustomItemStack(Material.PLAYER_HEAD, "&4Cargo node!"));
CargoInputNode node = new CargoInputNode(itemGroup, item, RecipeType.NULL, new ItemStack[9], null);
node.register(plugin);
BlockPlaceEvent event = new BlockPlaceEvent(b, b.getState(), against, item, player, true, EquipmentSlot.HAND);
listener.onCargoNodePlace(event);
Assertions.assertTrue(event.isCancelled());
}
use of io.github.thebusybiscuit.slimefun4.api.items.SlimefunItemStack in project Slimefun4 by Slimefun.
the class TestCargoNodeListener method testGrassPlacement.
@Test
@DisplayName("Test placing Cargo nodes on grass")
void testGrassPlacement() {
Player player = server.addPlayer();
Location l = new Location(player.getWorld(), 300, 25, 1200);
Block b = l.getBlock();
b.setType(Material.GRASS);
ItemGroup itemGroup = TestUtilities.getItemGroup(plugin, "cargo_test");
SlimefunItemStack item = new SlimefunItemStack("MOCK_CARGO_NODE_2", new CustomItemStack(Material.PLAYER_HEAD, "&4Cargo node!"));
CargoInputNode node = new CargoInputNode(itemGroup, item, RecipeType.NULL, new ItemStack[9], null);
node.register(plugin);
BlockPlaceEvent event = new BlockPlaceEvent(b, b.getState(), b, item, player, true, EquipmentSlot.HAND);
listener.onCargoNodePlace(event);
Assertions.assertTrue(event.isCancelled());
}
use of io.github.thebusybiscuit.slimefun4.api.items.SlimefunItemStack in project Slimefun4 by Slimefun.
the class TestRadioactiveItem method testWikiPages.
@ParameterizedTest
@EnumSource(value = Radioactivity.class)
@DisplayName("Test radioactive items being radioactive")
void testWikiPages(Radioactivity radioactivity) {
ItemGroup itemGroup = TestUtilities.getItemGroup(plugin, "radioactivity_test");
SlimefunItemStack stack = new SlimefunItemStack("RADIOACTIVE_" + radioactivity.name(), Material.EMERALD, "&4Radioactive!!!", "Imagine dragons");
RadioactiveItem item = new RadioactiveItem(itemGroup, radioactivity, stack, RecipeType.NULL, new ItemStack[9]);
Assertions.assertEquals(radioactivity, item.getRadioactivity());
}
Aggregations