From a42c1720170f30722c370b4ecc3fa93d9a915314 Mon Sep 17 00:00:00 2001 From: mfnalex <1122571+mfnalex@users.noreply.github.com> Date: Sun, 12 Jul 2020 15:56:49 +0200 Subject: [PATCH] 8.14.2 release --- CHANGELOG.md | 5 +++++ HOW_TO_USE_API.md | 5 +++-- pom.xml | 2 +- .../jeff_media/ChestSort/ChestSortListener.java | 12 ++++++++---- .../jeff_media/ChestSort/ChestSortPlugin.java | 2 +- .../ChestSort/hooks/CrateReloadedHook.java | 10 +++++++++- .../ChestSort/hooks/HeadDatabaseHook.java | 10 +++++++++- src/main/resources/config.yml | 17 +++++++++++------ src/main/resources/plugin.yml | 2 +- 9 files changed, 48 insertions(+), 17 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d617ba6..13c52e2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,9 @@ # Changelog + +## 8.14.2 +- Made CrateReloaded hook and HeadDatabase hook toggleable +- Updated Chinese translation + ## 8.14.1 - Prevent players from using left-click and right-click hotkeys on inventories created by CrateReloaded or HeadDatabase diff --git a/HOW_TO_USE_API.md b/HOW_TO_USE_API.md index 4ce8904..1acd335 100644 --- a/HOW_TO_USE_API.md +++ b/HOW_TO_USE_API.md @@ -111,5 +111,6 @@ Sortable holder = new Sortable(player) Here is a complete example plugin that shows to add and use the ChestSort API: [LINK](https://github.com/JEFF-Media-GbR/ChestSortAPIExample) -## Source code -The source code for the API can be found [here](https://github.com/JEFF-Media-GbR/Spigot-ChestSortAPI). \ No newline at end of file +## Javadocs & Source code +- [ChestSortAPI Javadocs](https://repo.jeff-media.de/javadocs/ChestSortAPI). +- [ChestSortAPI source code](https://github.com/JEFF-Media-GbR/Spigot-ChestSortAPI). \ No newline at end of file diff --git a/pom.xml b/pom.xml index 474e572..bce9d14 100644 --- a/pom.xml +++ b/pom.xml @@ -9,7 +9,7 @@ ChestSort https://www.chestsort.de Automatically sorts your chests! - 8.14.1 + 8.14.2 jar diff --git a/src/main/java/de/jeff_media/ChestSort/ChestSortListener.java b/src/main/java/de/jeff_media/ChestSort/ChestSortListener.java index 1e177c3..2dff1e8 100644 --- a/src/main/java/de/jeff_media/ChestSort/ChestSortListener.java +++ b/src/main/java/de/jeff_media/ChestSort/ChestSortListener.java @@ -28,10 +28,14 @@ public class ChestSortListener implements Listener { final ChestSortPlugin plugin; final MinepacksHook minepacksHook; + final HeadDatabaseHook headDatabaseHook; + final CrateReloadedHook crateReloadedHook; ChestSortListener(ChestSortPlugin plugin) { this.plugin = plugin; this.minepacksHook = new MinepacksHook(plugin); + this.headDatabaseHook = new HeadDatabaseHook(plugin); + this.crateReloadedHook = new CrateReloadedHook(plugin); } @EventHandler @@ -478,14 +482,14 @@ public class ChestSortListener implements Listener { } // HeadDatabase hook - if(HeadDatabaseHook.isHeadDB(e.getClickedInventory()) - || HeadDatabaseHook.isHeadDB(e.getInventory())) { + if(headDatabaseHook.isHeadDB(e.getClickedInventory()) + || headDatabaseHook.isHeadDB(e.getInventory())) { return; } // CrateReloaded hook - if(CrateReloadedHook.isCrate(e.getClickedInventory()) - || CrateReloadedHook.isCrate(e.getInventory())) { + if(crateReloadedHook.isCrate(e.getClickedInventory()) + || crateReloadedHook.isCrate(e.getInventory())) { //if(plugin.debug) plugin.getLogger().info("Aborting hotkey because this is a CrateReloaded crate"); return; } diff --git a/src/main/java/de/jeff_media/ChestSort/ChestSortPlugin.java b/src/main/java/de/jeff_media/ChestSort/ChestSortPlugin.java index 9354756..0de44d4 100644 --- a/src/main/java/de/jeff_media/ChestSort/ChestSortPlugin.java +++ b/src/main/java/de/jeff_media/ChestSort/ChestSortPlugin.java @@ -68,7 +68,7 @@ public class ChestSortPlugin extends JavaPlugin implements de.jeff_media.ChestSo String sortingMethod; ArrayList disabledWorlds; ChestSortAPIHandler api; - final int currentConfigVersion = 35; + final int currentConfigVersion = 36; boolean usingMatchingConfig = true; protected boolean debug = false; boolean verbose = true; diff --git a/src/main/java/de/jeff_media/ChestSort/hooks/CrateReloadedHook.java b/src/main/java/de/jeff_media/ChestSort/hooks/CrateReloadedHook.java index 697e1b0..3258a37 100644 --- a/src/main/java/de/jeff_media/ChestSort/hooks/CrateReloadedHook.java +++ b/src/main/java/de/jeff_media/ChestSort/hooks/CrateReloadedHook.java @@ -1,15 +1,23 @@ package de.jeff_media.ChestSort.hooks; +import de.jeff_media.ChestSort.ChestSortPlugin; import org.bukkit.inventory.Inventory; import org.jetbrains.annotations.NotNull; public class CrateReloadedHook { + ChestSortPlugin main; + + public CrateReloadedHook(ChestSortPlugin main) { + this.main=main; + } + // CrateReloaded inventories seem to have a holder called cratereloaded.bo // Maybe this changes? We just check if the String starts with cratereloaded - public static boolean isCrate(Inventory inv) { + public boolean isCrate(Inventory inv) { if(inv==null) return false; if(inv.getHolder()==null) return false; + if(!main.getConfig().getBoolean("hook-cratereloaded",true)) return false; return inv.getHolder().getClass().getName().startsWith("cratereloaded"); } diff --git a/src/main/java/de/jeff_media/ChestSort/hooks/HeadDatabaseHook.java b/src/main/java/de/jeff_media/ChestSort/hooks/HeadDatabaseHook.java index f7c6d3a..5b42309 100644 --- a/src/main/java/de/jeff_media/ChestSort/hooks/HeadDatabaseHook.java +++ b/src/main/java/de/jeff_media/ChestSort/hooks/HeadDatabaseHook.java @@ -1,12 +1,20 @@ package de.jeff_media.ChestSort.hooks; +import de.jeff_media.ChestSort.ChestSortPlugin; import org.bukkit.inventory.Inventory; public class HeadDatabaseHook { - public static boolean isHeadDB(Inventory inv) { + ChestSortPlugin main; + + public HeadDatabaseHook(ChestSortPlugin main) { + this.main=main; + } + + public boolean isHeadDB(Inventory inv) { if(inv==null) return false; if(inv.getHolder() == null) return false; + if(!main.getConfig().getBoolean("hook-headdatabase",true)) return false; return inv.getHolder().getClass().getName().equals("me.arcaniax.hdb.object.HeadDatabaseHolder"); } diff --git a/src/main/resources/config.yml b/src/main/resources/config.yml index 6b10fd7..f4e50e8 100644 --- a/src/main/resources/config.yml +++ b/src/main/resources/config.yml @@ -182,6 +182,14 @@ hook-inventorypages: true # backpacks and sort them like a regular chest. hook-minepacks: true +##### CrateReloaded ##### +# Prevents the player from using hotkeys on a crate +hook-cratereloaded: true + +##### HeadDatabase ##### +# Prevents the player from using hotkeys on the HeadDatabase GUI +hook-headdatabase: true + ##### Other backpack plugins ##### # ChestSort is able to detect backpacks from most backpack # plugins like ShulkerPacks or Better Shulker Boxes. @@ -290,9 +298,6 @@ message-gui-right-click: "Empty Chest (Right-Click/Double-Right-Click)" #message-gui-right-click: "Empty Chest (Right-Click/Double-Right-Click)" ##### Chinese - Thanks to qsefthuopq, Aira-Sakuranomiya and BackWheel for translating! -# Note: The following messages have been changed in version 8.11 and need a new translation: -# - message-gui-left-click -# - message-gui-right-click #message-when-using-chest: "&7提示: 输入 &6/chestsort&7 来启用自动整理箱子." #message-when-using-chest2: "&7提示: 输入 &6/chestsort&7 来关闭自动整理箱子." #message-sorting-disabled: "&7自动整理箱子已 &c关闭&7." @@ -308,8 +313,8 @@ message-gui-right-click: "Empty Chest (Right-Click/Double-Right-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: "填充箱子 (左键/双击左键)" +#message-gui-right-click: "清空箱子 (右键/双击右键)" ##### Chinese (Traditional) 繁體中文 - Thanks to Command1264 for translating! #message-when-using-chest: "&7小提醒: 輸入 &6/chestsort&7 來開啟自動整理箱子" @@ -571,4 +576,4 @@ log: false # Please DO NOT change the following line manually! # It is used by the automatic config updater. -config-version: 35 +config-version: 36 diff --git a/src/main/resources/plugin.yml b/src/main/resources/plugin.yml index 8a87d00..5e8ec43 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.14.1 +version: 8.14.2 api-version: "1.13" description: Allows automatic chest sorting author: mfnalex