diff --git a/CHANGELOG.md b/CHANGELOG.md index 32d2647..536335b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,8 @@ # Changelog +## 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 + ## 8.10.4 - Fixed exception when sorting inventories in 1.8 because Inventory.getLocation() did not exist yet diff --git a/TODO.md b/TODO.md index f3250a3..a51cc84 100644 --- a/TODO.md +++ b/TODO.md @@ -1,4 +1,6 @@ # Todo +## Minepacks API check +When using Minepacks, check if version is 2.3.8 or later and otherwise disable the hook ## StackableItems Make it configurable whether ItemStacks > 64 items will stay unsorted, or sorted and reverted back to stacks of 64 items diff --git a/pom.xml b/pom.xml index d05c990..cb7606f 100644 --- a/pom.xml +++ b/pom.xml @@ -9,7 +9,7 @@ JeffChestSort https://www.chestsort.de Automatically sorts your chests! - 8.10.4 + 8.10.5-SNAPSHOT jar diff --git a/src/main/java/de/jeff_media/ChestSort/ChestSortOrganizer.java b/src/main/java/de/jeff_media/ChestSort/ChestSortOrganizer.java index 361153e..ff3a831 100644 --- a/src/main/java/de/jeff_media/ChestSort/ChestSortOrganizer.java +++ b/src/main/java/de/jeff_media/ChestSort/ChestSortOrganizer.java @@ -639,8 +639,11 @@ public class ChestSortOrganizer { for(int i = playerInvStartSlot;i<=playerInvEndSlot;i++) { if(source.getItem(i)==null) continue; - if(plugin.hookMinepacks && plugin.listener.minepacksHook.isMinepacksBackpack(destination) - && plugin.listener.minepacksHook.isMinepacksBackpack(source.getItem(i))) continue; + // This prevents Minepacks from being put into Minepacks + /*if(plugin.hookMinepacks && plugin.listener.minepacksHook.isMinepacksBackpack(destination) + && plugin.listener.minepacksHook.isMinepacksBackpack(source.getItem(i))) continue;*/ + // This prevents Minepacks from being moved at all + if(plugin.hookMinepacks && plugin.listener.minepacksHook.isMinepacksBackpack(source.getItem(i))) continue; if(plugin.hookInventoryPages && plugin.organizer.inventoryPagesHook.isButton(source.getItem(i), i, source)) continue; diff --git a/src/main/java/de/jeff_media/ChestSort/hooks/MinepacksHook.java b/src/main/java/de/jeff_media/ChestSort/hooks/MinepacksHook.java index 743a483..41a8b90 100644 --- a/src/main/java/de/jeff_media/ChestSort/hooks/MinepacksHook.java +++ b/src/main/java/de/jeff_media/ChestSort/hooks/MinepacksHook.java @@ -26,7 +26,15 @@ public class MinepacksHook { public boolean isMinepacksBackpack(ItemStack item) { if(minepacks == null) return false; - if(minepacks.isBackpackItem(item)) return true; + try { + if(minepacks.getClass().getMethod("isBackpackItem", ItemStack.class) != null) { + if(minepacks.isBackpackItem(item)) return true; + } + } catch (NoSuchMethodException | SecurityException e) { + plugin.getLogger().warning("You are using a version of Minepacks that is too old and does not implement every API method needed by ChestSort. Minepacks hook will be disabled."); + minepacks = null; + plugin.hookMinepacks=false; + } return false; } diff --git a/src/main/resources/plugin.yml b/src/main/resources/plugin.yml index 6f9673e..c66c9c2 100644 --- a/src/main/resources/plugin.yml +++ b/src/main/resources/plugin.yml @@ -1,6 +1,6 @@ main: de.jeff_media.ChestSort.ChestSortPlugin name: ChestSort -version: 8.10.4 +version: 8.10.5-SNAPSHOT api-version: 1.13 description: Allows automatic chest sorting author: mfnalex