8.16.0 release

This commit is contained in:
mfnalex 2020-07-15 20:55:15 +02:00
parent ed7958540d
commit b25f03f2ae
8 changed files with 50 additions and 25 deletions

View File

@ -1,7 +1,10 @@
# Changelog # Changelog
## 8.15.2 ## 8.16.0
- Added generic hook for 3rd plugin GUIs - Added generic hook for 3rd party plugin GUIs
- Added config option to disable additional hotkeys (left-click and right-click outside of inventory)
for all players, while still allowing them to use the normal hotkeys
- Because of this, the option "allow-hotkeys" has been renamed to "allow-sorting-hotkeys". Don't worry, the config updater will take care of this change.
## 8.15.1 ## 8.15.1
- Fixed dirt in containers being affected by the right-click hotkey even though the player had no dirt in his inventory - Fixed dirt in containers being affected by the right-click hotkey even though the player had no dirt in his inventory
@ -213,7 +216,7 @@ The hotkeys are:
All hotkeys are enabled by default. All hotkeys are enabled by default.
Info: The "allow-shortcut" option in the config.yml has been renamed to "allow-hotkeys". Info: The "allow-shortcut" option in the config.yml has been renamed to "allow-sorting-hotkeys".
## 6.0 ## 6.0
Added middle-click shortcut Added middle-click shortcut

View File

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

View File

