mirror of
https://github.com/StarWishsama/Slimefun4.git
synced 2024-09-19 19:25:48 +00:00
A few fixes and performance improvements
This commit is contained in:
parent
167326292d
commit
95655dc6fc
@ -45,6 +45,9 @@
|
||||
* Small performance improvements for Cargo networks
|
||||
* Small performance improvements for Miner Androids
|
||||
* Small performance improvements for all machines, especially Electric Smelteries
|
||||
* Small performance improvements for Holograms
|
||||
* Small performance improvements for Tree Growth Accelerators
|
||||
* Small performance improvements for Reactors
|
||||
|
||||
#### Fixes
|
||||
* Fixed Programmable Androids rotating in the wrong direction
|
||||
@ -72,6 +75,7 @@
|
||||
* Fixed timings reports never arriving sometimes
|
||||
* Fixed #2138
|
||||
* Fixed #1951 (again)
|
||||
* Fixed Electric Press not working
|
||||
|
||||
## Release Candidate 15 (01 Aug 2020)
|
||||
|
||||
|
@ -94,8 +94,9 @@ public class UpdaterService {
|
||||
* @return The build number of this Slimefun.
|
||||
*/
|
||||
public int getBuildNumber() {
|
||||
if (updater != null && PatternUtils.NUMERIC.matcher(this.updater.getLocalVersion()).matches())
|
||||
return Integer.parseInt(this.updater.getLocalVersion());
|
||||
if (updater != null && PatternUtils.NUMERIC.matcher(this.updater.getLocalVersion()).matches()) {
|
||||
return Integer.parseInt(updater.getLocalVersion());
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
@ -19,7 +19,7 @@ public abstract class ElectricPress extends AContainer implements RecipeDisplayI
|
||||
|
||||
@Override
|
||||
protected void registerDefaultRecipes() {
|
||||
addRecipe(4, new CustomItem(SlimefunItems.STONE_CHUNK, 3), new ItemStack(Material.COBBLESTONE));
|
||||
addRecipe(4, new SlimefunItemStack(SlimefunItems.STONE_CHUNK, 3), new ItemStack(Material.COBBLESTONE));
|
||||
addRecipe(4, new ItemStack(Material.FLINT, 6), new ItemStack(Material.COBBLESTONE));
|
||||
addRecipe(5, new ItemStack(Material.GLASS), new ItemStack(Material.GLASS_PANE, 3));
|
||||
addRecipe(4, new ItemStack(Material.SNOWBALL, 4), new ItemStack(Material.SNOW_BLOCK));
|
||||
@ -30,19 +30,19 @@ public abstract class ElectricPress extends AContainer implements RecipeDisplayI
|
||||
addRecipe(3, new ItemStack(Material.CLAY_BALL, 4), new ItemStack(Material.CLAY));
|
||||
|
||||
addRecipe(6, SlimefunItems.COPPER_INGOT, new CustomItem(SlimefunItems.COPPER_WIRE, 3));
|
||||
addRecipe(16, new CustomItem(SlimefunItems.STEEL_INGOT, 8), SlimefunItems.STEEL_PLATE);
|
||||
addRecipe(18, new CustomItem(SlimefunItems.REINFORCED_ALLOY_INGOT, 8), SlimefunItems.REINFORCED_PLATE);
|
||||
addRecipe(16, new SlimefunItemStack(SlimefunItems.STEEL_INGOT, 8), SlimefunItems.STEEL_PLATE);
|
||||
addRecipe(18, new SlimefunItemStack(SlimefunItems.REINFORCED_ALLOY_INGOT, 8), SlimefunItems.REINFORCED_PLATE);
|
||||
|
||||
addRecipe(8, new ItemStack(Material.NETHER_WART), new CustomItem(SlimefunItems.MAGIC_LUMP_1, 2));
|
||||
addRecipe(10, new CustomItem(SlimefunItems.MAGIC_LUMP_1, 4), SlimefunItems.MAGIC_LUMP_2);
|
||||
addRecipe(12, new CustomItem(SlimefunItems.MAGIC_LUMP_2, 4), SlimefunItems.MAGIC_LUMP_3);
|
||||
addRecipe(10, new SlimefunItemStack(SlimefunItems.MAGIC_LUMP_1, 4), SlimefunItems.MAGIC_LUMP_2);
|
||||
addRecipe(12, new SlimefunItemStack(SlimefunItems.MAGIC_LUMP_2, 4), SlimefunItems.MAGIC_LUMP_3);
|
||||
|
||||
addRecipe(10, new ItemStack(Material.ENDER_EYE), new CustomItem(SlimefunItems.ENDER_LUMP_1, 2));
|
||||
addRecipe(12, new CustomItem(SlimefunItems.ENDER_LUMP_1, 4), SlimefunItems.ENDER_LUMP_2);
|
||||
addRecipe(14, new CustomItem(SlimefunItems.ENDER_LUMP_2, 4), SlimefunItems.ENDER_LUMP_3);
|
||||
addRecipe(12, new SlimefunItemStack(SlimefunItems.ENDER_LUMP_1, 4), SlimefunItems.ENDER_LUMP_2);
|
||||
addRecipe(14, new SlimefunItemStack(SlimefunItems.ENDER_LUMP_2, 4), SlimefunItems.ENDER_LUMP_3);
|
||||
|
||||
addRecipe(18, new CustomItem(SlimefunItems.TINY_URANIUM, 9), SlimefunItems.SMALL_URANIUM);
|
||||
addRecipe(24, new CustomItem(SlimefunItems.SMALL_URANIUM, 4), SlimefunItems.URANIUM);
|
||||
addRecipe(18, new SlimefunItemStack(SlimefunItems.TINY_URANIUM, 9), SlimefunItems.SMALL_URANIUM);
|
||||
addRecipe(24, new SlimefunItemStack(SlimefunItems.SMALL_URANIUM, 4), SlimefunItems.URANIUM);
|
||||
|
||||
addRecipe(4, new ItemStack(Material.QUARTZ, 4), new ItemStack(Material.QUARTZ_BLOCK));
|
||||
addRecipe(4, new ItemStack(Material.IRON_NUGGET, 9), new ItemStack(Material.IRON_INGOT));
|
||||
|
@ -130,7 +130,7 @@ public class TreeGrowthAccelerator extends SlimefunItem implements InventoryBloc
|
||||
ChargableBlock.addCharge(machine, -ENERGY_CONSUMPTION);
|
||||
|
||||
sapling.setStage(sapling.getStage() + 1);
|
||||
block.setBlockData(sapling);
|
||||
block.setBlockData(sapling, false);
|
||||
|
||||
inv.consumeItem(slot);
|
||||
block.getWorld().spawnParticle(Particle.VILLAGER_HAPPY, block.getLocation().add(0.5D, 0.5D, 0.5D), 4, 0.1F, 0.1F, 0.1F);
|
||||
|
@ -2,6 +2,7 @@ package io.github.thebusybiscuit.slimefun4.implementation.items.electric.reactor
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.ArmorStand;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
@ -44,12 +45,13 @@ public abstract class NetherStarReactor extends Reactor {
|
||||
@Override
|
||||
public void extraTick(Location l) {
|
||||
Slimefun.runSync(() -> {
|
||||
for (Entity entity : ReactorHologram.getArmorStand(l, true).getNearbyEntities(5, 5, 5)) {
|
||||
if (entity instanceof LivingEntity) {
|
||||
ArmorStand hologram = ReactorHologram.getArmorStand(l, true);
|
||||
for (Entity entity : hologram.getNearbyEntities(5, 5, 5)) {
|
||||
if (entity instanceof LivingEntity && entity.isValid()) {
|
||||
((LivingEntity) entity).addPotionEffect(new PotionEffect(PotionEffectType.WITHER, 60, 1));
|
||||
}
|
||||
}
|
||||
}, 0L);
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -26,6 +26,7 @@ import io.github.thebusybiscuit.slimefun4.utils.ChestMenuUtils;
|
||||
import io.github.thebusybiscuit.slimefun4.utils.SlimefunUtils;
|
||||
import io.github.thebusybiscuit.slimefun4.utils.holograms.ReactorHologram;
|
||||
import io.github.thebusybiscuit.slimefun4.utils.holograms.SimpleHologram;
|
||||
import io.github.thebusybiscuit.slimefun4.utils.itemstack.ItemStackWrapper;
|
||||
import me.mrCookieSlime.CSCoreLibPlugin.Configuration.Config;
|
||||
import me.mrCookieSlime.Slimefun.Lists.RecipeType;
|
||||
import me.mrCookieSlime.Slimefun.Objects.Category;
|
||||
@ -401,9 +402,11 @@ public abstract class Reactor extends AbstractEnergyProvider {
|
||||
boolean requiresCoolant = (processing.get(reactor).getTicks() - timeleft) % COOLANT_DURATION == 0;
|
||||
|
||||
if (requiresCoolant) {
|
||||
ItemStack coolant = new ItemStackWrapper(getCoolant());
|
||||
|
||||
if (accessPort != null) {
|
||||
for (int slot : getCoolantSlots()) {
|
||||
if (SlimefunUtils.isItemSimilar(accessPort.getItemInSlot(slot), getCoolant(), true)) {
|
||||
if (SlimefunUtils.isItemSimilar(accessPort.getItemInSlot(slot), coolant, true, false)) {
|
||||
ItemStack remainingItem = menu.pushItem(accessPort.getItemInSlot(slot), getCoolantSlots());
|
||||
accessPort.replaceExistingItem(slot, remainingItem);
|
||||
}
|
||||
@ -411,7 +414,7 @@ public abstract class Reactor extends AbstractEnergyProvider {
|
||||
}
|
||||
|
||||
for (int slot : getCoolantSlots()) {
|
||||
if (SlimefunUtils.isItemSimilar(menu.getItemInSlot(slot), getCoolant(), true)) {
|
||||
if (SlimefunUtils.isItemSimilar(menu.getItemInSlot(slot), coolant, true, false)) {
|
||||
menu.consumeItem(slot);
|
||||
ReactorHologram.update(reactor, "&b\u2744 &7100%");
|
||||
return true;
|
||||
|
@ -40,7 +40,7 @@ public final class SimpleHologram {
|
||||
Location l = new Location(b.getWorld(), b.getX() + 0.5, b.getY() + 0.7F, b.getZ() + 0.5);
|
||||
|
||||
for (Entity n : l.getChunk().getEntities()) {
|
||||
if (n instanceof ArmorStand && l.distanceSquared(n.getLocation()) < 0.4D && n.getCustomName() != null) {
|
||||
if (n instanceof ArmorStand && l.distanceSquared(n.getLocation()) < 0.4D && isPossibleHologram((ArmorStand) n)) {
|
||||
return (ArmorStand) n;
|
||||
}
|
||||
}
|
||||
@ -53,6 +53,10 @@ public final class SimpleHologram {
|
||||
}
|
||||
}
|
||||
|
||||
private static boolean isPossibleHologram(ArmorStand armorstand) {
|
||||
return armorstand.isValid() && armorstand.isSilent() && armorstand.isMarker() && !armorstand.hasGravity() && armorstand.isCustomNameVisible();
|
||||
}
|
||||
|
||||
public static ArmorStand create(Location l) {
|
||||
ArmorStand armorStand = (ArmorStand) l.getWorld().spawnEntity(l, EntityType.ARMOR_STAND);
|
||||
armorStand.setVisible(false);
|
||||
|
@ -25,10 +25,12 @@ public final class ItemStackWrapper extends ItemStack {
|
||||
private static final String ERROR_MESSAGE = "ItemStackWrappers are immutable and not indended for actual usage.";
|
||||
|
||||
private final ItemMeta meta;
|
||||
private final int amount;
|
||||
private final boolean hasItemMeta;
|
||||
|
||||
public ItemStackWrapper(ItemStack item) {
|
||||
super(item.getType());
|
||||
amount = item.getAmount();
|
||||
hasItemMeta = item.hasItemMeta();
|
||||
|
||||
if (hasItemMeta) {
|
||||
@ -60,7 +62,7 @@ public final class ItemStackWrapper extends ItemStack {
|
||||
|
||||
@Override
|
||||
public int getAmount() {
|
||||
return 1;
|
||||
return amount;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -5,6 +5,7 @@ import org.bukkit.entity.Player;
|
||||
import org.junit.jupiter.api.AfterAll;
|
||||
import org.junit.jupiter.api.Assertions;
|
||||
import org.junit.jupiter.api.BeforeAll;
|
||||
import org.junit.jupiter.api.DisplayName;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import be.seeseemelk.mockbukkit.MockBukkit;
|
||||
@ -14,7 +15,7 @@ import io.github.thebusybiscuit.slimefun4.core.researching.Research;
|
||||
import io.github.thebusybiscuit.slimefun4.implementation.SlimefunPlugin;
|
||||
import io.github.thebusybiscuit.slimefun4.testing.TestUtilities;
|
||||
|
||||
public class TestResearchCommand {
|
||||
class TestResearchCommand {
|
||||
|
||||
private static ServerMock server;
|
||||
|
||||
@ -39,7 +40,8 @@ public class TestResearchCommand {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testResearchAll() throws InterruptedException {
|
||||
@DisplayName("Test /sf research all")
|
||||
void testResearchAll() throws InterruptedException {
|
||||
SlimefunPlugin.getRegistry().setResearchingEnabled(true);
|
||||
Player player = server.addPlayer();
|
||||
PlayerProfile profile = TestUtilities.awaitProfile(player);
|
||||
@ -51,7 +53,8 @@ public class TestResearchCommand {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testResearchSpecific() throws InterruptedException {
|
||||
@DisplayName("Test /sf research <research id>")
|
||||
void testResearchSpecific() throws InterruptedException {
|
||||
SlimefunPlugin.getRegistry().setResearchingEnabled(true);
|
||||
Player player = server.addPlayer();
|
||||
PlayerProfile profile = TestUtilities.awaitProfile(player);
|
||||
@ -63,7 +66,8 @@ public class TestResearchCommand {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testResearchReset() throws InterruptedException {
|
||||
@DisplayName("Test /sf research reset")
|
||||
void testResearchReset() throws InterruptedException {
|
||||
SlimefunPlugin.getRegistry().setResearchingEnabled(true);
|
||||
Player player = server.addPlayer();
|
||||
PlayerProfile profile = TestUtilities.awaitProfile(player);
|
||||
|
@ -8,6 +8,7 @@ import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.junit.jupiter.api.AfterAll;
|
||||
import org.junit.jupiter.api.BeforeAll;
|
||||
import org.junit.jupiter.api.DisplayName;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.mockito.Mockito;
|
||||
|
||||
@ -22,7 +23,7 @@ import io.github.thebusybiscuit.slimefun4.testing.TestUtilities;
|
||||
import me.mrCookieSlime.Slimefun.Objects.Category;
|
||||
import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.SlimefunItem;
|
||||
|
||||
public class TestGuideOpening {
|
||||
class TestGuideOpening {
|
||||
|
||||
private static ServerMock server;
|
||||
private static SlimefunPlugin plugin;
|
||||
@ -48,14 +49,16 @@ public class TestGuideOpening {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testOpenMainMenu() throws InterruptedException {
|
||||
@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);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testOpenCategory() throws InterruptedException {
|
||||
@DisplayName("Test if a Category can be opened from the History")
|
||||
void testOpenCategory() throws InterruptedException {
|
||||
Category category = new Category(new NamespacedKey(plugin, "history_category"), new CustomItem(Material.BLUE_TERRACOTTA, "&9Testy test"));
|
||||
|
||||
SlimefunGuideImplementation guide = Mockito.mock(SlimefunGuideImplementation.class);
|
||||
@ -64,7 +67,8 @@ public class TestGuideOpening {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testOpenSlimefunItem() throws InterruptedException {
|
||||
@DisplayName("Test if a SlimefunItem can be viewed from the History")
|
||||
void testOpenSlimefunItem() throws InterruptedException {
|
||||
SlimefunItem item = TestUtilities.mockSlimefunItem(plugin, "OPEN_SLIMEFUN_ITEM", new CustomItem(Material.PRISMARINE_SHARD, "&5Some Shard I guess"));
|
||||
|
||||
SlimefunGuideImplementation guide = Mockito.mock(SlimefunGuideImplementation.class);
|
||||
@ -73,7 +77,8 @@ public class TestGuideOpening {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testOpenItemStack() throws InterruptedException {
|
||||
@DisplayName("Test if an ItemStack can be viewed from the History")
|
||||
void testOpenItemStack() throws InterruptedException {
|
||||
ItemStack item = new ItemStack(Material.REDSTONE_BLOCK);
|
||||
|
||||
SlimefunGuideImplementation guide = Mockito.mock(SlimefunGuideImplementation.class);
|
||||
@ -82,7 +87,8 @@ public class TestGuideOpening {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testOpenSearch() throws InterruptedException {
|
||||
@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);
|
||||
@ -91,7 +97,8 @@ public class TestGuideOpening {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGoBack() throws InterruptedException {
|
||||
@DisplayName("Test if the Back button works")
|
||||
void testGoBack() throws InterruptedException {
|
||||
Player player = server.addPlayer();
|
||||
|
||||
String query = "electric";
|
||||
|
@ -10,6 +10,7 @@ import org.bukkit.configuration.file.YamlConfiguration;
|
||||
import org.junit.jupiter.api.AfterAll;
|
||||
import org.junit.jupiter.api.Assertions;
|
||||
import org.junit.jupiter.api.BeforeAll;
|
||||
import org.junit.jupiter.api.DisplayName;
|
||||
import org.junit.jupiter.api.MethodOrderer.OrderAnnotation;
|
||||
import org.junit.jupiter.api.Order;
|
||||
import org.junit.jupiter.api.Test;
|
||||
@ -24,7 +25,7 @@ import io.github.thebusybiscuit.slimefun4.testing.TestUtilities;
|
||||
import me.mrCookieSlime.Slimefun.Objects.Category;
|
||||
|
||||
@TestMethodOrder(value = OrderAnnotation.class)
|
||||
public class TestItemSetup {
|
||||
class TestItemSetup {
|
||||
|
||||
private static SlimefunPlugin plugin;
|
||||
|
||||
@ -42,7 +43,8 @@ public class TestItemSetup {
|
||||
|
||||
@Test
|
||||
@Order(value = 1)
|
||||
public void testForExceptions() {
|
||||
@DisplayName("Test whether SlimefunItemSetup.setup() throws any Exceptions")
|
||||
void testForExceptions() {
|
||||
// Not really ideal but still important to test.
|
||||
// Item amount is variable, so we can't test for that.
|
||||
// We are really only concerned about any runtime exceptions here.
|
||||
@ -54,13 +56,15 @@ public class TestItemSetup {
|
||||
|
||||
@Test
|
||||
@Order(value = 2)
|
||||
public void testWikiSetup() {
|
||||
@DisplayName("Test whether PostSetup.setupWiki() throws any Exceptions")
|
||||
void testWikiSetup() {
|
||||
Assertions.assertDoesNotThrow(() -> PostSetup.setupWiki());
|
||||
}
|
||||
|
||||
@Test
|
||||
@Order(value = 3)
|
||||
public void testCategoryTranslations() throws IOException {
|
||||
@DisplayName("Test whether every Category is added to the translation files")
|
||||
void testCategoryTranslations() throws IOException {
|
||||
try (BufferedReader reader = new BufferedReader(new InputStreamReader(getClass().getResourceAsStream("/languages/categories_en.yml"), StandardCharsets.UTF_8))) {
|
||||
FileConfiguration config = YamlConfiguration.loadConfiguration(reader);
|
||||
|
||||
|
@ -4,6 +4,7 @@ import org.bukkit.entity.Player;
|
||||
import org.junit.jupiter.api.AfterAll;
|
||||
import org.junit.jupiter.api.Assertions;
|
||||
import org.junit.jupiter.api.BeforeAll;
|
||||
import org.junit.jupiter.api.DisplayName;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import be.seeseemelk.mockbukkit.MockBukkit;
|
||||
@ -14,7 +15,7 @@ import io.github.thebusybiscuit.slimefun4.implementation.SlimefunPlugin;
|
||||
import io.github.thebusybiscuit.slimefun4.implementation.listeners.DeathpointListener;
|
||||
import io.github.thebusybiscuit.slimefun4.testing.TestUtilities;
|
||||
|
||||
public class TestDeathpointListener {
|
||||
class TestDeathpointListener {
|
||||
|
||||
private static SlimefunPlugin plugin;
|
||||
private static ServerMock server;
|
||||
@ -32,7 +33,8 @@ public class TestDeathpointListener {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testNoTransmitter() throws InterruptedException {
|
||||
@DisplayName("Test Deathpoint not triggering when no Emergency Transmitter is found")
|
||||
void testNoTransmitter() throws InterruptedException {
|
||||
Player player = server.addPlayer();
|
||||
TestUtilities.awaitProfile(player);
|
||||
|
||||
@ -41,7 +43,8 @@ public class TestDeathpointListener {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testTransmitter() throws InterruptedException {
|
||||
@DisplayName("Test Emergency Transmitter creating a new Waypoint")
|
||||
void testTransmitter() throws InterruptedException {
|
||||
Player player = server.addPlayer();
|
||||
TestUtilities.awaitProfile(player);
|
||||
player.getInventory().setItem(8, SlimefunItems.GPS_EMERGENCY_TRANSMITTER.clone());
|
||||
|
@ -10,6 +10,7 @@ import org.bukkit.inventory.EquipmentSlot;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.junit.jupiter.api.AfterAll;
|
||||
import org.junit.jupiter.api.BeforeAll;
|
||||
import org.junit.jupiter.api.DisplayName;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.mockito.Mockito;
|
||||
|
||||
@ -20,7 +21,7 @@ import io.github.thebusybiscuit.slimefun4.core.networks.NetworkManager;
|
||||
import io.github.thebusybiscuit.slimefun4.implementation.SlimefunPlugin;
|
||||
import io.github.thebusybiscuit.slimefun4.implementation.listeners.NetworkListener;
|
||||
|
||||
public class TestNetworkListener {
|
||||
class TestNetworkListener {
|
||||
|
||||
private static SlimefunPlugin plugin;
|
||||
private static NetworkListener listener;
|
||||
@ -40,7 +41,8 @@ public class TestNetworkListener {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testBlockBreak() {
|
||||
@DisplayName("Test Network updates on Block breaking")
|
||||
void testBlockBreak() {
|
||||
World world = server.addSimpleWorld("Simple Network Listener World");
|
||||
Location l = new Location(world, 3000, 120, -500);
|
||||
|
||||
@ -53,7 +55,8 @@ public class TestNetworkListener {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testBlockPlace() {
|
||||
@DisplayName("Test Network updates on Block placing")
|
||||
void testBlockPlace() {
|
||||
World world = server.addSimpleWorld("Simple Network Listener World");
|
||||
Location l = new Location(world, 3000, 120, -500);
|
||||
Location l2 = new Location(world, 3000, 121, -500);
|
||||
|
@ -15,6 +15,7 @@ import org.bukkit.inventory.ShapelessRecipe;
|
||||
import org.junit.jupiter.api.AfterAll;
|
||||
import org.junit.jupiter.api.Assertions;
|
||||
import org.junit.jupiter.api.BeforeAll;
|
||||
import org.junit.jupiter.api.DisplayName;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import be.seeseemelk.mockbukkit.MockBukkit;
|
||||
@ -23,7 +24,7 @@ import io.github.thebusybiscuit.cscorelib2.recipes.RecipeSnapshot;
|
||||
import io.github.thebusybiscuit.slimefun4.core.services.MinecraftRecipeService;
|
||||
import io.github.thebusybiscuit.slimefun4.implementation.SlimefunPlugin;
|
||||
|
||||
public class TestRecipeService {
|
||||
class TestRecipeService {
|
||||
|
||||
private static ServerMock server;
|
||||
private static SlimefunPlugin plugin;
|
||||
@ -40,7 +41,8 @@ public class TestRecipeService {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testRecipe() {
|
||||
@DisplayName("Test getting a Minecraft Recipe for an ItemStack result")
|
||||
void testRecipe() {
|
||||
MinecraftRecipeService service = new MinecraftRecipeService(plugin);
|
||||
|
||||
NamespacedKey key = new NamespacedKey(plugin, "furnace_recipe_test");
|
||||
@ -59,7 +61,8 @@ public class TestRecipeService {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testNoRecipes() {
|
||||
@DisplayName("Test getting no Minecraft Recipes for uncraftable items or null")
|
||||
void testNoRecipes() {
|
||||
MinecraftRecipeService service = new MinecraftRecipeService(plugin);
|
||||
service.refresh();
|
||||
|
||||
@ -68,7 +71,8 @@ public class TestRecipeService {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testFurnaceOutput() {
|
||||
@DisplayName("Test if furnace recipes are handled correctly")
|
||||
void testFurnaceOutput() {
|
||||
MinecraftRecipeService service = new MinecraftRecipeService(plugin);
|
||||
|
||||
NamespacedKey key = new NamespacedKey(plugin, "furnace_recipe_test2");
|
||||
@ -95,7 +99,8 @@ public class TestRecipeService {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testBigShapedRecipe() {
|
||||
@DisplayName("Test Shaped Recipes on a 3x3 grid")
|
||||
void testBigShapedRecipe() {
|
||||
MinecraftRecipeService service = new MinecraftRecipeService(plugin);
|
||||
|
||||
NamespacedKey key = new NamespacedKey(plugin, "shaped_recipe_9");
|
||||
@ -112,7 +117,8 @@ public class TestRecipeService {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSmallShapedRecipe() {
|
||||
@DisplayName("Test Shaped Recipes on a 2x2 grid")
|
||||
void testSmallShapedRecipe() {
|
||||
MinecraftRecipeService service = new MinecraftRecipeService(plugin);
|
||||
|
||||
NamespacedKey key = new NamespacedKey(plugin, "shaped_recipe_4");
|
||||
@ -129,7 +135,8 @@ public class TestRecipeService {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testShapelessRecipeShape() {
|
||||
@DisplayName("Test shapeless Recipes")
|
||||
void testShapelessRecipeShape() {
|
||||
MinecraftRecipeService service = new MinecraftRecipeService(plugin);
|
||||
|
||||
Assertions.assertThrows(IllegalArgumentException.class, () -> service.getRecipeShape(null));
|
||||
@ -146,7 +153,8 @@ public class TestRecipeService {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSubscriptions() {
|
||||
@DisplayName("Test the Recipe Subscription Service")
|
||||
void testSubscriptions() {
|
||||
MinecraftRecipeService service = new MinecraftRecipeService(plugin);
|
||||
AtomicReference<RecipeSnapshot> reference = new AtomicReference<>();
|
||||
|
||||
|
@ -5,6 +5,7 @@ import java.io.File;
|
||||
import org.junit.jupiter.api.AfterAll;
|
||||
import org.junit.jupiter.api.Assertions;
|
||||
import org.junit.jupiter.api.BeforeAll;
|
||||
import org.junit.jupiter.api.DisplayName;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import be.seeseemelk.mockbukkit.MockBukkit;
|
||||
@ -12,7 +13,7 @@ import io.github.thebusybiscuit.slimefun4.api.SlimefunBranch;
|
||||
import io.github.thebusybiscuit.slimefun4.core.services.UpdaterService;
|
||||
import io.github.thebusybiscuit.slimefun4.implementation.SlimefunPlugin;
|
||||
|
||||
public class TestUpdaterService {
|
||||
class TestUpdaterService {
|
||||
|
||||
private static SlimefunPlugin plugin;
|
||||
|
||||
@ -30,7 +31,8 @@ public class TestUpdaterService {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testDevelopmentBuilds() {
|
||||
@DisplayName("Test if the development branch is recognized correctly")
|
||||
void testDevelopmentBuilds() {
|
||||
UpdaterService service = new UpdaterService(plugin, "DEV - 131 (git 123456)", file);
|
||||
Assertions.assertEquals(SlimefunBranch.DEVELOPMENT, service.getBranch());
|
||||
Assertions.assertTrue(service.getBranch().isOfficial());
|
||||
@ -39,7 +41,8 @@ public class TestUpdaterService {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testStableBuilds() {
|
||||
@DisplayName("Test if the stable branch is recognized correctly")
|
||||
void testStableBuilds() {
|
||||
UpdaterService service = new UpdaterService(plugin, "RC - 6 (git 123456)", file);
|
||||
Assertions.assertEquals(SlimefunBranch.STABLE, service.getBranch());
|
||||
Assertions.assertTrue(service.getBranch().isOfficial());
|
||||
@ -48,7 +51,8 @@ public class TestUpdaterService {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testUnofficialBuilds() {
|
||||
@DisplayName("Test if an unofficial build is recognized correctly")
|
||||
void testUnofficialBuilds() {
|
||||
UpdaterService service = new UpdaterService(plugin, "4.20 UNOFFICIAL", file);
|
||||
Assertions.assertEquals(SlimefunBranch.UNOFFICIAL, service.getBranch());
|
||||
Assertions.assertFalse(service.getBranch().isOfficial());
|
||||
@ -56,7 +60,8 @@ public class TestUpdaterService {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testUnknownBuilds() {
|
||||
@DisplayName("Test if unknown builds are caught")
|
||||
void testUnknownBuilds() {
|
||||
UpdaterService service = new UpdaterService(plugin, "I am special", file);
|
||||
Assertions.assertEquals(SlimefunBranch.UNKNOWN, service.getBranch());
|
||||
Assertions.assertFalse(service.getBranch().isOfficial());
|
||||
|
Loading…
Reference in New Issue
Block a user