From 5c3bb678b3fc80a02d74d152765d4bd7ae149d4d Mon Sep 17 00:00:00 2001 From: Auxilor Date: Wed, 15 Mar 2023 18:20:46 +0000 Subject: [PATCH] Updated backend paper version --- .../main/java/com/willfp/eco/core/recipe/Recipes.java | 6 +++++- .../willfp/eco/core/recipe/recipes/CraftingRecipe.java | 2 +- .../eco/core/recipe/recipes/ShapedCraftingRecipe.java | 6 +++++- .../core/recipe/recipes/ShapelessCraftingRecipe.java | 6 +++++- .../com/willfp/eco/internal/logging/EcoLogger.kt | 2 +- eco-core/core-plugin/build.gradle.kts | 2 +- .../com/willfp/eco/internal/spigot/ConflictFinder.kt | 1 + .../com/willfp/eco/internal/spigot/EcoSpigotPlugin.kt | 1 + .../eco/internal/spigot/integrations/bstats/Metrics.kt | 10 +--------- .../internal/spigot/recipes/StackedRecipeListener.kt | 2 +- .../core-plugin/src/main/resources/paper-plugin.yml | 1 + 11 files changed, 23 insertions(+), 16 deletions(-) diff --git a/eco-api/src/main/java/com/willfp/eco/core/recipe/Recipes.java b/eco-api/src/main/java/com/willfp/eco/core/recipe/Recipes.java index 12160b6a..ce653905 100644 --- a/eco-api/src/main/java/com/willfp/eco/core/recipe/Recipes.java +++ b/eco-api/src/main/java/com/willfp/eco/core/recipe/Recipes.java @@ -53,7 +53,11 @@ public final class Recipes { * @return The match, or null if not found. */ @Nullable - public static CraftingRecipe getMatch(@NotNull final ItemStack[] matrix) { + public static CraftingRecipe getMatch(@Nullable final ItemStack[] matrix) { + if (matrix == null) { + return null; + } + return RECIPES_FROM_MATRIX.get(matrix).orElse(null); } diff --git a/eco-api/src/main/java/com/willfp/eco/core/recipe/recipes/CraftingRecipe.java b/eco-api/src/main/java/com/willfp/eco/core/recipe/recipes/CraftingRecipe.java index 830fba3c..ff0410a1 100644 --- a/eco-api/src/main/java/com/willfp/eco/core/recipe/recipes/CraftingRecipe.java +++ b/eco-api/src/main/java/com/willfp/eco/core/recipe/recipes/CraftingRecipe.java @@ -20,7 +20,7 @@ public interface CraftingRecipe { * @param matrix The matrix to check. * @return If the recipe matches. */ - boolean test(@NotNull ItemStack[] matrix); + boolean test(@Nullable ItemStack[] matrix); /** * Register the recipe. diff --git a/eco-api/src/main/java/com/willfp/eco/core/recipe/recipes/ShapedCraftingRecipe.java b/eco-api/src/main/java/com/willfp/eco/core/recipe/recipes/ShapedCraftingRecipe.java index 159ae712..8b8688e8 100644 --- a/eco-api/src/main/java/com/willfp/eco/core/recipe/recipes/ShapedCraftingRecipe.java +++ b/eco-api/src/main/java/com/willfp/eco/core/recipe/recipes/ShapedCraftingRecipe.java @@ -69,7 +69,11 @@ public final class ShapedCraftingRecipe implements CraftingRecipe { } @Override - public boolean test(@NotNull final ItemStack[] matrix) { + public boolean test(@Nullable final ItemStack[] matrix) { + if (matrix == null) { + return false; + } + List dynamicMatrix = Arrays.asList(matrix); boolean matches = true; for (int i = 0; i < 9; i++) { diff --git a/eco-api/src/main/java/com/willfp/eco/core/recipe/recipes/ShapelessCraftingRecipe.java b/eco-api/src/main/java/com/willfp/eco/core/recipe/recipes/ShapelessCraftingRecipe.java index 53a570d8..db53134c 100644 --- a/eco-api/src/main/java/com/willfp/eco/core/recipe/recipes/ShapelessCraftingRecipe.java +++ b/eco-api/src/main/java/com/willfp/eco/core/recipe/recipes/ShapelessCraftingRecipe.java @@ -80,7 +80,11 @@ public final class ShapelessCraftingRecipe implements CraftingRecipe { } @Override - public boolean test(@NotNull final ItemStack[] matrix) { + public boolean test(@Nullable final ItemStack[] matrix) { + if (matrix == null) { + return false; + } + RecipeTest test = newTest(); for (ItemStack stack : matrix) { diff --git a/eco-core/core-backend/src/main/kotlin/com/willfp/eco/internal/logging/EcoLogger.kt b/eco-core/core-backend/src/main/kotlin/com/willfp/eco/internal/logging/EcoLogger.kt index ae435cf1..d84a256e 100644 --- a/eco-core/core-backend/src/main/kotlin/com/willfp/eco/internal/logging/EcoLogger.kt +++ b/eco-core/core-backend/src/main/kotlin/com/willfp/eco/internal/logging/EcoLogger.kt @@ -8,7 +8,7 @@ import java.util.logging.Logger class EcoLogger(private val plugin: EcoPlugin) : Logger(plugin.name, null as String?) { override fun info(msg: String) { - Bukkit.getConsoleSender().sendMessage("[${plugin.name}] ${StringUtils.format(msg)}") + Bukkit.getConsoleSender().sendMessage("[${plugin.name}] ${StringUtils.format(msg, StringUtils.FormatOption.WITHOUT_PLACEHOLDERS)}") } init { diff --git a/eco-core/core-plugin/build.gradle.kts b/eco-core/core-plugin/build.gradle.kts index 44fc1c79..00f8ebda 100644 --- a/eco-core/core-plugin/build.gradle.kts +++ b/eco-core/core-plugin/build.gradle.kts @@ -22,7 +22,7 @@ dependencies { // Included in spigot jar compileOnly("com.google.code.gson:gson:2.8.8") - compileOnly("io.papermc.paper:paper-api:1.17.1-R0.1-SNAPSHOT") + compileOnly("io.papermc.paper:paper-api:1.19.3-R0.1-SNAPSHOT") // Plugin dependencies compileOnly("com.comphenix.protocol:ProtocolLib:5.0.0-SNAPSHOT") diff --git a/eco-core/core-plugin/src/main/kotlin/com/willfp/eco/internal/spigot/ConflictFinder.kt b/eco-core/core-plugin/src/main/kotlin/com/willfp/eco/internal/spigot/ConflictFinder.kt index c4ab0b2a..17529c9e 100644 --- a/eco-core/core-plugin/src/main/kotlin/com/willfp/eco/internal/spigot/ConflictFinder.kt +++ b/eco-core/core-plugin/src/main/kotlin/com/willfp/eco/internal/spigot/ConflictFinder.kt @@ -47,6 +47,7 @@ enum class ConflictType( } private fun Plugin.getConflict(): Conflict? { + @Suppress("DEPRECATION") if (this.description.libraries.any { it.contains("kotlin-stdlib") }) { return Conflict(this, ConflictType.LIB_LOADER) } diff --git a/eco-core/core-plugin/src/main/kotlin/com/willfp/eco/internal/spigot/EcoSpigotPlugin.kt b/eco-core/core-plugin/src/main/kotlin/com/willfp/eco/internal/spigot/EcoSpigotPlugin.kt index 6d6a1469..c47dbfc0 100644 --- a/eco-core/core-plugin/src/main/kotlin/com/willfp/eco/internal/spigot/EcoSpigotPlugin.kt +++ b/eco-core/core-plugin/src/main/kotlin/com/willfp/eco/internal/spigot/EcoSpigotPlugin.kt @@ -270,6 +270,7 @@ abstract class EcoSpigotPlugin : EcoPlugin() { IntegrationLoader("CombatLogX") { val pluginManager = Bukkit.getPluginManager() val combatLogXPlugin = pluginManager.getPlugin("CombatLogX") ?: return@IntegrationLoader + @Suppress("DEPRECATION") val pluginVersion = combatLogXPlugin.description.version if (pluginVersion.startsWith("10")) { AntigriefManager.register(AntigriefCombatLogXV10()) diff --git a/eco-core/core-plugin/src/main/kotlin/com/willfp/eco/internal/spigot/integrations/bstats/Metrics.kt b/eco-core/core-plugin/src/main/kotlin/com/willfp/eco/internal/spigot/integrations/bstats/Metrics.kt index de3ebcae..aff9cc96 100644 --- a/eco-core/core-plugin/src/main/kotlin/com/willfp/eco/internal/spigot/integrations/bstats/Metrics.kt +++ b/eco-core/core-plugin/src/main/kotlin/com/willfp/eco/internal/spigot/integrations/bstats/Metrics.kt @@ -35,6 +35,7 @@ class Metrics(private val plugin: EcoPlugin) { } private fun appendServiceData(builder: JsonObjectBuilder) { + @Suppress("DEPRECATION") builder.appendField("pluginVersion", plugin.description.version) } @@ -238,15 +239,6 @@ class Metrics(private val plugin: EcoPlugin) { // Inform the server owners about bStats config .options() - .header( - """ - bStats (https://bStats.org) collects some basic information for plugin authors, like how - many people use their plugin and their total player count. It's recommended to keep bStats - enabled, but if you're not comfortable with this, you can turn this setting off. There is no - performance penalty associated with having metrics enabled, and data sent to bStats is fully - anonymous. - """.trimIndent() - ) .copyDefaults(true) config.save(configFile) } diff --git a/eco-core/core-plugin/src/main/kotlin/com/willfp/eco/internal/spigot/recipes/StackedRecipeListener.kt b/eco-core/core-plugin/src/main/kotlin/com/willfp/eco/internal/spigot/recipes/StackedRecipeListener.kt index 3bcccb32..bfd6560b 100644 --- a/eco-core/core-plugin/src/main/kotlin/com/willfp/eco/internal/spigot/recipes/StackedRecipeListener.kt +++ b/eco-core/core-plugin/src/main/kotlin/com/willfp/eco/internal/spigot/recipes/StackedRecipeListener.kt @@ -118,7 +118,7 @@ class StackedRecipeListener( // Just to be safe, modify the instance (safe check) Using ?. causes a warning. @Suppress("SENSELESS_COMPARISON") // I hate compiler warnings if (inventory.matrix[i] != null) { - inventory.matrix[i].amount = amount + inventory.matrix[i]?.amount = amount } } } diff --git a/eco-core/core-plugin/src/main/resources/paper-plugin.yml b/eco-core/core-plugin/src/main/resources/paper-plugin.yml index 68cf92cc..744edaa7 100644 --- a/eco-core/core-plugin/src/main/resources/paper-plugin.yml +++ b/eco-core/core-plugin/src/main/resources/paper-plugin.yml @@ -2,6 +2,7 @@ name: eco version: ${projectVersion} main: com.willfp.eco.internal.spigot.EcoImpl api-version: 1.19 +load: STARTUP dependencies: - name: ProtocolLib