@ -35,6 +35,11 @@ public class ChestSortConfigUpdater {
plugin.getConfig().set("sorting-hotkeys.shift-right-click", plugin.getConfig().getBoolean("hotkeys.shift-right-click")); plugin.getConfig().set("sorting-hotkeys.shift-right-click", plugin.getConfig().getBoolean("hotkeys.shift-right-click"));
} }
// allow-hotkeys has been renamed to allow-sorting-hotkeys
if(plugin.getConfig().isSet("allow-hotkeys")) {
plugin.getConfig().set("allow-sorting-hotkeys",plugin.getConfig().getBoolean("allow-hotkeys"));
}
try { try {
Files.deleteIfExists(new File(plugin.getDataFolder().getAbsolutePath()+File.separator+"config.old.yml").toPath()); Files.deleteIfExists(new File(plugin.getDataFolder().getAbsolutePath()+File.separator+"config.old.yml").toPath());
} catch (IOException ignored) { } catch (IOException ignored) {

View File

@ -319,7 +319,7 @@ public class ChestSortListener implements Listener {
plugin.registerPlayerIfNeeded(p); plugin.registerPlayerIfNeeded(p);
if (!plugin.getConfig().getBoolean("allow-hotkeys")) { if (!plugin.getConfig().getBoolean("allow-sorting-hotkeys")) {
return; return;
} }
@ -463,7 +463,7 @@ public class ChestSortListener implements Listener {
return; return;
} }
if (!plugin.getConfig().getBoolean("allow-hotkeys")) { if (!plugin.getConfig().getBoolean("allow-additional-hotkeys")) {
return; return;
} }
if (!(e.getWhoClicked() instanceof Player)) { if (!(e.getWhoClicked() instanceof Player)) {

View File

@ -69,7 +69,7 @@ public class ChestSortPlugin extends JavaPlugin implements de.jeff_media.ChestSo
String sortingMethod; String sortingMethod;
ArrayList<String> disabledWorlds; ArrayList<String> disabledWorlds;
ChestSortAPIHandler api; ChestSortAPIHandler api;
final int currentConfigVersion = 38; final int currentConfigVersion = 40;
boolean usingMatchingConfig = true; boolean usingMatchingConfig = true;
protected boolean debug = false; protected boolean debug = false;
boolean verbose = true; boolean verbose = true;
@ -192,7 +192,8 @@ public class ChestSortPlugin extends JavaPlugin implements de.jeff_media.ChestSo
getConfig().addDefault("check-interval", 4); getConfig().addDefault("check-interval", 4);
getConfig().addDefault("auto-generate-category-files", true); getConfig().addDefault("auto-generate-category-files", true);
getConfig().addDefault("sort-time", "close"); getConfig().addDefault("sort-time", "close");
getConfig().addDefault("allow-hotkeys", true); getConfig().addDefault("allow-sorting-hotkeys", true);
getConfig().addDefault("allow-additional-hotkeys", true);
getConfig().addDefault("sorting-hotkeys.middle-click", true); getConfig().addDefault("sorting-hotkeys.middle-click", true);
getConfig().addDefault("sorting-hotkeys.shift-click", true); getConfig().addDefault("sorting-hotkeys.shift-click", true);
getConfig().addDefault("sorting-hotkeys.double-click", true); getConfig().addDefault("sorting-hotkeys.double-click", true);
@ -295,7 +296,9 @@ public class ChestSortPlugin extends JavaPlugin implements de.jeff_media.ChestSo
bStats.addCustomChart(new Metrics.SimplePie("auto_generate_category_files", bStats.addCustomChart(new Metrics.SimplePie("auto_generate_category_files",
() -> Boolean.toString(getConfig().getBoolean("auto-generate-category-files")))); () -> Boolean.toString(getConfig().getBoolean("auto-generate-category-files"))));
bStats.addCustomChart(new Metrics.SimplePie("allow_hotkeys", bStats.addCustomChart(new Metrics.SimplePie("allow_hotkeys",
() -> Boolean.toString(getConfig().getBoolean("allow-hotkeys")))); () -> Boolean.toString(getConfig().getBoolean("allow-sorting-hotkeys"))));
bStats.addCustomChart(new Metrics.SimplePie("allow_additional_hotkeys",
() -> Boolean.toString(getConfig().getBoolean("allow-additional-hotkeys"))));
bStats.addCustomChart(new Metrics.SimplePie("hotkey_middle_click", bStats.addCustomChart(new Metrics.SimplePie("hotkey_middle_click",
() -> Boolean.toString(getConfig().getBoolean("sorting-hotkeys.middle-click")))); () -> Boolean.toString(getConfig().getBoolean("sorting-hotkeys.middle-click"))));
bStats.addCustomChart(new Metrics.SimplePie("hotkey_shift_click", bStats.addCustomChart(new Metrics.SimplePie("hotkey_shift_click",
@ -487,15 +490,17 @@ public class ChestSortPlugin extends JavaPlugin implements de.jeff_media.ChestSo
getLogger().info("Inventory sorting enabled by default: " + getConfig().getBoolean("inv-sorting-enabled-by-default")); getLogger().info("Inventory sorting enabled by default: " + getConfig().getBoolean("inv-sorting-enabled-by-default"));
getLogger().info("Auto generate category files: " + getConfig().getBoolean("auto-generate-category-files")); getLogger().info("Auto generate category files: " + getConfig().getBoolean("auto-generate-category-files"));
getLogger().info("Sort time: " + getConfig().getString("sort-time")); getLogger().info("Sort time: " + getConfig().getString("sort-time"));
getLogger().info("Allow hotkeys: " + getConfig().getBoolean("allow-hotkeys")); getLogger().info("Allow hotkeys: " + getConfig().getBoolean("allow-sorting-hotkeys"));
if(getConfig().getBoolean("allow-hotkeys")) { if(getConfig().getBoolean("allow-sorting-hotkeys")) {
getLogger().info("Hotkeys enabled by default:"); getLogger().info("Hotkeys enabled by default:");
getLogger().info("- Sorting hotkeys:");
getLogger().info(" |- Middle-Click: " + getConfig().getBoolean("sorting-hotkeys.middle-click")); getLogger().info(" |- Middle-Click: " + getConfig().getBoolean("sorting-hotkeys.middle-click"));
getLogger().info(" |- Shift-Click: " + getConfig().getBoolean("sorting-hotkeys.shift-click")); getLogger().info(" |- Shift-Click: " + getConfig().getBoolean("sorting-hotkeys.shift-click"));
getLogger().info(" |- Double-Click: " + getConfig().getBoolean("sorting-hotkeys.double-click")); getLogger().info(" |- Double-Click: " + getConfig().getBoolean("sorting-hotkeys.double-click"));
getLogger().info(" |- Shift-Right-Click: " + getConfig().getBoolean("sorting-hotkeys.shift-right-click")); getLogger().info(" |- Shift-Right-Click: " + getConfig().getBoolean("sorting-hotkeys.shift-right-click"));
getLogger().info("- Additional hotkeys:"); }
getLogger().info("Allow additional hotkeys: " + getConfig().getBoolean("allow-additional-hotkeys"));
if(getConfig().getBoolean("allow-additional-hotkeys")) {
getLogger().info("Additional hotkeys enabled by default:");
getLogger().info(" |- Left-Click: " + getConfig().getBoolean("additional-hotkeys.left-click")); getLogger().info(" |- Left-Click: " + getConfig().getBoolean("additional-hotkeys.left-click"));
getLogger().info(" |- Right-Click: " + getConfig().getBoolean("additional-hotkeys.right-click")); getLogger().info(" |- Right-Click: " + getConfig().getBoolean("additional-hotkeys.right-click"));
} }

View File

@ -83,12 +83,16 @@ public class ChestSortSettingsGUI implements Listener {
ChestSortPlayerSetting setting = plugin.perPlayerSettings.get(player.getUniqueId().toString()); ChestSortPlayerSetting setting = plugin.perPlayerSettings.get(player.getUniqueId().toString());
if(plugin.getConfig().getBoolean("allow-sorting-hotkeys")) {
inventory.setItem(slotMiddleClick, getItem(setting.middleClick, Hotkey.MiddleClick)); inventory.setItem(slotMiddleClick, getItem(setting.middleClick, Hotkey.MiddleClick));
inventory.setItem(slotShiftClick, getItem(setting.shiftClick, Hotkey.ShiftClick)); inventory.setItem(slotShiftClick, getItem(setting.shiftClick, Hotkey.ShiftClick));
inventory.setItem(slotDoubleClick, getItem(setting.doubleClick, Hotkey.DoubleClick)); inventory.setItem(slotDoubleClick, getItem(setting.doubleClick, Hotkey.DoubleClick));
inventory.setItem(slotShiftRightClick, getItem(setting.shiftRightClick, Hotkey.ShiftRightClick)); inventory.setItem(slotShiftRightClick, getItem(setting.shiftRightClick, Hotkey.ShiftRightClick));
}
if(plugin.getConfig().getBoolean("allow-additional-hotkeys")) {
inventory.setItem(slotLeftClick, getItem(setting.leftClick,Hotkey.LeftClick)); inventory.setItem(slotLeftClick, getItem(setting.leftClick,Hotkey.LeftClick));
inventory.setItem(slotRightClick, getItem(setting.rightClick,Hotkey.RightClick)); inventory.setItem(slotRightClick, getItem(setting.rightClick,Hotkey.RightClick));
}
setting.guiInventory = inventory; setting.guiInventory = inventory;
player.openInventory(inventory); player.openInventory(inventory);
@ -127,6 +131,11 @@ public class ChestSortSettingsGUI implements Listener {
return; return;
} }
if(event.getCurrentItem()==null || event.getCurrentItem().getType()==Material.AIR) {
return;
}
if(event.getSlot() == ChestSortSettingsGUI.slotMiddleClick) { if(event.getSlot() == ChestSortSettingsGUI.slotMiddleClick) {
setting.toggleMiddleClick(); setting.toggleMiddleClick();
plugin.settingsGUI.openGUI(p); plugin.settingsGUI.openGUI(p);

View File

@ -89,12 +89,12 @@ verbose: true
# Instead of automatic sorting, you can also use hotkeys (see below) # Instead of automatic sorting, you can also use hotkeys (see below)
# when using an inventory to have it sorted immediately. # when using an inventory to have it sorted immediately.
# You can disable this by setting this to false. # You can disable this by setting this to false.
allow-hotkeys: true allow-sorting-hotkeys: true
# You can define which sorting hotkeys are enabled by default. # You can define which sorting hotkeys are enabled by default.
# Players can also enable/disable these shortcuts individually via /chestsort hotkeys
# Hotkeys that could interfere with Minecraft's normal behaviour (e.g. # Hotkeys that could interfere with Minecraft's normal behaviour (e.g.
# shift+left-click) only work on empty slots, so don't worry about them. # shift+left-click) only work on empty slots, so don't worry about them.
# Players can also enable/disable these shortcuts individually via /chestsort hotkeys
sorting-hotkeys: sorting-hotkeys:
# Use middle click (mousewheel) on ANY inventory slot as hotkey # Use middle click (mousewheel) on ANY inventory slot as hotkey
middle-click: true middle-click: true
@ -109,6 +109,9 @@ sorting-hotkeys:
# using left-click or right-click outside of a chest's inventory. # using left-click or right-click outside of a chest's inventory.
# A single click will only affect matching items (items that are already present in the other inventory) # A single click will only affect matching items (items that are already present in the other inventory)
# and a double click will try to store/take all items. # and a double click will try to store/take all items.
allow-additional-hotkeys: true
# You can define which additional hotkeys are enabled by default.
# Players can also enable/disable these shortcuts individually via /chestsort hotkeys # Players can also enable/disable these shortcuts individually via /chestsort hotkeys
additional-hotkeys: additional-hotkeys:
# Use left-click outside inventory to quickly put matching items from your inventory (except hotbar) # Use left-click outside inventory to quickly put matching items from your inventory (except hotbar)
@ -577,4 +580,4 @@ log: false
# Please DO NOT change the following line manually! # Please DO NOT change the following line manually!
# It is used by the automatic config updater. # It is used by the automatic config updater.
config-version: 38 config-version: 40

View File

@ -1,6 +1,6 @@
main: de.jeff_media.ChestSort.ChestSortPlugin main: de.jeff_media.ChestSort.ChestSortPlugin
name: ChestSort name: ChestSort
version: 8.15.2-SNAPSHOT version: 8.16.0
api-version: "1.13" api-version: "1.13"
description: Allows automatic chest sorting description: Allows automatic chest sorting
author: mfnalex author: mfnalex