From 421c73dd7e831b52a72904e6bbded58e912e8244 Mon Sep 17 00:00:00 2001 From: LazyGon <26216029+LazyGon@users.noreply.github.com> Date: Thu, 3 Nov 2022 13:16:07 +0900 Subject: [PATCH] fix: made unable to trade if other is trading and bump v1.2 --- build.gradle.kts | 2 +- src/main/java/net/okocraft/boxtradestick/PlayerListener.java | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/build.gradle.kts b/build.gradle.kts index 827eda4..e7e0109 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -7,7 +7,7 @@ plugins { } group = "net.okocraft.boxtradestick" -version = "1.1" +version = "1.2" repositories { mavenCentral() diff --git a/src/main/java/net/okocraft/boxtradestick/PlayerListener.java b/src/main/java/net/okocraft/boxtradestick/PlayerListener.java index ba11c0f..9aea36a 100644 --- a/src/main/java/net/okocraft/boxtradestick/PlayerListener.java +++ b/src/main/java/net/okocraft/boxtradestick/PlayerListener.java @@ -15,6 +15,7 @@ import org.bukkit.event.inventory.InventoryCloseEvent; import org.bukkit.event.player.PlayerInteractEntityEvent; import org.bukkit.event.player.PlayerQuitEvent; +import org.bukkit.inventory.EquipmentSlot; public class PlayerListener implements Listener { @@ -54,7 +55,9 @@ public void onPlayerAttackVillager(EntityDamageByEntityEvent event) { } onEntityDamageByEntityEvent = false; - NMSUtil.startTrading(villager, player); + if (!NMSUtil.simulateMobInteract(player, villager, EquipmentSlot.HAND)) { + return; + } MerchantRecipesGUI gui = new MerchantRecipesGUI(player, villager); int selectedOfferIndex = gui.getCurrentSelected();