mirror of
https://github.com/JEFF-Media-GbR/ChestSort.git
synced 2024-12-02 15:43:22 +01:00
12.1.1
This commit is contained in:
parent
7be76e2343
commit
3563a827f7
@ -1,5 +1,8 @@
|
|||||||
# Changelog
|
# Changelog
|
||||||
|
|
||||||
|
## 12.1.1
|
||||||
|
- ChestSort will no longer move any shulkerboxes in the inventory around if this shulkerbox is currently open in ShulkerPacks
|
||||||
|
|
||||||
## 12.0.6
|
## 12.0.6
|
||||||
- Fixed "additional-hotkeys" not working for ender chests
|
- Fixed "additional-hotkeys" not working for ender chests
|
||||||
|
|
||||||
|
2
pom.xml
2
pom.xml
@ -9,7 +9,7 @@
|
|||||||
<name>ChestSort</name>
|
<name>ChestSort</name>
|
||||||
<url>https://www.chestsort.de</url>
|
<url>https://www.chestsort.de</url>
|
||||||
<description>Allows automatic chest sorting!</description>
|
<description>Allows automatic chest sorting!</description>
|
||||||
<version>12.1.0</version>
|
<version>12.1.1</version>
|
||||||
<packaging>jar</packaging>
|
<packaging>jar</packaging>
|
||||||
|
|
||||||
<properties>
|
<properties>
|
||||||
|
@ -5,6 +5,7 @@ import de.jeff_media.chestsort.ChestSortPlugin;
|
|||||||
import de.jeff_media.chestsort.data.Category;
|
import de.jeff_media.chestsort.data.Category;
|
||||||
import de.jeff_media.chestsort.hooks.CrackShotHook;
|
import de.jeff_media.chestsort.hooks.CrackShotHook;
|
||||||
import de.jeff_media.chestsort.hooks.InventoryPagesHook;
|
import de.jeff_media.chestsort.hooks.InventoryPagesHook;
|
||||||
|
import de.jeff_media.chestsort.hooks.ShulkerPacksHook;
|
||||||
import de.jeff_media.chestsort.hooks.SlimeFunHook;
|
import de.jeff_media.chestsort.hooks.SlimeFunHook;
|
||||||
import de.jeff_media.chestsort.data.CategoryLinePair;
|
import de.jeff_media.chestsort.data.CategoryLinePair;
|
||||||
import de.jeff_media.chestsort.utils.EnchantmentUtils;
|
import de.jeff_media.chestsort.utils.EnchantmentUtils;
|
||||||
@ -552,6 +553,7 @@ public class ChestSortOrganizer {
|
|||||||
if ((plugin.isHookMinepacks() && plugin.getListener().minepacksHook.isMinepacksBackpack(items[i]))
|
if ((plugin.isHookMinepacks() && plugin.getListener().minepacksHook.isMinepacksBackpack(items[i]))
|
||||||
|| (plugin.isHookInventoryPages() && inventoryPagesHook.isButton(items[i], i, inv))
|
|| (plugin.isHookInventoryPages() && inventoryPagesHook.isButton(items[i], i, inv))
|
||||||
|| (plugin.getConfig().getBoolean("dont-move-slimefun-backpacks") && SlimeFunHook.isSlimefunBackpack(items[i]))
|
|| (plugin.getConfig().getBoolean("dont-move-slimefun-backpacks") && SlimeFunHook.isSlimefunBackpack(items[i]))
|
||||||
|
|| ShulkerPacksHook.isOpenShulkerPack(items[i])
|
||||||
|| isOversizedStack(items[i])
|
|| isOversizedStack(items[i])
|
||||||
|| chestSortEvent.isUnmovable(i)
|
|| chestSortEvent.isUnmovable(i)
|
||||||
|| chestSortEvent.isUnmovable(items[i])) {
|
|| chestSortEvent.isUnmovable(items[i])) {
|
||||||
@ -718,6 +720,8 @@ public class ChestSortOrganizer {
|
|||||||
if (plugin.isHookInventoryPages()
|
if (plugin.isHookInventoryPages()
|
||||||
&& plugin.getOrganizer().inventoryPagesHook.isButton(currentItem, i, source)) continue;
|
&& plugin.getOrganizer().inventoryPagesHook.isButton(currentItem, i, source)) continue;
|
||||||
|
|
||||||
|
if(ShulkerPacksHook.isOpenShulkerPack(currentItem)) continue;
|
||||||
|
|
||||||
if (destinationIsShulkerBox && currentItem.getType().name().endsWith("SHULKER_BOX")) continue;
|
if (destinationIsShulkerBox && currentItem.getType().name().endsWith("SHULKER_BOX")) continue;
|
||||||
|
|
||||||
if (isOversizedStack(currentItem)) continue;
|
if (isOversizedStack(currentItem)) continue;
|
||||||
|
@ -0,0 +1,59 @@
|
|||||||
|
package de.jeff_media.chestsort.hooks;
|
||||||
|
|
||||||
|
import de.jeff_media.chestsort.ChestSortPlugin;
|
||||||
|
import de.jeff_media.chestsort.api.ChestSortEvent;
|
||||||
|
import org.bukkit.Bukkit;
|
||||||
|
import org.bukkit.Material;
|
||||||
|
import org.bukkit.inventory.Inventory;
|
||||||
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
import org.w3c.dom.ls.LSOutput;
|
||||||
|
|
||||||
|
import java.lang.reflect.InvocationTargetException;
|
||||||
|
import java.lang.reflect.Method;
|
||||||
|
|
||||||
|
public class ShulkerPacksHook {
|
||||||
|
|
||||||
|
private static Method checkIfOpenMethod;
|
||||||
|
private static Boolean installed = null;
|
||||||
|
|
||||||
|
public static boolean isOpenShulkerPack(ItemStack item) {
|
||||||
|
if(installed == null) {
|
||||||
|
if (Bukkit.getPluginManager().getPlugin("ShulkerPacks") == null) {
|
||||||
|
installed = false;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
checkIfOpenMethod = Class.forName("me.darkolythe.shulkerpacks.ShulkerListener").getDeclaredMethod("checkIfOpen",ItemStack.class);
|
||||||
|
//System.out.println("Found ShulkerPacks method: " + checkIfOpenMethod);
|
||||||
|
if(checkIfOpenMethod != null) checkIfOpenMethod.setAccessible(true);
|
||||||
|
installed = checkIfOpenMethod != null;
|
||||||
|
} catch (Throwable t) {
|
||||||
|
installed = false;
|
||||||
|
ChestSortPlugin.getInstance().getLogger().severe("Error while hooking into ShulkerPacks. Try updating ShulkerPacks to the newest version.");
|
||||||
|
t.printStackTrace();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if(installed) {
|
||||||
|
try {
|
||||||
|
return (boolean) checkIfOpenMethod.invoke(null, item);
|
||||||
|
} catch (IllegalAccessException | InvocationTargetException ignored) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static boolean containsOpenShulkerPack(Inventory inventory) {
|
||||||
|
for(ItemStack item : inventory.getContents()) {
|
||||||
|
if(item == null) continue;
|
||||||
|
if(!item.getType().name().endsWith("SHULKER_BOX")) continue;
|
||||||
|
if(isOpenShulkerPack(item)) return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
@ -502,7 +502,6 @@ public class Listener implements org.bukkit.event.Listener {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
switch (event.getClick()) {
|
switch (event.getClick()) {
|
||||||
case MIDDLE:
|
case MIDDLE:
|
||||||
cause = Logger.SortCause.H_MIDDLE;
|
cause = Logger.SortCause.H_MIDDLE;
|
||||||
|
@ -10,7 +10,7 @@ website: ${project.url}
|
|||||||
prefix: ${spigot.prefix}
|
prefix: ${spigot.prefix}
|
||||||
database: false
|
database: false
|
||||||
loadbefore: [InvUnload]
|
loadbefore: [InvUnload]
|
||||||
softdepend: [CrackShot,InventoryPages,Minepacks,PlaceholderAPI,AdvancedChests]
|
softdepend: [CrackShot,InventoryPages,Minepacks,PlaceholderAPI,AdvancedChests,ShulkerPacks]
|
||||||
commands:
|
commands:
|
||||||
sort:
|
sort:
|
||||||
description: Toggle automatic chest sorting or change your hotkey settings
|
description: Toggle automatic chest sorting or change your hotkey settings
|
||||||
|
Loading…
Reference in New Issue
Block a user