From b76c1a660182db4b2088e9e40720d7c74fa32cde Mon Sep 17 00:00:00 2001 From: LlmDl Date: Wed, 24 Jan 2024 11:08:11 -0600 Subject: [PATCH] Add support for ItemsAdder. TODO: finish readme with instructions for itemsadder. Closes #141. --- pom.xml | 6 ++++ .../townyresources/TownyResources.java | 11 ++++++- .../TownResourceCollectionController.java | 12 ++++++++ .../settings/TownyResourcesSettings.java | 6 ++++ .../townyresources/util/ItemsAdderUtil.java | 30 +++++++++++++++++++ .../util/TownyResourcesMessagingUtil.java | 8 +++++ src/main/resources/plugin.yml | 2 +- 7 files changed, 73 insertions(+), 2 deletions(-) create mode 100644 src/main/java/io/github/townyadvanced/townyresources/util/ItemsAdderUtil.java diff --git a/pom.xml b/pom.xml index 4ed80e8..35e26e1 100644 --- a/pom.xml +++ b/pom.xml @@ -89,6 +89,12 @@ 6.9.2-SNAPSHOT provided + + com.github.LoneDev6 + api-itemsadder + 3.6.1 + provided + com.github.bsideup.jabel jabel-javac-plugin diff --git a/src/main/java/io/github/townyadvanced/townyresources/TownyResources.java b/src/main/java/io/github/townyadvanced/townyresources/TownyResources.java index fc60f78..5d2b091 100644 --- a/src/main/java/io/github/townyadvanced/townyresources/TownyResources.java +++ b/src/main/java/io/github/townyadvanced/townyresources/TownyResources.java @@ -41,7 +41,7 @@ public class TownyResources extends JavaPlugin { private static boolean slimeFunInstalled; private static boolean mythicMobsInstalled; private static boolean mmmoItemsInstalled; - + private static boolean itemsAdderInstalled; public TownyResources() { plugin = this; @@ -222,6 +222,10 @@ public boolean isMythicMobsV5() { return mythicMobsInstalled; } + public boolean isItemsAdderInstalled() { + return itemsAdderInstalled; + } + public boolean isMMOItemsInstalled() { return mmmoItemsInstalled; } @@ -264,6 +268,11 @@ private void setupIntegrationsWithOtherPlugins() { } } + Plugin itemsAdder = Bukkit.getPluginManager().getPlugin("ItemsAdder"); + itemsAdderInstalled = itemsAdder != null; + if (itemsAdderInstalled) + info(" ItemsAdder Integration Enabled"); + Plugin mmmoItems = Bukkit.getPluginManager().getPlugin("MMOItems"); mmmoItemsInstalled = mmmoItems != null; if (mmmoItemsInstalled) diff --git a/src/main/java/io/github/townyadvanced/townyresources/controllers/TownResourceCollectionController.java b/src/main/java/io/github/townyadvanced/townyresources/controllers/TownResourceCollectionController.java index 6ca247f..0901f74 100644 --- a/src/main/java/io/github/townyadvanced/townyresources/controllers/TownResourceCollectionController.java +++ b/src/main/java/io/github/townyadvanced/townyresources/controllers/TownResourceCollectionController.java @@ -7,6 +7,7 @@ import io.github.thebusybiscuit.slimefun4.api.items.SlimefunItem; import io.github.townyadvanced.townyresources.TownyResources; import io.github.townyadvanced.townyresources.metadata.TownyResourcesGovernmentMetaDataController; +import io.github.townyadvanced.townyresources.util.ItemsAdderUtil; import io.github.townyadvanced.townyresources.util.MMOItemsUtil; import io.github.townyadvanced.townyresources.util.MythicMobsUtil; import io.github.townyadvanced.townyresources.util.TownyResourcesMessagingUtil; @@ -139,6 +140,17 @@ private static List buildItemStackList(Player player, Set