From 558a0abfadd394b63f6d2b1534308cf72127cd4d Mon Sep 17 00:00:00 2001 From: montlikadani Date: Sun, 20 Oct 2019 17:13:42 +0200 Subject: [PATCH] Fix issue for other versions the getView() is not existent --- Changelog.txt | 1 + .../java/com/gamingmesh/jobs/listeners/JobsListener.java | 8 ++++++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/Changelog.txt b/Changelog.txt index fd42603a..2771b3f6 100644 --- a/Changelog.txt +++ b/Changelog.txt @@ -23,3 +23,4 @@ - Quest objective amount is now optional (default 1) - Fixed issue when used 1.12 and lower versions then some materials not work correctly. - Added option to jobs shop to hide icon if a player there are no enough points to buy a item +- Fixed issue for inventory dragging when a player is in jobs GUI. diff --git a/src/main/java/com/gamingmesh/jobs/listeners/JobsListener.java b/src/main/java/com/gamingmesh/jobs/listeners/JobsListener.java index 6a30056d..c7f5c7c3 100644 --- a/src/main/java/com/gamingmesh/jobs/listeners/JobsListener.java +++ b/src/main/java/com/gamingmesh/jobs/listeners/JobsListener.java @@ -232,8 +232,12 @@ public class JobsListener implements Listener { @EventHandler public void onGuiDrag(InventoryDragEvent e) { Player player = (Player) e.getWhoClicked(); - if (Jobs.getGUIManager().isInGui(player) && e.getView().getTopInventory().getHolder() instanceof JobsInventoryHolder) { - e.setCancelled(true); + if (Jobs.getGUIManager().isInGui(player)) { + if (Version.isCurrentEqualOrLower(Version.v1_12_R1) && e.getInventory().getHolder() instanceof JobsInventoryHolder + || Version.isCurrentEqualOrHigher(Version.v1_13_R1) && e.getView().getTopInventory().getHolder() + instanceof JobsInventoryHolder) { + e.setCancelled(true); + } } }