mirror of
https://github.com/kiranhart/Auction-House.git
synced 2024-11-26 06:05:25 +01:00
2.45.0 - Mark chest
This commit is contained in:
parent
e69c4945c7
commit
4fdd4e552d
4
pom.xml
4
pom.xml
@ -6,7 +6,7 @@
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>ca.tweetzy</groupId>
|
||||
<artifactId>auctionhouse</artifactId>
|
||||
<version>2.44.0</version>
|
||||
<version>2.45.0</version>
|
||||
|
||||
<properties>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
@ -184,7 +184,7 @@
|
||||
<dependency>
|
||||
<groupId>org.spigotmc</groupId>
|
||||
<artifactId>spigot</artifactId>
|
||||
<version>1.17-R0.1-SNAPSHOT</version>
|
||||
<version>1.18-R0.1-SNAPSHOT</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
|
@ -207,7 +207,8 @@ public class AuctionHouse extends TweetyPlugin {
|
||||
new CommandStatus(),
|
||||
new CommandAdmin(),
|
||||
new CommandBan(),
|
||||
new CommandUnban()
|
||||
new CommandUnban(),
|
||||
new CommandMarkChest()
|
||||
);
|
||||
|
||||
// Placeholder API
|
||||
|
@ -4,6 +4,7 @@ import ca.tweetzy.auctionhouse.AuctionHouse;
|
||||
import ca.tweetzy.auctionhouse.api.AuctionAPI;
|
||||
import ca.tweetzy.auctionhouse.auction.AuctionPlayer;
|
||||
import ca.tweetzy.auctionhouse.guis.GUIActiveAuctions;
|
||||
import ca.tweetzy.auctionhouse.settings.Settings;
|
||||
import ca.tweetzy.core.commands.AbstractCommand;
|
||||
import ca.tweetzy.core.utils.TextUtils;
|
||||
import org.bukkit.Bukkit;
|
||||
@ -29,6 +30,10 @@ public class CommandActive extends AbstractCommand {
|
||||
Player player = (Player) sender;
|
||||
|
||||
if (AuctionAPI.tellMigrationStatus(player)) return ReturnType.FAILURE;
|
||||
if (Settings.USE_AUCTION_CHEST_MODE.getBoolean()) {
|
||||
AuctionHouse.getInstance().getLocale().getMessage("general.visit auction chest").sendPrefixedMessage(player);
|
||||
return ReturnType.FAILURE;
|
||||
}
|
||||
|
||||
if (AuctionHouse.getInstance().getAuctionBanManager().checkAndHandleBan(player)) {
|
||||
return ReturnType.FAILURE;
|
||||
|
@ -4,6 +4,7 @@ import ca.tweetzy.auctionhouse.AuctionHouse;
|
||||
import ca.tweetzy.auctionhouse.api.AuctionAPI;
|
||||
import ca.tweetzy.auctionhouse.auction.AuctionPlayer;
|
||||
import ca.tweetzy.auctionhouse.guis.GUIAuctionHouse;
|
||||
import ca.tweetzy.auctionhouse.settings.Settings;
|
||||
import ca.tweetzy.core.commands.AbstractCommand;
|
||||
import ca.tweetzy.core.utils.TextUtils;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
@ -31,6 +32,10 @@ public class CommandAuctionHouse extends AbstractCommand {
|
||||
if (sender instanceof Player) {
|
||||
Player player = (Player) sender;
|
||||
if (AuctionAPI.tellMigrationStatus(player)) return ReturnType.FAILURE;
|
||||
if (Settings.USE_AUCTION_CHEST_MODE.getBoolean()) {
|
||||
AuctionHouse.getInstance().getLocale().getMessage("general.visit auction chest").sendPrefixedMessage(player);
|
||||
return ReturnType.FAILURE;
|
||||
}
|
||||
|
||||
if (AuctionHouse.getInstance().getAuctionBanManager().checkAndHandleBan(player)) {
|
||||
return ReturnType.FAILURE;
|
||||
|
@ -4,6 +4,7 @@ import ca.tweetzy.auctionhouse.AuctionHouse;
|
||||
import ca.tweetzy.auctionhouse.api.AuctionAPI;
|
||||
import ca.tweetzy.auctionhouse.auction.AuctionPlayer;
|
||||
import ca.tweetzy.auctionhouse.guis.GUIExpiredItems;
|
||||
import ca.tweetzy.auctionhouse.settings.Settings;
|
||||
import ca.tweetzy.core.commands.AbstractCommand;
|
||||
import ca.tweetzy.core.utils.TextUtils;
|
||||
import org.bukkit.Bukkit;
|
||||
@ -29,6 +30,11 @@ public class CommandExpired extends AbstractCommand {
|
||||
Player player = (Player) sender;
|
||||
if (AuctionAPI.tellMigrationStatus(player)) return ReturnType.FAILURE;
|
||||
|
||||
if (Settings.USE_AUCTION_CHEST_MODE.getBoolean()) {
|
||||
AuctionHouse.getInstance().getLocale().getMessage("general.visit auction chest").sendPrefixedMessage(player);
|
||||
return ReturnType.FAILURE;
|
||||
}
|
||||
|
||||
if (AuctionHouse.getInstance().getAuctionBanManager().checkAndHandleBan(player)) {
|
||||
return ReturnType.FAILURE;
|
||||
}
|
||||
|
@ -0,0 +1,73 @@
|
||||
package ca.tweetzy.auctionhouse.commands;
|
||||
|
||||
import ca.tweetzy.auctionhouse.AuctionHouse;
|
||||
import ca.tweetzy.auctionhouse.api.AuctionAPI;
|
||||
import ca.tweetzy.core.commands.AbstractCommand;
|
||||
import ca.tweetzy.core.compatibility.ServerVersion;
|
||||
import ca.tweetzy.core.compatibility.XMaterial;
|
||||
import org.bukkit.NamespacedKey;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.block.Chest;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.persistence.PersistentDataType;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* The current file has been created by Kiran Hart
|
||||
* Date Created: December 04 2021
|
||||
* Time Created: 11:30 p.m.
|
||||
* Usage of any code found within this class is prohibited unless given explicit permission otherwise
|
||||
*/
|
||||
public final class CommandMarkChest extends AbstractCommand {
|
||||
|
||||
public CommandMarkChest() {
|
||||
super(CommandType.PLAYER_ONLY, "markchest");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected ReturnType runCommand(CommandSender sender, String... args) {
|
||||
if (AuctionAPI.tellMigrationStatus(sender)) return ReturnType.FAILURE;
|
||||
if (!ServerVersion.isServerVersionAtLeast(ServerVersion.V1_14)) return ReturnType.FAILURE;
|
||||
final Player player = (Player) sender;
|
||||
|
||||
final Block targetBlock = player.getTargetBlock(null, 10);
|
||||
if (targetBlock.getType() != XMaterial.CHEST.parseMaterial()) return ReturnType.FAILURE;
|
||||
|
||||
final Chest chest = (Chest) targetBlock.getState();
|
||||
final NamespacedKey key = new NamespacedKey(AuctionHouse.getInstance(), "AuctionHouseMarkedChest");
|
||||
|
||||
if (chest.getPersistentDataContainer().has(key, PersistentDataType.BYTE)) {
|
||||
chest.getPersistentDataContainer().remove(key);
|
||||
chest.update(true);
|
||||
AuctionHouse.getInstance().getLocale().getMessage("general.unmarked chest").sendPrefixedMessage(player);
|
||||
} else {
|
||||
chest.getPersistentDataContainer().set(key, PersistentDataType.BYTE, (byte) 1);
|
||||
chest.update(true);
|
||||
AuctionHouse.getInstance().getLocale().getMessage("general.marked chest").sendPrefixedMessage(player);
|
||||
}
|
||||
|
||||
return ReturnType.SUCCESS;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected List<String> onTab(CommandSender sender, String... args) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPermissionNode() {
|
||||
return "auctionhouse.cmd.markchest";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getSyntax() {
|
||||
return AuctionHouse.getInstance().getLocale().getMessage("commands.syntax.markchest").getMessage();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDescription() {
|
||||
return AuctionHouse.getInstance().getLocale().getMessage("commands.description.markchest").getMessage();
|
||||
}
|
||||
}
|
@ -4,6 +4,7 @@ import ca.tweetzy.auctionhouse.AuctionHouse;
|
||||
import ca.tweetzy.auctionhouse.api.AuctionAPI;
|
||||
import ca.tweetzy.auctionhouse.auction.AuctionPlayer;
|
||||
import ca.tweetzy.auctionhouse.guis.GUIAuctionHouse;
|
||||
import ca.tweetzy.auctionhouse.settings.Settings;
|
||||
import ca.tweetzy.core.commands.AbstractCommand;
|
||||
import ca.tweetzy.core.utils.TextUtils;
|
||||
import org.bukkit.Bukkit;
|
||||
@ -30,6 +31,11 @@ public class CommandSearch extends AbstractCommand {
|
||||
Player player = (Player) sender;
|
||||
if (AuctionAPI.tellMigrationStatus(player)) return ReturnType.FAILURE;
|
||||
|
||||
if (Settings.USE_AUCTION_CHEST_MODE.getBoolean()) {
|
||||
AuctionHouse.getInstance().getLocale().getMessage("general.visit auction chest").sendPrefixedMessage(player);
|
||||
return ReturnType.FAILURE;
|
||||
}
|
||||
|
||||
if (AuctionHouse.getInstance().getAuctionBanManager().checkAndHandleBan(player)) {
|
||||
return ReturnType.FAILURE;
|
||||
}
|
||||
|
@ -41,6 +41,11 @@ public final class CommandSell extends AbstractCommand {
|
||||
Player player = (Player) sender;
|
||||
if (AuctionAPI.tellMigrationStatus(player)) return ReturnType.FAILURE;
|
||||
|
||||
if (Settings.USE_AUCTION_CHEST_MODE.getBoolean()) {
|
||||
AuctionHouse.getInstance().getLocale().getMessage("general.visit auction chest").sendPrefixedMessage(player);
|
||||
return ReturnType.FAILURE;
|
||||
}
|
||||
|
||||
if (AuctionHouse.getInstance().getAuctionBanManager().checkAndHandleBan(player)) {
|
||||
return ReturnType.FAILURE;
|
||||
}
|
||||
|
@ -3,6 +3,7 @@ package ca.tweetzy.auctionhouse.commands;
|
||||
import ca.tweetzy.auctionhouse.AuctionHouse;
|
||||
import ca.tweetzy.auctionhouse.api.AuctionAPI;
|
||||
import ca.tweetzy.auctionhouse.guis.transaction.GUITransactionType;
|
||||
import ca.tweetzy.auctionhouse.settings.Settings;
|
||||
import ca.tweetzy.core.commands.AbstractCommand;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
@ -26,6 +27,11 @@ public class CommandTransactions extends AbstractCommand {
|
||||
Player player = (Player) sender;
|
||||
if (AuctionAPI.tellMigrationStatus(player)) return ReturnType.FAILURE;
|
||||
|
||||
if (Settings.USE_AUCTION_CHEST_MODE.getBoolean()) {
|
||||
AuctionHouse.getInstance().getLocale().getMessage("general.visit auction chest").sendPrefixedMessage(player);
|
||||
return ReturnType.FAILURE;
|
||||
}
|
||||
|
||||
if (AuctionHouse.getInstance().getAuctionBanManager().checkAndHandleBan(player)) {
|
||||
return ReturnType.FAILURE;
|
||||
}
|
||||
|
@ -4,6 +4,7 @@ import ca.tweetzy.auctionhouse.AuctionHouse;
|
||||
import ca.tweetzy.auctionhouse.api.AuctionAPI;
|
||||
import ca.tweetzy.auctionhouse.api.UpdateChecker;
|
||||
import ca.tweetzy.auctionhouse.auction.AuctionPlayer;
|
||||
import ca.tweetzy.auctionhouse.guis.GUIAuctionHouse;
|
||||
import ca.tweetzy.auctionhouse.helpers.PlayerHelper;
|
||||
import ca.tweetzy.core.compatibility.ServerVersion;
|
||||
import ca.tweetzy.core.compatibility.XMaterial;
|
||||
@ -11,7 +12,11 @@ import ca.tweetzy.core.utils.PlayerUtils;
|
||||
import ca.tweetzy.core.utils.TextUtils;
|
||||
import ca.tweetzy.core.utils.nms.NBTEditor;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.NamespacedKey;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.block.Chest;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.Event;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.block.Action;
|
||||
@ -20,6 +25,7 @@ import org.bukkit.event.player.PlayerInteractEvent;
|
||||
import org.bukkit.event.player.PlayerJoinEvent;
|
||||
import org.bukkit.event.player.PlayerQuitEvent;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.persistence.PersistentDataType;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
@ -65,6 +71,27 @@ public class PlayerListeners implements Listener {
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onAuctionChestClick(PlayerInteractEvent e) {
|
||||
final Player player = e.getPlayer();
|
||||
final Block block = e.getClickedBlock();
|
||||
|
||||
if (block == null || block.getType() != XMaterial.CHEST.parseMaterial()) return;
|
||||
final Chest chest = (Chest) block.getState();
|
||||
|
||||
final NamespacedKey key = new NamespacedKey(AuctionHouse.getInstance(), "AuctionHouseMarkedChest");
|
||||
if (chest.getPersistentDataContainer().has(key, PersistentDataType.BYTE)) {
|
||||
e.setUseInteractedBlock(Event.Result.DENY);
|
||||
e.setCancelled(true);
|
||||
|
||||
if (AuctionHouse.getInstance().getAuctionBanManager().checkAndHandleBan(player)) {
|
||||
return;
|
||||
}
|
||||
|
||||
AuctionHouse.getInstance().getGuiManager().showGUI(player, new GUIAuctionHouse(AuctionHouse.getInstance().getAuctionPlayerManager().getPlayer(player.getUniqueId())));
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onBundleClick(PlayerInteractEvent e) {
|
||||
Player player = e.getPlayer();
|
||||
|
@ -48,6 +48,9 @@ public class LocaleSettings {
|
||||
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("general.cannot list damaged item", "&cCannot list a damaged item!");
|
||||
languageNodes.put("general.marked chest", "&aYou marked that chest as an Auction chest");
|
||||
languageNodes.put("general.unmarked chest", "&cYou unmarked that chest as an Auction chest");
|
||||
languageNodes.put("general.visit auction chest", "&cVisit an Auction chest to use Auction House.");
|
||||
|
||||
|
||||
languageNodes.put("pricing.minbaseprice", "&cThe minimum base price must be &a$%price%");
|
||||
@ -148,6 +151,7 @@ public class LocaleSettings {
|
||||
languageNodes.put("commands.syntax.ban", "ban [player] [time] [reason]");
|
||||
languageNodes.put("commands.syntax.unban", "unban <player>");
|
||||
languageNodes.put("commands.syntax.togglelistinfo", "togglelistinfo");
|
||||
languageNodes.put("commands.syntax.markchest", "markchest");
|
||||
|
||||
languageNodes.put("commands.description.active", "View all your auction listings");
|
||||
languageNodes.put("commands.description.auctionhouse", "Main command for the plugin, it opens the auction window.");
|
||||
@ -163,6 +167,7 @@ public class LocaleSettings {
|
||||
languageNodes.put("commands.description.ban", "Ban a player from the auction house for a set amount of time.");
|
||||
languageNodes.put("commands.description.unban", "Unban a player from the auction house");
|
||||
languageNodes.put("commands.description.togglelistinfo", "Toggle whether auction house should message you when you list an item");
|
||||
languageNodes.put("commands.description.markchest", "Toggles whether a chest is an auction chest");
|
||||
}
|
||||
|
||||
public static void setup() {
|
||||
|
@ -128,6 +128,7 @@ public class Settings {
|
||||
public static final ConfigSetting MISC_FILTER_ENABLED = new ConfigSetting(config, "auction setting.enabled filters.misc", true, "Should this filter be enabled?");
|
||||
public static final ConfigSetting SEARCH_FILTER_ENABLED = new ConfigSetting(config, "auction setting.enabled filters.search", true, "Should this filter be enabled?");
|
||||
public static final ConfigSetting SELF_FILTER_ENABLED = new ConfigSetting(config, "auction setting.enabled filters.self", true, "Should this filter be enabled?");
|
||||
public static final ConfigSetting USE_AUCTION_CHEST_MODE = new ConfigSetting(config, "auction setting.use auction chest mode", false, "Enabling this will make it so players can only access the auction through the auction chest");
|
||||
|
||||
public static final ConfigSetting ALLOW_ITEM_BUNDLES = new ConfigSetting(config, "auction setting.bundles.enabled", true, "If true, players can use -b in the sell command to bundle all similar items into a single item.");
|
||||
public static final ConfigSetting ITEM_BUNDLE_ITEM = new ConfigSetting(config, "auction setting.bundles.item", XMaterial.GOLD_BLOCK.name());
|
||||
|
Loading…
Reference in New Issue
Block a user