🧰 chestshop listener

Took 14 minutes
This commit is contained in:
Kiran Hart 2023-03-09 23:55:48 -05:00
parent 25fbdaef23
commit 344976203d
No known key found for this signature in database
GPG Key ID: 5F36C7BC79D3EBC3
2 changed files with 48 additions and 1 deletions

View File

@ -0,0 +1,33 @@
/*
* Auction House
* Copyright 2023 Kiran Hart
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package ca.tweetzy.auctionhouse.listeners;
import ca.tweetzy.auctionhouse.AuctionHouse;
import com.Acrobot.ChestShop.Events.PreTransactionEvent;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
public final class ChestShopListener implements Listener {
@EventHandler
public void onPreTransact(final PreTransactionEvent event) {
if (AuctionHouse.getInstance().getAuctionPlayerManager().isInSellProcess(event.getClient()))
event.setCancelled(PreTransactionEvent.TransactionOutcome.OTHER);
}
}

View File

@ -25,12 +25,12 @@ import ca.tweetzy.auctionhouse.auction.AuctionPlayer;
import ca.tweetzy.auctionhouse.guis.GUIAuctionHouse;
import ca.tweetzy.auctionhouse.helpers.PlayerHelper;
import ca.tweetzy.auctionhouse.settings.Settings;
import ca.tweetzy.flight.comp.enums.CompMaterial;
import ca.tweetzy.core.compatibility.ServerVersion;
import ca.tweetzy.core.utils.PlayerUtils;
import ca.tweetzy.core.utils.TextUtils;
import ca.tweetzy.core.utils.nms.NBTEditor;
import ca.tweetzy.flight.comp.Titles;
import ca.tweetzy.flight.comp.enums.CompMaterial;
import org.bukkit.Bukkit;
import org.bukkit.NamespacedKey;
import org.bukkit.block.Block;
@ -216,4 +216,18 @@ public class PlayerListeners implements Listener {
stack = NBTEditor.set(stack, "AUCTION_REPAIRED", "AuctionHouseRepaired");
event.setResult(stack);
}
// @EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
// public void onInteractDuringSell(final PlayerInteractEvent event) {
// final Player player = event.getPlayer();
// if (AuctionHouse.getInstance().getAuctionPlayerManager().isInSellProcess(player)) {
//
// Bukkit.broadcastMessage("in sell");
// event.setUseItemInHand(Event.Result.DENY);
// event.setUseInteractedBlock(Event.Result.DENY);
// event.setCancelled(true);
// return;
// }
//
// }
}