2.39.0 - mcMMO hook

This commit is contained in:
Kiran Hart 2021-10-09 13:41:37 -04:00
parent aaed974ae2
commit ea68340596
4 changed files with 44 additions and 1 deletions

11
pom.xml
View File

@ -6,7 +6,7 @@
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<groupId>ca.tweetzy</groupId> <groupId>ca.tweetzy</groupId>
<artifactId>auctionhouse</artifactId> <artifactId>auctionhouse</artifactId>
<version>2.38.0</version> <version>2.39.0</version>
<properties> <properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
@ -152,6 +152,10 @@
<id>placeholderapi</id> <id>placeholderapi</id>
<url>https://repo.extendedclip.com/content/repositories/placeholderapi/</url> <url>https://repo.extendedclip.com/content/repositories/placeholderapi/</url>
</repository> </repository>
<repository>
<id>neetgames</id>
<url>https://nexus.neetgames.com/repository/maven-releases/</url>
</repository>
</repositories> </repositories>
<dependencies> <dependencies>
<dependency> <dependency>
@ -165,6 +169,11 @@
<artifactId>tweetycore</artifactId> <artifactId>tweetycore</artifactId>
<version>2.9.3</version> <version>2.9.3</version>
</dependency> </dependency>
<dependency>
<groupId>com.gmail.nossr50.mcMMO</groupId>
<artifactId>mcMMO</artifactId>
<version>2.1.202</version>
</dependency>
<dependency> <dependency>
<groupId>org.projectlombok</groupId> <groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId> <artifactId>lombok</artifactId>

View File

@ -3,6 +3,7 @@ package ca.tweetzy.auctionhouse.api;
import ca.tweetzy.auctionhouse.AuctionHouse; import ca.tweetzy.auctionhouse.AuctionHouse;
import ca.tweetzy.auctionhouse.api.events.AuctionStartEvent; import ca.tweetzy.auctionhouse.api.events.AuctionStartEvent;
import ca.tweetzy.auctionhouse.api.hook.MMOItemsHook; 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.AuctionPlayer;
import ca.tweetzy.auctionhouse.auction.AuctionSaleType; import ca.tweetzy.auctionhouse.auction.AuctionSaleType;
import ca.tweetzy.auctionhouse.auction.AuctionedItem; import ca.tweetzy.auctionhouse.auction.AuctionedItem;
@ -603,6 +604,11 @@ public class AuctionAPI {
* @param isUsingBundle States whether the item is a bundled item * @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) { 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 auctionedItem = new AuctionedItem();
auctionedItem.setId(UUID.randomUUID()); auctionedItem.setId(UUID.randomUUID());
auctionedItem.setOwner(seller.getUniqueId()); auctionedItem.setOwner(seller.getUniqueId());

View File

@ -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);
}
}

View File

@ -47,6 +47,7 @@ public class LocaleSettings {
languageNodes.put("general.bought_item", "&aYou bought &fx%amount% %item%&a for &a$%price%"); 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.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.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%"); languageNodes.put("pricing.minbaseprice", "&cThe minimum base price must be &a$%price%");