1
0
mirror of https://github.com/Zrips/Jobs.git synced 2024-11-29 05:55:27 +01:00

Fix issue for other versions the getView() is not existent

This commit is contained in:
montlikadani 2019-10-20 17:13:42 +02:00
parent fb4f80c341
commit 558a0abfad
2 changed files with 7 additions and 2 deletions

View File

@ -23,3 +23,4 @@
- Quest objective amount is now optional (default 1) - Quest objective amount is now optional (default 1)
- Fixed issue when used 1.12 and lower versions then some materials not work correctly. - 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 - 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.

View File

@ -232,10 +232,14 @@ public class JobsListener implements Listener {
@EventHandler @EventHandler
public void onGuiDrag(InventoryDragEvent e) { public void onGuiDrag(InventoryDragEvent e) {
Player player = (Player) e.getWhoClicked(); Player player = (Player) e.getWhoClicked();
if (Jobs.getGUIManager().isInGui(player) && e.getView().getTopInventory().getHolder() instanceof JobsInventoryHolder) { 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); e.setCancelled(true);
} }
} }
}
@EventHandler(priority = EventPriority.HIGHEST) @EventHandler(priority = EventPriority.HIGHEST)
public void onGuiLeftClick(InventoryClickEvent event) { public void onGuiLeftClick(InventoryClickEvent event) {