This commit is contained in:
mfnalex 2022-01-10 23:52:10 +01:00
parent 35f9cc880e
commit 33283a3360
4 changed files with 16 additions and 4 deletions

View File

@ -1,5 +1,8 @@
# Changelog
## 12.1.4
- Disabled additional hotkeys (fill & empty chest) for ShulkerPacks to avoid duplication and possible item loss caused by ShulkerPacks not checking for changed inventory in InventoryCloseEvent
## 12.1.2
- Fixed newlines ("\n") in config.yml breaking the config updater

View File

@ -9,7 +9,7 @@
<name>ChestSort</name>
<url>https://www.chestsort.de</url>
<description>Allows automatic chest sorting!</description>
<version>12.1.3</version>
<version>12.1.4</version>
<packaging>jar</packaging>
<properties>

View File

@ -1,21 +1,27 @@
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.InventoryView;
import org.bukkit.inventory.ItemStack;
import org.w3c.dom.ls.LSOutput;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.Locale;
public class ShulkerPacksHook {
private static Method checkIfOpenMethod;
private static Boolean installed = null;
public static boolean isOpenShulkerView(InventoryView view) {
if(view == null) return false;
if(view.getTopInventory() == null) return false;
if(view.getTopInventory().getHolder() == null) return false;
return (view.getTopInventory().getHolder().getClass().getName().toLowerCase(Locale.ROOT).contains("shulkerpacks"));
}
public static boolean isOpenShulkerPack(ItemStack item) {
if(installed == null) {
if (Bukkit.getPluginManager().getPlugin("ShulkerPacks") == null) {

View File

@ -698,6 +698,9 @@ public class Listener implements org.bukkit.event.Listener {
return;
}
// ShulkerPacks
if(ShulkerPacksHook.isOpenShulkerView(e.getView())) return;
if (!p.hasPermission("chestsort.use")) return;
plugin.registerPlayerIfNeeded(p);