(InventoryClickEvent e)
| 65 | } |
| 66 | |
| 67 | @EventHandler(priority = EventPriority.HIGHEST) |
| 68 | public void on(InventoryClickEvent e) { |
| 69 | if (!e.getWhoClicked().equals(viewer)) { |
| 70 | return; |
| 71 | } |
| 72 | |
| 73 | if (!isVisible()) { |
| 74 | return; |
| 75 | } |
| 76 | |
| 77 | // 1.14 bukkit api change, removed getTitle() and getName() from Inventory.class |
| 78 | if (!viewer.getOpenInventory().getTitle().equals(title)) { |
| 79 | return; |
| 80 | } |
| 81 | |
| 82 | if (e.getClickedInventory() == null) { |
| 83 | return; |
| 84 | } |
| 85 | |
| 86 | if (!e.getView().getType().equals(getResolution().getType())) { |
| 87 | return; |
| 88 | } |
| 89 | |
| 90 | if (e.getClickedInventory().getType().equals(getResolution().getType())) { |
| 91 | Element element = getElement(getLayoutPosition(e.getSlot()), getLayoutRow(e.getSlot())); |
| 92 | |
| 93 | switch (e.getAction()) { |
| 94 | case CLONE_STACK: |
| 95 | case COLLECT_TO_CURSOR: |
| 96 | case DROP_ALL_CURSOR: |
| 97 | case DROP_ALL_SLOT: |
| 98 | case DROP_ONE_CURSOR: |
| 99 | case DROP_ONE_SLOT: |
| 100 | case HOTBAR_MOVE_AND_READD: |
| 101 | case HOTBAR_SWAP: |
| 102 | case MOVE_TO_OTHER_INVENTORY: |
| 103 | case NOTHING: |
| 104 | case PICKUP_ALL: |
| 105 | case PICKUP_HALF: |
| 106 | case PICKUP_ONE: |
| 107 | case PICKUP_SOME: |
| 108 | case PLACE_ALL: |
| 109 | case PLACE_ONE: |
| 110 | case PLACE_SOME: |
| 111 | case SWAP_WITH_CURSOR: |
| 112 | case UNKNOWN: |
| 113 | break; |
| 114 | } |
| 115 | |
| 116 | switch (e.getClick()) { |
| 117 | case DOUBLE_CLICK -> doubleclicked = true; |
| 118 | case LEFT -> { |
| 119 | clickcheck++; |
| 120 | if (clickcheck == 1) { |
| 121 | J.s(() -> |
| 122 | { |
| 123 | if (clickcheck == 1) { |
| 124 | clickcheck = 0; |
nothing calls this directly
no test coverage detected