Skip to content
This repository has been archived by the owner on Jan 20, 2024. It is now read-only.

Commit

Permalink
ToolTip: add check player inventory for shortcut
Browse files Browse the repository at this point in the history
  • Loading branch information
TheFaser committed Sep 9, 2023
1 parent 635f350 commit 76e8909
Showing 1 changed file with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
import org.bukkit.event.Listener;
import org.bukkit.event.inventory.InventoryClickEvent;
import org.bukkit.event.player.AsyncPlayerChatEvent;
import org.bukkit.inventory.CraftingInventory;
import org.bukkit.inventory.ItemStack;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
Expand Down Expand Up @@ -98,7 +99,9 @@ public void createMessage(@NotNull Set<Player> recipients, @NotNull Player playe

@EventHandler
public void checkItemTooltipShortcut(@NotNull InventoryClickEvent event) {
if (event.getSlot() != 39
if (event.isCancelled()
|| !(event.getInventory() instanceof CraftingInventory)
|| event.getSlot() != 39
|| !event.isShiftClick()
|| event.getCursor() == null
|| event.getCursor().getType().equals(Material.AIR)) {
Expand Down

0 comments on commit 76e8909

Please sign in to comment.