1
0
mirror of https://github.com/JEFF-Media-GbR/ChestSort.git synced 2025-03-25 13:09:34 +01:00

Prevent Minepacks from being moved

This commit is contained in:
mfnalex 2020-06-14 20:49:42 +02:00
parent 73f361651f
commit 6ba7854de9
6 changed files with 22 additions and 5 deletions

View File

@ -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

View File

@ -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

View File

@ -9,7 +9,7 @@
<name>JeffChestSort</name>
<url>https://www.chestsort.de</url>
<description>Automatically sorts your chests!</description>
<version>8.10.4</version>
<version>8.10.5-SNAPSHOT</version>
<packaging>jar</packaging>
<properties>

View File

@ -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;

View File

@ -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;
}

View File

@ -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