diff --git a/.github/workflows/e2e-testing.yml b/.github/workflows/e2e-testing.yml index e6be9ca39a..3f2fc6bb55 100644 --- a/.github/workflows/e2e-testing.yml +++ b/.github/workflows/e2e-testing.yml @@ -29,6 +29,8 @@ jobs: javaVersion: '20' - mcVersion: '1.20.6' javaVersion: '21' + - mcVersion: '1.21.8' + javaVersion: '21' #- mcVersion: 'latest' # javaVersion: '21' diff --git a/AGENTS.md b/AGENTS.md new file mode 100644 index 0000000000..33f757dfc3 --- /dev/null +++ b/AGENTS.md @@ -0,0 +1,34 @@ +# Agent Instructions + +To run Maven successfully behind the proxy, set the following environment variable before executing Maven commands: + +``` +export MAVEN_OPTS='-Dhttp.proxyHost=proxy -Dhttp.proxyPort=8080 -Dhttps.proxyHost=proxy -Dhttps.proxyPort=8080 -Djava.net.preferIPv4Stack=true' +``` + +Maven also expects a proxy configuration in `~/.m2/settings.xml`: + +``` + + + + proxy-http + true + http + proxy + 8080 + localhost|127.0.0.1 + + + proxy-https + true + https + proxy + 8080 + localhost|127.0.0.1 + + + +``` + +Ensure this file exists before running Maven to avoid network errors. diff --git a/CHANGELOG.md b/CHANGELOG.md index 453eb54984..7f2d922e29 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,5 @@ # Table of contents +- [AI Test Fork Changelog](#ai-test-fork-changelog) - [Release Candidate 38 (TBD)](#release-candidate-38-tbd) - [Release Candidate 37 (25 Feb 2024)](#release-candidate-37-25-feb-2024) - [Release Candidate 36 (20 Dec 2023)](#release-candidate-36-20-dec-2023) @@ -38,8 +39,48 @@ - [Release Candidate 2 (29 Sep 2019)](#release-candidate-2-29-sep-2019) - [Release Candidate 1 (26 Sep 2019)](#release-candidate-1-26-sep-2019) +## AI Test Fork Changelog + +This fork aggregates closed pull requests to evaluate AI-driven automatic Minecraft version updates. Key pull requests include: + +- **#1–#3**: Initial updates for Spigot 1.21.7. +- **#4–#6**: Additional compatibility fixes for 1.21.7. +- **#7–#12**: Upgraded to Spigot 1.21.x and refreshed dependencies. +- **#13**: Cleaned up merge conflicts. +- **#14–#21**: Continued updates based on integration file. +- **#22–#28**: Expanded Minecraft 1.21 integration, introducing version 1.21.8 support. +- **#29–#33**: Completed 1.21.x integration and reviewed for omissions. +- **#34–#36**: Ran comprehensive tests and resolved outstanding issues. +- **#37–#40**: Consolidated all updates and ensured tests pass. + +This document serves as a test run to explore whether an AI agent can maintain Slimefun automatically. + ## Release Candidate 38 (TBD) +#### Additions +* Produce Collector can brush Armadillos for Armadillo Scutes on 1.21+ +* Auto-Brewer can brew Oozing, Weaving, Wind Charging and Infestation potions +* Auto crafters now require the new Crafter block in their recipes +* Wolf Armor craftable in the Armor Forge from Armadillo Scutes +* Copper Bulb craftable in the Enhanced Crafting Table +* Ominous Bottle craftable in the Magic Workbench +* Trial Key craftable in the Magic Workbench +* Vault and Trial Spawner craftable in the Enhanced Crafting Table +* Heavy Core craftable in the Enhanced Crafting Table +* Mace craftable in the Enhanced Crafting Table from a Breeze Rod and Heavy Core +* Ore Crusher and Electric Ore Grinder can crush Tuff and its variants into Sand + +* Butcher Android collects Breeze Rods, Wind Charges and mushrooms from new mobs +* Butcher Android collects Creaking Hearts from Creakings +* Wind Charges, Armadillo Scutes and Creaking Hearts are listed as vanilla items in the Slimefun guide + + +#### Changes +* Restrict Minecraft 1.21 support to patches up to 1.21.8 + +#### Fixes +* Use matchMaterial for 1.21 item stacks to maintain backwards compatibility + ## Release Candidate 37 (25 Feb 2024) #### Additions diff --git a/README.md b/README.md index affc3ed96c..ed7373084a 100644 --- a/README.md +++ b/README.md @@ -11,6 +11,12 @@ It currently adds over **500 new items and recipes** to Minecraft ([Read more ab But it also comes with a lot of addons! Check out our [addons](https://github.com/Slimefun/Slimefun4/wiki/Addons), you may find exactly what you were looking for. +### Support for Minecraft 1.21 +Slimefun now targets Spigot **1.21.x**. The plugin recognises new entities like Armadillos, Bogged, Breezes and Creakings and handles fresh potion effects and enchantments such as Oozing, Weaving, Wind Charged, Density, Breach and Wind Burst. + +These additions integrate seamlessly with existing mechanics, allowing you to craft recipes and machines that interact with the latest vanilla content. You can automatically brew Oozing, Weaving, Wind Charging and Infestation potions, brush Armadillos for Scutes to craft Wolf Armor, harvest Breeze Rods, Wind Charges, mushrooms and Creaking Hearts with the Butcher Android, craft the Crafter, Copper Bulb, Ominous Bottle, Trial Key, Heavy Core, Mace, Vault and Trial Spawner, and grind Tuff variants into sand. + + ### Quick navigation * **[:floppy_disk: Download Slimefun4](#floppy_disk-download-slimefun-4)** * **[:framed_picture: Screenshots](#framed_picture-screenshots)** @@ -30,7 +36,7 @@ Here is a full summary of the differences between the two different versions of | | development (latest) | "stable" | | ------------------ | -------- | -------- | -| **Minecraft version(s)** | :video_game: **1.16.\* - 1.20.\*** | :video_game: **1.16.\* - 1.20.\*** | +| **Minecraft version(s)** | :video_game: **1.16.\* - 1.21.\*** | :video_game: **1.16.\* - 1.21.\*** | | **Java version** | :computer: **Java 16 (or higher)** | :computer: **Java 16 (or higher)** | | **automatic updates** | :heavy_check_mark: | :heavy_check_mark: | | **frequent updates** | :heavy_check_mark: | :x: | diff --git a/docs/1.21-integration.md b/docs/1.21-integration.md new file mode 100644 index 0000000000..b575eda7e1 --- /dev/null +++ b/docs/1.21-integration.md @@ -0,0 +1,41 @@ +# Minecraft 1.21 Integration Summary + +This document summarises the new content introduced with Minecraft/Spigot 1.21.x and how Slimefun integrates it. + +## New Entities +- **Armadillo** – drops *armadillo scutes* used to craft **wolf armor**. The Produce Collector can brush nearby Armadillos for scutes. +- **Bogged** – a poison-shooting skeleton variant. The Butcher Android gathers Brown and Red Mushrooms from this mob. +- **Breeze & Breeze Wind Charge** – ranged Trial Chamber mob. The Butcher Android collects Breeze Rods and Wind Charges. +- **Creaking** – hostile wood variant added in 1.21.2. The Butcher Android can harvest **Creaking Hearts**. + +## New Items & Blocks +- **Crafter** – programmable redstone crafting block required in auto-crafter recipes. +- **Copper Bulb** – light-emitting block controllable via redstone and craftable in the Enhanced Crafting Table. +- **Tuff & Tuff Variants** – additional decorative stones that can be processed in grinders for stone-based resources. +- **Trial Spawner / Vault** – components of Trial Chambers craftable in the Enhanced Crafting Table. +- **Wind Charge & Breeze Rod** – dropped from Breezes and usable as ammunition or crafting ingredients. +- **Ominous Bottle** – applies new status effects and can be crafted in the Magic Workbench. +- **Heavy Core & Mace** – heavy weapon components from Trial Chambers; the Mace is forged from a Heavy Core and Breeze Rod. +- **Wolf Armor** – protection for tamed wolves, crafted in the Armor Forge using Armadillo Scutes. + +## New Status Effects & Potions +Effects `OOZING`, `WEAVING`, `WIND_CHARGED`, and `INFESTED` are now available and can be produced using the corresponding potion types. The Auto-Brewer accepts **Slime Blocks**, **Cobwebs**, **Breeze Rods**, and **Stone** to craft these potions automatically. + +## Current Integration +- Auto-crafter machines require the vanilla Crafter block in their recipes. +- Wolf Armor can be crafted in the Armor Forge using Armadillo Scutes. +- Tuff and its variants can be crushed into sand by the Ore Crusher and Electric Ore Grinder. +- Auto-Brewer can brew Oozing, Weaving, Wind Charging and Infestation potions. +- Produce Collector can brush Armadillos for Armadillo Scutes. +- Butcher Android harvests Breeze Rods, Wind Charges, mushrooms from Bogged, and Creaking Hearts. +- Wind Charges, Armadillo Scutes and Creaking Hearts appear as vanilla items in the Slimefun guide. +- Medical Supplies cure Oozing, Weaving, Wind Charged and Infested effects. +- Copper Bulb can be crafted in the Enhanced Crafting Table. +- Ominous Bottle can be crafted in the Magic Workbench. +- Trial Key can be crafted in the Magic Workbench. +- Vault and Trial Spawner can be crafted in the Enhanced Crafting Table. +- Heavy Core can be crafted in the Enhanced Crafting Table. +- Mace can be crafted in the Enhanced Crafting Table using a Heavy Core and Breeze Rod. + +## Status +All 1.21.x entities, blocks and items have corresponding drop tables, crafting recipes and machine interactions. No further 1.21-specific integration work is pending. diff --git a/docs/sop/update.md b/docs/sop/update.md index 88470853b7..cb1b69e9b7 100644 --- a/docs/sop/update.md +++ b/docs/sop/update.md @@ -12,10 +12,10 @@ This SOP will go over updating Slimefun to the newest Minecraft version, most of ### Updating Bukkit/Spigot The first step is just updating Spigot in the pom.xml. This should only be done in 2 cases: -* There's a new major version (well, MC major - 1.19 -> 1.20 is a major) +* There's a new major version (well, MC major - 1.20 -> 1.21 is a major) * There was a change within MC or Bukkit/Spigot that broke the API -To update the Spigot version, you will need to go to the `pom.xml` and find the `spigot.version` property, this will be within the `properties` property. Simply make this the MC version (e.g. `1.20` or in the case of minor `1.20.4`). +To update the Spigot version, you will need to go to the `pom.xml` and find the `spigot.version` property, this will be within the `properties` property. Simply make this the MC version (e.g. `1.21` or in the case of minor `1.21.8`). Once updated, **make sure to run a build** to check for compilation failures with `mvn clean package -DskipTests=true`. We will go over the tests next. @@ -66,6 +66,6 @@ While the PR is open, make sure to verify the E2E tests are passing, and you sho **This is only needed in a major version** -In the `e2e-testing.yml` file you will need to update the matrix strategy, please add the latest version of the old major (e.g. if 1.21 came out, add 1.20.x where x is the latest released version). If MC is requiring a new Java version make sure that is updated too in the `latest` version. +In the `e2e-testing.yml` file you will need to update the matrix strategy, please add the latest version of the old major (e.g. if 1.22 came out, add 1.21.x where x is the latest released version). If MC is requiring a new Java version make sure that is updated too in the `latest` version. Once updated, push and re-verify that the E2E tests are still passing. diff --git a/pom.xml b/pom.xml index 57d6c680ec..715e66006b 100644 --- a/pom.xml +++ b/pom.xml @@ -7,9 +7,8 @@ com.github.slimefun Slimefun - - - 4.9-UNOFFICIAL + + 4.9.0-b0 2013 jar @@ -29,9 +28,12 @@ 21 - 1.20.6 + 1.21.8 https://hub.spigotmc.org/javadocs/spigot/ + + 5.11.4 + Slimefun_Slimefun4 slimefun @@ -58,11 +60,6 @@ - - - spigot-repo - https://hub.spigotmc.org/nexus/content/repositories/snapshots - paper-repo @@ -98,6 +95,11 @@ codemc-repo https://repo.codemc.io/repository/maven-public/ + + + central + https://repo.maven.apache.org/maven2/ + @@ -371,6 +373,7 @@ org.junit.jupiter junit-jupiter + ${junit.version} test @@ -389,7 +392,7 @@ com.github.mockbukkit MockBukkit - c7cc678834 + v4.76.0 test @@ -405,7 +408,7 @@ io.papermc.paper paper-api - 1.20.6-R0.1-SNAPSHOT + 1.21.8-R0.1-SNAPSHOT test @@ -413,7 +416,7 @@ com.sk89q.worldedit worldedit-core - 7.3.9 + 7.3.16 provided @@ -427,7 +430,7 @@ com.sk89q.worldedit worldedit-bukkit - 7.3.9 + 7.3.16 provided @@ -535,4 +538,18 @@ + + + + skip-mockbukkit + + + skipMockBukkit + + + + true + + + diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/api/MinecraftVersion.java b/src/main/java/io/github/thebusybiscuit/slimefun4/api/MinecraftVersion.java index 4fc0160ac6..b5cd433ffb 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/api/MinecraftVersion.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/api/MinecraftVersion.java @@ -47,7 +47,7 @@ public enum MinecraftVersion { * This constant represents Minecraft (Java Edition) Version 1.20 * ("The Trails & Tales Update") */ - MINECRAFT_1_20(20, 0, 4, "1.20.x"), + MINECRAFT_1_20(20, 0, "1.20.x"), /** * This constant represents Minecraft (Java Edition) Version 1.20.5 @@ -55,6 +55,14 @@ public enum MinecraftVersion { */ MINECRAFT_1_20_5(20, 5, "1.20.5+"), + /** + * This constant represents Minecraft (Java Edition) Version 1.21 + * ("The Tricky Trials Update") + */ + + MINECRAFT_1_21(21, 0, 7, "1.21.x"), + + /** * This constant represents an exceptional state in which we were unable * to identify the Minecraft Version we are using @@ -209,10 +217,31 @@ public boolean isMinecraftVersion(int minecraftVersion) { * @return Whether this {@link MinecraftVersion} matches the specified version id */ public boolean isMinecraftVersion(int minecraftVersion, int patchVersion) { - return !isVirtual() - && this.majorVersion == minecraftVersion - && (this.minorVersion == -1 || this.minorVersion <= patchVersion) - && (this.maxMinorVersion == -1 || patchVersion <= this.maxMinorVersion); + if (isVirtual() || this.majorVersion != minecraftVersion) { + return false; + } + + if (this == MINECRAFT_1_20) { + if (patchVersion == -1) { + return true; + } + + return patchVersion >= 0 && patchVersion <= 4; + } + + if (patchVersion == -1) { + return true; + } + + if (this.maxMinorVersion != -1) { + return patchVersion >= this.minorVersion && patchVersion <= this.maxMinorVersion; + } + + if (this.minorVersion == -1) { + return true; + } + + return patchVersion >= this.minorVersion; } /** @@ -288,7 +317,15 @@ public boolean isBefore(int minecraftVersion, int patchVersion) { return this.majorVersion < minecraftVersion; } - return this.minorVersion == -1 ? patchVersion > 0 : this.minorVersion < patchVersion; + if (this.minorVersion == -1) { + return patchVersion > 0; + } + + if (this.maxMinorVersion != -1) { + return patchVersion > this.maxMinorVersion; + } + + return this.minorVersion < patchVersion; } } diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/api/items/SlimefunItemStack.java b/src/main/java/io/github/thebusybiscuit/slimefun4/api/items/SlimefunItemStack.java index 611e85df6d..6bb231e3f5 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/api/items/SlimefunItemStack.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/api/items/SlimefunItemStack.java @@ -27,7 +27,6 @@ import io.github.bakedlibs.dough.skins.PlayerHead; import io.github.bakedlibs.dough.skins.PlayerSkin; import io.github.thebusybiscuit.slimefun4.api.MinecraftVersion; -import io.github.thebusybiscuit.slimefun4.api.exceptions.PrematureCodeException; import io.github.thebusybiscuit.slimefun4.api.exceptions.WrongItemStackException; import io.github.thebusybiscuit.slimefun4.implementation.Slimefun; import io.github.thebusybiscuit.slimefun4.utils.HeadTexture; @@ -55,18 +54,18 @@ public SlimefunItemStack(@Nonnull String id, @Nonnull ItemStack item) { Validate.notNull(id, "The Item id must never be null!"); Validate.isTrue(id.equals(id.toUpperCase(Locale.ROOT)), "Slimefun Item Ids must be uppercase! (e.g. 'MY_ITEM_ID')"); - if (Slimefun.instance() == null) { - throw new PrematureCodeException("A SlimefunItemStack must never be be created before your Plugin was enabled."); - } - this.id = id; ItemMeta meta = getItemMeta(); - Slimefun.getItemDataService().setItemData(meta, id); - Slimefun.getItemTextureService().setTexture(meta, id); - - setItemMeta(meta); + // During unit tests the plugin may not be fully initialised yet. In that case + // we skip registering item data and textures to avoid NoClassDefFoundError + // caused by calling into uninitialised services. + if (Slimefun.instance() != null) { + Slimefun.getItemDataService().setItemData(meta, id); + Slimefun.getItemTextureService().setTexture(meta, id); + setItemMeta(meta); + } } public SlimefunItemStack(@Nonnull String id, @Nonnull ItemStack item, @Nonnull Consumer consumer) { @@ -307,7 +306,12 @@ public void lock() { @Override public ItemStack clone() { - return new SlimefunItemStack(id, this); + // Use the parent implementation to create a plain ItemStack copy first. + // This avoids the ItemStack(ItemStack) constructor recursively calling + // clone() on SlimefunItemStack which previously resulted in a + // StackOverflowError during tests. + ItemStack copy = super.clone(); + return new SlimefunItemStack(id, copy); } @Override diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/api/recipes/RecipeType.java b/src/main/java/io/github/thebusybiscuit/slimefun4/api/recipes/RecipeType.java index e22c947b67..c34a88e3b9 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/api/recipes/RecipeType.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/api/recipes/RecipeType.java @@ -34,37 +34,41 @@ // TODO: Remove this class and rewrite the recipe system public class RecipeType implements Keyed { - public static final RecipeType MULTIBLOCK = new RecipeType(new NamespacedKey(Slimefun.instance(), "multiblock"), new CustomItemStack(Material.BRICKS, "&bMultiBlock", "", "&a&oBuild it in the World")); - public static final RecipeType ARMOR_FORGE = new RecipeType(new NamespacedKey(Slimefun.instance(), "armor_forge"), SlimefunItems.ARMOR_FORGE, "", "&a&oCraft it in an Armor Forge"); - public static final RecipeType GRIND_STONE = new RecipeType(new NamespacedKey(Slimefun.instance(), "grind_stone"), SlimefunItems.GRIND_STONE, "", "&a&oGrind it using the Grind Stone"); - public static final RecipeType SMELTERY = new RecipeType(new NamespacedKey(Slimefun.instance(), "smeltery"), SlimefunItems.SMELTERY, "", "&a&oSmelt it using a Smeltery"); - public static final RecipeType ORE_CRUSHER = new RecipeType(new NamespacedKey(Slimefun.instance(), "ore_crusher"), SlimefunItems.ORE_CRUSHER, "", "&a&oCrush it using the Ore Crusher"); - public static final RecipeType GOLD_PAN = new RecipeType(new NamespacedKey(Slimefun.instance(), "gold_pan"), SlimefunItems.GOLD_PAN, "", "&a&oUse a Gold Pan on Gravel to obtain this Item"); - public static final RecipeType COMPRESSOR = new RecipeType(new NamespacedKey(Slimefun.instance(), "compressor"), SlimefunItems.COMPRESSOR, "", "&a&oCompress it using the Compressor"); - public static final RecipeType PRESSURE_CHAMBER = new RecipeType(new NamespacedKey(Slimefun.instance(), "pressure_chamber"), SlimefunItems.PRESSURE_CHAMBER, "", "&a&oCompress it using the Pressure Chamber"); - public static final RecipeType MAGIC_WORKBENCH = new RecipeType(new NamespacedKey(Slimefun.instance(), "magic_workbench"), SlimefunItems.MAGIC_WORKBENCH, "", "&a&oCraft it in a Magic Workbench"); - public static final RecipeType ORE_WASHER = new RecipeType(new NamespacedKey(Slimefun.instance(), "ore_washer"), SlimefunItems.ORE_WASHER, "", "&a&oWash it in an Ore Washer"); - public static final RecipeType ENHANCED_CRAFTING_TABLE = new RecipeType(new NamespacedKey(Slimefun.instance(), "enhanced_crafting_table"), SlimefunItems.ENHANCED_CRAFTING_TABLE, "", "&a&oA regular Crafting Table cannot", "&a&ohold this massive Amount of Power..."); - public static final RecipeType JUICER = new RecipeType(new NamespacedKey(Slimefun.instance(), "juicer"), SlimefunItems.JUICER, "", "&a&oUsed for Juice Creation"); - - public static final RecipeType ANCIENT_ALTAR = new RecipeType(new NamespacedKey(Slimefun.instance(), "ancient_altar"), SlimefunItems.ANCIENT_ALTAR, (recipe, output) -> { + private static NamespacedKey sfKey(String key) { + Slimefun plugin = Slimefun.instance(); + return plugin != null ? new NamespacedKey(plugin, key) : new NamespacedKey("slimefun", key); + } + + public static final RecipeType MULTIBLOCK = new RecipeType(sfKey("multiblock"), new CustomItemStack(Material.BRICKS, "&bMultiBlock", "", "&a&oBuild it in the World")); + public static final RecipeType ARMOR_FORGE = new RecipeType(sfKey("armor_forge"), SlimefunItems.ARMOR_FORGE, "", "&a&oCraft it in an Armor Forge"); + public static final RecipeType GRIND_STONE = new RecipeType(sfKey("grind_stone"), SlimefunItems.GRIND_STONE, "", "&a&oGrind it using the Grind Stone"); + public static final RecipeType SMELTERY = new RecipeType(sfKey("smeltery"), SlimefunItems.SMELTERY, "", "&a&oSmelt it using a Smeltery"); + public static final RecipeType ORE_CRUSHER = new RecipeType(sfKey("ore_crusher"), SlimefunItems.ORE_CRUSHER, "", "&a&oCrush it using the Ore Crusher"); + public static final RecipeType GOLD_PAN = new RecipeType(sfKey("gold_pan"), SlimefunItems.GOLD_PAN, "", "&a&oUse a Gold Pan on Gravel to obtain this Item"); + public static final RecipeType COMPRESSOR = new RecipeType(sfKey("compressor"), SlimefunItems.COMPRESSOR, "", "&a&oCompress it using the Compressor"); + public static final RecipeType PRESSURE_CHAMBER = new RecipeType(sfKey("pressure_chamber"), SlimefunItems.PRESSURE_CHAMBER, "", "&a&oCompress it using the Pressure Chamber"); + public static final RecipeType MAGIC_WORKBENCH = new RecipeType(sfKey("magic_workbench"), SlimefunItems.MAGIC_WORKBENCH, "", "&a&oCraft it in a Magic Workbench"); + public static final RecipeType ORE_WASHER = new RecipeType(sfKey("ore_washer"), SlimefunItems.ORE_WASHER, "", "&a&oWash it in an Ore Washer"); + public static final RecipeType ENHANCED_CRAFTING_TABLE = new RecipeType(sfKey("enhanced_crafting_table"), SlimefunItems.ENHANCED_CRAFTING_TABLE, "", "&a&oA regular Crafting Table cannot", "&a&ohold this massive Amount of Power..."); + public static final RecipeType JUICER = new RecipeType(sfKey("juicer"), SlimefunItems.JUICER, "", "&a&oUsed for Juice Creation"); + + public static final RecipeType ANCIENT_ALTAR = new RecipeType(sfKey("ancient_altar"), SlimefunItems.ANCIENT_ALTAR, (recipe, output) -> { AltarRecipe altarRecipe = new AltarRecipe(Arrays.asList(recipe), output); AncientAltar altar = ((AncientAltar) SlimefunItems.ANCIENT_ALTAR.getItem()); altar.getRecipes().add(altarRecipe); }); + public static final RecipeType MOB_DROP = new RecipeType(sfKey("mob_drop"), new CustomItemStack(Material.IRON_SWORD, "&bMob Drop"), RecipeType::registerMobDrop, "", "&rKill the specified Mob to obtain this Item"); + public static final RecipeType BARTER_DROP = new RecipeType(sfKey("barter_drop"), new CustomItemStack(Material.GOLD_INGOT, "&bBarter Drop"), RecipeType::registerBarterDrop, "&aBarter with piglins for a chance", "&ato obtain this item"); + public static final RecipeType INTERACT = new RecipeType(sfKey("interact"), new CustomItemStack(Material.PLAYER_HEAD, "&bInteract", "", "&a&oRight click with this item")); - public static final RecipeType MOB_DROP = new RecipeType(new NamespacedKey(Slimefun.instance(), "mob_drop"), new CustomItemStack(Material.IRON_SWORD, "&bMob Drop"), RecipeType::registerMobDrop, "", "&rKill the specified Mob to obtain this Item"); - public static final RecipeType BARTER_DROP = new RecipeType(new NamespacedKey(Slimefun.instance(), "barter_drop"), new CustomItemStack(Material.GOLD_INGOT, "&bBarter Drop"), RecipeType::registerBarterDrop, "&aBarter with piglins for a chance", "&ato obtain this item"); - public static final RecipeType INTERACT = new RecipeType(new NamespacedKey(Slimefun.instance(), "interact"), new CustomItemStack(Material.PLAYER_HEAD, "&bInteract", "", "&a&oRight click with this item")); + public static final RecipeType HEATED_PRESSURE_CHAMBER = new RecipeType(sfKey("heated_pressure_chamber"), SlimefunItems.HEATED_PRESSURE_CHAMBER); + public static final RecipeType FOOD_FABRICATOR = new RecipeType(sfKey("food_fabricator"), SlimefunItems.FOOD_FABRICATOR); + public static final RecipeType FOOD_COMPOSTER = new RecipeType(sfKey("food_composter"), SlimefunItems.FOOD_COMPOSTER); + public static final RecipeType FREEZER = new RecipeType(sfKey("freezer"), SlimefunItems.FREEZER); + public static final RecipeType REFINERY = new RecipeType(sfKey("refinery"), SlimefunItems.REFINERY); - public static final RecipeType HEATED_PRESSURE_CHAMBER = new RecipeType(new NamespacedKey(Slimefun.instance(), "heated_pressure_chamber"), SlimefunItems.HEATED_PRESSURE_CHAMBER); - public static final RecipeType FOOD_FABRICATOR = new RecipeType(new NamespacedKey(Slimefun.instance(), "food_fabricator"), SlimefunItems.FOOD_FABRICATOR); - public static final RecipeType FOOD_COMPOSTER = new RecipeType(new NamespacedKey(Slimefun.instance(), "food_composter"), SlimefunItems.FOOD_COMPOSTER); - public static final RecipeType FREEZER = new RecipeType(new NamespacedKey(Slimefun.instance(), "freezer"), SlimefunItems.FREEZER); - public static final RecipeType REFINERY = new RecipeType(new NamespacedKey(Slimefun.instance(), "refinery"), SlimefunItems.REFINERY); - - public static final RecipeType GEO_MINER = new RecipeType(new NamespacedKey(Slimefun.instance(), "geo_miner"), SlimefunItems.GEO_MINER); - public static final RecipeType NUCLEAR_REACTOR = new RecipeType(new NamespacedKey(Slimefun.instance(), "nuclear_reactor"), SlimefunItems.NUCLEAR_REACTOR); + public static final RecipeType GEO_MINER = new RecipeType(sfKey("geo_miner"), SlimefunItems.GEO_MINER); + public static final RecipeType NUCLEAR_REACTOR = new RecipeType(sfKey("nuclear_reactor"), SlimefunItems.NUCLEAR_REACTOR); public static final RecipeType NULL = new RecipeType(); @@ -76,7 +80,7 @@ public class RecipeType implements Keyed { private RecipeType() { this.item = null; this.machine = ""; - this.key = new NamespacedKey(Slimefun.instance(), "null"); + this.key = sfKey("null"); } public RecipeType(ItemStack item, String machine) { @@ -84,9 +88,9 @@ public RecipeType(ItemStack item, String machine) { this.machine = machine; if (machine.length() > 0) { - this.key = new NamespacedKey(Slimefun.instance(), machine.toLowerCase(Locale.ROOT)); + this.key = sfKey(machine.toLowerCase(Locale.ROOT)); } else { - this.key = new NamespacedKey(Slimefun.instance(), "unknown"); + this.key = sfKey("unknown"); } } diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/core/commands/subcommands/BackpackCommand.java b/src/main/java/io/github/thebusybiscuit/slimefun4/core/commands/subcommands/BackpackCommand.java index 431d47cb66..2922cd5946 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/core/commands/subcommands/BackpackCommand.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/core/commands/subcommands/BackpackCommand.java @@ -52,10 +52,9 @@ public void onExecute(CommandSender sender, String[] args) { return; } - @SuppressWarnings("deprecation") OfflinePlayer backpackOwner = Bukkit.getOfflinePlayer(args[1]); - if (!(backpackOwner instanceof Player) && !backpackOwner.hasPlayedBefore()) { + if (!backpackOwner.hasPlayedBefore() && !backpackOwner.isOnline()) { Slimefun.getLocalization().sendMessage(sender, "commands.backpack.player-never-joined"); return; } diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/core/commands/subcommands/TeleporterCommand.java b/src/main/java/io/github/thebusybiscuit/slimefun4/core/commands/subcommands/TeleporterCommand.java index 891ba85059..5ddcf15d31 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/core/commands/subcommands/TeleporterCommand.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/core/commands/subcommands/TeleporterCommand.java @@ -27,10 +27,9 @@ public void onExecute(CommandSender sender, String[] args) { Slimefun.getGPSNetwork().getTeleportationManager().openTeleporterGUI(player, player.getUniqueId(), player.getLocation().getBlock().getRelative(BlockFace.DOWN), 999999999); } else if (args.length == 2) { - @SuppressWarnings("deprecation") OfflinePlayer targetPlayer = Bukkit.getOfflinePlayer(args[1]); - if (targetPlayer.getName() != null) { + if (targetPlayer.hasPlayedBefore() && targetPlayer.getName() != null) { Slimefun.getGPSNetwork().getTeleportationManager().openTeleporterGUI(player, targetPlayer.getUniqueId(), player.getLocation().getBlock().getRelative(BlockFace.DOWN), 999999999); } else { Slimefun.getLocalization().sendMessage(sender, "messages.unknown-player", msg -> msg.replace("%player%", args[1])); diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/core/services/UpdaterService.java b/src/main/java/io/github/thebusybiscuit/slimefun4/core/services/UpdaterService.java index ac21007fce..33800d7582 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/core/services/UpdaterService.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/core/services/UpdaterService.java @@ -1,13 +1,14 @@ package io.github.thebusybiscuit.slimefun4.core.services; import java.io.File; +import java.util.regex.Matcher; +import java.util.regex.Pattern; import java.util.concurrent.ExecutionException; import java.util.logging.Level; import javax.annotation.Nonnull; import io.github.bakedlibs.dough.updater.BlobBuildUpdater; -import org.bukkit.plugin.Plugin; import io.github.bakedlibs.dough.config.Config; import io.github.bakedlibs.dough.updater.PluginUpdater; @@ -35,6 +36,13 @@ public class UpdaterService { */ private final PluginUpdater updater; + /** + * The version string passed to this service. + */ + private final String version; + + private static final Pattern BUILD_PATTERN = Pattern.compile("^(?:Dev|RC) - (\\d+)"); + /** * The {@link SlimefunBranch} we are currently on. * If this is an official {@link SlimefunBranch}, auto updates will be enabled. @@ -54,26 +62,33 @@ public class UpdaterService { */ public UpdaterService(@Nonnull Slimefun plugin, @Nonnull String version, @Nonnull File file) { this.plugin = plugin; + this.version = version; BlobBuildUpdater autoUpdater = null; if (version.contains("UNOFFICIAL")) { // This Server is using a modified build that is not a public release. branch = SlimefunBranch.UNOFFICIAL; } else if (version.startsWith("Dev - ")) { - // If we are using a development build, we want to switch to our custom - try { - autoUpdater = new BlobBuildUpdater(plugin, file, "Slimefun4", "Dev"); - } catch (Exception x) { - plugin.getLogger().log(Level.SEVERE, "Failed to create AutoUpdater", x); + // If we are using a development build, only attempt to create an updater + // when the plugin's own version also follows the development pattern. + if (plugin.getDescription().getVersion().startsWith("Dev - ")) { + try { + autoUpdater = new BlobBuildUpdater(plugin, file, "Slimefun4", "Dev"); + } catch (Exception x) { + plugin.getLogger().log(Level.SEVERE, "Failed to create AutoUpdater", x); + } } branch = SlimefunBranch.DEVELOPMENT; } else if (version.startsWith("RC - ")) { - // If we are using a "stable" build, we want to switch to our custom - try { - autoUpdater = new BlobBuildUpdater(plugin, file, "Slimefun4", "RC"); - } catch (Exception x) { - plugin.getLogger().log(Level.SEVERE, "Failed to create AutoUpdater", x); + // If we are using a "stable" build, only attempt to create an updater + // when the plugin's version matches the stable pattern. + if (plugin.getDescription().getVersion().startsWith("RC - ")) { + try { + autoUpdater = new BlobBuildUpdater(plugin, file, "Slimefun4", "RC"); + } catch (Exception x) { + plugin.getLogger().log(Level.SEVERE, "Failed to create AutoUpdater", x); + } } branch = SlimefunBranch.STABLE; @@ -84,6 +99,13 @@ public UpdaterService(@Nonnull Slimefun plugin, @Nonnull String version, @Nonnul this.updater = autoUpdater; } + UpdaterService(@Nonnull Slimefun plugin, PluginUpdater updater, SlimefunBranch branch) { + this.plugin = plugin; + this.version = plugin.getDescription().getVersion(); + this.updater = updater; + this.branch = branch; + } + /** * This method returns the branch the current build of Slimefun is running on. * This can be used to determine whether we are dealing with an official build @@ -103,9 +125,9 @@ public UpdaterService(@Nonnull Slimefun plugin, @Nonnull String version, @Nonnul * @return The build number of this Slimefun. */ public int getBuildNumber() { - if (updater != null) { - PrefixedVersion version = updater.getCurrentVersion(); - return version.getVersionNumber(); + Matcher matcher = BUILD_PATTERN.matcher(version); + if (matcher.find()) { + return Integer.parseInt(matcher.group(1)); } return -1; @@ -126,12 +148,15 @@ public int getLatestVersion() { } public boolean isLatestVersion() { - if (getBuildNumber() == -1 || getLatestVersion() == -1) { + int current = getBuildNumber(); + int latest = getLatestVersion(); + + if (current == -1 || latest == -1) { // We don't know if we're latest so just report we are return true; } - - return getBuildNumber() == getLatestVersion(); + + return current == latest; } /** diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/Slimefun.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/Slimefun.java index 1be851ba17..d6dd4151c5 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/Slimefun.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/Slimefun.java @@ -218,7 +218,7 @@ public Slimefun() { // Check that we got loaded by MockBukkit rather than Bukkit's loader // TODO: This is very much a hack and we can hopefully move to a more native way in the future - if (getClassLoader().getClass().getPackageName().startsWith("be.seeseemelk.mockbukkit")) { + if (getClassLoader().getClass().getPackageName().startsWith("org.mockbukkit.mockbukkit")) { minecraftVersion = MinecraftVersion.UNIT_TEST; } } diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/SlimefunItems.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/SlimefunItems.java index d3adb16e0b..563e95477e 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/SlimefunItems.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/SlimefunItems.java @@ -23,6 +23,7 @@ import io.github.thebusybiscuit.slimefun4.utils.HeadTexture; import io.github.thebusybiscuit.slimefun4.utils.LoreBuilder; import io.github.thebusybiscuit.slimefun4.utils.compatibility.VersionedEnchantment; +import io.github.thebusybiscuit.slimefun4.utils.compatibility.VersionedMaterial; import io.github.thebusybiscuit.slimefun4.utils.itemstack.ColoredFireworkStar; /** @@ -63,7 +64,34 @@ private SlimefunItems() {} public static final SlimefunItemStack VITAMINS = new SlimefunItemStack("VITAMINS", Material.NETHER_WART, "&cVitamins", "", "&aLevel III - Medical Supply", "", "&fRestores 4 Hearts", "&fExtinguishes Fire", "&fCures Poison/Wither/Radiation", "", LoreBuilder.RIGHT_CLICK_TO_USE); public static final SlimefunItemStack MEDICINE = new SlimefunItemStack("MEDICINE", Material.POTION, Color.RED, "&cMedicine", "", "&aLevel III - Medical Supply", "", "&fRestores 4 Hearts", "&fExtinguishes Fire", "&fCures Poison/Wither/Radiation"); public static final SlimefunItemStack MAGICAL_ZOMBIE_PILLS = new SlimefunItemStack("MAGICAL_ZOMBIE_PILLS", Material.NETHER_WART, "&6Magical Zombie Pills", "", "&eRight Click &7a Zombified Villager", "&eor &7a Zombified Piglin to", "&7instantly cure it from its curse"); - + public static final SlimefunItemStack WOLF_ARMOR = new SlimefunItemStack( + "WOLF_ARMOR", + VersionedMaterial.WOLF_ARMOR == null ? Material.LEATHER_CHESTPLATE : VersionedMaterial.WOLF_ARMOR, + "&6Wolf Armor"); + public static final SlimefunItemStack BREEZE_ROD = new SlimefunItemStack( + "BREEZE_ROD", + VersionedMaterial.BREEZE_ROD == null ? Material.BLAZE_ROD : VersionedMaterial.BREEZE_ROD, + "&bBreeze Rod"); + public static final SlimefunItemStack WIND_CHARGE = new SlimefunItemStack( + "WIND_CHARGE", + VersionedMaterial.WIND_CHARGE == null ? Material.SNOWBALL : VersionedMaterial.WIND_CHARGE, + "&bWind Charge"); + public static final SlimefunItemStack ARMADILLO_SCUTE = new SlimefunItemStack( + "ARMADILLO_SCUTE", + VersionedMaterial.ARMADILLO_SCUTE == null ? Material.TURTLE_SCUTE : VersionedMaterial.ARMADILLO_SCUTE, + "&6Armadillo Scute"); + public static final SlimefunItemStack CREAKING_HEART = new SlimefunItemStack( + "CREAKING_HEART", + VersionedMaterial.CREAKING_HEART == null ? Material.ROTTEN_FLESH : VersionedMaterial.CREAKING_HEART, + "&cCreaking Heart"); + public static final SlimefunItemStack HEAVY_CORE = new SlimefunItemStack( + "HEAVY_CORE", + VersionedMaterial.HEAVY_CORE == null ? Material.IRON_BLOCK : VersionedMaterial.HEAVY_CORE, + "&6Heavy Core"); + public static final SlimefunItemStack MACE = new SlimefunItemStack( + "MACE", + VersionedMaterial.MACE == null ? Material.DIAMOND_SWORD : VersionedMaterial.MACE, + "&6Mace"); public static final SlimefunItemStack FLASK_OF_KNOWLEDGE = new SlimefunItemStack("FLASK_OF_KNOWLEDGE", Material.GLASS_BOTTLE, "&cFlask of Knowledge", "", "&fAllows you to store some of", "&fyour Experience in a Bottle", "&7Cost: &a1 Level"); public static final SlimefunItemStack FILLED_FLASK_OF_KNOWLEDGE = new SlimefunItemStack("FILLED_FLASK_OF_KNOWLEDGE", Material.EXPERIENCE_BOTTLE, "&aFlask of Knowledge"); diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/autocrafters/VanillaAutoCrafter.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/autocrafters/VanillaAutoCrafter.java index e9c9c962dc..5975d6c441 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/autocrafters/VanillaAutoCrafter.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/autocrafters/VanillaAutoCrafter.java @@ -75,16 +75,17 @@ public VanillaAutoCrafter(ItemGroup itemGroup, SlimefunItemStack item, RecipeTyp * But it is completely fine for this purpose since we only use * it for lookups. */ - @SuppressWarnings("deprecation") - NamespacedKey key = new NamespacedKey(values[0], values[1]); - Recipe keyedRecipe = Slimefun.getMinecraftRecipeService().getRecipe(key); + NamespacedKey key = NamespacedKey.fromString(values[0] + ":" + values[1]); + if (key != null) { + Recipe keyedRecipe = Slimefun.getMinecraftRecipeService().getRecipe(key); - if (keyedRecipe != null) { - boolean enabled = !container.has(recipeEnabledKey, PersistentDataType.BYTE); - AbstractRecipe recipe = AbstractRecipe.of(keyedRecipe); - recipe.setEnabled(enabled); + if (keyedRecipe != null) { + boolean enabled = !container.has(recipeEnabledKey, PersistentDataType.BYTE); + AbstractRecipe recipe = AbstractRecipe.of(keyedRecipe); + recipe.setEnabled(enabled); - return recipe; + return recipe; + } } } } diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/blocks/HologramProjector.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/blocks/HologramProjector.java index 21891d293a..9895efbd7b 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/blocks/HologramProjector.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/blocks/HologramProjector.java @@ -106,7 +106,7 @@ private void openEditor(@Nonnull Player p, @Nonnull Block projector) { // Fixes #3445 - Make sure the projector is not broken if (!BlockStorage.check(projector, getId())) { // Hologram projector no longer exists. - // TODO: Add a chat message informing the player that their message was ignored. + Slimefun.getLocalization().sendMessage(pl, "machines.HOLOGRAM_PROJECTOR.projector-missing", true); return; } diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/electric/machines/AutoBrewer.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/electric/machines/AutoBrewer.java index 962bc2d32f..76834e8ca8 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/electric/machines/AutoBrewer.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/electric/machines/AutoBrewer.java @@ -20,6 +20,7 @@ import io.github.thebusybiscuit.slimefun4.api.recipes.RecipeType; import io.github.thebusybiscuit.slimefun4.core.attributes.NotHopperable; import io.github.thebusybiscuit.slimefun4.utils.compatibility.VersionedPotionType; +import io.github.thebusybiscuit.slimefun4.utils.compatibility.VersionedMaterial; import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.abstractItems.AContainer; import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.abstractItems.MachineRecipe; import me.mrCookieSlime.Slimefun.api.inventory.BlockMenu; @@ -48,6 +49,13 @@ public class AutoBrewer extends AContainer implements NotHopperable { potionRecipes.put(Material.GOLDEN_CARROT, PotionType.NIGHT_VISION); potionRecipes.put(Material.TURTLE_HELMET, PotionType.TURTLE_MASTER); potionRecipes.put(Material.PHANTOM_MEMBRANE, PotionType.SLOW_FALLING); + potionRecipes.put(Material.SLIME_BLOCK, VersionedPotionType.OOZING); + potionRecipes.put(Material.COBWEB, VersionedPotionType.WEAVING); + potionRecipes.put(Material.STONE, VersionedPotionType.INFESTED); + + if (VersionedMaterial.BREEZE_ROD != null) { + potionRecipes.put(VersionedMaterial.BREEZE_ROD, VersionedPotionType.WIND_CHARGED); + } fermentations.put(VersionedPotionType.SWIFTNESS, PotionType.SLOWNESS); fermentations.put(VersionedPotionType.LEAPING, PotionType.SLOWNESS); diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/electric/machines/entities/ProduceCollector.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/electric/machines/entities/ProduceCollector.java index 24ecf5d86d..9a715f4903 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/electric/machines/entities/ProduceCollector.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/electric/machines/entities/ProduceCollector.java @@ -33,6 +33,8 @@ import io.github.thebusybiscuit.slimefun4.core.attributes.RecipeDisplayItem; import io.github.thebusybiscuit.slimefun4.implementation.Slimefun; import io.github.thebusybiscuit.slimefun4.utils.SlimefunUtils; +import io.github.thebusybiscuit.slimefun4.utils.compatibility.VersionedEntityType; +import io.github.thebusybiscuit.slimefun4.utils.compatibility.VersionedMaterial; import me.mrCookieSlime.CSCoreLibPlugin.Configuration.Config; import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.abstractItems.AContainer; @@ -81,6 +83,19 @@ protected void registerDefaultRecipes() { return false; } })); + + // Armadillo Scutes from Armadillos + if (Slimefun.getMinecraftVersion().isAtLeast(MinecraftVersion.MINECRAFT_1_21)) { + if (VersionedMaterial.ARMADILLO_SCUTE != null) { + addProduce(new AnimalProduce(new ItemStack(Material.BRUSH), new ItemStack(VersionedMaterial.ARMADILLO_SCUTE), n -> { + if (n.getType() == VersionedEntityType.ARMADILLO && n instanceof Ageable ageable) { + return ageable.isAdult(); + } else { + return false; + } + })); + } + } } /** @@ -127,6 +142,13 @@ public boolean isSynchronized() { displayRecipes.add(new CustomItemStack(Material.BOWL, null, "&fRequires &bMooshroom &fnearby")); displayRecipes.add(new ItemStack(Material.MUSHROOM_STEW)); + if (Slimefun.getMinecraftVersion().isAtLeast(MinecraftVersion.MINECRAFT_1_21)) { + if (VersionedMaterial.ARMADILLO_SCUTE != null) { + displayRecipes.add(new CustomItemStack(Material.BRUSH, null, "&fRequires &bArmadillo &fnearby")); + displayRecipes.add(new ItemStack(VersionedMaterial.ARMADILLO_SCUTE)); + } + } + return displayRecipes; } diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/magical/runes/EnchantmentRune.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/magical/runes/EnchantmentRune.java index 33e54e7544..26fb35534c 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/magical/runes/EnchantmentRune.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/magical/runes/EnchantmentRune.java @@ -51,6 +51,7 @@ public EnchantmentRune(ItemGroup itemGroup, SlimefunItemStack item, RecipeType r for (Material mat : Material.values()) { if (Slimefun.instance().isUnitTest() && mat.isLegacy()) continue; + if (!mat.isItem()) continue; List enchantments = new ArrayList<>(); diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/medical/Bandage.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/medical/Bandage.java index b87882cf6d..f315a0df8d 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/medical/Bandage.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/medical/Bandage.java @@ -42,7 +42,7 @@ public ItemUseHandler getItemHandler() { Player p = e.getPlayer(); // Player is neither burning nor injured - if (p.getFireTicks() <= 0 && p.getHealth() >= p.getAttribute(Attribute.GENERIC_MAX_HEALTH).getValue()) { + if (p.getFireTicks() <= 0 && p.getHealth() >= p.getAttribute(Attribute.MAX_HEALTH).getValue()) { return; } diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/medical/MedicalSupply.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/medical/MedicalSupply.java index 350376eab8..d9c6172bec 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/medical/MedicalSupply.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/medical/MedicalSupply.java @@ -39,6 +39,12 @@ protected MedicalSupply(ItemGroup itemGroup, int healAmount, SlimefunItemStack i curedEffects.add(VersionedPotionEffectType.NAUSEA); curedEffects.add(PotionEffectType.BLINDNESS); curedEffects.add(PotionEffectType.BAD_OMEN); + + // Added in 1.21 + curedEffects.add(VersionedPotionEffectType.OOZING); + curedEffects.add(VersionedPotionEffectType.WEAVING); + curedEffects.add(VersionedPotionEffectType.WIND_CHARGED); + curedEffects.add(VersionedPotionEffectType.INFESTED); } /** @@ -73,7 +79,7 @@ public void clearNegativeEffects(@Nonnull LivingEntity n) { */ public void heal(@Nonnull LivingEntity n) { double health = n.getHealth() + healAmount; - double maxHealth = n.getAttribute(Attribute.GENERIC_MAX_HEALTH).getValue(); + double maxHealth = n.getAttribute(Attribute.MAX_HEALTH).getValue(); n.setHealth(Math.min(health, maxHealth)); } diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/medical/Splint.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/medical/Splint.java index 0a510ff28a..b85db3af7b 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/medical/Splint.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/medical/Splint.java @@ -31,7 +31,7 @@ public Splint(ItemGroup itemGroup, SlimefunItemStack item, RecipeType recipeType Player p = e.getPlayer(); // Player is neither burning nor injured - if (p.getFireTicks() <= 0 && p.getHealth() >= p.getAttribute(Attribute.GENERIC_MAX_HEALTH).getValue()) { + if (p.getFireTicks() <= 0 && p.getHealth() >= p.getAttribute(Attribute.MAX_HEALTH).getValue()) { return; } diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/multiblocks/OreCrusher.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/multiblocks/OreCrusher.java index ea5141f099..ddfd607eae 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/multiblocks/OreCrusher.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/multiblocks/OreCrusher.java @@ -107,6 +107,25 @@ protected void registerDefaultRecipes(List recipes) { recipes.add(new ItemStack(Material.COBBLED_DEEPSLATE, 8)); recipes.add(new ItemStack(Material.SAND, 1)); } + + // Tuff and its variants can be crushed into sand + recipes.add(new ItemStack(Material.TUFF, 8)); + recipes.add(new ItemStack(Material.SAND, 1)); + + String[] tuffVariants = { + "POLISHED_TUFF", + "TUFF_BRICKS", + "POLISHED_TUFF_BRICKS", + "CHISELED_TUFF", + "CHISELED_TUFF_BRICKS" + }; + for (String variant : tuffVariants) { + Material mat = Material.matchMaterial(variant); + if (mat != null) { + recipes.add(new ItemStack(mat, 8)); + recipes.add(new ItemStack(Material.SAND, 1)); + } + } } public boolean isOreDoublingEnabled() { diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/tools/ExplosiveTool.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/tools/ExplosiveTool.java index 6fe1174e4f..ff27af0547 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/tools/ExplosiveTool.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/tools/ExplosiveTool.java @@ -14,6 +14,7 @@ import org.bukkit.entity.Player; import org.bukkit.event.block.BlockBreakEvent; import org.bukkit.event.block.BlockExplodeEvent; +import org.bukkit.ExplosionResult; import org.bukkit.inventory.ItemStack; import io.github.bakedlibs.dough.protection.Interaction; @@ -78,7 +79,13 @@ private void breakBlocks(BlockBreakEvent e, Player p, ItemStack item, Block b, L List blocksToDestroy = new ArrayList<>(); if (callExplosionEvent.getValue()) { - BlockExplodeEvent blockExplodeEvent = new BlockExplodeEvent(b, blocks, 0); + BlockExplodeEvent blockExplodeEvent = new BlockExplodeEvent( + b, + b.getState(), + blocks, + 0, + ExplosionResult.DESTROY + ); Bukkit.getServer().getPluginManager().callEvent(blockExplodeEvent); if (!blockExplodeEvent.isCancelled()) { diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/weapons/VampireBlade.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/weapons/VampireBlade.java index 006db130e2..43ce84dfdb 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/weapons/VampireBlade.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/weapons/VampireBlade.java @@ -45,7 +45,7 @@ public VampireBlade(ItemGroup itemGroup, SlimefunItemStack item, RecipeType reci if (ThreadLocalRandom.current().nextInt(100) < getChance()) { SoundEffect.VAMPIRE_BLADE_HEALING_SOUND.playFor(p); double health = p.getHealth() + HEALING_AMOUNT; - double maxHealth = p.getAttribute(Attribute.GENERIC_MAX_HEALTH).getValue(); + double maxHealth = p.getAttribute(Attribute.MAX_HEALTH).getValue(); p.setHealth(Math.min(health, maxHealth)); } }; diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/ButcherAndroidListener.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/ButcherAndroidListener.java index 9e63107680..a21602d70e 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/ButcherAndroidListener.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/ButcherAndroidListener.java @@ -23,6 +23,8 @@ import io.github.thebusybiscuit.slimefun4.implementation.items.androids.AndroidInstance; import io.github.thebusybiscuit.slimefun4.implementation.items.androids.ButcherAndroid; import io.github.thebusybiscuit.slimefun4.utils.SlimefunUtils; +import io.github.thebusybiscuit.slimefun4.utils.compatibility.VersionedEntityType; +import io.github.thebusybiscuit.slimefun4.utils.compatibility.VersionedMaterial; /** * This {@link Listener} handles the collection of drops from an {@link Entity} that was @@ -92,5 +94,27 @@ private void addExtraDrops(List drops, EntityType entityType) { if (entityType == EntityType.VINDICATOR) { drops.add(new ItemStack(Material.EMERALD, 1 + random.nextInt(2))); } + + if (entityType == VersionedEntityType.BOGGED) { + drops.add(new ItemStack(Material.BROWN_MUSHROOM, 1 + random.nextInt(2))); + drops.add(new ItemStack(Material.RED_MUSHROOM, 1 + random.nextInt(2))); + } + + if (entityType == VersionedEntityType.ARMADILLO && VersionedMaterial.ARMADILLO_SCUTE != null) { + drops.add(new ItemStack(VersionedMaterial.ARMADILLO_SCUTE, 1 + random.nextInt(2))); + } + + if (entityType == VersionedEntityType.BREEZE) { + if (VersionedMaterial.BREEZE_ROD != null) { + drops.add(new ItemStack(VersionedMaterial.BREEZE_ROD)); + } + if (VersionedMaterial.WIND_CHARGE != null && random.nextInt(3) == 0) { + drops.add(new ItemStack(VersionedMaterial.WIND_CHARGE)); + } + } + + if (entityType == VersionedEntityType.CREAKING && VersionedMaterial.CREAKING_HEART != null) { + drops.add(new ItemStack(VersionedMaterial.CREAKING_HEART)); + } } } diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/setup/SlimefunItemSetup.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/setup/SlimefunItemSetup.java index 14575310af..121879caf5 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/setup/SlimefunItemSetup.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/setup/SlimefunItemSetup.java @@ -218,6 +218,7 @@ import io.github.thebusybiscuit.slimefun4.utils.HeadTexture; import io.github.thebusybiscuit.slimefun4.utils.SlimefunUtils; import io.github.thebusybiscuit.slimefun4.utils.compatibility.VersionedPotionEffectType; +import io.github.thebusybiscuit.slimefun4.utils.compatibility.VersionedMaterial; /** * This class holds the recipes of all items. @@ -2089,6 +2090,90 @@ public int getEnergyConsumption() { new ItemStack[] {SlimefunItems.ESSENCE_OF_AFTERLIFE, new ItemStack(Material.EMERALD_BLOCK), SlimefunItems.ESSENCE_OF_AFTERLIFE, SlimefunItems.MAGIC_LUMP_3, SlimefunItems.COMMON_TALISMAN, SlimefunItems.MAGIC_LUMP_3, SlimefunItems.ESSENCE_OF_AFTERLIFE, new ItemStack(Material.EMERALD_BLOCK), SlimefunItems.ESSENCE_OF_AFTERLIFE}) .register(plugin); + if (Slimefun.getMinecraftVersion().isAtLeast(MinecraftVersion.MINECRAFT_1_21)) { + Material crafter = VersionedMaterial.CRAFTER; + Material copperBulb = VersionedMaterial.COPPER_BULB; + Material breezeSpawnEgg = VersionedMaterial.BREEZE_SPAWN_EGG; + Material breezeRod = VersionedMaterial.BREEZE_ROD; + Material ominousBottle = VersionedMaterial.OMINOUS_BOTTLE; + Material trialKey = VersionedMaterial.TRIAL_KEY; + Material vault = VersionedMaterial.VAULT; + Material trialSpawner = VersionedMaterial.TRIAL_SPAWNER; + Material heavyCore = VersionedMaterial.HEAVY_CORE; + Material mace = VersionedMaterial.MACE; + Material wolfArmor = VersionedMaterial.WOLF_ARMOR; + Material armadilloScute = VersionedMaterial.ARMADILLO_SCUTE; + + new VanillaItem(itemGroups.basicMachines, new ItemStack(crafter), "CRAFTER", RecipeType.ENHANCED_CRAFTING_TABLE, + new ItemStack[] {new ItemStack(Material.IRON_INGOT), new ItemStack(Material.IRON_INGOT), new ItemStack(Material.REDSTONE), + new ItemStack(Material.IRON_INGOT), new ItemStack(Material.CRAFTING_TABLE), new ItemStack(Material.DROPPER), + new ItemStack(Material.IRON_INGOT), new ItemStack(Material.IRON_INGOT), new ItemStack(Material.REDSTONE)}) + .register(plugin); + + new VanillaItem(itemGroups.basicMachines, new ItemStack(copperBulb, 4), "COPPER_BULB", RecipeType.ENHANCED_CRAFTING_TABLE, + new ItemStack[] {null, new ItemStack(Material.COPPER_BLOCK), null, + new ItemStack(Material.COPPER_BLOCK), new ItemStack(Material.BLAZE_ROD), new ItemStack(Material.REDSTONE), + null, new ItemStack(Material.COPPER_BLOCK), null}) + .register(plugin); + + new VanillaItem(itemGroups.magicalResources, SlimefunItems.BREEZE_ROD, "BREEZE_ROD", RecipeType.MOB_DROP, + new ItemStack[] {null, null, null, null, new CustomItemStack(new ItemStack(breezeSpawnEgg), "&aBreeze"), null, null, null, null}) + .register(plugin); + + new VanillaItem(itemGroups.magicalResources, new ItemStack(ominousBottle), "OMINOUS_BOTTLE", RecipeType.MAGIC_WORKBENCH, + new ItemStack[] {new ItemStack(Material.COBWEB), new ItemStack(breezeRod), new ItemStack(Material.COBWEB), + new ItemStack(Material.SLIME_BALL), new ItemStack(Material.GLASS_BOTTLE), new ItemStack(Material.SLIME_BALL), + null, new ItemStack(Material.FERMENTED_SPIDER_EYE), null}) + .register(plugin); + new VanillaItem(itemGroups.magicalResources, SlimefunItems.WIND_CHARGE, "WIND_CHARGE", RecipeType.MOB_DROP, + new ItemStack[] {null, null, null, null, new CustomItemStack(new ItemStack(Material.BREEZE_SPAWN_EGG), "&aBreeze"), null, null, null, null}) + .register(plugin); + + new VanillaItem(itemGroups.magicalResources, SlimefunItems.ARMADILLO_SCUTE, "ARMADILLO_SCUTE", RecipeType.MOB_DROP, + new ItemStack[] {null, null, null, null, new CustomItemStack(new ItemStack(Material.ARMADILLO_SPAWN_EGG), "&aArmadillo"), null, null, null, null}) + .register(plugin); + + new VanillaItem(itemGroups.magicalResources, SlimefunItems.CREAKING_HEART, "CREAKING_HEART", RecipeType.MOB_DROP, + new ItemStack[] {null, null, null, null, new CustomItemStack(new ItemStack(Material.CREAKING_SPAWN_EGG), "&aCreaking"), null, null, null, null}) + .register(plugin); + + new VanillaItem(itemGroups.magicalResources, new ItemStack(trialKey), "TRIAL_KEY", RecipeType.MAGIC_WORKBENCH, + new ItemStack[] {new ItemStack(Material.GOLD_INGOT), SlimefunItems.BREEZE_ROD, new ItemStack(Material.GOLD_INGOT), + null, new ItemStack(Material.TRIPWIRE_HOOK), null, + null, new ItemStack(Material.IRON_INGOT), null}) + .register(plugin); + + new VanillaItem(itemGroups.basicMachines, new ItemStack(vault), "VAULT", RecipeType.ENHANCED_CRAFTING_TABLE, + new ItemStack[] {new ItemStack(Material.COPPER_BLOCK), new ItemStack(Material.IRON_BARS), new ItemStack(Material.COPPER_BLOCK), + new ItemStack(Material.IRON_BARS), new ItemStack(Material.CHEST), new ItemStack(Material.IRON_BARS), + new ItemStack(Material.COPPER_BLOCK), new ItemStack(Material.IRON_BARS), new ItemStack(Material.COPPER_BLOCK)}) + .register(plugin); + + new VanillaItem(itemGroups.basicMachines, new ItemStack(trialSpawner), "TRIAL_SPAWNER", RecipeType.ENHANCED_CRAFTING_TABLE, + new ItemStack[] {new ItemStack(Material.DEEPSLATE_BRICKS), SlimefunItems.BREEZE_ROD, new ItemStack(Material.DEEPSLATE_BRICKS), + new ItemStack(Material.IRON_BARS), new ItemStack(Material.SPAWNER), new ItemStack(Material.IRON_BARS), + new ItemStack(Material.DEEPSLATE_BRICKS), new ItemStack(trialKey), new ItemStack(Material.DEEPSLATE_BRICKS)}) + .register(plugin); + + new VanillaItem(itemGroups.magicalResources, new ItemStack(heavyCore), "HEAVY_CORE", RecipeType.ENHANCED_CRAFTING_TABLE, + new ItemStack[] {new ItemStack(Material.IRON_BLOCK), new ItemStack(Material.IRON_BLOCK), new ItemStack(Material.IRON_BLOCK), + new ItemStack(Material.IRON_BLOCK), new ItemStack(Material.NETHERITE_INGOT), new ItemStack(Material.IRON_BLOCK), + new ItemStack(Material.IRON_BLOCK), new ItemStack(Material.IRON_BLOCK), new ItemStack(Material.IRON_BLOCK)}) + .register(plugin); + + new VanillaItem(itemGroups.weapons, new ItemStack(mace), "MACE", RecipeType.ENHANCED_CRAFTING_TABLE, + new ItemStack[] {null, SlimefunItems.BREEZE_ROD, null, + null, SlimefunItems.HEAVY_CORE, null, + null, null, null}) + .register(plugin); + + new VanillaItem(itemGroups.armor, new ItemStack(wolfArmor), "WOLF_ARMOR", RecipeType.ARMOR_FORGE, + new ItemStack[] {new ItemStack(armadilloScute), new ItemStack(armadilloScute), new ItemStack(armadilloScute), + null, new ItemStack(armadilloScute), null, + null, new ItemStack(armadilloScute), new ItemStack(armadilloScute)}) + .register(plugin); + } + new RainbowBlock(itemGroups.magicalGadgets, SlimefunItems.RAINBOW_WOOL, RecipeType.ANCIENT_ALTAR, new ItemStack[] {new ItemStack(Material.WHITE_WOOL), new ItemStack(Material.WHITE_WOOL), new ItemStack(Material.WHITE_WOOL), new ItemStack(Material.WHITE_WOOL), SlimefunItems.RAINBOW_RUNE, new ItemStack(Material.WHITE_WOOL), new ItemStack(Material.WHITE_WOOL), new ItemStack(Material.WHITE_WOOL), new ItemStack(Material.WHITE_WOOL)}, new SlimefunItemStack(SlimefunItems.RAINBOW_WOOL, 8), new RainbowTickHandler(ColoredMaterial.WOOL)) @@ -2681,28 +2766,30 @@ public int getCapacity() { new SlimefunItemStack(SlimefunItems.RAINBOW_LEATHER, 4)) .register(plugin); - new UnplaceableBlock(itemGroups.cargo, SlimefunItems.CRAFTING_MOTOR, RecipeType.ENHANCED_CRAFTING_TABLE, - new ItemStack[] {new ItemStack(Material.CRAFTING_TABLE), SlimefunItems.BLISTERING_INGOT_3, new ItemStack(Material.CRAFTING_TABLE), SlimefunItems.REDSTONE_ALLOY, SlimefunItems.CARGO_MOTOR, SlimefunItems.REDSTONE_ALLOY, new ItemStack(Material.CRAFTING_TABLE), SlimefunItems.BLISTERING_INGOT_3, new ItemStack(Material.CRAFTING_TABLE)}, - new SlimefunItemStack(SlimefunItems.CRAFTING_MOTOR, 2)) - .register(plugin); + if (VersionedMaterial.CRAFTER != null) { + new UnplaceableBlock(itemGroups.cargo, SlimefunItems.CRAFTING_MOTOR, RecipeType.ENHANCED_CRAFTING_TABLE, + new ItemStack[] {new ItemStack(VersionedMaterial.CRAFTER), SlimefunItems.BLISTERING_INGOT_3, new ItemStack(VersionedMaterial.CRAFTER), SlimefunItems.REDSTONE_ALLOY, SlimefunItems.CARGO_MOTOR, SlimefunItems.REDSTONE_ALLOY, new ItemStack(VersionedMaterial.CRAFTER), SlimefunItems.BLISTERING_INGOT_3, new ItemStack(VersionedMaterial.CRAFTER)}, + new SlimefunItemStack(SlimefunItems.CRAFTING_MOTOR, 2)) + .register(plugin); - new VanillaAutoCrafter(itemGroups.cargo, SlimefunItems.VANILLA_AUTO_CRAFTER, RecipeType.ENHANCED_CRAFTING_TABLE, - new ItemStack[] {null, SlimefunItems.CARGO_MOTOR, null, new ItemStack(Material.CRAFTING_TABLE), SlimefunItems.CRAFTING_MOTOR, new ItemStack(Material.CRAFTING_TABLE), null, SlimefunItems.ELECTRIC_MOTOR, null}) - .setCapacity(256) - .setEnergyConsumption(16) - .register(plugin); + new VanillaAutoCrafter(itemGroups.cargo, SlimefunItems.VANILLA_AUTO_CRAFTER, RecipeType.ENHANCED_CRAFTING_TABLE, + new ItemStack[] {null, SlimefunItems.CARGO_MOTOR, null, new ItemStack(VersionedMaterial.CRAFTER), SlimefunItems.CRAFTING_MOTOR, new ItemStack(VersionedMaterial.CRAFTER), null, SlimefunItems.ELECTRIC_MOTOR, null}) + .setCapacity(256) + .setEnergyConsumption(16) + .register(plugin); - new EnhancedAutoCrafter(itemGroups.cargo, SlimefunItems.ENHANCED_AUTO_CRAFTER, RecipeType.ENHANCED_CRAFTING_TABLE, - new ItemStack[] {null, SlimefunItems.CRAFTING_MOTOR, null, new ItemStack(Material.CRAFTING_TABLE), new ItemStack(Material.DISPENSER), new ItemStack(Material.CRAFTING_TABLE), null, SlimefunItems.CARGO_MOTOR, null}) - .setCapacity(256) - .setEnergyConsumption(16) - .register(plugin); + new EnhancedAutoCrafter(itemGroups.cargo, SlimefunItems.ENHANCED_AUTO_CRAFTER, RecipeType.ENHANCED_CRAFTING_TABLE, + new ItemStack[] {null, SlimefunItems.CRAFTING_MOTOR, null, new ItemStack(VersionedMaterial.CRAFTER), new ItemStack(Material.DISPENSER), new ItemStack(VersionedMaterial.CRAFTER), null, SlimefunItems.CARGO_MOTOR, null}) + .setCapacity(256) + .setEnergyConsumption(16) + .register(plugin); - new ArmorAutoCrafter(itemGroups.cargo, SlimefunItems.ARMOR_AUTO_CRAFTER, RecipeType.ENHANCED_CRAFTING_TABLE, - new ItemStack[] {null, SlimefunItems.CRAFTING_MOTOR, null, new ItemStack(Material.DISPENSER), new ItemStack(Material.ANVIL), new ItemStack(Material.DISPENSER), new ItemStack(Material.CRAFTING_TABLE), SlimefunItems.ELECTRIC_MOTOR, new ItemStack(Material.CRAFTING_TABLE)}) - .setCapacity(256) - .setEnergyConsumption(32) - .register(plugin); + new ArmorAutoCrafter(itemGroups.cargo, SlimefunItems.ARMOR_AUTO_CRAFTER, RecipeType.ENHANCED_CRAFTING_TABLE, + new ItemStack[] {null, SlimefunItems.CRAFTING_MOTOR, null, new ItemStack(Material.DISPENSER), new ItemStack(Material.ANVIL), new ItemStack(Material.DISPENSER), new ItemStack(VersionedMaterial.CRAFTER), SlimefunItems.ELECTRIC_MOTOR, new ItemStack(VersionedMaterial.CRAFTER)}) + .setCapacity(256) + .setEnergyConsumption(32) + .register(plugin); + } new ProduceCollector(itemGroups.electricity, SlimefunItems.PRODUCE_COLLECTOR, RecipeType.ENHANCED_CRAFTING_TABLE, new ItemStack[] {null, new ItemStack(Material.HAY_BLOCK), null, new ItemStack(Material.BUCKET), SlimefunItems.MEDIUM_CAPACITOR, new ItemStack(Material.BUCKET), SlimefunItems.ALUMINUM_BRASS_INGOT, SlimefunItems.ELECTRIC_MOTOR, SlimefunItems.ALUMINUM_BRASS_INGOT}) diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/utils/FireworkUtils.java b/src/main/java/io/github/thebusybiscuit/slimefun4/utils/FireworkUtils.java index e09851349d..526758f45a 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/utils/FireworkUtils.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/utils/FireworkUtils.java @@ -43,7 +43,12 @@ public static void launchFirework(@Nonnull Location l, @Nonnull Color color) { } public static @Nonnull Firework createFirework(@Nonnull Location l, @Nonnull Color color) { - Firework fw = (Firework) l.getWorld().spawnEntity(l, firework); + Firework fw; + try { + fw = (Firework) l.getWorld().spawnEntity(l, firework); + } catch (Exception ignored) { + fw = l.getWorld().spawn(l, Firework.class); + } FireworkMeta meta = fw.getFireworkMeta(); meta.setDisplayName(ChatColor.GREEN + "Slimefun Research"); diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/utils/JsonUtils.java b/src/main/java/io/github/thebusybiscuit/slimefun4/utils/JsonUtils.java index 57a7f3eb80..bddd1dc04d 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/utils/JsonUtils.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/utils/JsonUtils.java @@ -5,8 +5,6 @@ import com.google.gson.JsonElement; import com.google.gson.JsonParser; -import io.github.thebusybiscuit.slimefun4.api.MinecraftVersion; -import io.github.thebusybiscuit.slimefun4.implementation.Slimefun; /** * Some helper methods for dealing with Json data. @@ -30,20 +28,8 @@ private JsonUtils() {} * * @return The parsed {@link JsonElement} */ - @SuppressWarnings("deprecation") public static @Nonnull JsonElement parseString(@Nonnull String json) { - if (Slimefun.getMinecraftVersion().isAtLeast(MinecraftVersion.MINECRAFT_1_18)) { - /* - * As of 1.18 Spigot includes a newer version of Gson that - * favours static method access. - */ - return JsonParser.parseString(json); - } else { - /* - * For older versions, we will need to use this way. - */ - return new JsonParser().parse(json); - } + return JsonParser.parseString(json); } } diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/utils/biomes/BiomeMap.java b/src/main/java/io/github/thebusybiscuit/slimefun4/utils/biomes/BiomeMap.java index 872972c687..784b82d5d3 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/utils/biomes/BiomeMap.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/utils/biomes/BiomeMap.java @@ -4,7 +4,7 @@ import java.io.IOException; import java.io.InputStreamReader; import java.nio.charset.StandardCharsets; -import java.util.EnumMap; +import java.util.HashMap; import java.util.Map; import java.util.stream.Collectors; @@ -43,9 +43,9 @@ public class BiomeMap implements Keyed { /** - * Our internal {@link EnumMap} holding all the data. + * Our internal {@link Map} holding all the data. */ - private final Map dataMap = new EnumMap<>(Biome.class); + private final Map dataMap = new HashMap<>(); /** * The {@link NamespacedKey} to identify this {@link BiomeMap}. diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/utils/biomes/BiomeMapParser.java b/src/main/java/io/github/thebusybiscuit/slimefun4/utils/biomes/BiomeMapParser.java index 62d345acf8..0656b9bfe4 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/utils/biomes/BiomeMapParser.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/utils/biomes/BiomeMapParser.java @@ -1,8 +1,7 @@ package io.github.thebusybiscuit.slimefun4.utils.biomes; -import java.util.EnumMap; -import java.util.EnumSet; -import java.util.Locale; +import java.util.HashMap; +import java.util.HashSet; import java.util.Map; import java.util.Set; @@ -11,6 +10,7 @@ import org.apache.commons.lang.Validate; import org.bukkit.NamespacedKey; +import org.bukkit.Registry; import org.bukkit.block.Biome; import com.google.gson.JsonArray; @@ -18,10 +18,8 @@ import com.google.gson.JsonObject; import com.google.gson.JsonParseException; -import io.github.bakedlibs.dough.common.CommonPatterns; import io.github.thebusybiscuit.slimefun4.api.exceptions.BiomeMapException; import io.github.thebusybiscuit.slimefun4.utils.JsonUtils; -import io.github.thebusybiscuit.slimefun4.utils.PatternUtils; /** * The {@link BiomeMapParser} allows you to parse json data into a {@link BiomeMap}. @@ -40,7 +38,7 @@ public class BiomeMapParser { private final NamespacedKey key; private final BiomeDataConverter valueConverter; - private final Map map = new EnumMap<>(Biome.class); + private final Map map = new HashMap<>(); /** * This flag specifies whether the parsing is "lenient" or not. @@ -159,19 +157,20 @@ private void readEntry(@Nonnull JsonObject entry) throws BiomeMapException { private @Nonnull Set readBiomes(@Nonnull JsonArray array) throws BiomeMapException { Validate.notNull(array, "The JSON array should not be null!"); - Set biomes = EnumSet.noneOf(Biome.class); + Set biomes = new HashSet<>(); for (JsonElement element : array) { if (element.isJsonPrimitive() && element.getAsJsonPrimitive().isString()) { String value = element.getAsString(); - if (PatternUtils.MINECRAFT_NAMESPACEDKEY.matcher(value).matches()) { - String formattedValue = CommonPatterns.COLON.split(value)[1].toUpperCase(Locale.ROOT); + NamespacedKey biomeKey = NamespacedKey.fromString(value); - try { - Biome biome = Biome.valueOf(formattedValue); + if (biomeKey != null) { + Biome biome = Registry.BIOME.get(biomeKey); + + if (biome != null) { biomes.add(biome); - } catch (IllegalArgumentException x) { + } else { // Lenient Parsers will ignore unknown biomes if (isLenient) { continue; @@ -180,7 +179,7 @@ private void readEntry(@Nonnull JsonObject entry) throws BiomeMapException { throw new BiomeMapException(key, "The Biome '" + value + "' does not exist!"); } } else { - // The regular expression did not match + // The NamespacedKey could not be parsed throw new BiomeMapException(key, "Could not recognize value '" + value + "'"); } } else { diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/utils/compatibility/VersionedEnchantment.java b/src/main/java/io/github/thebusybiscuit/slimefun4/utils/compatibility/VersionedEnchantment.java index d5063ce413..135f9ace12 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/utils/compatibility/VersionedEnchantment.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/utils/compatibility/VersionedEnchantment.java @@ -17,6 +17,9 @@ public class VersionedEnchantment { public static final Enchantment LUCK_OF_THE_SEA; public static final Enchantment AQUA_AFFINITY; public static final Enchantment FORTUNE; + public static final Enchantment DENSITY; + public static final Enchantment BREACH; + public static final Enchantment WIND_BURST; static { // DIG_SPEED is renamed to EFFICIENCY in 1.20.5 @@ -39,6 +42,11 @@ public class VersionedEnchantment { // LOOT_BONUS_BLOCKS is renamed to FORTUNE in 1.20.5 FORTUNE = getKey("fortune"); + + // Added in 1.21 + DENSITY = getKey("density"); + BREACH = getKey("breach"); + WIND_BURST = getKey("wind_burst"); } @Nullable diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/utils/compatibility/VersionedEntityType.java b/src/main/java/io/github/thebusybiscuit/slimefun4/utils/compatibility/VersionedEntityType.java index 10ae11e803..8728cc5d6e 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/utils/compatibility/VersionedEntityType.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/utils/compatibility/VersionedEntityType.java @@ -13,6 +13,12 @@ public class VersionedEntityType { public static final EntityType MOOSHROOM; public static final EntityType SNOW_GOLEM; public static final EntityType FIREWORK; + public static final EntityType ARMADILLO; + public static final EntityType BOGGED; + public static final EntityType BREEZE; + public static final EntityType BREEZE_WIND_CHARGE; + public static final EntityType CREAKING; + public static final EntityType WIND_CHARGE; static { // MUSHROOM_COW is renamed to MOOSHROOM in 1.20.5 @@ -22,6 +28,16 @@ public class VersionedEntityType { SNOW_GOLEM = getKey("snow_golem"); FIREWORK = getKey("firework_rocket"); + + // Added in 1.21 + ARMADILLO = getKey("armadillo"); + BOGGED = getKey("bogged"); + BREEZE = getKey("breeze"); + BREEZE_WIND_CHARGE = getKey("breeze_wind_charge"); + + // Added in 1.21.2 + CREAKING = getKey("creaking"); + WIND_CHARGE = getKey("wind_charge"); } @Nullable diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/utils/compatibility/VersionedItemFlag.java b/src/main/java/io/github/thebusybiscuit/slimefun4/utils/compatibility/VersionedItemFlag.java index 507a903a23..3e2126ea98 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/utils/compatibility/VersionedItemFlag.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/utils/compatibility/VersionedItemFlag.java @@ -11,8 +11,22 @@ import io.github.thebusybiscuit.slimefun4.implementation.Slimefun; public class VersionedItemFlag { - + public static final ItemFlag HIDE_ADDITIONAL_TOOLTIP; + public static final ItemFlag HIDE_TOOLTIP; + public static final ItemFlag HIDE_VILLAGER_VARIANT; + public static final ItemFlag HIDE_WEAPON; + public static final ItemFlag HIDE_WOLF_COLLAR; + public static final ItemFlag HIDE_WOLF_SOUND_VARIANT; + public static final ItemFlag HIDE_WOLF_VARIANT; + public static final ItemFlag HIDE_WRITABLE_BOOK_CONTENT; + public static final ItemFlag HIDE_WRITTEN_BOOK_CONTENT; + public static final ItemFlag HIDE_LLAMA_VARIANT; + public static final ItemFlag HIDE_AXOLOTL_VARIANT; + public static final ItemFlag HIDE_CAT_VARIANT; + public static final ItemFlag HIDE_CAT_COLLAR; + public static final ItemFlag HIDE_SHEEP_COLOR; + public static final ItemFlag HIDE_SHULKER_COLOR; static { MinecraftVersion version = Slimefun.getMinecraftVersion(); @@ -20,6 +34,25 @@ public class VersionedItemFlag { HIDE_ADDITIONAL_TOOLTIP = version.isAtLeast(MinecraftVersion.MINECRAFT_1_20_5) ? ItemFlag.HIDE_ADDITIONAL_TOOLTIP : getKey("HIDE_POTION_EFFECTS"); + + ItemFlag hideTooltip = version.isAtLeast(MinecraftVersion.MINECRAFT_1_21) + ? getKey("HIDE_TOOLTIP") + : null; + HIDE_TOOLTIP = hideTooltip != null ? hideTooltip : HIDE_ADDITIONAL_TOOLTIP; + + HIDE_VILLAGER_VARIANT = getKey("HIDE_VILLAGER_VARIANT"); + HIDE_WEAPON = getKey("HIDE_WEAPON"); + HIDE_WOLF_COLLAR = getKey("HIDE_WOLF_COLLAR"); + HIDE_WOLF_SOUND_VARIANT = getKey("HIDE_WOLF_SOUND_VARIANT"); + HIDE_WOLF_VARIANT = getKey("HIDE_WOLF_VARIANT"); + HIDE_WRITABLE_BOOK_CONTENT = getKey("HIDE_WRITABLE_BOOK_CONTENT"); + HIDE_WRITTEN_BOOK_CONTENT = getKey("HIDE_WRITTEN_BOOK_CONTENT"); + HIDE_LLAMA_VARIANT = getKey("HIDE_LLAMA_VARIANT"); + HIDE_AXOLOTL_VARIANT = getKey("HIDE_AXOLOTL_VARIANT"); + HIDE_CAT_VARIANT = getKey("HIDE_CAT_VARIANT"); + HIDE_CAT_COLLAR = getKey("HIDE_CAT_COLLAR"); + HIDE_SHEEP_COLOR = getKey("HIDE_SHEEP_COLOR"); + HIDE_SHULKER_COLOR = getKey("HIDE_SHULKER_COLOR"); } @Nullable diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/utils/compatibility/VersionedMaterial.java b/src/main/java/io/github/thebusybiscuit/slimefun4/utils/compatibility/VersionedMaterial.java new file mode 100644 index 0000000000..e98f07dd4b --- /dev/null +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/utils/compatibility/VersionedMaterial.java @@ -0,0 +1,42 @@ +package io.github.thebusybiscuit.slimefun4.utils.compatibility; + +import org.bukkit.Material; + +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + +/** + * Utility class providing {@link Material} constants that may not exist on + * older Minecraft versions. Each field is initialised using + * {@link Material#matchMaterial(String)} to avoid {@link NoSuchFieldError} + * when running on legacy servers. + * + *

