adjusted middle-click hotkey

This commit is contained in:
mfnalex 2020-06-14 21:21:29 +02:00
parent 6ba7854de9
commit e2d602a727
3 changed files with 12 additions and 3 deletions

View File

@ -2,6 +2,7 @@
## 8.10.5
- ChestSort checks if Minepacks version is recent enough and, if not, disable the Minepacks hook.
- Backpacks from Minepacks will no longer be moved into chests with the left-/right-click hotkeys
- Middle-Click hotkey is now disabled in Creative mode unless the clicked slot is empty, to allow players to duplicate items just like in vanilla
## 8.10.4
- Fixed exception when sorting inventories in 1.8 because Inventory.getLocation() did not exist yet

View File

@ -24,8 +24,10 @@ public class ChestSortDebugger implements @NotNull Listener {
System.out.println(" ");
System.out.println("InventoryClickEvent:");
System.out.println("- Holder: " + e.getInventory().getHolder());
//System.out.println("- Holder (Class): "+e.getInventory().getHolder().getClass().getName());
System.out.println("- Slot: "+e.getRawSlot());
System.out.println("- Left-Click: "+e.isLeftClick());
System.out.println("- Right-Click: "+e.isRightClick());
System.out.println("- Shift-Click: "+e.isShiftClick());
System.out.println(" ");
}
}

View File

@ -297,7 +297,7 @@ public class ChestSortListener implements Listener {
}
@EventHandler(ignoreCancelled = true, priority = EventPriority.HIGHEST)
public void onInventoryClickEvent(InventoryClickEvent event) {
public void onHotkey(InventoryClickEvent event) {
if(!(event.getWhoClicked() instanceof Player)) {
return;
@ -351,7 +351,13 @@ public class ChestSortListener implements Listener {
case MIDDLE:
//if(plugin.getConfig().getBoolean("hotkeys.middle-click")) {
if(setting.middleClick) {
sort=true;
if(event.getWhoClicked().getGameMode() != GameMode.CREATIVE) {
sort=true;
} else {
if(event.getCurrentItem()==null || event.getCurrentItem().getType()==Material.AIR) {
sort=false;
}
}
}
break;
case DOUBLE_CLICK: