From ea683405964779d778a5deee912da315c7c16a54 Mon Sep 17 00:00:00 2001 From: Kiran Hart Date: Sat, 9 Oct 2021 13:41:37 -0400 Subject: [PATCH] 2.39.0 - mcMMO hook --- pom.xml | 11 +++++++- .../tweetzy/auctionhouse/api/AuctionAPI.java | 6 +++++ .../auctionhouse/api/hook/McMMOHook.java | 27 +++++++++++++++++++ .../auctionhouse/settings/LocaleSettings.java | 1 + 4 files changed, 44 insertions(+), 1 deletion(-) create mode 100644 src/main/java/ca/tweetzy/auctionhouse/api/hook/McMMOHook.java diff --git a/pom.xml b/pom.xml index c056d51..0310d76 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ 4.0.0 ca.tweetzy auctionhouse - 2.38.0 + 2.39.0 UTF-8 @@ -152,6 +152,10 @@ placeholderapi https://repo.extendedclip.com/content/repositories/placeholderapi/ + + neetgames + https://nexus.neetgames.com/repository/maven-releases/ + @@ -165,6 +169,11 @@ tweetycore 2.9.3 + + com.gmail.nossr50.mcMMO + mcMMO + 2.1.202 + org.projectlombok lombok diff --git a/src/main/java/ca/tweetzy/auctionhouse/api/AuctionAPI.java b/src/main/java/ca/tweetzy/auctionhouse/api/AuctionAPI.java index dbd7228..cf98edc 100644 --- a/src/main/java/ca/tweetzy/auctionhouse/api/AuctionAPI.java +++ b/src/main/java/ca/tweetzy/auctionhouse/api/AuctionAPI.java @@ -3,6 +3,7 @@ package ca.tweetzy.auctionhouse.api; import ca.tweetzy.auctionhouse.AuctionHouse; import ca.tweetzy.auctionhouse.api.events.AuctionStartEvent; import ca.tweetzy.auctionhouse.api.hook.MMOItemsHook; +import ca.tweetzy.auctionhouse.api.hook.McMMOHook; import ca.tweetzy.auctionhouse.auction.AuctionPlayer; import ca.tweetzy.auctionhouse.auction.AuctionSaleType; import ca.tweetzy.auctionhouse.auction.AuctionedItem; @@ -603,6 +604,11 @@ public class AuctionAPI { * @param isUsingBundle States whether the item is a bundled item */ public void listAuction(Player seller, ItemStack original, ItemStack item, int seconds, double basePrice, double bidStartPrice, double bidIncPrice, double currentPrice, boolean isBiddingItem, boolean isUsingBundle, boolean requiresHandRemove) { + if (McMMOHook.isUsingAbility(seller)) { + AuctionHouse.getInstance().getLocale().getMessage("general.mcmmo_ability_active").sendPrefixedMessage(seller); + return; + } + AuctionedItem auctionedItem = new AuctionedItem(); auctionedItem.setId(UUID.randomUUID()); auctionedItem.setOwner(seller.getUniqueId()); diff --git a/src/main/java/ca/tweetzy/auctionhouse/api/hook/McMMOHook.java b/src/main/java/ca/tweetzy/auctionhouse/api/hook/McMMOHook.java new file mode 100644 index 0000000..0d8f939 --- /dev/null +++ b/src/main/java/ca/tweetzy/auctionhouse/api/hook/McMMOHook.java @@ -0,0 +1,27 @@ +package ca.tweetzy.auctionhouse.api.hook; + +import com.gmail.nossr50.api.AbilityAPI; +import lombok.NonNull; +import lombok.experimental.UtilityClass; +import org.bukkit.Bukkit; +import org.bukkit.entity.Player; +import org.bukkit.inventory.ItemStack; + +/** + * The current file has been created by Kiran Hart + * Date Created: October 09 2021 + * Time Created: 1:35 p.m. + * Usage of any code found within this class is prohibited unless given explicit permission otherwise + */ +@UtilityClass +public final class McMMOHook { + + private boolean isEnabled() { + return Bukkit.getPluginManager().getPlugin("mcMMO") != null; + } + + public boolean isUsingAbility(@NonNull final Player player) { + if (!isEnabled()) return false; + return AbilityAPI.isAnyAbilityEnabled(player); + } +} diff --git a/src/main/java/ca/tweetzy/auctionhouse/settings/LocaleSettings.java b/src/main/java/ca/tweetzy/auctionhouse/settings/LocaleSettings.java index 812c5a1..35f43c6 100644 --- a/src/main/java/ca/tweetzy/auctionhouse/settings/LocaleSettings.java +++ b/src/main/java/ca/tweetzy/auctionhouse/settings/LocaleSettings.java @@ -47,6 +47,7 @@ public class LocaleSettings { languageNodes.put("general.bought_item", "&aYou bought &fx%amount% %item%&a for &a$%price%"); languageNodes.put("general.wait_to_list", "&cPlease wait &4%time%&cs before listing another item"); languageNodes.put("general.please_enter_at_least_one_number", "&cPlease enter at least 1 valid number!"); + languageNodes.put("general.mcmmo_ability_active", "&cCannot list item when mcMMO ability is active!"); languageNodes.put("pricing.minbaseprice", "&cThe minimum base price must be &a$%price%");