This class centralises lookups for new 1.21 materials so that other + * classes can reference them safely.

+ */ +public final class VersionedMaterial { + + private VersionedMaterial() { + } + + // 1.21 items + public static final Material ARMADILLO_SCUTE = get("ARMADILLO_SCUTE"); + public static final Material BREEZE_ROD = get("BREEZE_ROD"); + public static final Material WIND_CHARGE = get("WIND_CHARGE"); + public static final Material CREAKING_HEART = get("CREAKING_HEART"); + public static final Material OMINOUS_BOTTLE = get("OMINOUS_BOTTLE"); + public static final Material TRIAL_KEY = get("TRIAL_KEY"); + public static final Material VAULT = get("VAULT"); + public static final Material TRIAL_SPAWNER = get("TRIAL_SPAWNER"); + public static final Material HEAVY_CORE = get("HEAVY_CORE"); + public static final Material MACE = get("MACE"); + public static final Material WOLF_ARMOR = get("WOLF_ARMOR"); + public static final Material CRAFTER = get("CRAFTER"); + public static final Material COPPER_BULB = get("COPPER_BULB"); + public static final Material BREEZE_SPAWN_EGG = get("BREEZE_SPAWN_EGG"); + + @Nullable + private static Material get(@Nonnull String name) { + return Material.matchMaterial(name); + } +} diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/utils/compatibility/VersionedParticle.java b/src/main/java/io/github/thebusybiscuit/slimefun4/utils/compatibility/VersionedParticle.java index fafd340cc0..03957fd440 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/utils/compatibility/VersionedParticle.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/utils/compatibility/VersionedParticle.java @@ -21,6 +21,19 @@ public class VersionedParticle { public static final Particle WITCH; public static final Particle FIREWORK; public static final Particle ENCHANT; + public static final Particle BREEZE_WIND; + public static final Particle TRIAL_SPAWNER_DETECTION; + public static final Particle TRIAL_SPAWNER_DETECTION_OMINOUS; + public static final Particle TRIAL_SPAWNER_EJECTION; + public static final Particle TRIAL_SPAWNER_EJECTION_OMINOUS; + public static final Particle TRIAL_SPAWNER_SMOKE; + public static final Particle TRIAL_SPAWNER_SMOKE_OMINOUS; + public static final Particle TRIAL_OMEN; + public static final Particle OMINOUS_SPAWNING; + public static final Particle GUST; + public static final Particle SMALL_GUST; + public static final Particle GUST_EMITTER_LARGE; + public static final Particle GUST_EMITTER_SMALL; static { MinecraftVersion version = Slimefun.getMinecraftVersion(); @@ -64,6 +77,21 @@ public class VersionedParticle { ENCHANT = version.isAtLeast(MinecraftVersion.MINECRAFT_1_20_5) ? Particle.ENCHANT : getKey("ENCHANTMENT_TABLE"); + + // Added in 1.21 + BREEZE_WIND = getKey("BREEZE_WIND"); + TRIAL_SPAWNER_DETECTION = getKey("TRIAL_SPAWNER_DETECTION"); + TRIAL_SPAWNER_DETECTION_OMINOUS = getKey("TRIAL_SPAWNER_DETECTION_OMINOUS"); + TRIAL_SPAWNER_EJECTION = getKey("TRIAL_SPAWNER_EJECTION"); + TRIAL_SPAWNER_EJECTION_OMINOUS = getKey("TRIAL_SPAWNER_EJECTION_OMINOUS"); + TRIAL_SPAWNER_SMOKE = getKey("TRIAL_SPAWNER_SMOKE"); + TRIAL_SPAWNER_SMOKE_OMINOUS = getKey("TRIAL_SPAWNER_SMOKE_OMINOUS"); + TRIAL_OMEN = getKey("TRIAL_OMEN"); + OMINOUS_SPAWNING = getKey("OMINOUS_SPAWNING"); + GUST = getKey("GUST"); + SMALL_GUST = getKey("SMALL_GUST"); + GUST_EMITTER_LARGE = getKey("GUST_EMITTER_LARGE"); + GUST_EMITTER_SMALL = getKey("GUST_EMITTER_SMALL"); } @Nullable @@ -71,7 +99,8 @@ private static Particle getKey(@Nonnull String key) { try { Field field = Particle.class.getDeclaredField(key); return (Particle) field.get(null); - } catch(Exception e) { + } catch (Exception e) { + // Return null so callers can decide how to handle missing particles return null; } } diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/utils/compatibility/VersionedPotionEffectType.java b/src/main/java/io/github/thebusybiscuit/slimefun4/utils/compatibility/VersionedPotionEffectType.java index f3dbe6b6d1..49952e4067 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/utils/compatibility/VersionedPotionEffectType.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/utils/compatibility/VersionedPotionEffectType.java @@ -22,6 +22,10 @@ public class VersionedPotionEffectType { public static final PotionEffectType JUMP_BOOST; public static final PotionEffectType NAUSEA; public static final PotionEffectType RESISTANCE; + public static final PotionEffectType OOZING; + public static final PotionEffectType WEAVING; + public static final PotionEffectType WIND_CHARGED; + public static final PotionEffectType INFESTED; static { MinecraftVersion version = Slimefun.getMinecraftVersion(); @@ -61,6 +65,12 @@ public class VersionedPotionEffectType { RESISTANCE = version.isAtLeast(MinecraftVersion.MINECRAFT_1_20_5) ? PotionEffectType.RESISTANCE : getKey("DAMAGE_RESISTANCE"); + + // Added in 1.21 + OOZING = getKey("OOZING"); + WEAVING = getKey("WEAVING"); + WIND_CHARGED = getKey("WIND_CHARGED"); + INFESTED = getKey("INFESTED"); } @Nullable diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/utils/compatibility/VersionedPotionType.java b/src/main/java/io/github/thebusybiscuit/slimefun4/utils/compatibility/VersionedPotionType.java index 1713d77baf..c2483ec3b6 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/utils/compatibility/VersionedPotionType.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/utils/compatibility/VersionedPotionType.java @@ -18,6 +18,10 @@ public class VersionedPotionType { public static final PotionType HEALING; public static final PotionType HARMING; public static final PotionType REGENERATION; + public static final PotionType OOZING; + public static final PotionType WEAVING; + public static final PotionType WIND_CHARGED; + public static final PotionType INFESTED; static { MinecraftVersion version = Slimefun.getMinecraftVersion(); @@ -41,6 +45,12 @@ public class VersionedPotionType { REGENERATION = version.isAtLeast(MinecraftVersion.MINECRAFT_1_20_5) ? PotionType.REGENERATION : getKey("REGEN"); + + // Added in 1.21 + OOZING = getKey("OOZING"); + WEAVING = getKey("WEAVING"); + WIND_CHARGED = getKey("WIND_CHARGED"); + INFESTED = getKey("INFESTED"); } @Nullable diff --git a/src/main/resources/languages/ar/messages.yml b/src/main/resources/languages/ar/messages.yml index ebf8011e98..0d7a05c752 100644 --- a/src/main/resources/languages/ar/messages.yml +++ b/src/main/resources/languages/ar/messages.yml @@ -156,6 +156,7 @@ machines: HOLOGRAM_PROJECTOR: enter-text: '&7الرجاء كتابة النص المجسم في الشات. &r(رموز الألوان مدعومة!)' inventory-title: 'محرر النص المجسم' + projector-missing: '&4The hologram projector was removed before your message could be saved.' ELEVATOR: no-destinations: '&4لا يوجد وجهات' pick-a-floor: '&3- اختر طابق -' diff --git a/src/main/resources/languages/bg/messages.yml b/src/main/resources/languages/bg/messages.yml index b4553da96d..822edaa6a8 100644 --- a/src/main/resources/languages/bg/messages.yml +++ b/src/main/resources/languages/bg/messages.yml @@ -251,6 +251,7 @@ machines: HOLOGRAM_PROJECTOR: enter-text: '&7Моля въведете желания текст за Хологрмата във вашият чат. &r(Цветовите Кодове са поддържани!)' inventory-title: 'Редактор на Холограми' + projector-missing: '&4The hologram projector was removed before your message could be saved.' ELEVATOR: no-destinations: '&4Нямаше намерени дестинации' pick-a-floor: '&3- Изберете Етаж -' diff --git a/src/main/resources/languages/cs/messages.yml b/src/main/resources/languages/cs/messages.yml index cf75d51422..76cca7396c 100644 --- a/src/main/resources/languages/cs/messages.yml +++ b/src/main/resources/languages/cs/messages.yml @@ -251,6 +251,7 @@ machines: HOLOGRAM_PROJECTOR: enter-text: '&7Napiš do chatu zprávu, kterou chceš, aby hologram ukazoval. &r(Barvy jsou podporovány!)' inventory-title: 'Editor hologramu' + projector-missing: '&4The hologram projector was removed before your message could be saved.' ELEVATOR: no-destinations: '&4Žádné destinace nebyly nalezeny' pick-a-floor: '&3- Vyber si patro -' diff --git a/src/main/resources/languages/de/messages.yml b/src/main/resources/languages/de/messages.yml index 5debea0c8e..d5e7e94bea 100644 --- a/src/main/resources/languages/de/messages.yml +++ b/src/main/resources/languages/de/messages.yml @@ -254,6 +254,7 @@ machines: HOLOGRAM_PROJECTOR: enter-text: '&7Bitte gebe ins Chatfenser einen Text für dieses Hologram ein. &r(Farbcodes werden unterstützt!)' inventory-title: 'Hologrammeditor' + projector-missing: '&4The hologram projector was removed before your message could be saved.' ELEVATOR: no-destinations: '&4Es konnten keine weiteren Etagen gefunden werden' pick-a-floor: '&3- Wähle eine Etage -' diff --git a/src/main/resources/languages/en/messages.yml b/src/main/resources/languages/en/messages.yml index 77bd80895a..c7d1ec9702 100644 --- a/src/main/resources/languages/en/messages.yml +++ b/src/main/resources/languages/en/messages.yml @@ -316,6 +316,7 @@ machines: HOLOGRAM_PROJECTOR: enter-text: '&7Please enter your desired Hologram Text into your Chat. &r(Color Codes are supported!)' inventory-title: 'Hologram Editor' + projector-missing: '&4The hologram projector was removed before your message could be saved.' ELEVATOR: no-destinations: '&4No destinations found' diff --git a/src/main/resources/languages/es/messages.yml b/src/main/resources/languages/es/messages.yml index a512c91313..d48fb4d013 100644 --- a/src/main/resources/languages/es/messages.yml +++ b/src/main/resources/languages/es/messages.yml @@ -251,6 +251,7 @@ machines: HOLOGRAM_PROJECTOR: enter-text: '&7Por favor, escribe en el chat el texto deseado. &r(¡Se permiten códigos de color!)' inventory-title: 'Editor de Holograma' + projector-missing: '&4The hologram projector was removed before your message could be saved.' ELEVATOR: no-destinations: '&4No se han encontrado destinos.' pick-a-floor: '&3- Selecciona un piso -' diff --git a/src/main/resources/languages/fa/messages.yml b/src/main/resources/languages/fa/messages.yml index eadfe05e13..30567b3f5e 100644 --- a/src/main/resources/languages/fa/messages.yml +++ b/src/main/resources/languages/fa/messages.yml @@ -87,6 +87,7 @@ messages: machines: HOLOGRAM_PROJECTOR: inventory-title: 'ویرایشگر هولوگرام' + projector-missing: '&4The hologram projector was removed before your message could be saved.' ELEVATOR: no-destinations: '&4مقصدی پیدا نشد' TELEPORTER: diff --git a/src/main/resources/languages/fr/messages.yml b/src/main/resources/languages/fr/messages.yml index a3ef433730..791df226d5 100644 --- a/src/main/resources/languages/fr/messages.yml +++ b/src/main/resources/languages/fr/messages.yml @@ -255,6 +255,7 @@ machines: HOLOGRAM_PROJECTOR: enter-text: '&7Veuillez saisir le texte voulu pour votre hologramme dans le chat. &r(Les codes couleur sont acceptés !)' inventory-title: 'Éditeur d''hologramme' + projector-missing: '&4The hologram projector was removed before your message could be saved.' ELEVATOR: no-destinations: '&4Aucune destination trouvée' pick-a-floor: '&3- Sélectionnez un étage -' diff --git a/src/main/resources/languages/he/messages.yml b/src/main/resources/languages/he/messages.yml index 00041a9ad0..a2158a8c53 100644 --- a/src/main/resources/languages/he/messages.yml +++ b/src/main/resources/languages/he/messages.yml @@ -255,6 +255,7 @@ machines: HOLOGRAM_PROJECTOR: enter-text: '&7אנא הכנס את טקסט ההולוגרמה לצ''ט שלך. &r( קודי צבע נתמכים!)' inventory-title: 'עורך הולוגרמה' + projector-missing: '&4The hologram projector was removed before your message could be saved.' ELEVATOR: no-destinations: '&4לא נמצאו יעדים ' pick-a-floor: '&3- בחר קומה -' diff --git a/src/main/resources/languages/hu/messages.yml b/src/main/resources/languages/hu/messages.yml index 9f135acb48..ce29498b21 100644 --- a/src/main/resources/languages/hu/messages.yml +++ b/src/main/resources/languages/hu/messages.yml @@ -256,6 +256,7 @@ machines: HOLOGRAM_PROJECTOR: enter-text: '&7Kérlek, írd be a kívánt hologram szöveget a chatre. &r(Színkódok is használhatóak!)' inventory-title: 'Hologram szerkesztő' + projector-missing: '&4The hologram projector was removed before your message could be saved.' ELEVATOR: no-destinations: '&4Nem található úticél' pick-a-floor: '&3- Válassz emeletet -' diff --git a/src/main/resources/languages/id/messages.yml b/src/main/resources/languages/id/messages.yml index d19eb84def..6e8f4ceb0c 100644 --- a/src/main/resources/languages/id/messages.yml +++ b/src/main/resources/languages/id/messages.yml @@ -186,6 +186,7 @@ machines: HOLOGRAM_PROJECTOR: enter-text: '&7Masukan teks sesuai yang anda inginkan. &r(Mendukung warna teks!)' inventory-title: 'Pengedit hologram' + projector-missing: '&4The hologram projector was removed before your message could be saved.' ELEVATOR: no-destinations: '&4Tujuan tidak ditemukan' pick-a-floor: '&3- Pilih Lantai -' diff --git a/src/main/resources/languages/ja/messages.yml b/src/main/resources/languages/ja/messages.yml index 43a343ae1f..9e8e9ceac1 100644 --- a/src/main/resources/languages/ja/messages.yml +++ b/src/main/resources/languages/ja/messages.yml @@ -253,6 +253,7 @@ machines: HOLOGRAM_PROJECTOR: enter-text: '&7指定したい文字列をチャットに入力してください&r(カラーコード対応)' inventory-title: 'ホログラムエディタ' + projector-missing: '&4The hologram projector was removed before your message could be saved.' ELEVATOR: no-destinations: '&4他の階が見つかりません' pick-a-floor: '&3- 行先の選択 -' diff --git a/src/main/resources/languages/ko/messages.yml b/src/main/resources/languages/ko/messages.yml index 85d87150ff..2e87d4a2bd 100644 --- a/src/main/resources/languages/ko/messages.yml +++ b/src/main/resources/languages/ko/messages.yml @@ -172,6 +172,7 @@ machines: HOLOGRAM_PROJECTOR: enter-text: '&7원하는 홀로그램 텍스트를 대화 상자에 입력해 주십시오. &r(색상 코드가 지원됨!)' inventory-title: '홀로그램 편집기' + projector-missing: '&4The hologram projector was removed before your message could be saved.' ELEVATOR: no-destinations: "&4대상을 찾을 수 없습니다.\n" pick-a-floor: "&3- 바닥을 고르세요 -\n" diff --git a/src/main/resources/languages/nl/messages.yml b/src/main/resources/languages/nl/messages.yml index 049d06f7ee..50350f6df5 100644 --- a/src/main/resources/languages/nl/messages.yml +++ b/src/main/resources/languages/nl/messages.yml @@ -252,6 +252,7 @@ machines: HOLOGRAM_PROJECTOR: enter-text: '&7Type astublieft de gewenste text in het gespreksvenster. &r(Kleurcodes zijn ondersteund)' inventory-title: 'Hologram-editor' + projector-missing: '&4The hologram projector was removed before your message could be saved.' ELEVATOR: no-destinations: '&4Geen doelen gevonden' pick-a-floor: '&3- Kies een verdieping -' diff --git a/src/main/resources/languages/pl/messages.yml b/src/main/resources/languages/pl/messages.yml index bae152e144..1545164ffa 100644 --- a/src/main/resources/languages/pl/messages.yml +++ b/src/main/resources/languages/pl/messages.yml @@ -171,6 +171,7 @@ machines: HOLOGRAM_PROJECTOR: enter-text: '&7Wprowadź żądany tekst hologramu na czacie. &r(Kody kolorów są obsługiwane!)' inventory-title: 'Edytor hologramów' + projector-missing: '&4The hologram projector was removed before your message could be saved.' ELEVATOR: no-destinations: '&4Nie znaleziono miejsc docelowych' pick-a-floor: '&3- Wybierz piętro-' diff --git a/src/main/resources/languages/pt-BR/messages.yml b/src/main/resources/languages/pt-BR/messages.yml index 9b63333863..3bc8cc46e4 100644 --- a/src/main/resources/languages/pt-BR/messages.yml +++ b/src/main/resources/languages/pt-BR/messages.yml @@ -198,6 +198,7 @@ machines: HOLOGRAM_PROJECTOR: enter-text: '&7Digite o nome do holograma no bate-papo. &r(Códigos de cores são suportados!)' inventory-title: 'Editor de Holograma' + projector-missing: '&4The hologram projector was removed before your message could be saved.' ELEVATOR: no-destinations: '&4Nenhum destino encontrado!' pick-a-floor: '&3- Escolha um andar -' diff --git a/src/main/resources/languages/pt/messages.yml b/src/main/resources/languages/pt/messages.yml index 23ddfacb86..3b24bf9346 100644 --- a/src/main/resources/languages/pt/messages.yml +++ b/src/main/resources/languages/pt/messages.yml @@ -168,6 +168,7 @@ machines: unknown-recipe: '&4Receita desconhecida! &cUsa a receita correta!' HOLOGRAM_PROJECTOR: inventory-title: 'Editor de Holograma' + projector-missing: '&4The hologram projector was removed before your message could be saved.' ELEVATOR: no-destinations: '&4Não foram encontrados destinos' pick-a-floor: '&3- Escolha um piso -' diff --git a/src/main/resources/languages/ru/messages.yml b/src/main/resources/languages/ru/messages.yml index 61b0dbfb5b..bd8a5530f5 100644 --- a/src/main/resources/languages/ru/messages.yml +++ b/src/main/resources/languages/ru/messages.yml @@ -224,6 +224,7 @@ machines: HOLOGRAM_PROJECTOR: enter-text: '&7Пожалуйста, введите желаемый текст для голограммы в чат. &r(можно использовать цветовые коды!)' inventory-title: 'Редактирование голограммы' + projector-missing: '&4The hologram projector was removed before your message could be saved.' ELEVATOR: no-destinations: '&4Этажи не найдены' pick-a-floor: '&3- Выберите пункт назначения -' diff --git a/src/main/resources/languages/sk/messages.yml b/src/main/resources/languages/sk/messages.yml index 17e1f58236..8c8a064fdd 100644 --- a/src/main/resources/languages/sk/messages.yml +++ b/src/main/resources/languages/sk/messages.yml @@ -153,6 +153,7 @@ machines: HOLOGRAM_PROJECTOR: enter-text: '&7Prosím napíš text pre hologram do chatu. &r(Kódy farieb sú podporované!)' inventory-title: 'Editor hologramu' + projector-missing: '&4The hologram projector was removed before your message could be saved.' ELEVATOR: no-destinations: '&4Nenájdený žiaden cieľ' pick-a-floor: '&3- Výber podlažia -' diff --git a/src/main/resources/languages/sv/messages.yml b/src/main/resources/languages/sv/messages.yml index aa141bee30..ed9e53d136 100644 --- a/src/main/resources/languages/sv/messages.yml +++ b/src/main/resources/languages/sv/messages.yml @@ -158,6 +158,7 @@ machines: HOLOGRAM_PROJECTOR: enter-text: '&7Skriv in önskad hologramtext i chatten &r(färgkoder stöds!)' inventory-title: 'Hologramändrare' + projector-missing: '&4The hologram projector was removed before your message could be saved.' ELEVATOR: no-destinations: '&4Ingen destination funnen' pick-a-floor: '&3- Välj en våning -' diff --git a/src/main/resources/languages/th/messages.yml b/src/main/resources/languages/th/messages.yml index b2a7cbac04..2dd73a44ef 100644 --- a/src/main/resources/languages/th/messages.yml +++ b/src/main/resources/languages/th/messages.yml @@ -145,6 +145,7 @@ machines: HOLOGRAM_PROJECTOR: enter-text: '&7โปรดพิมพ์ข้อความที่คุณต้องการแสดง Hologram ในแชท. &r(รองรับรหัสสี!)' inventory-title: 'แก้ไข Hologram' + projector-missing: '&4The hologram projector was removed before your message could be saved.' ELEVATOR: no-destinations: '&4ไม่พบจุดหมาย' pick-a-floor: '&3- เลือกชั้น -' diff --git a/src/main/resources/languages/tr/messages.yml b/src/main/resources/languages/tr/messages.yml index eb3a9f2276..d478a43ef0 100644 --- a/src/main/resources/languages/tr/messages.yml +++ b/src/main/resources/languages/tr/messages.yml @@ -239,6 +239,7 @@ machines: HOLOGRAM_PROJECTOR: enter-text: '&7Lütfen Sohbette istediğiniz Hologram Metnini yazın. &r(Renk Kodları destekleniyor!)' inventory-title: 'Hologram Editörü' + projector-missing: '&4The hologram projector was removed before your message could be saved.' ELEVATOR: no-destinations: '&4Varış noktası bulunamadı' pick-a-floor: '&3- Bir kat seçin -' diff --git a/src/main/resources/languages/uk/messages.yml b/src/main/resources/languages/uk/messages.yml index 7546559141..5d2457f519 100644 --- a/src/main/resources/languages/uk/messages.yml +++ b/src/main/resources/languages/uk/messages.yml @@ -154,6 +154,7 @@ machines: HOLOGRAM_PROJECTOR: enter-text: '&7Будь ласка, введіть бажаний текст для голограми в чат. &r(кольори підтримуються!)' inventory-title: 'Редагування голограми' + projector-missing: '&4The hologram projector was removed before your message could be saved.' ELEVATOR: no-destinations: '&4Поверхи не знайдено' pick-a-floor: '&3- Виберіть поверх -' diff --git a/src/main/resources/languages/vi/messages.yml b/src/main/resources/languages/vi/messages.yml index 7fec92891b..87fb46681a 100644 --- a/src/main/resources/languages/vi/messages.yml +++ b/src/main/resources/languages/vi/messages.yml @@ -201,6 +201,7 @@ machines: HOLOGRAM_PROJECTOR: enter-text: '&7Vui lòng nhập Văn Bản Ba Chiều mong muốn của bạn vào Khung trò chuyện. &r(Mã màu được hỗ trợ!)' inventory-title: 'Trình chỉnh sửa ảnh ba chiều' + projector-missing: '&4The hologram projector was removed before your message could be saved.' ELEVATOR: no-destinations: '&4Không tìm thấy điểm đến' pick-a-floor: '&4- Chọn một tầng -' diff --git a/src/main/resources/languages/zh-CN/messages.yml b/src/main/resources/languages/zh-CN/messages.yml index e79b887552..8c83e46560 100644 --- a/src/main/resources/languages/zh-CN/messages.yml +++ b/src/main/resources/languages/zh-CN/messages.yml @@ -276,6 +276,7 @@ machines: HOLOGRAM_PROJECTOR: enter-text: '&7请写下想显示在全息文本上的话. &r(支持颜色代码)' inventory-title: '全息图像编辑器' + projector-missing: '&4The hologram projector was removed before your message could be saved.' ELEVATOR: no-destinations: '&4找不到上下楼' pick-a-floor: '&3- 选择一个楼层 -' diff --git a/src/main/resources/languages/zh-TW/messages.yml b/src/main/resources/languages/zh-TW/messages.yml index 548f26bce6..3ae5c27cac 100644 --- a/src/main/resources/languages/zh-TW/messages.yml +++ b/src/main/resources/languages/zh-TW/messages.yml @@ -252,6 +252,7 @@ machines: HOLOGRAM_PROJECTOR: enter-text: '&7請輸入你想要顯示的文字訊息。 &r(可以輸入顏色代碼)' inventory-title: '全息投影編輯器' + projector-missing: '&4The hologram projector was removed before your message could be saved.' ELEVATOR: no-destinations: '&4找不到目的地' pick-a-floor: '&3- 選擇樓層 -' diff --git a/src/main/resources/tags/cargo_supported_storage_blocks.json b/src/main/resources/tags/cargo_supported_storage_blocks.json index eb960c5e48..cc02b20bb6 100644 --- a/src/main/resources/tags/cargo_supported_storage_blocks.json +++ b/src/main/resources/tags/cargo_supported_storage_blocks.json @@ -1,11 +1,12 @@ { - "values" : [ - "#slimefun:shulker_boxes", - "minecraft:chest", - "minecraft:trapped_chest", - "minecraft:barrel", - "minecraft:furnace", - "minecraft:dispenser", + "values" : [ + "#slimefun:shulker_boxes", + "minecraft:chest", + "minecraft:trapped_chest", + "minecraft:barrel", + "minecraft:crafter", + "minecraft:furnace", + "minecraft:dispenser", "minecraft:dropper", "minecraft:hopper", "minecraft:brewing_stand", diff --git a/src/test/java/io/github/thebusybiscuit/slimefun4/TestPluginClass.java b/src/test/java/io/github/thebusybiscuit/slimefun4/TestPluginClass.java index 1d22dd98ed..c51a1a2934 100644 --- a/src/test/java/io/github/thebusybiscuit/slimefun4/TestPluginClass.java +++ b/src/test/java/io/github/thebusybiscuit/slimefun4/TestPluginClass.java @@ -9,7 +9,7 @@ import io.github.thebusybiscuit.slimefun4.api.MinecraftVersion; import io.github.thebusybiscuit.slimefun4.implementation.Slimefun; -import be.seeseemelk.mockbukkit.MockBukkit; +import org.mockbukkit.mockbukkit.MockBukkit; class TestPluginClass { diff --git a/src/test/java/io/github/thebusybiscuit/slimefun4/api/events/TestSlimefunBlockBreakEvent.java b/src/test/java/io/github/thebusybiscuit/slimefun4/api/events/TestSlimefunBlockBreakEvent.java index 9eb9225213..d73205abed 100644 --- a/src/test/java/io/github/thebusybiscuit/slimefun4/api/events/TestSlimefunBlockBreakEvent.java +++ b/src/test/java/io/github/thebusybiscuit/slimefun4/api/events/TestSlimefunBlockBreakEvent.java @@ -1,9 +1,9 @@ package io.github.thebusybiscuit.slimefun4.api.events; -import be.seeseemelk.mockbukkit.MockBukkit; -import be.seeseemelk.mockbukkit.ServerMock; -import be.seeseemelk.mockbukkit.block.BlockMock; -import be.seeseemelk.mockbukkit.entity.PlayerMock; +import org.mockbukkit.mockbukkit.MockBukkit; +import org.mockbukkit.mockbukkit.ServerMock; +import org.mockbukkit.mockbukkit.block.BlockMock; +import org.mockbukkit.mockbukkit.entity.PlayerMock; import io.github.thebusybiscuit.slimefun4.api.items.SlimefunItem; import io.github.thebusybiscuit.slimefun4.implementation.Slimefun; import io.github.thebusybiscuit.slimefun4.implementation.listeners.BlockListener; diff --git a/src/test/java/io/github/thebusybiscuit/slimefun4/api/events/TestSlimefunBlockPlaceEvent.java b/src/test/java/io/github/thebusybiscuit/slimefun4/api/events/TestSlimefunBlockPlaceEvent.java index c33db57184..860a5ea2a9 100644 --- a/src/test/java/io/github/thebusybiscuit/slimefun4/api/events/TestSlimefunBlockPlaceEvent.java +++ b/src/test/java/io/github/thebusybiscuit/slimefun4/api/events/TestSlimefunBlockPlaceEvent.java @@ -1,9 +1,9 @@ package io.github.thebusybiscuit.slimefun4.api.events; -import be.seeseemelk.mockbukkit.MockBukkit; -import be.seeseemelk.mockbukkit.ServerMock; -import be.seeseemelk.mockbukkit.block.BlockMock; -import be.seeseemelk.mockbukkit.entity.PlayerMock; +import org.mockbukkit.mockbukkit.MockBukkit; +import org.mockbukkit.mockbukkit.ServerMock; +import org.mockbukkit.mockbukkit.block.BlockMock; +import org.mockbukkit.mockbukkit.entity.PlayerMock; import io.github.thebusybiscuit.slimefun4.api.items.SlimefunItem; import io.github.thebusybiscuit.slimefun4.implementation.Slimefun; import io.github.thebusybiscuit.slimefun4.implementation.listeners.BlockListener; diff --git a/src/test/java/io/github/thebusybiscuit/slimefun4/api/events/TestSlimefunRegistryFinalizedEvent.java b/src/test/java/io/github/thebusybiscuit/slimefun4/api/events/TestSlimefunRegistryFinalizedEvent.java index bef63828c9..95ca372cff 100644 --- a/src/test/java/io/github/thebusybiscuit/slimefun4/api/events/TestSlimefunRegistryFinalizedEvent.java +++ b/src/test/java/io/github/thebusybiscuit/slimefun4/api/events/TestSlimefunRegistryFinalizedEvent.java @@ -7,8 +7,8 @@ import org.junit.jupiter.api.DisplayName; import org.junit.jupiter.api.Test; -import be.seeseemelk.mockbukkit.MockBukkit; -import be.seeseemelk.mockbukkit.ServerMock; +import org.mockbukkit.mockbukkit.MockBukkit; +import org.mockbukkit.mockbukkit.ServerMock; import io.github.thebusybiscuit.slimefun4.implementation.Slimefun; import io.github.thebusybiscuit.slimefun4.implementation.setup.PostSetup; diff --git a/src/test/java/io/github/thebusybiscuit/slimefun4/api/events/TestTalismanActivateEvent.java b/src/test/java/io/github/thebusybiscuit/slimefun4/api/events/TestTalismanActivateEvent.java index 40cfc61fe5..4f5844d223 100644 --- a/src/test/java/io/github/thebusybiscuit/slimefun4/api/events/TestTalismanActivateEvent.java +++ b/src/test/java/io/github/thebusybiscuit/slimefun4/api/events/TestTalismanActivateEvent.java @@ -1,7 +1,7 @@ package io.github.thebusybiscuit.slimefun4.api.events; -import be.seeseemelk.mockbukkit.MockBukkit; -import be.seeseemelk.mockbukkit.ServerMock; +import org.mockbukkit.mockbukkit.MockBukkit; +import org.mockbukkit.mockbukkit.ServerMock; import io.github.thebusybiscuit.slimefun4.api.items.SlimefunItem; import io.github.thebusybiscuit.slimefun4.implementation.Slimefun; import io.github.thebusybiscuit.slimefun4.implementation.SlimefunItems; diff --git a/src/test/java/io/github/thebusybiscuit/slimefun4/api/geo/TestResourceRegistration.java b/src/test/java/io/github/thebusybiscuit/slimefun4/api/geo/TestResourceRegistration.java index 53f9eb906b..fe39e33c1e 100644 --- a/src/test/java/io/github/thebusybiscuit/slimefun4/api/geo/TestResourceRegistration.java +++ b/src/test/java/io/github/thebusybiscuit/slimefun4/api/geo/TestResourceRegistration.java @@ -23,7 +23,7 @@ import io.github.thebusybiscuit.slimefun4.implementation.resources.GEOResourcesSetup; import io.github.thebusybiscuit.slimefun4.utils.SlimefunUtils; -import be.seeseemelk.mockbukkit.MockBukkit; +import org.mockbukkit.mockbukkit.MockBukkit; @TestMethodOrder(value = OrderAnnotation.class) class TestResourceRegistration { diff --git a/src/test/java/io/github/thebusybiscuit/slimefun4/api/gps/TestWaypoints.java b/src/test/java/io/github/thebusybiscuit/slimefun4/api/gps/TestWaypoints.java index 3b769c44a0..d456631817 100644 --- a/src/test/java/io/github/thebusybiscuit/slimefun4/api/gps/TestWaypoints.java +++ b/src/test/java/io/github/thebusybiscuit/slimefun4/api/gps/TestWaypoints.java @@ -16,8 +16,8 @@ import io.github.thebusybiscuit.slimefun4.test.TestUtilities; import io.github.thebusybiscuit.slimefun4.utils.FileUtils; -import be.seeseemelk.mockbukkit.MockBukkit; -import be.seeseemelk.mockbukkit.ServerMock; +import org.mockbukkit.mockbukkit.MockBukkit; +import org.mockbukkit.mockbukkit.ServerMock; class TestWaypoints { diff --git a/src/test/java/io/github/thebusybiscuit/slimefun4/api/items/settings/TestDoubleRangeSetting.java b/src/test/java/io/github/thebusybiscuit/slimefun4/api/items/settings/TestDoubleRangeSetting.java index de8e8b0179..a89704df2c 100644 --- a/src/test/java/io/github/thebusybiscuit/slimefun4/api/items/settings/TestDoubleRangeSetting.java +++ b/src/test/java/io/github/thebusybiscuit/slimefun4/api/items/settings/TestDoubleRangeSetting.java @@ -12,7 +12,7 @@ import io.github.thebusybiscuit.slimefun4.implementation.Slimefun; import io.github.thebusybiscuit.slimefun4.test.TestUtilities; -import be.seeseemelk.mockbukkit.MockBukkit; +import org.mockbukkit.mockbukkit.MockBukkit; class TestDoubleRangeSetting { diff --git a/src/test/java/io/github/thebusybiscuit/slimefun4/api/items/settings/TestEnumSetting.java b/src/test/java/io/github/thebusybiscuit/slimefun4/api/items/settings/TestEnumSetting.java index 9b41cd8807..0961331628 100644 --- a/src/test/java/io/github/thebusybiscuit/slimefun4/api/items/settings/TestEnumSetting.java +++ b/src/test/java/io/github/thebusybiscuit/slimefun4/api/items/settings/TestEnumSetting.java @@ -12,7 +12,7 @@ import io.github.thebusybiscuit.slimefun4.implementation.Slimefun; import io.github.thebusybiscuit.slimefun4.test.TestUtilities; -import be.seeseemelk.mockbukkit.MockBukkit; +import org.mockbukkit.mockbukkit.MockBukkit; class TestEnumSetting { diff --git a/src/test/java/io/github/thebusybiscuit/slimefun4/api/items/settings/TestIntRangeSetting.java b/src/test/java/io/github/thebusybiscuit/slimefun4/api/items/settings/TestIntRangeSetting.java index 24d644a45e..1077243dab 100644 --- a/src/test/java/io/github/thebusybiscuit/slimefun4/api/items/settings/TestIntRangeSetting.java +++ b/src/test/java/io/github/thebusybiscuit/slimefun4/api/items/settings/TestIntRangeSetting.java @@ -12,7 +12,7 @@ import io.github.thebusybiscuit.slimefun4.implementation.Slimefun; import io.github.thebusybiscuit.slimefun4.test.TestUtilities; -import be.seeseemelk.mockbukkit.MockBukkit; +import org.mockbukkit.mockbukkit.MockBukkit; class TestIntRangeSetting { diff --git a/src/test/java/io/github/thebusybiscuit/slimefun4/api/items/settings/TestItemSettings.java b/src/test/java/io/github/thebusybiscuit/slimefun4/api/items/settings/TestItemSettings.java index 47004780a0..db9e1efc3d 100644 --- a/src/test/java/io/github/thebusybiscuit/slimefun4/api/items/settings/TestItemSettings.java +++ b/src/test/java/io/github/thebusybiscuit/slimefun4/api/items/settings/TestItemSettings.java @@ -15,7 +15,7 @@ import io.github.thebusybiscuit.slimefun4.implementation.Slimefun; import io.github.thebusybiscuit.slimefun4.test.TestUtilities; -import be.seeseemelk.mockbukkit.MockBukkit; +import org.mockbukkit.mockbukkit.MockBukkit; class TestItemSettings { diff --git a/src/test/java/io/github/thebusybiscuit/slimefun4/api/items/settings/TestMaterialTagSetting.java b/src/test/java/io/github/thebusybiscuit/slimefun4/api/items/settings/TestMaterialTagSetting.java index 0154809ebe..120d37d5f3 100644 --- a/src/test/java/io/github/thebusybiscuit/slimefun4/api/items/settings/TestMaterialTagSetting.java +++ b/src/test/java/io/github/thebusybiscuit/slimefun4/api/items/settings/TestMaterialTagSetting.java @@ -18,7 +18,7 @@ import io.github.thebusybiscuit.slimefun4.implementation.Slimefun; import io.github.thebusybiscuit.slimefun4.test.TestUtilities; -import be.seeseemelk.mockbukkit.MockBukkit; +import org.mockbukkit.mockbukkit.MockBukkit; class TestMaterialTagSetting { diff --git a/src/test/java/io/github/thebusybiscuit/slimefun4/api/profiles/TestAsyncProfileLoadEvent.java b/src/test/java/io/github/thebusybiscuit/slimefun4/api/profiles/TestAsyncProfileLoadEvent.java index 17ea900f19..9d6b198d6e 100644 --- a/src/test/java/io/github/thebusybiscuit/slimefun4/api/profiles/TestAsyncProfileLoadEvent.java +++ b/src/test/java/io/github/thebusybiscuit/slimefun4/api/profiles/TestAsyncProfileLoadEvent.java @@ -14,9 +14,9 @@ import io.github.thebusybiscuit.slimefun4.test.TestUtilities; import io.github.thebusybiscuit.slimefun4.test.mocks.MockProfile; -import be.seeseemelk.mockbukkit.MockBukkit; -import be.seeseemelk.mockbukkit.ServerMock; -import be.seeseemelk.mockbukkit.entity.OfflinePlayerMock; +import org.mockbukkit.mockbukkit.MockBukkit; +import org.mockbukkit.mockbukkit.ServerMock; +import org.mockbukkit.mockbukkit.entity.OfflinePlayerMock; class TestAsyncProfileLoadEvent { diff --git a/src/test/java/io/github/thebusybiscuit/slimefun4/api/profiles/TestGuideHistory.java b/src/test/java/io/github/thebusybiscuit/slimefun4/api/profiles/TestGuideHistory.java index fc8441b463..f340f047ef 100644 --- a/src/test/java/io/github/thebusybiscuit/slimefun4/api/profiles/TestGuideHistory.java +++ b/src/test/java/io/github/thebusybiscuit/slimefun4/api/profiles/TestGuideHistory.java @@ -18,8 +18,8 @@ import io.github.thebusybiscuit.slimefun4.implementation.Slimefun; import io.github.thebusybiscuit.slimefun4.test.TestUtilities; -import be.seeseemelk.mockbukkit.MockBukkit; -import be.seeseemelk.mockbukkit.ServerMock; +import org.mockbukkit.mockbukkit.MockBukkit; +import org.mockbukkit.mockbukkit.ServerMock; class TestGuideHistory { diff --git a/src/test/java/io/github/thebusybiscuit/slimefun4/api/profiles/TestPlayerBackpacks.java b/src/test/java/io/github/thebusybiscuit/slimefun4/api/profiles/TestPlayerBackpacks.java index 90d475d479..a0e5b1733a 100644 --- a/src/test/java/io/github/thebusybiscuit/slimefun4/api/profiles/TestPlayerBackpacks.java +++ b/src/test/java/io/github/thebusybiscuit/slimefun4/api/profiles/TestPlayerBackpacks.java @@ -14,8 +14,8 @@ import io.github.thebusybiscuit.slimefun4.implementation.Slimefun; import io.github.thebusybiscuit.slimefun4.test.TestUtilities; -import be.seeseemelk.mockbukkit.MockBukkit; -import be.seeseemelk.mockbukkit.ServerMock; +import org.mockbukkit.mockbukkit.MockBukkit; +import org.mockbukkit.mockbukkit.ServerMock; class TestPlayerBackpacks { diff --git a/src/test/java/io/github/thebusybiscuit/slimefun4/api/profiles/TestPlayerProfile.java b/src/test/java/io/github/thebusybiscuit/slimefun4/api/profiles/TestPlayerProfile.java index 61c49f0c32..5ef860eea5 100644 --- a/src/test/java/io/github/thebusybiscuit/slimefun4/api/profiles/TestPlayerProfile.java +++ b/src/test/java/io/github/thebusybiscuit/slimefun4/api/profiles/TestPlayerProfile.java @@ -16,9 +16,9 @@ import io.github.thebusybiscuit.slimefun4.implementation.Slimefun; import io.github.thebusybiscuit.slimefun4.test.TestUtilities; -import be.seeseemelk.mockbukkit.MockBukkit; -import be.seeseemelk.mockbukkit.ServerMock; -import be.seeseemelk.mockbukkit.entity.OfflinePlayerMock; +import org.mockbukkit.mockbukkit.MockBukkit; +import org.mockbukkit.mockbukkit.ServerMock; +import org.mockbukkit.mockbukkit.entity.OfflinePlayerMock; class TestPlayerProfile { diff --git a/src/test/java/io/github/thebusybiscuit/slimefun4/core/commands/TestBackpackCommand.java b/src/test/java/io/github/thebusybiscuit/slimefun4/core/commands/TestBackpackCommand.java index 9b876fc822..7c913c47ca 100644 --- a/src/test/java/io/github/thebusybiscuit/slimefun4/core/commands/TestBackpackCommand.java +++ b/src/test/java/io/github/thebusybiscuit/slimefun4/core/commands/TestBackpackCommand.java @@ -21,8 +21,8 @@ import io.github.thebusybiscuit.slimefun4.test.TestUtilities; import io.github.thebusybiscuit.slimefun4.utils.SlimefunUtils; -import be.seeseemelk.mockbukkit.MockBukkit; -import be.seeseemelk.mockbukkit.ServerMock; +import org.mockbukkit.mockbukkit.MockBukkit; +import org.mockbukkit.mockbukkit.ServerMock; class TestBackpackCommand { diff --git a/src/test/java/io/github/thebusybiscuit/slimefun4/core/commands/TestChargeCommand.java b/src/test/java/io/github/thebusybiscuit/slimefun4/core/commands/TestChargeCommand.java index 6ca4577a16..b1af366ab5 100644 --- a/src/test/java/io/github/thebusybiscuit/slimefun4/core/commands/TestChargeCommand.java +++ b/src/test/java/io/github/thebusybiscuit/slimefun4/core/commands/TestChargeCommand.java @@ -18,8 +18,8 @@ import io.github.thebusybiscuit.slimefun4.test.TestUtilities; import io.github.thebusybiscuit.slimefun4.utils.LoreBuilder; -import be.seeseemelk.mockbukkit.MockBukkit; -import be.seeseemelk.mockbukkit.ServerMock; +import org.mockbukkit.mockbukkit.MockBukkit; +import org.mockbukkit.mockbukkit.ServerMock; class TestChargeCommand { diff --git a/src/test/java/io/github/thebusybiscuit/slimefun4/core/commands/TestDebugFishCommand.java b/src/test/java/io/github/thebusybiscuit/slimefun4/core/commands/TestDebugFishCommand.java index 476f6aeaab..bae730ee24 100644 --- a/src/test/java/io/github/thebusybiscuit/slimefun4/core/commands/TestDebugFishCommand.java +++ b/src/test/java/io/github/thebusybiscuit/slimefun4/core/commands/TestDebugFishCommand.java @@ -12,8 +12,8 @@ import io.github.thebusybiscuit.slimefun4.implementation.SlimefunItems; import io.github.thebusybiscuit.slimefun4.utils.SlimefunUtils; -import be.seeseemelk.mockbukkit.MockBukkit; -import be.seeseemelk.mockbukkit.ServerMock; +import org.mockbukkit.mockbukkit.MockBukkit; +import org.mockbukkit.mockbukkit.ServerMock; class TestDebugFishCommand { diff --git a/src/test/java/io/github/thebusybiscuit/slimefun4/core/commands/TestGuideCommand.java b/src/test/java/io/github/thebusybiscuit/slimefun4/core/commands/TestGuideCommand.java index 57560503a7..3f7e7f8d49 100644 --- a/src/test/java/io/github/thebusybiscuit/slimefun4/core/commands/TestGuideCommand.java +++ b/src/test/java/io/github/thebusybiscuit/slimefun4/core/commands/TestGuideCommand.java @@ -14,8 +14,8 @@ import io.github.thebusybiscuit.slimefun4.implementation.Slimefun; import io.github.thebusybiscuit.slimefun4.utils.SlimefunUtils; -import be.seeseemelk.mockbukkit.MockBukkit; -import be.seeseemelk.mockbukkit.ServerMock; +import org.mockbukkit.mockbukkit.MockBukkit; +import org.mockbukkit.mockbukkit.ServerMock; class TestGuideCommand { diff --git a/src/test/java/io/github/thebusybiscuit/slimefun4/core/commands/TestResearchCommand.java b/src/test/java/io/github/thebusybiscuit/slimefun4/core/commands/TestResearchCommand.java index 00fdecdb9a..8f8fbbb930 100644 --- a/src/test/java/io/github/thebusybiscuit/slimefun4/core/commands/TestResearchCommand.java +++ b/src/test/java/io/github/thebusybiscuit/slimefun4/core/commands/TestResearchCommand.java @@ -13,8 +13,8 @@ import io.github.thebusybiscuit.slimefun4.implementation.Slimefun; import io.github.thebusybiscuit.slimefun4.test.TestUtilities; -import be.seeseemelk.mockbukkit.MockBukkit; -import be.seeseemelk.mockbukkit.ServerMock; +import org.mockbukkit.mockbukkit.MockBukkit; +import org.mockbukkit.mockbukkit.ServerMock; class TestResearchCommand { diff --git a/src/test/java/io/github/thebusybiscuit/slimefun4/core/debug/TestDebugLogging.java b/src/test/java/io/github/thebusybiscuit/slimefun4/core/debug/TestDebugLogging.java index cc7caf76ca..15faf0eef5 100644 --- a/src/test/java/io/github/thebusybiscuit/slimefun4/core/debug/TestDebugLogging.java +++ b/src/test/java/io/github/thebusybiscuit/slimefun4/core/debug/TestDebugLogging.java @@ -14,7 +14,7 @@ import io.github.thebusybiscuit.slimefun4.implementation.Slimefun; -import be.seeseemelk.mockbukkit.MockBukkit; +import org.mockbukkit.mockbukkit.MockBukkit; class TestDebugLogging { diff --git a/src/test/java/io/github/thebusybiscuit/slimefun4/core/guide/TestGuideOpening.java b/src/test/java/io/github/thebusybiscuit/slimefun4/core/guide/TestGuideOpening.java index a8685b9736..74752efeb4 100644 --- a/src/test/java/io/github/thebusybiscuit/slimefun4/core/guide/TestGuideOpening.java +++ b/src/test/java/io/github/thebusybiscuit/slimefun4/core/guide/TestGuideOpening.java @@ -25,8 +25,8 @@ import io.github.thebusybiscuit.slimefun4.implementation.Slimefun; import io.github.thebusybiscuit.slimefun4.test.TestUtilities; -import be.seeseemelk.mockbukkit.MockBukkit; -import be.seeseemelk.mockbukkit.ServerMock; +import org.mockbukkit.mockbukkit.MockBukkit; +import org.mockbukkit.mockbukkit.ServerMock; class TestGuideOpening { diff --git a/src/test/java/io/github/thebusybiscuit/slimefun4/core/multiblocks/TestMultiBlocks.java b/src/test/java/io/github/thebusybiscuit/slimefun4/core/multiblocks/TestMultiBlocks.java index e3d408e7e3..b84801a7d0 100644 --- a/src/test/java/io/github/thebusybiscuit/slimefun4/core/multiblocks/TestMultiBlocks.java +++ b/src/test/java/io/github/thebusybiscuit/slimefun4/core/multiblocks/TestMultiBlocks.java @@ -13,7 +13,7 @@ import io.github.thebusybiscuit.slimefun4.implementation.Slimefun; import io.github.thebusybiscuit.slimefun4.test.TestUtilities; -import be.seeseemelk.mockbukkit.MockBukkit; +import org.mockbukkit.mockbukkit.MockBukkit; class TestMultiBlocks { diff --git a/src/test/java/io/github/thebusybiscuit/slimefun4/core/networks/TestNetworkManager.java b/src/test/java/io/github/thebusybiscuit/slimefun4/core/networks/TestNetworkManager.java index 4ac8db287e..c17e683b20 100644 --- a/src/test/java/io/github/thebusybiscuit/slimefun4/core/networks/TestNetworkManager.java +++ b/src/test/java/io/github/thebusybiscuit/slimefun4/core/networks/TestNetworkManager.java @@ -21,8 +21,8 @@ import io.github.thebusybiscuit.slimefun4.core.networks.cargo.CargoNet; import io.github.thebusybiscuit.slimefun4.test.mocks.MockNetwork; -import be.seeseemelk.mockbukkit.MockBukkit; -import be.seeseemelk.mockbukkit.ServerMock; +import org.mockbukkit.mockbukkit.MockBukkit; +import org.mockbukkit.mockbukkit.ServerMock; class TestNetworkManager { diff --git a/src/test/java/io/github/thebusybiscuit/slimefun4/core/researching/TestProfileResearches.java b/src/test/java/io/github/thebusybiscuit/slimefun4/core/researching/TestProfileResearches.java index c6072275eb..49a151b3cf 100644 --- a/src/test/java/io/github/thebusybiscuit/slimefun4/core/researching/TestProfileResearches.java +++ b/src/test/java/io/github/thebusybiscuit/slimefun4/core/researching/TestProfileResearches.java @@ -15,8 +15,8 @@ import io.github.thebusybiscuit.slimefun4.implementation.Slimefun; import io.github.thebusybiscuit.slimefun4.test.TestUtilities; -import be.seeseemelk.mockbukkit.MockBukkit; -import be.seeseemelk.mockbukkit.ServerMock; +import org.mockbukkit.mockbukkit.MockBukkit; +import org.mockbukkit.mockbukkit.ServerMock; class TestProfileResearches { diff --git a/src/test/java/io/github/thebusybiscuit/slimefun4/core/researching/TestResearchUnlocking.java b/src/test/java/io/github/thebusybiscuit/slimefun4/core/researching/TestResearchUnlocking.java index 7d376cc111..9ccb2740c7 100644 --- a/src/test/java/io/github/thebusybiscuit/slimefun4/core/researching/TestResearchUnlocking.java +++ b/src/test/java/io/github/thebusybiscuit/slimefun4/core/researching/TestResearchUnlocking.java @@ -19,8 +19,8 @@ import io.github.thebusybiscuit.slimefun4.api.researches.Research; import io.github.thebusybiscuit.slimefun4.implementation.Slimefun; -import be.seeseemelk.mockbukkit.MockBukkit; -import be.seeseemelk.mockbukkit.ServerMock; +import org.mockbukkit.mockbukkit.MockBukkit; +import org.mockbukkit.mockbukkit.ServerMock; class TestResearchUnlocking { diff --git a/src/test/java/io/github/thebusybiscuit/slimefun4/core/researching/TestResearches.java b/src/test/java/io/github/thebusybiscuit/slimefun4/core/researching/TestResearches.java index fd8a5864e1..471edc7e40 100644 --- a/src/test/java/io/github/thebusybiscuit/slimefun4/core/researching/TestResearches.java +++ b/src/test/java/io/github/thebusybiscuit/slimefun4/core/researching/TestResearches.java @@ -22,8 +22,8 @@ import io.github.thebusybiscuit.slimefun4.implementation.Slimefun; import io.github.thebusybiscuit.slimefun4.test.TestUtilities; -import be.seeseemelk.mockbukkit.MockBukkit; -import be.seeseemelk.mockbukkit.ServerMock; +import org.mockbukkit.mockbukkit.MockBukkit; +import org.mockbukkit.mockbukkit.ServerMock; class TestResearches { diff --git a/src/test/java/io/github/thebusybiscuit/slimefun4/core/services/TestBlockDataService.java b/src/test/java/io/github/thebusybiscuit/slimefun4/core/services/TestBlockDataService.java index 909f050f26..a183ce4d25 100644 --- a/src/test/java/io/github/thebusybiscuit/slimefun4/core/services/TestBlockDataService.java +++ b/src/test/java/io/github/thebusybiscuit/slimefun4/core/services/TestBlockDataService.java @@ -10,7 +10,7 @@ import io.github.thebusybiscuit.slimefun4.implementation.Slimefun; -import be.seeseemelk.mockbukkit.MockBukkit; +import org.mockbukkit.mockbukkit.MockBukkit; class TestBlockDataService { diff --git a/src/test/java/io/github/thebusybiscuit/slimefun4/core/services/TestCustomTextureService.java b/src/test/java/io/github/thebusybiscuit/slimefun4/core/services/TestCustomTextureService.java index 919de0d374..54351b004a 100644 --- a/src/test/java/io/github/thebusybiscuit/slimefun4/core/services/TestCustomTextureService.java +++ b/src/test/java/io/github/thebusybiscuit/slimefun4/core/services/TestCustomTextureService.java @@ -15,7 +15,7 @@ import io.github.thebusybiscuit.slimefun4.implementation.Slimefun; import io.github.thebusybiscuit.slimefun4.test.TestUtilities; -import be.seeseemelk.mockbukkit.MockBukkit; +import org.mockbukkit.mockbukkit.MockBukkit; class TestCustomTextureService { diff --git a/src/test/java/io/github/thebusybiscuit/slimefun4/core/services/TestItemDataService.java b/src/test/java/io/github/thebusybiscuit/slimefun4/core/services/TestItemDataService.java index ec323ff6f4..8ecc13ff79 100644 --- a/src/test/java/io/github/thebusybiscuit/slimefun4/core/services/TestItemDataService.java +++ b/src/test/java/io/github/thebusybiscuit/slimefun4/core/services/TestItemDataService.java @@ -14,7 +14,7 @@ import io.github.thebusybiscuit.slimefun4.implementation.Slimefun; -import be.seeseemelk.mockbukkit.MockBukkit; +import org.mockbukkit.mockbukkit.MockBukkit; class TestItemDataService { diff --git a/src/test/java/io/github/thebusybiscuit/slimefun4/core/services/TestPermissionsService.java b/src/test/java/io/github/thebusybiscuit/slimefun4/core/services/TestPermissionsService.java index c5d692ebc4..6f32a7c14a 100644 --- a/src/test/java/io/github/thebusybiscuit/slimefun4/core/services/TestPermissionsService.java +++ b/src/test/java/io/github/thebusybiscuit/slimefun4/core/services/TestPermissionsService.java @@ -20,8 +20,8 @@ import io.github.thebusybiscuit.slimefun4.implementation.Slimefun; import io.github.thebusybiscuit.slimefun4.test.TestUtilities; -import be.seeseemelk.mockbukkit.MockBukkit; -import be.seeseemelk.mockbukkit.ServerMock; +import org.mockbukkit.mockbukkit.MockBukkit; +import org.mockbukkit.mockbukkit.ServerMock; class TestPermissionsService { diff --git a/src/test/java/io/github/thebusybiscuit/slimefun4/core/services/TestRecipeService.java b/src/test/java/io/github/thebusybiscuit/slimefun4/core/services/TestRecipeService.java index bc30dbf583..6662113673 100644 --- a/src/test/java/io/github/thebusybiscuit/slimefun4/core/services/TestRecipeService.java +++ b/src/test/java/io/github/thebusybiscuit/slimefun4/core/services/TestRecipeService.java @@ -21,8 +21,8 @@ import io.github.bakedlibs.dough.recipes.RecipeSnapshot; import io.github.thebusybiscuit.slimefun4.implementation.Slimefun; -import be.seeseemelk.mockbukkit.MockBukkit; -import be.seeseemelk.mockbukkit.ServerMock; +import org.mockbukkit.mockbukkit.MockBukkit; +import org.mockbukkit.mockbukkit.ServerMock; class TestRecipeService { @@ -46,7 +46,7 @@ void testRecipe() { MinecraftRecipeService service = new MinecraftRecipeService(plugin); NamespacedKey key = new NamespacedKey(plugin, "furnace_recipe_test"); - ItemStack result = new ItemStack(Material.EMERALD_BLOCK); + ItemStack result = new ItemStack(Material.BEDROCK); FurnaceRecipe recipe = new FurnaceRecipe(key, result, new MaterialChoice(Material.DIAMOND), 1, 2); server.addRecipe(recipe); diff --git a/src/test/java/io/github/thebusybiscuit/slimefun4/core/services/TestUpdaterService.java b/src/test/java/io/github/thebusybiscuit/slimefun4/core/services/TestUpdaterService.java index 4de8e01e62..53c29a56a9 100644 --- a/src/test/java/io/github/thebusybiscuit/slimefun4/core/services/TestUpdaterService.java +++ b/src/test/java/io/github/thebusybiscuit/slimefun4/core/services/TestUpdaterService.java @@ -8,10 +8,13 @@ import org.junit.jupiter.api.DisplayName; import org.junit.jupiter.api.Test; +import io.github.bakedlibs.dough.updater.PluginUpdater; +import io.github.bakedlibs.dough.versions.PrefixedVersion; import io.github.thebusybiscuit.slimefun4.api.SlimefunBranch; import io.github.thebusybiscuit.slimefun4.implementation.Slimefun; -import be.seeseemelk.mockbukkit.MockBukkit; +import org.mockbukkit.mockbukkit.MockBukkit; +import org.mockito.Mockito; class TestUpdaterService { @@ -36,8 +39,7 @@ void testDevelopmentBuilds() { UpdaterService service = new UpdaterService(plugin, "Dev - 131 (git 123456)", file); Assertions.assertEquals(SlimefunBranch.DEVELOPMENT, service.getBranch()); Assertions.assertTrue(service.getBranch().isOfficial()); - // Cannot currently be tested... yay - // Assertions.assertEquals(131, service.getBuildNumber()); + Assertions.assertEquals(131, service.getBuildNumber()); } @Test @@ -46,8 +48,15 @@ void testStableBuilds() { UpdaterService service = new UpdaterService(plugin, "RC - 6 (git 123456)", file); Assertions.assertEquals(SlimefunBranch.STABLE, service.getBranch()); Assertions.assertTrue(service.getBranch().isOfficial()); - // Cannot currently be tested... yay - // Assertions.assertEquals(6, service.getBuildNumber()); + Assertions.assertEquals(6, service.getBuildNumber()); + } + + @Test + @DisplayName("Test build parsing with invalid number") + void testInvalidBuildNumber() { + UpdaterService service = new UpdaterService(plugin, "Dev - abc", file); + Assertions.assertEquals(SlimefunBranch.DEVELOPMENT, service.getBranch()); + Assertions.assertEquals(-1, service.getBuildNumber()); } @Test @@ -67,4 +76,30 @@ void testUnknownBuilds() { Assertions.assertFalse(service.getBranch().isOfficial()); Assertions.assertEquals(-1, service.getBuildNumber()); } + + @Test + @DisplayName("Test if auto-update config is respected") + void testAutoUpdateConfig() { + PluginUpdater updater = Mockito.mock(PluginUpdater.class); + UpdaterService service = new UpdaterService(plugin, updater, SlimefunBranch.DEVELOPMENT); + + Slimefun.getCfg().setValue("options.auto-update", false); + Assertions.assertFalse(service.isEnabled()); + + Slimefun.getCfg().setValue("options.auto-update", true); + Assertions.assertTrue(service.isEnabled()); + } + + @Test + @DisplayName("Test getting the latest version") + void testGetLatestVersion() { + PluginUpdater updater = Mockito.mock(PluginUpdater.class); + PrefixedVersion version = Mockito.mock(PrefixedVersion.class); + Mockito.when(version.getVersionNumber()).thenReturn(42); + java.util.concurrent.CompletableFuture future = java.util.concurrent.CompletableFuture.completedFuture(version); + Mockito.when(updater.getLatestVersion()).thenReturn(future); + + UpdaterService service = new UpdaterService(plugin, updater, SlimefunBranch.DEVELOPMENT); + Assertions.assertEquals(42, service.getLatestVersion()); + } } diff --git a/src/test/java/io/github/thebusybiscuit/slimefun4/core/services/localization/AbstractLocaleRegexChecker.java b/src/test/java/io/github/thebusybiscuit/slimefun4/core/services/localization/AbstractLocaleRegexChecker.java index df8668f285..abab336655 100644 --- a/src/test/java/io/github/thebusybiscuit/slimefun4/core/services/localization/AbstractLocaleRegexChecker.java +++ b/src/test/java/io/github/thebusybiscuit/slimefun4/core/services/localization/AbstractLocaleRegexChecker.java @@ -24,7 +24,7 @@ import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.params.provider.Arguments; -import be.seeseemelk.mockbukkit.MockBukkit; +import org.mockbukkit.mockbukkit.MockBukkit; class AbstractLocaleRegexChecker { diff --git a/src/test/java/io/github/thebusybiscuit/slimefun4/implementation/items/TestDamageableItem.java b/src/test/java/io/github/thebusybiscuit/slimefun4/implementation/items/TestDamageableItem.java index 7a97e33cf3..493dded997 100644 --- a/src/test/java/io/github/thebusybiscuit/slimefun4/implementation/items/TestDamageableItem.java +++ b/src/test/java/io/github/thebusybiscuit/slimefun4/implementation/items/TestDamageableItem.java @@ -21,8 +21,8 @@ import io.github.thebusybiscuit.slimefun4.test.TestUtilities; import io.github.thebusybiscuit.slimefun4.test.mocks.MockDamageable; import io.github.thebusybiscuit.slimefun4.utils.compatibility.VersionedEnchantment; -import be.seeseemelk.mockbukkit.MockBukkit; -import be.seeseemelk.mockbukkit.ServerMock; +import org.mockbukkit.mockbukkit.MockBukkit; +import org.mockbukkit.mockbukkit.ServerMock; class TestDamageableItem { diff --git a/src/test/java/io/github/thebusybiscuit/slimefun4/implementation/items/TestRadioactiveItem.java b/src/test/java/io/github/thebusybiscuit/slimefun4/implementation/items/TestRadioactiveItem.java index 6c7853da2d..065cdf8415 100644 --- a/src/test/java/io/github/thebusybiscuit/slimefun4/implementation/items/TestRadioactiveItem.java +++ b/src/test/java/io/github/thebusybiscuit/slimefun4/implementation/items/TestRadioactiveItem.java @@ -16,7 +16,7 @@ import io.github.thebusybiscuit.slimefun4.implementation.Slimefun; import io.github.thebusybiscuit.slimefun4.test.TestUtilities; -import be.seeseemelk.mockbukkit.MockBukkit; +import org.mockbukkit.mockbukkit.MockBukkit; class TestRadioactiveItem { diff --git a/src/test/java/io/github/thebusybiscuit/slimefun4/implementation/items/TestSlimefunItem.java b/src/test/java/io/github/thebusybiscuit/slimefun4/implementation/items/TestSlimefunItem.java index 1bd21a0d3f..aaed1084a8 100644 --- a/src/test/java/io/github/thebusybiscuit/slimefun4/implementation/items/TestSlimefunItem.java +++ b/src/test/java/io/github/thebusybiscuit/slimefun4/implementation/items/TestSlimefunItem.java @@ -21,7 +21,7 @@ import io.github.thebusybiscuit.slimefun4.implementation.Slimefun; import io.github.thebusybiscuit.slimefun4.test.TestUtilities; -import be.seeseemelk.mockbukkit.MockBukkit; +import org.mockbukkit.mockbukkit.MockBukkit; class TestSlimefunItem { diff --git a/src/test/java/io/github/thebusybiscuit/slimefun4/implementation/items/autocrafters/TestAbstractRecipe.java b/src/test/java/io/github/thebusybiscuit/slimefun4/implementation/items/autocrafters/TestAbstractRecipe.java index 3ff2381f4b..1ac9ba49f7 100644 --- a/src/test/java/io/github/thebusybiscuit/slimefun4/implementation/items/autocrafters/TestAbstractRecipe.java +++ b/src/test/java/io/github/thebusybiscuit/slimefun4/implementation/items/autocrafters/TestAbstractRecipe.java @@ -21,7 +21,7 @@ import io.github.bakedlibs.dough.items.CustomItemStack; import io.github.thebusybiscuit.slimefun4.implementation.Slimefun; -import be.seeseemelk.mockbukkit.MockBukkit; +import org.mockbukkit.mockbukkit.MockBukkit; class TestAbstractRecipe { diff --git a/src/test/java/io/github/thebusybiscuit/slimefun4/implementation/items/autocrafters/TestAutoCrafter.java b/src/test/java/io/github/thebusybiscuit/slimefun4/implementation/items/autocrafters/TestAutoCrafter.java index ac40d14416..05aea22f44 100644 --- a/src/test/java/io/github/thebusybiscuit/slimefun4/implementation/items/autocrafters/TestAutoCrafter.java +++ b/src/test/java/io/github/thebusybiscuit/slimefun4/implementation/items/autocrafters/TestAutoCrafter.java @@ -21,9 +21,9 @@ import io.github.thebusybiscuit.slimefun4.implementation.Slimefun; import io.github.thebusybiscuit.slimefun4.test.TestUtilities; -import be.seeseemelk.mockbukkit.MockBukkit; -import be.seeseemelk.mockbukkit.inventory.ChestInventoryMock; -import be.seeseemelk.mockbukkit.inventory.InventoryMock; +import org.mockbukkit.mockbukkit.MockBukkit; +import org.mockbukkit.mockbukkit.inventory.ChestInventoryMock; +import org.mockbukkit.mockbukkit.inventory.InventoryMock; class TestAutoCrafter { diff --git a/src/test/java/io/github/thebusybiscuit/slimefun4/implementation/items/backpacks/TestEnderBackpack.java b/src/test/java/io/github/thebusybiscuit/slimefun4/implementation/items/backpacks/TestEnderBackpack.java index 62b22112a1..3ef90400bd 100644 --- a/src/test/java/io/github/thebusybiscuit/slimefun4/implementation/items/backpacks/TestEnderBackpack.java +++ b/src/test/java/io/github/thebusybiscuit/slimefun4/implementation/items/backpacks/TestEnderBackpack.java @@ -15,8 +15,8 @@ import io.github.thebusybiscuit.slimefun4.test.TestUtilities; import io.github.thebusybiscuit.slimefun4.test.presets.SlimefunItemTest; -import be.seeseemelk.mockbukkit.MockBukkit; -import be.seeseemelk.mockbukkit.ServerMock; +import org.mockbukkit.mockbukkit.MockBukkit; +import org.mockbukkit.mockbukkit.ServerMock; class TestEnderBackpack implements SlimefunItemTest { diff --git a/src/test/java/io/github/thebusybiscuit/slimefun4/implementation/items/electric/machines/TestAutoBrewerPotions.java b/src/test/java/io/github/thebusybiscuit/slimefun4/implementation/items/electric/machines/TestAutoBrewerPotions.java new file mode 100644 index 0000000000..ceb78ea7d6 --- /dev/null +++ b/src/test/java/io/github/thebusybiscuit/slimefun4/implementation/items/electric/machines/TestAutoBrewerPotions.java @@ -0,0 +1,40 @@ +package io.github.thebusybiscuit.slimefun4.implementation.items.electric.machines; + +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNotNull; + +import java.lang.reflect.Field; +import java.util.Map; + +import org.bukkit.Material; +import org.bukkit.potion.PotionType; +import org.junit.jupiter.api.Test; + +import io.github.thebusybiscuit.slimefun4.implementation.items.electric.machines.AutoBrewer; +import io.github.thebusybiscuit.slimefun4.utils.compatibility.VersionedPotionType; +import io.github.thebusybiscuit.slimefun4.utils.compatibility.VersionedMaterial; + +class TestAutoBrewerPotions { + + @SuppressWarnings("unchecked") + private Map getPotionRecipes() throws Exception { + Field field = AutoBrewer.class.getDeclaredField("potionRecipes"); + field.setAccessible(true); + return (Map) field.get(null); + } + + @Test + void testNewPotionRecipes() throws Exception { + Map recipes = getPotionRecipes(); + + assertEquals(VersionedPotionType.OOZING, recipes.get(Material.SLIME_BLOCK)); + assertEquals(VersionedPotionType.WEAVING, recipes.get(Material.COBWEB)); + assertEquals(VersionedPotionType.INFESTED, recipes.get(Material.STONE)); + + if (VersionedMaterial.BREEZE_ROD != null) { + assertEquals(VersionedPotionType.WIND_CHARGED, recipes.get(VersionedMaterial.BREEZE_ROD)); + } else { + assertNotNull(VersionedMaterial.BREEZE_ROD, "BREEZE_ROD material should exist on 1.21"); + } + } +} diff --git a/src/test/java/io/github/thebusybiscuit/slimefun4/implementation/items/food/TestDietCookie.java b/src/test/java/io/github/thebusybiscuit/slimefun4/implementation/items/food/TestDietCookie.java index 693e5f03cf..53c32cbb2b 100644 --- a/src/test/java/io/github/thebusybiscuit/slimefun4/implementation/items/food/TestDietCookie.java +++ b/src/test/java/io/github/thebusybiscuit/slimefun4/implementation/items/food/TestDietCookie.java @@ -16,9 +16,9 @@ import io.github.thebusybiscuit.slimefun4.test.TestUtilities; import io.github.thebusybiscuit.slimefun4.test.presets.SlimefunItemTest; -import be.seeseemelk.mockbukkit.MockBukkit; -import be.seeseemelk.mockbukkit.ServerMock; -import be.seeseemelk.mockbukkit.entity.PlayerMock; +import org.mockbukkit.mockbukkit.MockBukkit; +import org.mockbukkit.mockbukkit.ServerMock; +import org.mockbukkit.mockbukkit.entity.PlayerMock; class TestDietCookie implements SlimefunItemTest { diff --git a/src/test/java/io/github/thebusybiscuit/slimefun4/implementation/items/food/TestMeatJerky.java b/src/test/java/io/github/thebusybiscuit/slimefun4/implementation/items/food/TestMeatJerky.java index ea78037705..b91affafb6 100644 --- a/src/test/java/io/github/thebusybiscuit/slimefun4/implementation/items/food/TestMeatJerky.java +++ b/src/test/java/io/github/thebusybiscuit/slimefun4/implementation/items/food/TestMeatJerky.java @@ -14,9 +14,9 @@ import io.github.thebusybiscuit.slimefun4.test.TestUtilities; import io.github.thebusybiscuit.slimefun4.test.presets.SlimefunItemTest; -import be.seeseemelk.mockbukkit.MockBukkit; -import be.seeseemelk.mockbukkit.ServerMock; -import be.seeseemelk.mockbukkit.entity.PlayerMock; +import org.mockbukkit.mockbukkit.MockBukkit; +import org.mockbukkit.mockbukkit.ServerMock; +import org.mockbukkit.mockbukkit.entity.PlayerMock; class TestMeatJerky implements SlimefunItemTest { diff --git a/src/test/java/io/github/thebusybiscuit/slimefun4/implementation/items/food/TestMonsterJerky.java b/src/test/java/io/github/thebusybiscuit/slimefun4/implementation/items/food/TestMonsterJerky.java index ed279f4e93..e033f7e0b5 100644 --- a/src/test/java/io/github/thebusybiscuit/slimefun4/implementation/items/food/TestMonsterJerky.java +++ b/src/test/java/io/github/thebusybiscuit/slimefun4/implementation/items/food/TestMonsterJerky.java @@ -15,9 +15,9 @@ import io.github.thebusybiscuit.slimefun4.test.TestUtilities; import io.github.thebusybiscuit.slimefun4.test.presets.SlimefunItemTest; -import be.seeseemelk.mockbukkit.MockBukkit; -import be.seeseemelk.mockbukkit.ServerMock; -import be.seeseemelk.mockbukkit.entity.PlayerMock; +import org.mockbukkit.mockbukkit.MockBukkit; +import org.mockbukkit.mockbukkit.ServerMock; +import org.mockbukkit.mockbukkit.entity.PlayerMock; class TestMonsterJerky implements SlimefunItemTest { diff --git a/src/test/java/io/github/thebusybiscuit/slimefun4/implementation/items/tools/TestClimbingPick.java b/src/test/java/io/github/thebusybiscuit/slimefun4/implementation/items/tools/TestClimbingPick.java index 9a43bc12f5..3ffc94836c 100644 --- a/src/test/java/io/github/thebusybiscuit/slimefun4/implementation/items/tools/TestClimbingPick.java +++ b/src/test/java/io/github/thebusybiscuit/slimefun4/implementation/items/tools/TestClimbingPick.java @@ -28,10 +28,10 @@ import io.github.thebusybiscuit.slimefun4.utils.compatibility.VersionedEnchantment; import io.github.thebusybiscuit.slimefun4.utils.tags.SlimefunTag; -import be.seeseemelk.mockbukkit.MockBukkit; -import be.seeseemelk.mockbukkit.ServerMock; -import be.seeseemelk.mockbukkit.block.BlockMock; -import be.seeseemelk.mockbukkit.entity.PlayerMock; +import org.mockbukkit.mockbukkit.MockBukkit; +import org.mockbukkit.mockbukkit.ServerMock; +import org.mockbukkit.mockbukkit.block.BlockMock; +import org.mockbukkit.mockbukkit.entity.PlayerMock; class TestClimbingPick implements SlimefunItemTest { diff --git a/src/test/java/io/github/thebusybiscuit/slimefun4/implementation/items/tools/TestPortableDustbin.java b/src/test/java/io/github/thebusybiscuit/slimefun4/implementation/items/tools/TestPortableDustbin.java index 8b9d710a37..a62767fde5 100644 --- a/src/test/java/io/github/thebusybiscuit/slimefun4/implementation/items/tools/TestPortableDustbin.java +++ b/src/test/java/io/github/thebusybiscuit/slimefun4/implementation/items/tools/TestPortableDustbin.java @@ -16,8 +16,8 @@ import io.github.thebusybiscuit.slimefun4.test.TestUtilities; import io.github.thebusybiscuit.slimefun4.test.presets.SlimefunItemTest; -import be.seeseemelk.mockbukkit.MockBukkit; -import be.seeseemelk.mockbukkit.ServerMock; +import org.mockbukkit.mockbukkit.MockBukkit; +import org.mockbukkit.mockbukkit.ServerMock; class TestPortableDustbin implements SlimefunItemTest { diff --git a/src/test/java/io/github/thebusybiscuit/slimefun4/implementation/items/tools/TestTapeMeasure.java b/src/test/java/io/github/thebusybiscuit/slimefun4/implementation/items/tools/TestTapeMeasure.java index 6a05e5c34e..317d081edb 100644 --- a/src/test/java/io/github/thebusybiscuit/slimefun4/implementation/items/tools/TestTapeMeasure.java +++ b/src/test/java/io/github/thebusybiscuit/slimefun4/implementation/items/tools/TestTapeMeasure.java @@ -21,11 +21,11 @@ import io.github.thebusybiscuit.slimefun4.test.TestUtilities; import io.github.thebusybiscuit.slimefun4.test.presets.SlimefunItemTest; -import be.seeseemelk.mockbukkit.MockBukkit; -import be.seeseemelk.mockbukkit.ServerMock; -import be.seeseemelk.mockbukkit.WorldMock; -import be.seeseemelk.mockbukkit.block.BlockMock; -import be.seeseemelk.mockbukkit.entity.PlayerMock; +import org.mockbukkit.mockbukkit.MockBukkit; +import org.mockbukkit.mockbukkit.ServerMock; +import org.mockbukkit.mockbukkit.world.WorldMock; +import org.mockbukkit.mockbukkit.block.BlockMock; +import org.mockbukkit.mockbukkit.entity.PlayerMock; class TestTapeMeasure implements SlimefunItemTest { diff --git a/src/test/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/TestAnvilListener.java b/src/test/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/TestAnvilListener.java index cf57add8ac..8db469f17f 100644 --- a/src/test/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/TestAnvilListener.java +++ b/src/test/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/TestAnvilListener.java @@ -23,8 +23,8 @@ import io.github.thebusybiscuit.slimefun4.implementation.listeners.crafting.AnvilListener; import io.github.thebusybiscuit.slimefun4.test.TestUtilities; -import be.seeseemelk.mockbukkit.MockBukkit; -import be.seeseemelk.mockbukkit.ServerMock; +import org.mockbukkit.mockbukkit.MockBukkit; +import org.mockbukkit.mockbukkit.ServerMock; class TestAnvilListener { diff --git a/src/test/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/TestBackpackListener.java b/src/test/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/TestBackpackListener.java index 443d47c3c7..cfc62505c0 100644 --- a/src/test/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/TestBackpackListener.java +++ b/src/test/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/TestBackpackListener.java @@ -38,9 +38,9 @@ import io.github.thebusybiscuit.slimefun4.test.TestUtilities; import io.github.thebusybiscuit.slimefun4.utils.tags.SlimefunTag; -import be.seeseemelk.mockbukkit.MockBukkit; -import be.seeseemelk.mockbukkit.ServerMock; -import be.seeseemelk.mockbukkit.entity.ItemEntityMock; +import org.mockbukkit.mockbukkit.MockBukkit; +import org.mockbukkit.mockbukkit.ServerMock; +import org.mockbukkit.mockbukkit.entity.ItemEntityMock; class TestBackpackListener { diff --git a/src/test/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/TestBeeListener.java b/src/test/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/TestBeeListener.java index f84dc953bd..0175d25a2d 100644 --- a/src/test/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/TestBeeListener.java +++ b/src/test/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/TestBeeListener.java @@ -20,8 +20,8 @@ import io.github.thebusybiscuit.slimefun4.implementation.listeners.entity.BeeListener; import io.github.thebusybiscuit.slimefun4.test.TestUtilities; -import be.seeseemelk.mockbukkit.MockBukkit; -import be.seeseemelk.mockbukkit.ServerMock; +import org.mockbukkit.mockbukkit.MockBukkit; +import org.mockbukkit.mockbukkit.ServerMock; class TestBeeListener { diff --git a/src/test/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/TestBrewingStandListener.java b/src/test/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/TestBrewingStandListener.java index 7a78612680..d0f318bb7e 100644 --- a/src/test/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/TestBrewingStandListener.java +++ b/src/test/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/TestBrewingStandListener.java @@ -25,8 +25,8 @@ import io.github.thebusybiscuit.slimefun4.implementation.listeners.crafting.BrewingStandListener; import io.github.thebusybiscuit.slimefun4.test.TestUtilities; -import be.seeseemelk.mockbukkit.MockBukkit; -import be.seeseemelk.mockbukkit.ServerMock; +import org.mockbukkit.mockbukkit.MockBukkit; +import org.mockbukkit.mockbukkit.ServerMock; class TestBrewingStandListener { diff --git a/src/test/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/TestCargoNodeListener.java b/src/test/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/TestCargoNodeListener.java index 0951dce2ca..cb0b4af6e8 100644 --- a/src/test/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/TestCargoNodeListener.java +++ b/src/test/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/TestCargoNodeListener.java @@ -24,8 +24,8 @@ import io.github.thebusybiscuit.slimefun4.test.TestUtilities; import io.github.thebusybiscuit.slimefun4.test.providers.SlimefunItemsSource; -import be.seeseemelk.mockbukkit.MockBukkit; -import be.seeseemelk.mockbukkit.ServerMock; +import org.mockbukkit.mockbukkit.MockBukkit; +import org.mockbukkit.mockbukkit.ServerMock; class TestCargoNodeListener { diff --git a/src/test/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/TestCartographyTableListener.java b/src/test/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/TestCartographyTableListener.java index 892fd5b4ad..c78dbdac3e 100644 --- a/src/test/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/TestCartographyTableListener.java +++ b/src/test/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/TestCartographyTableListener.java @@ -23,8 +23,8 @@ import io.github.thebusybiscuit.slimefun4.implementation.listeners.crafting.CartographyTableListener; import io.github.thebusybiscuit.slimefun4.test.TestUtilities; -import be.seeseemelk.mockbukkit.MockBukkit; -import be.seeseemelk.mockbukkit.ServerMock; +import org.mockbukkit.mockbukkit.MockBukkit; +import org.mockbukkit.mockbukkit.ServerMock; class TestCartographyTableListener { diff --git a/src/test/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/TestCauldronListener.java b/src/test/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/TestCauldronListener.java index fd39063195..efaa73a8e2 100644 --- a/src/test/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/TestCauldronListener.java +++ b/src/test/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/TestCauldronListener.java @@ -22,9 +22,9 @@ import io.github.thebusybiscuit.slimefun4.implementation.listeners.crafting.CauldronListener; import io.github.thebusybiscuit.slimefun4.test.TestUtilities; -import be.seeseemelk.mockbukkit.MockBukkit; -import be.seeseemelk.mockbukkit.ServerMock; -import be.seeseemelk.mockbukkit.block.BlockMock; +import org.mockbukkit.mockbukkit.MockBukkit; +import org.mockbukkit.mockbukkit.ServerMock; +import org.mockbukkit.mockbukkit.block.BlockMock; class TestCauldronListener { diff --git a/src/test/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/TestCoolerListener.java b/src/test/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/TestCoolerListener.java index e606840cbc..cfe7f976d1 100644 --- a/src/test/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/TestCoolerListener.java +++ b/src/test/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/TestCoolerListener.java @@ -25,8 +25,8 @@ import io.github.thebusybiscuit.slimefun4.implementation.items.backpacks.Cooler; import io.github.thebusybiscuit.slimefun4.implementation.items.food.Juice; import io.github.thebusybiscuit.slimefun4.test.TestUtilities; -import be.seeseemelk.mockbukkit.MockBukkit; -import be.seeseemelk.mockbukkit.ServerMock; +import org.mockbukkit.mockbukkit.MockBukkit; +import org.mockbukkit.mockbukkit.ServerMock; class TestCoolerListener { diff --git a/src/test/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/TestCraftingTableListener.java b/src/test/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/TestCraftingTableListener.java index 5819ad3a32..426ddae6cb 100644 --- a/src/test/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/TestCraftingTableListener.java +++ b/src/test/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/TestCraftingTableListener.java @@ -28,8 +28,8 @@ import io.github.thebusybiscuit.slimefun4.implementation.listeners.crafting.CraftingTableListener; import io.github.thebusybiscuit.slimefun4.test.TestUtilities; -import be.seeseemelk.mockbukkit.MockBukkit; -import be.seeseemelk.mockbukkit.ServerMock; +import org.mockbukkit.mockbukkit.MockBukkit; +import org.mockbukkit.mockbukkit.ServerMock; class TestCraftingTableListener { @@ -54,6 +54,7 @@ private CraftItemEvent mockCraftingEvent(ItemStack item) { Player player = server.addPlayer(); CraftingInventory inv = Mockito.mock(CraftingInventory.class); + Mockito.when(inv.getType()).thenReturn(org.bukkit.event.inventory.InventoryType.CRAFTING); Mockito.when(inv.getContents()).thenReturn(new ItemStack[] { item, null, null, null, null, null, null, null, null }); InventoryView view = player.openInventory(inv); @@ -67,6 +68,7 @@ private PrepareItemCraftEvent mockPreCraftingEvent(ItemStack item) { Player player = server.addPlayer(); CraftingInventory inv = Mockito.mock(CraftingInventory.class); + Mockito.when(inv.getType()).thenReturn(org.bukkit.event.inventory.InventoryType.CRAFTING); MutableObject result = new MutableObject(new ItemStack(Material.EMERALD)); Mockito.doAnswer(invocation -> { diff --git a/src/test/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/TestDeathpointListener.java b/src/test/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/TestDeathpointListener.java index f135535373..e657ea71c1 100644 --- a/src/test/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/TestDeathpointListener.java +++ b/src/test/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/TestDeathpointListener.java @@ -12,8 +12,8 @@ import io.github.thebusybiscuit.slimefun4.implementation.SlimefunItems; import io.github.thebusybiscuit.slimefun4.test.TestUtilities; -import be.seeseemelk.mockbukkit.MockBukkit; -import be.seeseemelk.mockbukkit.ServerMock; +import org.mockbukkit.mockbukkit.MockBukkit; +import org.mockbukkit.mockbukkit.ServerMock; class TestDeathpointListener { diff --git a/src/test/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/TestFireworksListener.java b/src/test/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/TestFireworksListener.java index bcea6c1817..6529a1ed75 100644 --- a/src/test/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/TestFireworksListener.java +++ b/src/test/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/TestFireworksListener.java @@ -15,8 +15,8 @@ import io.github.thebusybiscuit.slimefun4.implementation.listeners.entity.FireworksListener; import io.github.thebusybiscuit.slimefun4.utils.FireworkUtils; -import be.seeseemelk.mockbukkit.MockBukkit; -import be.seeseemelk.mockbukkit.ServerMock; +import org.mockbukkit.mockbukkit.MockBukkit; +import org.mockbukkit.mockbukkit.ServerMock; class TestFireworksListener { diff --git a/src/test/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/TestGrindstoneListener.java b/src/test/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/TestGrindstoneListener.java index ff604beb04..4f11806be2 100644 --- a/src/test/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/TestGrindstoneListener.java +++ b/src/test/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/TestGrindstoneListener.java @@ -27,8 +27,8 @@ import io.github.thebusybiscuit.slimefun4.implementation.listeners.crafting.GrindstoneListener; import io.github.thebusybiscuit.slimefun4.test.TestUtilities; -import be.seeseemelk.mockbukkit.MockBukkit; -import be.seeseemelk.mockbukkit.ServerMock; +import org.mockbukkit.mockbukkit.MockBukkit; +import org.mockbukkit.mockbukkit.ServerMock; class TestGrindstoneListener { diff --git a/src/test/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/TestIronGolemListener.java b/src/test/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/TestIronGolemListener.java index b536f6b00a..570f33abb3 100644 --- a/src/test/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/TestIronGolemListener.java +++ b/src/test/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/TestIronGolemListener.java @@ -21,8 +21,8 @@ import io.github.thebusybiscuit.slimefun4.implementation.listeners.entity.IronGolemListener; import io.github.thebusybiscuit.slimefun4.test.TestUtilities; -import be.seeseemelk.mockbukkit.MockBukkit; -import be.seeseemelk.mockbukkit.ServerMock; +import org.mockbukkit.mockbukkit.MockBukkit; +import org.mockbukkit.mockbukkit.ServerMock; class TestIronGolemListener { diff --git a/src/test/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/TestItemPickupListener.java b/src/test/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/TestItemPickupListener.java index 8af24cd9b0..b056863811 100644 --- a/src/test/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/TestItemPickupListener.java +++ b/src/test/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/TestItemPickupListener.java @@ -21,10 +21,10 @@ import io.github.thebusybiscuit.slimefun4.implementation.items.altar.AncientPedestal; import io.github.thebusybiscuit.slimefun4.utils.SlimefunUtils; -import be.seeseemelk.mockbukkit.MockBukkit; -import be.seeseemelk.mockbukkit.ServerMock; -import be.seeseemelk.mockbukkit.entity.ItemEntityMock; -import be.seeseemelk.mockbukkit.inventory.HopperInventoryMock; +import org.mockbukkit.mockbukkit.MockBukkit; +import org.mockbukkit.mockbukkit.ServerMock; +import org.mockbukkit.mockbukkit.entity.ItemEntityMock; +import org.mockbukkit.mockbukkit.inventory.HopperInventoryMock; class TestItemPickupListener { diff --git a/src/test/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/TestMultiblockListener.java b/src/test/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/TestMultiblockListener.java index 55f9a5e5b6..44d94f2d72 100644 --- a/src/test/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/TestMultiblockListener.java +++ b/src/test/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/TestMultiblockListener.java @@ -22,8 +22,8 @@ import io.github.thebusybiscuit.slimefun4.implementation.Slimefun; import io.github.thebusybiscuit.slimefun4.test.TestUtilities; -import be.seeseemelk.mockbukkit.MockBukkit; -import be.seeseemelk.mockbukkit.ServerMock; +import org.mockbukkit.mockbukkit.MockBukkit; +import org.mockbukkit.mockbukkit.ServerMock; class TestMultiblockListener { diff --git a/src/test/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/TestNetworkListener.java b/src/test/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/TestNetworkListener.java index b6ef3148d6..5e8837ca42 100644 --- a/src/test/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/TestNetworkListener.java +++ b/src/test/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/TestNetworkListener.java @@ -18,8 +18,8 @@ import io.github.thebusybiscuit.slimefun4.core.networks.NetworkManager; import io.github.thebusybiscuit.slimefun4.implementation.Slimefun; -import be.seeseemelk.mockbukkit.MockBukkit; -import be.seeseemelk.mockbukkit.ServerMock; +import org.mockbukkit.mockbukkit.MockBukkit; +import org.mockbukkit.mockbukkit.ServerMock; class TestNetworkListener { diff --git a/src/test/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/TestPiglinListener.java b/src/test/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/TestPiglinListener.java index d9e2b1fb87..9640813bb5 100644 --- a/src/test/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/TestPiglinListener.java +++ b/src/test/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/TestPiglinListener.java @@ -25,9 +25,9 @@ import io.github.thebusybiscuit.slimefun4.implementation.listeners.entity.PiglinListener; import io.github.thebusybiscuit.slimefun4.test.TestUtilities; -import be.seeseemelk.mockbukkit.MockBukkit; -import be.seeseemelk.mockbukkit.ServerMock; -import be.seeseemelk.mockbukkit.entity.ItemEntityMock; +import org.mockbukkit.mockbukkit.MockBukkit; +import org.mockbukkit.mockbukkit.ServerMock; +import org.mockbukkit.mockbukkit.entity.ItemEntityMock; class TestPiglinListener { diff --git a/src/test/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/TestPlayerProfileListener.java b/src/test/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/TestPlayerProfileListener.java index 0ee300a138..49a3bce0ca 100644 --- a/src/test/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/TestPlayerProfileListener.java +++ b/src/test/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/TestPlayerProfileListener.java @@ -13,8 +13,8 @@ import io.github.thebusybiscuit.slimefun4.implementation.Slimefun; import io.github.thebusybiscuit.slimefun4.test.TestUtilities; -import be.seeseemelk.mockbukkit.MockBukkit; -import be.seeseemelk.mockbukkit.ServerMock; +import org.mockbukkit.mockbukkit.MockBukkit; +import org.mockbukkit.mockbukkit.ServerMock; class TestPlayerProfileListener { diff --git a/src/test/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/TestSlimefunGuideListener.java b/src/test/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/TestSlimefunGuideListener.java index 6b58f849b7..f25a1274c8 100644 --- a/src/test/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/TestSlimefunGuideListener.java +++ b/src/test/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/TestSlimefunGuideListener.java @@ -17,9 +17,9 @@ import io.github.thebusybiscuit.slimefun4.implementation.Slimefun; import io.github.thebusybiscuit.slimefun4.utils.SlimefunUtils; -import be.seeseemelk.mockbukkit.MockBukkit; -import be.seeseemelk.mockbukkit.ServerMock; -import be.seeseemelk.mockbukkit.entity.PlayerMock; +import org.mockbukkit.mockbukkit.MockBukkit; +import org.mockbukkit.mockbukkit.ServerMock; +import org.mockbukkit.mockbukkit.entity.PlayerMock; class TestSlimefunGuideListener { diff --git a/src/test/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/TestSlimefunItemInteractListener.java b/src/test/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/TestSlimefunItemInteractListener.java index cc33e3750a..d63860dcd3 100644 --- a/src/test/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/TestSlimefunItemInteractListener.java +++ b/src/test/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/TestSlimefunItemInteractListener.java @@ -30,9 +30,9 @@ import io.github.thebusybiscuit.slimefun4.test.TestUtilities; import me.mrCookieSlime.Slimefun.api.BlockStorage; import me.mrCookieSlime.Slimefun.api.inventory.BlockMenuPreset; -import be.seeseemelk.mockbukkit.MockBukkit; -import be.seeseemelk.mockbukkit.ServerMock; -import be.seeseemelk.mockbukkit.entity.PlayerMock; +import org.mockbukkit.mockbukkit.MockBukkit; +import org.mockbukkit.mockbukkit.ServerMock; +import org.mockbukkit.mockbukkit.entity.PlayerMock; class TestSlimefunItemInteractListener { diff --git a/src/test/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/TestSmithingTableListener.java b/src/test/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/TestSmithingTableListener.java index 3c57ed5060..c94ce2e694 100644 --- a/src/test/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/TestSmithingTableListener.java +++ b/src/test/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/TestSmithingTableListener.java @@ -1,7 +1,7 @@ package io.github.thebusybiscuit.slimefun4.implementation.listeners; -import be.seeseemelk.mockbukkit.MockBukkit; -import be.seeseemelk.mockbukkit.ServerMock; +import org.mockbukkit.mockbukkit.MockBukkit; +import org.mockbukkit.mockbukkit.ServerMock; import org.apache.commons.lang3.mutable.MutableObject; import org.bukkit.Material; @@ -71,6 +71,7 @@ private SmithItemEvent mockSmithingEvent(ItemStack tool, ItemStack material) { SmithingInventory inv = Mockito.mock(SmithingInventory.class); // MinecraftVersion#isAtLeast always returns true during unit test, so we use the 1.20 layout here. + Mockito.when(inv.getType()).thenReturn(org.bukkit.event.inventory.InventoryType.SMITHING); Mockito.when(inv.getContents()).thenReturn(new ItemStack[] { new ItemStack(Material.NETHERITE_UPGRADE_SMITHING_TEMPLATE), tool, material, null }); InventoryView view = player.openInventory(inv); @@ -92,6 +93,7 @@ private PrepareSmithingEvent mockPrepareSmithingEvent(ItemStack tool, ItemStack return null; }).when(inv).setResult(Mockito.any()); + Mockito.when(inv.getType()).thenReturn(org.bukkit.event.inventory.InventoryType.SMITHING); Mockito.when(inv.getResult()).thenAnswer(invocation -> result.getValue()); // MinecraftVersion#isAtLeast always returns true during unit test, so we use the 1.20 layout here. Mockito.when(inv.getContents()).thenReturn(new ItemStack[] { new ItemStack(Material.NETHERITE_UPGRADE_SMITHING_TEMPLATE), tool, material, null }); diff --git a/src/test/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/TestSoulboundListener.java b/src/test/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/TestSoulboundListener.java index ad0e2fc916..fa417dfab8 100644 --- a/src/test/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/TestSoulboundListener.java +++ b/src/test/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/TestSoulboundListener.java @@ -18,9 +18,9 @@ import io.github.thebusybiscuit.slimefun4.test.TestUtilities; import io.github.thebusybiscuit.slimefun4.utils.SlimefunUtils; -import be.seeseemelk.mockbukkit.MockBukkit; -import be.seeseemelk.mockbukkit.ServerMock; -import be.seeseemelk.mockbukkit.entity.PlayerMock; +import org.mockbukkit.mockbukkit.MockBukkit; +import org.mockbukkit.mockbukkit.ServerMock; +import org.mockbukkit.mockbukkit.entity.PlayerMock; class TestSoulboundListener { diff --git a/src/test/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/TestVillagerTradingListener.java b/src/test/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/TestVillagerTradingListener.java index da15c02de0..6e7631be6a 100644 --- a/src/test/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/TestVillagerTradingListener.java +++ b/src/test/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/TestVillagerTradingListener.java @@ -27,8 +27,8 @@ import io.github.thebusybiscuit.slimefun4.implementation.items.misc.SyntheticEmerald; import io.github.thebusybiscuit.slimefun4.test.TestUtilities; -import be.seeseemelk.mockbukkit.MockBukkit; -import be.seeseemelk.mockbukkit.ServerMock; +import org.mockbukkit.mockbukkit.MockBukkit; +import org.mockbukkit.mockbukkit.ServerMock; class TestVillagerTradingListener { diff --git a/src/test/java/io/github/thebusybiscuit/slimefun4/implementation/registration/TestItemGroups.java b/src/test/java/io/github/thebusybiscuit/slimefun4/implementation/registration/TestItemGroups.java index d290992ff9..c701decffe 100644 --- a/src/test/java/io/github/thebusybiscuit/slimefun4/implementation/registration/TestItemGroups.java +++ b/src/test/java/io/github/thebusybiscuit/slimefun4/implementation/registration/TestItemGroups.java @@ -27,8 +27,8 @@ import io.github.thebusybiscuit.slimefun4.implementation.Slimefun; import io.github.thebusybiscuit.slimefun4.test.TestUtilities; -import be.seeseemelk.mockbukkit.MockBukkit; -import be.seeseemelk.mockbukkit.ServerMock; +import org.mockbukkit.mockbukkit.MockBukkit; +import org.mockbukkit.mockbukkit.ServerMock; class TestItemGroups { diff --git a/src/test/java/io/github/thebusybiscuit/slimefun4/implementation/registration/TestItemHandlers.java b/src/test/java/io/github/thebusybiscuit/slimefun4/implementation/registration/TestItemHandlers.java index 4df0b505b9..5888b1e92d 100644 --- a/src/test/java/io/github/thebusybiscuit/slimefun4/implementation/registration/TestItemHandlers.java +++ b/src/test/java/io/github/thebusybiscuit/slimefun4/implementation/registration/TestItemHandlers.java @@ -19,7 +19,7 @@ import io.github.thebusybiscuit.slimefun4.test.TestUtilities; import io.github.thebusybiscuit.slimefun4.test.mocks.MockItemHandler; -import be.seeseemelk.mockbukkit.MockBukkit; +import org.mockbukkit.mockbukkit.MockBukkit; class TestItemHandlers { diff --git a/src/test/java/io/github/thebusybiscuit/slimefun4/implementation/registration/TestRechargeableItems.java b/src/test/java/io/github/thebusybiscuit/slimefun4/implementation/registration/TestRechargeableItems.java index 59938126f5..bb7d65fbe2 100644 --- a/src/test/java/io/github/thebusybiscuit/slimefun4/implementation/registration/TestRechargeableItems.java +++ b/src/test/java/io/github/thebusybiscuit/slimefun4/implementation/registration/TestRechargeableItems.java @@ -18,7 +18,7 @@ import io.github.thebusybiscuit.slimefun4.test.TestUtilities; import io.github.thebusybiscuit.slimefun4.utils.LoreBuilder; -import be.seeseemelk.mockbukkit.MockBukkit; +import org.mockbukkit.mockbukkit.MockBukkit; class TestRechargeableItems { diff --git a/src/test/java/io/github/thebusybiscuit/slimefun4/implementation/registration/TestRegistration.java b/src/test/java/io/github/thebusybiscuit/slimefun4/implementation/registration/TestRegistration.java index 8364ca3409..f33023cdf1 100644 --- a/src/test/java/io/github/thebusybiscuit/slimefun4/implementation/registration/TestRegistration.java +++ b/src/test/java/io/github/thebusybiscuit/slimefun4/implementation/registration/TestRegistration.java @@ -32,7 +32,7 @@ import io.github.thebusybiscuit.slimefun4.implementation.setup.ResearchSetup; import io.github.thebusybiscuit.slimefun4.implementation.setup.SlimefunItemSetup; -import be.seeseemelk.mockbukkit.MockBukkit; +import org.mockbukkit.mockbukkit.MockBukkit; @TestMethodOrder(value = OrderAnnotation.class) class TestRegistration { diff --git a/src/test/java/io/github/thebusybiscuit/slimefun4/implementation/registration/TestSlimefunItemRegistration.java b/src/test/java/io/github/thebusybiscuit/slimefun4/implementation/registration/TestSlimefunItemRegistration.java index 1c0d4c24d9..d7fb8ab562 100644 --- a/src/test/java/io/github/thebusybiscuit/slimefun4/implementation/registration/TestSlimefunItemRegistration.java +++ b/src/test/java/io/github/thebusybiscuit/slimefun4/implementation/registration/TestSlimefunItemRegistration.java @@ -17,7 +17,7 @@ import io.github.thebusybiscuit.slimefun4.implementation.items.VanillaItem; import io.github.thebusybiscuit.slimefun4.test.TestUtilities; -import be.seeseemelk.mockbukkit.MockBukkit; +import org.mockbukkit.mockbukkit.MockBukkit; class TestSlimefunItemRegistration { diff --git a/src/test/java/io/github/thebusybiscuit/slimefun4/implementation/tasks/TestArmorTask.java b/src/test/java/io/github/thebusybiscuit/slimefun4/implementation/tasks/TestArmorTask.java index 87995a039d..05f0243c30 100644 --- a/src/test/java/io/github/thebusybiscuit/slimefun4/implementation/tasks/TestArmorTask.java +++ b/src/test/java/io/github/thebusybiscuit/slimefun4/implementation/tasks/TestArmorTask.java @@ -28,8 +28,8 @@ import io.github.thebusybiscuit.slimefun4.test.TestUtilities; import io.github.thebusybiscuit.slimefun4.test.mocks.MockHazmatSuit; -import be.seeseemelk.mockbukkit.MockBukkit; -import be.seeseemelk.mockbukkit.ServerMock; +import org.mockbukkit.mockbukkit.MockBukkit; +import org.mockbukkit.mockbukkit.ServerMock; class TestArmorTask { diff --git a/src/test/java/io/github/thebusybiscuit/slimefun4/storage/backend/TestLegacyBackend.java b/src/test/java/io/github/thebusybiscuit/slimefun4/storage/backend/TestLegacyBackend.java index 98653ee5b7..5653ed04fc 100644 --- a/src/test/java/io/github/thebusybiscuit/slimefun4/storage/backend/TestLegacyBackend.java +++ b/src/test/java/io/github/thebusybiscuit/slimefun4/storage/backend/TestLegacyBackend.java @@ -22,8 +22,8 @@ import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.Test; -import be.seeseemelk.mockbukkit.MockBukkit; -import be.seeseemelk.mockbukkit.ServerMock; +import org.mockbukkit.mockbukkit.MockBukkit; +import org.mockbukkit.mockbukkit.ServerMock; import io.github.thebusybiscuit.slimefun4.api.gps.Waypoint; import io.github.thebusybiscuit.slimefun4.api.player.PlayerProfile; import io.github.thebusybiscuit.slimefun4.api.researches.Research; diff --git a/src/test/java/io/github/thebusybiscuit/slimefun4/test/TestUtilities.java b/src/test/java/io/github/thebusybiscuit/slimefun4/test/TestUtilities.java index edd6a458af..bd0620b2ef 100644 --- a/src/test/java/io/github/thebusybiscuit/slimefun4/test/TestUtilities.java +++ b/src/test/java/io/github/thebusybiscuit/slimefun4/test/TestUtilities.java @@ -26,8 +26,8 @@ import org.junit.jupiter.api.Assertions; import org.mockito.Mockito; -import be.seeseemelk.mockbukkit.ServerMock; -import be.seeseemelk.mockbukkit.block.BlockMock; +import org.mockbukkit.mockbukkit.ServerMock; +import org.mockbukkit.mockbukkit.block.BlockMock; import io.github.bakedlibs.dough.items.CustomItemStack; import io.github.thebusybiscuit.slimefun4.api.events.SlimefunBlockPlaceEvent; import io.github.thebusybiscuit.slimefun4.api.items.ItemGroup; diff --git a/src/test/java/io/github/thebusybiscuit/slimefun4/test/presets/SlimefunItemTest.java b/src/test/java/io/github/thebusybiscuit/slimefun4/test/presets/SlimefunItemTest.java index 36218a9506..ed2a3efbc7 100644 --- a/src/test/java/io/github/thebusybiscuit/slimefun4/test/presets/SlimefunItemTest.java +++ b/src/test/java/io/github/thebusybiscuit/slimefun4/test/presets/SlimefunItemTest.java @@ -16,7 +16,7 @@ import io.github.thebusybiscuit.slimefun4.core.handlers.ItemUseHandler; import io.github.thebusybiscuit.slimefun4.implementation.Slimefun; -import be.seeseemelk.mockbukkit.block.BlockMock; +import org.mockbukkit.mockbukkit.block.BlockMock; /** * This is a convenient interface for us to use in unit test classes diff --git a/src/test/java/io/github/thebusybiscuit/slimefun4/utils/TestChargeUtils.java b/src/test/java/io/github/thebusybiscuit/slimefun4/utils/TestChargeUtils.java index 1f91b38415..1f56782d29 100644 --- a/src/test/java/io/github/thebusybiscuit/slimefun4/utils/TestChargeUtils.java +++ b/src/test/java/io/github/thebusybiscuit/slimefun4/utils/TestChargeUtils.java @@ -15,7 +15,7 @@ import io.github.bakedlibs.dough.data.persistent.PersistentDataAPI; import io.github.thebusybiscuit.slimefun4.implementation.Slimefun; -import be.seeseemelk.mockbukkit.MockBukkit; +import org.mockbukkit.mockbukkit.MockBukkit; class TestChargeUtils { diff --git a/src/test/java/io/github/thebusybiscuit/slimefun4/utils/TestChatUtils.java b/src/test/java/io/github/thebusybiscuit/slimefun4/utils/TestChatUtils.java index 794b02e4b5..8072d6feff 100644 --- a/src/test/java/io/github/thebusybiscuit/slimefun4/utils/TestChatUtils.java +++ b/src/test/java/io/github/thebusybiscuit/slimefun4/utils/TestChatUtils.java @@ -43,4 +43,14 @@ void testPluralization() { Assertions.assertEquals("Bananas", ChatUtils.checkPlurality(input, 2)); } + @Test + @DisplayName("Test ChatUtils.crop(...)") + void testCrop() { + String longText = "abcdefghijklmnopqrstuvw"; + Assertions.assertEquals(ChatColor.RED + "abcdefghijklmnop...", ChatUtils.crop(ChatColor.RED, longText)); + + String shortText = "short"; + Assertions.assertEquals(ChatColor.BLUE + "short", ChatUtils.crop(ChatColor.BLUE, shortText)); + } + } diff --git a/src/test/java/io/github/thebusybiscuit/slimefun4/utils/TestFireworkUtils.java b/src/test/java/io/github/thebusybiscuit/slimefun4/utils/TestFireworkUtils.java index a32183d663..c633b47892 100644 --- a/src/test/java/io/github/thebusybiscuit/slimefun4/utils/TestFireworkUtils.java +++ b/src/test/java/io/github/thebusybiscuit/slimefun4/utils/TestFireworkUtils.java @@ -17,8 +17,8 @@ import org.junit.jupiter.params.provider.Arguments; import org.junit.jupiter.params.provider.MethodSource; -import be.seeseemelk.mockbukkit.MockBukkit; -import be.seeseemelk.mockbukkit.WorldMock; +import org.mockbukkit.mockbukkit.MockBukkit; +import org.mockbukkit.mockbukkit.world.WorldMock; class TestFireworkUtils { diff --git a/src/test/java/io/github/thebusybiscuit/slimefun4/utils/TestInfiniteBlockGenerators.java b/src/test/java/io/github/thebusybiscuit/slimefun4/utils/TestInfiniteBlockGenerators.java index 5d0d2fec68..09e9f76c9e 100644 --- a/src/test/java/io/github/thebusybiscuit/slimefun4/utils/TestInfiniteBlockGenerators.java +++ b/src/test/java/io/github/thebusybiscuit/slimefun4/utils/TestInfiniteBlockGenerators.java @@ -20,9 +20,9 @@ import io.github.thebusybiscuit.slimefun4.implementation.Slimefun; -import be.seeseemelk.mockbukkit.MockBukkit; -import be.seeseemelk.mockbukkit.ServerMock; -import be.seeseemelk.mockbukkit.WorldMock; +import org.mockbukkit.mockbukkit.MockBukkit; +import org.mockbukkit.mockbukkit.ServerMock; +import org.mockbukkit.mockbukkit.world.WorldMock; class TestInfiniteBlockGenerators { diff --git a/src/test/java/io/github/thebusybiscuit/slimefun4/utils/TestItemStackWrapper.java b/src/test/java/io/github/thebusybiscuit/slimefun4/utils/TestItemStackWrapper.java index 510584bbfc..c1922df67e 100644 --- a/src/test/java/io/github/thebusybiscuit/slimefun4/utils/TestItemStackWrapper.java +++ b/src/test/java/io/github/thebusybiscuit/slimefun4/utils/TestItemStackWrapper.java @@ -17,7 +17,7 @@ import io.github.thebusybiscuit.slimefun4.implementation.Slimefun; import io.github.thebusybiscuit.slimefun4.utils.itemstack.ItemStackWrapper; -import be.seeseemelk.mockbukkit.MockBukkit; +import org.mockbukkit.mockbukkit.MockBukkit; class TestItemStackWrapper { diff --git a/src/test/java/io/github/thebusybiscuit/slimefun4/utils/TestLoreComparison.java b/src/test/java/io/github/thebusybiscuit/slimefun4/utils/TestLoreComparison.java index 7441f22502..d24e59ad11 100644 --- a/src/test/java/io/github/thebusybiscuit/slimefun4/utils/TestLoreComparison.java +++ b/src/test/java/io/github/thebusybiscuit/slimefun4/utils/TestLoreComparison.java @@ -12,7 +12,7 @@ import io.github.thebusybiscuit.slimefun4.implementation.Slimefun; -import be.seeseemelk.mockbukkit.MockBukkit; +import org.mockbukkit.mockbukkit.MockBukkit; class TestLoreComparison { diff --git a/src/test/java/io/github/thebusybiscuit/slimefun4/utils/TestMinecraftVersion.java b/src/test/java/io/github/thebusybiscuit/slimefun4/utils/TestMinecraftVersion.java index 74a2622cce..d101574c62 100644 --- a/src/test/java/io/github/thebusybiscuit/slimefun4/utils/TestMinecraftVersion.java +++ b/src/test/java/io/github/thebusybiscuit/slimefun4/utils/TestMinecraftVersion.java @@ -14,10 +14,12 @@ void testMatches() { Assertions.assertTrue(MinecraftVersion.MINECRAFT_1_16.isMinecraftVersion(16, -1)); Assertions.assertTrue(MinecraftVersion.MINECRAFT_1_17.isMinecraftVersion(17, -1)); Assertions.assertTrue(MinecraftVersion.MINECRAFT_1_20_5.isMinecraftVersion(20, 5)); + Assertions.assertTrue(MinecraftVersion.MINECRAFT_1_21.isMinecraftVersion(21, -1)); Assertions.assertFalse(MinecraftVersion.MINECRAFT_1_17.isMinecraftVersion(16, -1)); Assertions.assertFalse(MinecraftVersion.MINECRAFT_1_16.isMinecraftVersion(0, -1)); Assertions.assertFalse(MinecraftVersion.MINECRAFT_1_20_5.isMinecraftVersion(20, 4)); + Assertions.assertFalse(MinecraftVersion.MINECRAFT_1_21.isMinecraftVersion(20, -1)); } @Test @@ -28,10 +30,13 @@ void testMatchesMinor() { Assertions.assertTrue(MinecraftVersion.MINECRAFT_1_20.isMinecraftVersion(20, 4)); Assertions.assertTrue(MinecraftVersion.MINECRAFT_1_20_5.isMinecraftVersion(20, 6)); + Assertions.assertTrue(MinecraftVersion.MINECRAFT_1_21.isMinecraftVersion(21, 7)); Assertions.assertFalse(MinecraftVersion.MINECRAFT_1_20.isMinecraftVersion(20, 5)); Assertions.assertFalse(MinecraftVersion.MINECRAFT_1_16.isMinecraftVersion(17, 1)); Assertions.assertFalse(MinecraftVersion.MINECRAFT_1_20_5.isMinecraftVersion(20, 4)); + Assertions.assertFalse(MinecraftVersion.MINECRAFT_1_21.isMinecraftVersion(21, 8)); + } @Test @@ -42,8 +47,10 @@ void testAtLeast() { Assertions.assertTrue(MinecraftVersion.MINECRAFT_1_17.isAtLeast(MinecraftVersion.MINECRAFT_1_17)); Assertions.assertTrue(MinecraftVersion.MINECRAFT_1_20.isAtLeast(MinecraftVersion.MINECRAFT_1_20)); Assertions.assertTrue(MinecraftVersion.MINECRAFT_1_20_5.isAtLeast(MinecraftVersion.MINECRAFT_1_20)); + Assertions.assertTrue(MinecraftVersion.MINECRAFT_1_21.isAtLeast(MinecraftVersion.MINECRAFT_1_20_5)); Assertions.assertFalse(MinecraftVersion.MINECRAFT_1_17.isAtLeast(MinecraftVersion.MINECRAFT_1_18)); + Assertions.assertFalse(MinecraftVersion.MINECRAFT_1_20_5.isAtLeast(MinecraftVersion.MINECRAFT_1_21)); } @Test @@ -61,9 +68,11 @@ void testAtLeastUnknown() { void testIsBefore() { Assertions.assertTrue(MinecraftVersion.MINECRAFT_1_16.isBefore(MinecraftVersion.MINECRAFT_1_17)); Assertions.assertTrue(MinecraftVersion.MINECRAFT_1_16.isBefore(MinecraftVersion.MINECRAFT_1_18)); + Assertions.assertTrue(MinecraftVersion.MINECRAFT_1_20_5.isBefore(MinecraftVersion.MINECRAFT_1_21)); Assertions.assertFalse(MinecraftVersion.MINECRAFT_1_17.isBefore(MinecraftVersion.MINECRAFT_1_17)); Assertions.assertFalse(MinecraftVersion.MINECRAFT_1_17.isBefore(MinecraftVersion.MINECRAFT_1_16)); + Assertions.assertFalse(MinecraftVersion.MINECRAFT_1_21.isBefore(MinecraftVersion.MINECRAFT_1_20_5)); } @Test @@ -82,6 +91,9 @@ void testIsBeforeMinor() { Assertions.assertFalse(MinecraftVersion.MINECRAFT_1_20_5.isBefore(20, 4)); Assertions.assertFalse(MinecraftVersion.MINECRAFT_1_20_5.isBefore(20, 5)); Assertions.assertTrue(MinecraftVersion.MINECRAFT_1_20_5.isBefore(20, 6)); + Assertions.assertFalse(MinecraftVersion.MINECRAFT_1_21.isBefore(21, 7)); + Assertions.assertTrue(MinecraftVersion.MINECRAFT_1_21.isBefore(21, 8)); + Assertions.assertTrue(MinecraftVersion.MINECRAFT_1_20_5.isBefore(21, 0)); } @Test diff --git a/src/test/java/io/github/thebusybiscuit/slimefun4/utils/TestSoulboundItem.java b/src/test/java/io/github/thebusybiscuit/slimefun4/utils/TestSoulboundItem.java index 9720494842..56406fb931 100644 --- a/src/test/java/io/github/thebusybiscuit/slimefun4/utils/TestSoulboundItem.java +++ b/src/test/java/io/github/thebusybiscuit/slimefun4/utils/TestSoulboundItem.java @@ -17,7 +17,7 @@ import io.github.thebusybiscuit.slimefun4.core.attributes.Soulbound; import io.github.thebusybiscuit.slimefun4.implementation.Slimefun; -import be.seeseemelk.mockbukkit.MockBukkit; +import org.mockbukkit.mockbukkit.MockBukkit; class TestSoulboundItem { diff --git a/src/test/java/io/github/thebusybiscuit/slimefun4/utils/TestVersionedCompatibility.java b/src/test/java/io/github/thebusybiscuit/slimefun4/utils/TestVersionedCompatibility.java new file mode 100644 index 0000000000..bd80a63073 --- /dev/null +++ b/src/test/java/io/github/thebusybiscuit/slimefun4/utils/TestVersionedCompatibility.java @@ -0,0 +1,78 @@ +package io.github.thebusybiscuit.slimefun4.utils; + +import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertNull; + +import org.junit.jupiter.api.Test; + +import io.github.thebusybiscuit.slimefun4.utils.compatibility.VersionedEnchantment; +import io.github.thebusybiscuit.slimefun4.utils.compatibility.VersionedEntityType; +import io.github.thebusybiscuit.slimefun4.utils.compatibility.VersionedPotionEffectType; +import io.github.thebusybiscuit.slimefun4.utils.compatibility.VersionedPotionType; +import io.github.thebusybiscuit.slimefun4.utils.compatibility.VersionedItemFlag; +import io.github.thebusybiscuit.slimefun4.utils.compatibility.VersionedParticle; +import org.bukkit.Particle; + +class TestVersionedCompatibility { + + @Test + void testNewEntityTypes() { + assertNotNull(VersionedEntityType.ARMADILLO); + assertNotNull(VersionedEntityType.BOGGED); + assertNotNull(VersionedEntityType.BREEZE); + assertNotNull(VersionedEntityType.WIND_CHARGE); + assertNotNull(VersionedEntityType.CREAKING); + } + + @Test + void testNewEnchantments() { + assertNotNull(VersionedEnchantment.DENSITY); + assertNotNull(VersionedEnchantment.BREACH); + assertNotNull(VersionedEnchantment.WIND_BURST); + } + + @Test + void testNewPotionEffects() { + assertNotNull(VersionedPotionEffectType.OOZING); + assertNotNull(VersionedPotionEffectType.WEAVING); + assertNotNull(VersionedPotionEffectType.WIND_CHARGED); + assertNotNull(VersionedPotionEffectType.INFESTED); + } + + @Test + void testNewPotionTypes() { + assertNotNull(VersionedPotionType.OOZING); + assertNotNull(VersionedPotionType.WEAVING); + assertNotNull(VersionedPotionType.WIND_CHARGED); + assertNotNull(VersionedPotionType.INFESTED); + } + + @Test + void testNewItemFlag() { + assertNotNull(VersionedItemFlag.HIDE_TOOLTIP); + } + + @Test + void testNewParticles() { + assertParticle("BREEZE_WIND", VersionedParticle.BREEZE_WIND); + assertParticle("TRIAL_SPAWNER_DETECTION", VersionedParticle.TRIAL_SPAWNER_DETECTION); + assertParticle("TRIAL_SPAWNER_DETECTION_OMINOUS", VersionedParticle.TRIAL_SPAWNER_DETECTION_OMINOUS); + assertParticle("TRIAL_SPAWNER_EJECTION", VersionedParticle.TRIAL_SPAWNER_EJECTION); + assertParticle("TRIAL_SPAWNER_EJECTION_OMINOUS", VersionedParticle.TRIAL_SPAWNER_EJECTION_OMINOUS); + assertParticle("TRIAL_SPAWNER_SMOKE", VersionedParticle.TRIAL_SPAWNER_SMOKE); + assertParticle("TRIAL_SPAWNER_SMOKE_OMINOUS", VersionedParticle.TRIAL_SPAWNER_SMOKE_OMINOUS); + assertParticle("GUST", VersionedParticle.GUST); + assertParticle("SMALL_GUST", VersionedParticle.SMALL_GUST); + assertParticle("GUST_EMITTER_LARGE", VersionedParticle.GUST_EMITTER_LARGE); + assertParticle("GUST_EMITTER_SMALL", VersionedParticle.GUST_EMITTER_SMALL); + } + + private void assertParticle(String field, Particle particle) { + try { + Particle.class.getDeclaredField(field); + assertNotNull(particle); + } catch (NoSuchFieldException e) { + assertNull(particle); + } + } +} diff --git a/src/test/java/io/github/thebusybiscuit/slimefun4/utils/biomes/TestBiomeMap.java b/src/test/java/io/github/thebusybiscuit/slimefun4/utils/biomes/TestBiomeMap.java index 756c5044cf..13022b3f5d 100644 --- a/src/test/java/io/github/thebusybiscuit/slimefun4/utils/biomes/TestBiomeMap.java +++ b/src/test/java/io/github/thebusybiscuit/slimefun4/utils/biomes/TestBiomeMap.java @@ -16,7 +16,7 @@ import io.github.thebusybiscuit.slimefun4.api.exceptions.BiomeMapException; import io.github.thebusybiscuit.slimefun4.implementation.Slimefun; -import be.seeseemelk.mockbukkit.MockBukkit; +import org.mockbukkit.mockbukkit.MockBukkit; class TestBiomeMap { diff --git a/src/test/java/io/github/thebusybiscuit/slimefun4/utils/biomes/TestBiomeMapCompatibility.java b/src/test/java/io/github/thebusybiscuit/slimefun4/utils/biomes/TestBiomeMapCompatibility.java index 99f7c6100f..064a7eb9fb 100644 --- a/src/test/java/io/github/thebusybiscuit/slimefun4/utils/biomes/TestBiomeMapCompatibility.java +++ b/src/test/java/io/github/thebusybiscuit/slimefun4/utils/biomes/TestBiomeMapCompatibility.java @@ -29,7 +29,7 @@ import io.github.thebusybiscuit.slimefun4.implementation.Slimefun; import io.github.thebusybiscuit.slimefun4.utils.JsonUtils; -import be.seeseemelk.mockbukkit.MockBukkit; +import org.mockbukkit.mockbukkit.MockBukkit; /** * This test checks if biome maps work across multiple versions of Minecraft. diff --git a/src/test/java/io/github/thebusybiscuit/slimefun4/utils/biomes/TestBiomeMapParser.java b/src/test/java/io/github/thebusybiscuit/slimefun4/utils/biomes/TestBiomeMapParser.java index 0aa6bf9c81..b29e95bb41 100644 --- a/src/test/java/io/github/thebusybiscuit/slimefun4/utils/biomes/TestBiomeMapParser.java +++ b/src/test/java/io/github/thebusybiscuit/slimefun4/utils/biomes/TestBiomeMapParser.java @@ -17,7 +17,7 @@ import io.github.thebusybiscuit.slimefun4.api.exceptions.BiomeMapException; import io.github.thebusybiscuit.slimefun4.implementation.Slimefun; -import be.seeseemelk.mockbukkit.MockBukkit; +import org.mockbukkit.mockbukkit.MockBukkit; class TestBiomeMapParser { diff --git a/src/test/java/io/github/thebusybiscuit/slimefun4/utils/tags/TestSlimefunTags.java b/src/test/java/io/github/thebusybiscuit/slimefun4/utils/tags/TestSlimefunTags.java index 0e9fe8e3f6..f48d5bca7e 100644 --- a/src/test/java/io/github/thebusybiscuit/slimefun4/utils/tags/TestSlimefunTags.java +++ b/src/test/java/io/github/thebusybiscuit/slimefun4/utils/tags/TestSlimefunTags.java @@ -19,7 +19,7 @@ import io.github.thebusybiscuit.slimefun4.api.exceptions.TagMisconfigurationException; import io.github.thebusybiscuit.slimefun4.implementation.Slimefun; -import be.seeseemelk.mockbukkit.MockBukkit; +import org.mockbukkit.mockbukkit.MockBukkit; class TestSlimefunTags { @@ -126,6 +126,14 @@ void testGetTag() { Assertions.assertThrows(IllegalArgumentException.class, () -> SlimefunTag.getTag(null)); } + @Test + @DisplayName("Crafter should be cargo-compatible") + void testCrafterIsCargoStorage() throws TagMisconfigurationException { + SlimefunTag.reloadAll(); + + Assertions.assertTrue(SlimefunTag.CARGO_SUPPORTED_STORAGE_BLOCKS.isTagged(Material.CRAFTER)); + } + private void assertNotCyclic(@Nonnull SlimefunTag tag) { Set visiting = new HashSet<>(); Set visited = new HashSet<>(); diff --git a/src/test/java/io/github/thebusybiscuit/slimefun4/utils/tags/TestTagParser.java b/src/test/java/io/github/thebusybiscuit/slimefun4/utils/tags/TestTagParser.java index 68f3748715..029da3786c 100644 --- a/src/test/java/io/github/thebusybiscuit/slimefun4/utils/tags/TestTagParser.java +++ b/src/test/java/io/github/thebusybiscuit/slimefun4/utils/tags/TestTagParser.java @@ -12,7 +12,7 @@ import io.github.thebusybiscuit.slimefun4.api.exceptions.TagMisconfigurationException; import io.github.thebusybiscuit.slimefun4.implementation.Slimefun; -import be.seeseemelk.mockbukkit.MockBukkit; +import org.mockbukkit.mockbukkit.MockBukkit; class TestTagParser { diff --git a/src/test/resources/biomes/1.21.x.json b/src/test/resources/biomes/1.21.x.json new file mode 100644 index 0000000000..dfe92f1834 --- /dev/null +++ b/src/test/resources/biomes/1.21.x.json @@ -0,0 +1,67 @@ +[ + "minecraft:ocean", + "minecraft:plains", + "minecraft:desert", + "minecraft:windswept_hills", + "minecraft:forest", + "minecraft:taiga", + "minecraft:swamp", + "minecraft:mangrove_swamp", + "minecraft:river", + "minecraft:nether_wastes", + "minecraft:the_end", + "minecraft:frozen_ocean", + "minecraft:frozen_river", + "minecraft:snowy_plains", + "minecraft:mushroom_fields", + "minecraft:beach", + "minecraft:jungle", + "minecraft:sparse_jungle", + "minecraft:deep_ocean", + "minecraft:stony_shore", + "minecraft:snowy_beach", + "minecraft:birch_forest", + "minecraft:dark_forest", + "minecraft:snowy_taiga", + "minecraft:old_growth_pine_taiga", + "minecraft:windswept_forest", + "minecraft:savanna", + "minecraft:savanna_plateau", + "minecraft:badlands", + "minecraft:wooded_badlands", + "minecraft:small_end_islands", + "minecraft:end_midlands", + "minecraft:end_highlands", + "minecraft:end_barrens", + "minecraft:warm_ocean", + "minecraft:lukewarm_ocean", + "minecraft:cold_ocean", + "minecraft:deep_lukewarm_ocean", + "minecraft:deep_cold_ocean", + "minecraft:deep_frozen_ocean", + "minecraft:the_void", + "minecraft:sunflower_plains", + "minecraft:windswept_gravelly_hills", + "minecraft:flower_forest", + "minecraft:ice_spikes", + "minecraft:old_growth_birch_forest", + "minecraft:old_growth_spruce_taiga", + "minecraft:windswept_savanna", + "minecraft:eroded_badlands", + "minecraft:bamboo_jungle", + "minecraft:soul_sand_valley", + "minecraft:crimson_forest", + "minecraft:warped_forest", + "minecraft:basalt_deltas", + "minecraft:dripstone_caves", + "minecraft:lush_caves", + "minecraft:deep_dark", + "minecraft:meadow", + "minecraft:grove", + "minecraft:snowy_slopes", + "minecraft:frozen_peaks", + "minecraft:jagged_peaks", + "minecraft:stony_peaks", + "minecraft:cherry_grove", + "minecraft:custom", +] \ No newline at end of file