use of io.github.thebusybiscuit.slimefun4.implementation.Slimefun in project Slimefun4 by Slimefun.
the class TestMeatJerky method registerSlimefunItem.
@Override
public MeatJerky registerSlimefunItem(Slimefun plugin, String id) {
SlimefunItemStack item = new SlimefunItemStack(id, Material.COOKED_BEEF, "&5Test Jerky");
MeatJerky meat = new MeatJerky(TestUtilities.getItemGroup(plugin, "test_jerky"), item, RecipeType.NULL, new ItemStack[9]);
meat.register(plugin);
return meat;
}
use of io.github.thebusybiscuit.slimefun4.implementation.Slimefun in project Slimefun4 by Slimefun.
the class TestSoulboundItem method testSoulboundSlimefunItem.
@Test
@DisplayName("Test that soulbound Slimefun Items are soulbound")
void testSoulboundSlimefunItem() {
SlimefunItem item = new SoulboundMock(new ItemGroup(new NamespacedKey(plugin, "soulbound_itemgroup"), new CustomItemStack(Material.REDSTONE, "&4Walshrus forever")));
item.register(plugin);
Assertions.assertTrue(SlimefunUtils.isSoulbound(item.getItem()));
}
use of io.github.thebusybiscuit.slimefun4.implementation.Slimefun in project Slimefun4 by Slimefun.
the class TestResearchCommand method testResearchSpecific.
@Test
@DisplayName("Test /sf research <research id>")
void testResearchSpecific() throws InterruptedException {
Slimefun.getRegistry().setResearchingEnabled(true);
Player player = server.addPlayer();
PlayerProfile profile = TestUtilities.awaitProfile(player);
server.executeConsole("slimefun", "research", player.getName(), research.getKey().toString()).assertSucceeded();
Assertions.assertTrue(profile.hasUnlocked(research));
Assertions.assertFalse(profile.hasUnlocked(research2));
}
use of io.github.thebusybiscuit.slimefun4.implementation.Slimefun in project Slimefun4 by Slimefun.
the class TestResearchCommand method testResearchReset.
@Test
@DisplayName("Test /sf research reset")
void testResearchReset() 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));
server.executeConsole("slimefun", "research", player.getName(), "reset").assertSucceeded();
Assertions.assertFalse(profile.hasUnlocked(research));
Assertions.assertFalse(profile.hasUnlocked(research2));
}
use of io.github.thebusybiscuit.slimefun4.implementation.Slimefun in project Slimefun4 by Slimefun.
the class SlimefunUtils method getCustomHead.
/**
* This method returns an {@link ItemStack} for the given texture.
* The result will be a Player Head with this texture.
*
* @param texture
* The texture for this head (base64 or hash)
*
* @return An {@link ItemStack} with this Head texture
*/
@Nonnull
public static ItemStack getCustomHead(@Nonnull String texture) {
Validate.notNull(texture, "The provided texture is null");
if (Slimefun.instance() == null) {
throw new PrematureCodeException("You cannot instantiate a custom head before Slimefun was loaded.");
}
if (Slimefun.getMinecraftVersion() == MinecraftVersion.UNIT_TEST) {
// com.mojang.authlib.GameProfile does not exist in a Test Environment
return new ItemStack(Material.PLAYER_HEAD);
}
String base64 = texture;
if (CommonPatterns.HEXADECIMAL.matcher(texture).matches()) {
base64 = Base64.getEncoder().encodeToString(("{\"textures\":{\"SKIN\":{\"url\":\"http://textures.minecraft.net/texture/" + texture + "\"}}}").getBytes(StandardCharsets.UTF_8));
}
PlayerSkin skin = PlayerSkin.fromBase64(base64);
return PlayerHead.getItemStack(skin);
}
Aggregations