From 70522f9fdd736cc4845f4b776070420072bf02fd Mon Sep 17 00:00:00 2001
From: mfnalex <1122571+mfnalex@users.noreply.github.com>
Date: Sun, 20 Jun 2021 17:26:29 +0200
Subject: [PATCH] 10.1.0 release
---
CHANGELOG.md | 4 ++
pom.xml | 2 +-
.../jeff_media/chestsort/ChestSortPlugin.java | 1 +
.../chestsort/hooks/GenericGUIHook.java | 5 +++
src/main/resources/config.yml | 42 +++++++++++--------
5 files changed, 36 insertions(+), 18 deletions(-)
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 3d4135a..40b6b6a 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,5 +1,9 @@
# Changelog
+## 10.1.0
+- Added config option "prevent-sorting-null-inventories"
+- Updated Chinese (Traditional) translation
+
## 10.0.4
- Added compatibility to the ChestShopConfirmation plugin
diff --git a/pom.xml b/pom.xml
index 3bc1560..e8ff03c 100644
--- a/pom.xml
+++ b/pom.xml
@@ -9,7 +9,7 @@
ChestSort
https://www.chestsort.de
Allows automatic chest sorting!
- 10.1.0-SNAPSHOT
+ 10.1.0
jar
diff --git a/src/main/java/de/jeff_media/chestsort/ChestSortPlugin.java b/src/main/java/de/jeff_media/chestsort/ChestSortPlugin.java
index d4262f6..72ca567 100644
--- a/src/main/java/de/jeff_media/chestsort/ChestSortPlugin.java
+++ b/src/main/java/de/jeff_media/chestsort/ChestSortPlugin.java
@@ -729,6 +729,7 @@ public class ChestSortPlugin extends JavaPlugin {
getConfig().addDefault("hook-inventorypages", true);
getConfig().addDefault("hook-minepacks", true);
getConfig().addDefault("hook-generic", true);
+ getConfig().addDefault("prevent-sorting-null-inventories", false);
getConfig().addDefault("verbose", true); // Prints some information in onEnable()
}
diff --git a/src/main/java/de/jeff_media/chestsort/hooks/GenericGUIHook.java b/src/main/java/de/jeff_media/chestsort/hooks/GenericGUIHook.java
index a846c4b..a9e624d 100644
--- a/src/main/java/de/jeff_media/chestsort/hooks/GenericGUIHook.java
+++ b/src/main/java/de/jeff_media/chestsort/hooks/GenericGUIHook.java
@@ -24,6 +24,11 @@ public class GenericGUIHook {
main.debug("Generic GUI detected by class name containing \"gui\" or \"menu\"");
return true;
}
+ if(main.getConfig().getBoolean("prevent-sorting-null-inventories")) {
+ if(inv.getHolder()==null) {
+ return false;
+ }
+ }
if(inv.getHolder() != null && guiClasses.contains(inv.getHolder().getClass().getName())) return true;
return false;
}
diff --git a/src/main/resources/config.yml b/src/main/resources/config.yml
index b770546..abf50d0 100644
--- a/src/main/resources/config.yml
+++ b/src/main/resources/config.yml
@@ -284,6 +284,13 @@ dont-move-slimefun-backpacks: false
# https://github.com/JEFF-Media-GbR/Spigot-ChestSort/issues
hook-generic: true
+##### Plugins not using an InventoryHolder #####
+# When you have a plugin that uses "null" as InventoryHolder for their
+# GUIs, you can prevent those from being sorted. Please note that this
+# will also disable sorting for certain other inventories, so only use
+# it if it's the only possibility.
+prevent-sorting-null-inventories: false
+
##########################
##### Sorting Method #####
##########################
@@ -403,25 +410,26 @@ message-gui-left-click-outside: "Left-Click from outside"
#message-gui-right-click: "清空箱子 (右键/双击右键)"
#message-gui-left-click-outside: "Left-Click from outside"
-##### Chinese (Traditional) 繁體中文 - Thanks to Command1264 for translating!
-#message-when-using-chest: "&7小提醒: 輸入 &6/chestsort&7 來開啟自動整理箱子"
-#message-when-using-chest2: "&7小提醒: 輸入 &6/chestsort&7 來關閉自動整理箱子"
-#message-sorting-disabled: "&7自動整理箱子已 &c關閉&7"
-#message-sorting-enabled: "&7自動整理箱子已 &a開啟&7"
-#message-inv-sorting-disabled: "&7自動整理背包已 &c關閉&7."
-#message-inv-sorting-enabled: "&7自動整理背包已 &a開啟&7."
-#message-player-inventory-sorted: "&7你的背包已成功整理."
-#message-error-players-only: "&c錯誤: 這個指令只能由玩家使用"
-#message-error-invalid-options: "&c錯誤: 未知選項 %s. 有效的選項為 %s."
+##### Chinese (Traditional) 繁體中文
+#message-when-using-chest: "&7小提醒 : 輸入 &6/chestsort&7 來開啟自動整理儲物箱。"
+#message-when-using-chest2: "&7小提醒 : 輸入 &6/chestsort&7 來關閉自動整理儲物箱。"
+#message-sorting-disabled: "&c已關閉&7自動整理儲物箱。"
+#message-sorting-enabled: "&a已開啟&7自動整理儲物箱。"
+#message-inv-sorting-disabled: "&c已關閉&7自動整理物品欄。"
+#message-inv-sorting-enabled: "&a已開啟&7自動整理物品欄。"
+#message-player-inventory-sorted: "&7已成功整理物品欄。"
+#message-error-players-only: "&c錯誤 : 這個指令只能由玩家使用。"
+#message-error-invalid-options: "&c錯誤 : 未知的選項 %s,有效的選項為 %s。"
+#message-hotbar-container-sorted: "&a已成功整理儲物箱 !"
#message-gui-enabled: "&a開啟"
#message-gui-disabled: "&c關閉"
-#message-gui-middle-click: "中鍵"
-#message-gui-shift-click: "Shift + 左鍵"
-#message-gui-double-click: "雙擊左鍵"
-#message-gui-shift-right-click: "Shift + 右鍵"
-#message-gui-left-click: "填滿箱子 (左鍵/雙擊左鍵)"
-#message-gui-right-click: "清空箱子 (右鍵/雙擊右鍵)"
-#message-gui-left-click-outside: "Left-Click from outside"
+#message-gui-middle-click: "點擊中鍵"
+#message-gui-shift-click: "Shift + 點擊左鍵"
+#message-gui-double-click: "雙點擊左鍵"
+#message-gui-shift-right-click: "Shift + 點擊右鍵"
+#message-gui-left-click: "填滿儲物箱 (點擊左鍵/雙點擊左鍵)"
+#message-gui-right-click: "清空儲物箱 (點擊右鍵/雙點擊右鍵)"
+#message-gui-left-click-outside: "對儲物箱點擊左鍵"
##### Dutch - Thanks to Xeyame for translating!
##### Note: Some messages are still untranslated. Please send me your translation at SpigotMC