mirror of
https://github.com/kiranhart/Auction-House.git
synced 2025-01-07 12:47:36 +01:00
🌠 Fix some meteor client dupe stuff
Took 19 seconds
This commit is contained in:
parent
8aa840ef0d
commit
bd305d7510
@ -25,10 +25,7 @@ import ca.tweetzy.auctionhouse.auction.AuctionedItem;
|
||||
import ca.tweetzy.auctionhouse.commands.*;
|
||||
import ca.tweetzy.auctionhouse.database.DataManager;
|
||||
import ca.tweetzy.auctionhouse.database.migrations.*;
|
||||
import ca.tweetzy.auctionhouse.listeners.AuctionListeners;
|
||||
import ca.tweetzy.auctionhouse.listeners.CMIListener;
|
||||
import ca.tweetzy.auctionhouse.listeners.ChestShopListener;
|
||||
import ca.tweetzy.auctionhouse.listeners.PlayerListeners;
|
||||
import ca.tweetzy.auctionhouse.listeners.*;
|
||||
import ca.tweetzy.auctionhouse.managers.*;
|
||||
import ca.tweetzy.auctionhouse.settings.LocaleSettings;
|
||||
import ca.tweetzy.auctionhouse.settings.Settings;
|
||||
@ -183,6 +180,7 @@ public class AuctionHouse extends TweetyPlugin {
|
||||
|
||||
// listeners
|
||||
Bukkit.getServer().getPluginManager().registerEvents(new PlayerListeners(), this);
|
||||
Bukkit.getServer().getPluginManager().registerEvents(new MeteorClientListeners(), this);
|
||||
Bukkit.getServer().getPluginManager().registerEvents(new AuctionListeners(), this);
|
||||
|
||||
if (getServer().getPluginManager().isPluginEnabled("ChestShop"))
|
||||
|
@ -318,12 +318,15 @@ public final class CommandSell extends AbstractCommand {
|
||||
AuctionHouse.getInstance().getAuctionPlayerManager().addToSellProcess(player);
|
||||
|
||||
if (Settings.ASK_FOR_LISTING_CONFIRMATION.getBoolean()) {
|
||||
player.getInventory().setItemInHand(CompMaterial.AIR.parseItem());
|
||||
auctionPlayer.setItemBeingListed(auctionedItem.getItem());
|
||||
|
||||
instance.getGuiManager().showGUI(player, new GUIListingConfirm(player, auctionedItem, result -> {
|
||||
if (!result) {
|
||||
AuctionHouse.getInstance().getAuctionPlayerManager().processSell(player);
|
||||
|
||||
player.closeInventory();
|
||||
// PlayerUtils.giveItem(player, auctionedItem.getItem());
|
||||
PlayerUtils.giveItem(player, auctionedItem.getItem());
|
||||
auctionPlayer.setItemBeingListed(null);
|
||||
return;
|
||||
}
|
||||
@ -333,8 +336,6 @@ public final class CommandSell extends AbstractCommand {
|
||||
return;
|
||||
}
|
||||
|
||||
player.getInventory().setItemInHand(CompMaterial.AIR.parseItem());
|
||||
|
||||
AuctionCreator.create(auctionPlayer, auctionedItem, (auction, listingResult) -> {
|
||||
AuctionHouse.getInstance().getAuctionPlayerManager().processSell(player);
|
||||
|
||||
|
@ -19,10 +19,12 @@
|
||||
package ca.tweetzy.auctionhouse.guis.confirmation;
|
||||
|
||||
import ca.tweetzy.auctionhouse.AuctionHouse;
|
||||
import ca.tweetzy.auctionhouse.auction.AuctionPlayer;
|
||||
import ca.tweetzy.auctionhouse.auction.AuctionedItem;
|
||||
import ca.tweetzy.auctionhouse.auction.enums.AuctionStackType;
|
||||
import ca.tweetzy.auctionhouse.guis.AbstractPlaceholderGui;
|
||||
import ca.tweetzy.auctionhouse.settings.Settings;
|
||||
import ca.tweetzy.core.utils.PlayerUtils;
|
||||
import ca.tweetzy.core.utils.TextUtils;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.inventory.ClickType;
|
||||
@ -58,6 +60,13 @@ public final class GUIListingConfirm extends AbstractPlaceholderGui {
|
||||
|
||||
setOnClose(close -> {
|
||||
close.player.removeMetadata("AuctionHouseConfirmListing", AuctionHouse.getInstance());
|
||||
final AuctionPlayer auctionPlayer = AuctionHouse.getInstance().getAuctionPlayerManager().getPlayer(close.player.getUniqueId());
|
||||
|
||||
if (auctionPlayer.getItemBeingListed() != null) {
|
||||
PlayerUtils.giveItem(close.player, auctionedItem.getItem());
|
||||
auctionPlayer.setItemBeingListed(null);
|
||||
}
|
||||
|
||||
AuctionHouse.getInstance().getAuctionPlayerManager().processSell(close.player);
|
||||
});
|
||||
|
||||
|
@ -35,19 +35,18 @@ import org.bukkit.Bukkit;
|
||||
import org.bukkit.NamespacedKey;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.block.Chest;
|
||||
import org.bukkit.entity.HumanEntity;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.Event;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.block.Action;
|
||||
import org.bukkit.event.block.BlockPlaceEvent;
|
||||
import org.bukkit.event.entity.PlayerDeathEvent;
|
||||
import org.bukkit.event.inventory.InventoryClickEvent;
|
||||
import org.bukkit.event.inventory.PrepareAnvilEvent;
|
||||
import org.bukkit.event.inventory.PrepareItemCraftEvent;
|
||||
import org.bukkit.event.player.*;
|
||||
import org.bukkit.event.player.PlayerInteractEvent;
|
||||
import org.bukkit.event.player.PlayerJoinEvent;
|
||||
import org.bukkit.event.player.PlayerQuitEvent;
|
||||
import org.bukkit.inventory.CraftingInventory;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.persistence.PersistentDataType;
|
||||
@ -72,7 +71,8 @@ public class PlayerListeners implements Listener {
|
||||
Bukkit.getServer().getScheduler().cancelTask(auctionPlayer.getAssignedTaskId());
|
||||
|
||||
if (auctionPlayer.getItemBeingListed() != null && player.getLocation().getWorld() != null) {
|
||||
player.getLocation().getWorld().dropItemNaturally(player.getLocation(), auctionPlayer.getItemBeingListed());
|
||||
if (!AuctionHouse.getInstance().getAuctionPlayerManager().isInSellProcess(player))
|
||||
player.getLocation().getWorld().dropItemNaturally(player.getLocation(), auctionPlayer.getItemBeingListed());
|
||||
auctionPlayer.setItemBeingListed(CompMaterial.AIR.parseItem());
|
||||
}
|
||||
}
|
||||
@ -176,61 +176,6 @@ public class PlayerListeners implements Listener {
|
||||
PlayerUtils.giveItem(player, items);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onItemDropDuringSell(final PlayerDropItemEvent event) {
|
||||
final Player player = event.getPlayer();
|
||||
|
||||
if (AuctionHouse.getInstance().getAuctionPlayerManager().isInSellProcess(player))
|
||||
event.setCancelled(true);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onHotbarSwapDuringSell(final PlayerItemHeldEvent event) {
|
||||
final Player player = event.getPlayer();
|
||||
|
||||
if (AuctionHouse.getInstance().getAuctionPlayerManager().isInSellProcess(player))
|
||||
event.setCancelled(true);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onOffhandSwap(final PlayerSwapHandItemsEvent event) {
|
||||
final Player player = event.getPlayer();
|
||||
|
||||
if (AuctionHouse.getInstance().getAuctionPlayerManager().isInSellProcess(player)) {
|
||||
event.setCancelled(true);
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onItemRemove(final InventoryClickEvent event) {
|
||||
final HumanEntity clicker = event.getWhoClicked();
|
||||
if (!(clicker instanceof Player)) return;
|
||||
|
||||
final Player player = (Player) clicker;
|
||||
if (AuctionHouse.getInstance().getAuctionPlayerManager().isInSellProcess(player)) {
|
||||
event.setCancelled(true);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@EventHandler
|
||||
public void onCommandDuringSell(final PlayerCommandPreprocessEvent event) {
|
||||
final Player player = event.getPlayer();
|
||||
|
||||
if (AuctionHouse.getInstance().getAuctionPlayerManager().isInSellProcess(player))
|
||||
event.setCancelled(true);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onBuildDuringSell(final BlockPlaceEvent event) {
|
||||
final Player player = event.getPlayer();
|
||||
|
||||
if (AuctionHouse.getInstance().getAuctionPlayerManager().isInSellProcess(player)) {
|
||||
event.setBuild(false);
|
||||
event.setCancelled(true);
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onInventoryClick(PrepareAnvilEvent event) {
|
||||
ItemStack stack = event.getResult();
|
||||
|
Loading…
Reference in New Issue
Block a user