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
## 8.15.2
- Added generic hook for 3rd plugin GUIs
## 8.16.0
- 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
- 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.
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
Added middle-click shortcut

View File

@ -9,7 +9,7 @@
<name>ChestSort</name>
<url>https://www.chestsort.de</url>
<description>Automatically sorts your chests!</description>
<version>8.15.2-SNAPSHOT</version>
<version>8.16.0</version>
<packaging>jar</packaging>
<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"));
}
// 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 {
Files.deleteIfExists(new File(plugin.getDataFolder().getAbsolutePath()+File.separator+"config.old.yml").toPath());
} catch (IOException ignored) {

View File

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

View File

@ -69,7 +69,7 @@ public class ChestSortPlugin extends JavaPlugin implements de.jeff_media.ChestSo
String sortingMethod;
ArrayList<String> disabledWorlds;
ChestSortAPIHandler api;
final int currentConfigVersion = 38;
final int currentConfigVersion = 40;
boolean usingMatchingConfig = true;
protected boolean debug = false;
boolean verbose = true;
@ -192,7 +192,8 @@ public class ChestSortPlugin extends JavaPlugin implements de.jeff_media.ChestSo
getConfig().addDefault("check-interval", 4);
getConfig().addDefault("auto-generate-category-files", true);
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.shift-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",
() -> Boolean.toString(getConfig().getBoolean("auto-generate-category-files"))));
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",
() -> Boolean.toString(getConfig().getBoolean("sorting-hotkeys.middle-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("Auto generate category files: " + getConfig().getBoolean("auto-generate-category-files"));
getLogger().info("Sort time: " + getConfig().getString("sort-time"));
getLogger().info("Allow hotkeys: " + getConfig().getBoolean("allow-hotkeys"));
if(getConfig().getBoolean("allow-hotkeys")) {
getLogger().info("Allow hotkeys: " + getConfig().getBoolean("allow-sorting-hotkeys"));
if(getConfig().getBoolean("allow-sorting-hotkeys")) {
getLogger().info("Hotkeys enabled by default:");
getLogger().info("- Sorting hotkeys:");
getLogger().info(" |- Middle-Click: " + getConfig().getBoolean("sorting-hotkeys.middle-click"));
getLogger().info(" |- Shift-Click: " + getConfig().getBoolean("sorting-hotkeys.shift-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("- 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(" |- Right-Click: " + getConfig().getBoolean("additional-hotkeys.right-click"));
}

View File

@ -82,13 +82,17 @@ public class ChestSortSettingsGUI implements Listener {
Inventory inventory = createGUI("ChestSort", player);
ChestSortPlayerSetting setting = plugin.perPlayerSettings.get(player.getUniqueId().toString());
inventory.setItem(slotMiddleClick, getItem(setting.middleClick,Hotkey.MiddleClick));
inventory.setItem(slotShiftClick, getItem(setting.shiftClick,Hotkey.ShiftClick));
inventory.setItem(slotDoubleClick, getItem(setting.doubleClick,Hotkey.DoubleClick));
inventory.setItem(slotShiftRightClick, getItem(setting.shiftRightClick,Hotkey.ShiftRightClick));
inventory.setItem(slotLeftClick, getItem(setting.leftClick,Hotkey.LeftClick));
inventory.setItem(slotRightClick, getItem(setting.rightClick,Hotkey.RightClick));
if(plugin.getConfig().getBoolean("allow-sorting-hotkeys")) {
inventory.setItem(slotMiddleClick, getItem(setting.middleClick, Hotkey.MiddleClick));
inventory.setItem(slotShiftClick, getItem(setting.shiftClick, Hotkey.ShiftClick));
inventory.setItem(slotDoubleClick, getItem(setting.doubleClick, Hotkey.DoubleClick));
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(slotRightClick, getItem(setting.rightClick,Hotkey.RightClick));
}
setting.guiInventory = inventory;
player.openInventory(inventory);
@ -126,7 +130,12 @@ public class ChestSortSettingsGUI implements Listener {
if(event.getClick() != ClickType.LEFT) {
return;
}
if(event.getCurrentItem()==null || event.getCurrentItem().getType()==Material.AIR) {
return;
}
if(event.getSlot() == ChestSortSettingsGUI.slotMiddleClick) {
setting.toggleMiddleClick();
plugin.settingsGUI.openGUI(p);

View File

@ -89,12 +89,12 @@ verbose: true
# Instead of automatic sorting, you can also use hotkeys (see below)
# when using an inventory to have it sorted immediately.
# 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.
# Players can also enable/disable these shortcuts individually via /chestsort hotkeys
# 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.
# Players can also enable/disable these shortcuts individually via /chestsort hotkeys
sorting-hotkeys:
# Use middle click (mousewheel) on ANY inventory slot as hotkey
middle-click: true
@ -109,6 +109,9 @@ sorting-hotkeys:
# 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)
# 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
additional-hotkeys:
# 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!
# 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
name: ChestSort
version: 8.15.2-SNAPSHOT
version: 8.16.0
api-version: "1.13"
description: Allows automatic chest sorting
author: mfnalex