mirror of
https://github.com/JEFF-Media-GbR/ChestSort.git
synced 2024-12-02 15:43:22 +01:00
commit
27f3521c20
15
CHANGELOG.md
15
CHANGELOG.md
@ -1,7 +1,16 @@
|
||||
# Changelog
|
||||
|
||||
## 8.15.2
|
||||
- Added generic hook for 3rd plugin GUIs
|
||||
## 8.17.0
|
||||
- Added option to disable automatic sorting and/or automatic inventory sorting. Hotkeys will still work if enabled. When running /chestsort while automatic sorting is disabled, it will display the hotkeys gui instead.
|
||||
|
||||
## 8.16.1
|
||||
- Allow middle-click hotkey in creative mode when clicked slot is empty
|
||||
|
||||
## 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 +222,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
|
||||
|
2
pom.xml
2
pom.xml
@ -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.17.0</version>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<properties>
|
||||
|
@ -36,6 +36,19 @@ public class ChestSortChestSortCommand implements CommandExecutor {
|
||||
return true;
|
||||
}
|
||||
|
||||
// Debug command
|
||||
if(args.length>0 && args[0].equalsIgnoreCase("debug")) {
|
||||
if(!sender.hasPermission("chestsort.debug")) {
|
||||
sender.sendMessage(plugin.getCommand("chestsort").getPermissionMessage());
|
||||
}
|
||||
sender.sendMessage(ChatColor.RED+"ChestSort Debug mode enabled - I hope you know what you are doing!");
|
||||
plugin.debug=true;
|
||||
ChestSortDebugger debugger = new ChestSortDebugger(plugin);
|
||||
plugin.getServer().getPluginManager().registerEvents(debugger, plugin);
|
||||
plugin.debug("Debug mode activated through command by "+sender.getName());
|
||||
return true;
|
||||
}
|
||||
|
||||
if(args.length>0 && args[0].equalsIgnoreCase("help")) {
|
||||
return false;
|
||||
}
|
||||
@ -58,6 +71,8 @@ public class ChestSortChestSortCommand implements CommandExecutor {
|
||||
|
||||
// fix for Spigot's stupid /reload function
|
||||
plugin.registerPlayerIfNeeded(p);
|
||||
|
||||
if(!plugin.getConfig().getBoolean("allow-automatic-sorting")) args=new String[] {"hotkeys"};
|
||||
|
||||
// Settings GUI
|
||||
if(args.length>0) {
|
||||
|
@ -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) {
|
||||
|
@ -37,6 +37,8 @@ public class ChestSortInvSortCommand implements CommandExecutor {
|
||||
int end = 35;
|
||||
|
||||
ChestSortPlayerSetting setting = plugin.perPlayerSettings.get(p.getUniqueId().toString());
|
||||
|
||||
if(!plugin.getConfig().getBoolean("allow-automatic-inventory-sorting")) args=new String[]{"inv"};
|
||||
|
||||
if(args.length>0) {
|
||||
if(args[0].equalsIgnoreCase("all")) {
|
||||
|
@ -74,6 +74,7 @@ public class ChestSortListener implements Listener {
|
||||
}
|
||||
|
||||
void onBackPackUse(Inventory inv, Player p) {
|
||||
if(!plugin.getConfig().getBoolean("allow-automatic-sorting")) return; //TODO: Maybe change to allow-automatic-inventory-sorting ?
|
||||
if (!minepacksHook.isMinepacksBackpack(inv)) return;
|
||||
if (!p.hasPermission("chestsort.use")) return;
|
||||
plugin.registerPlayerIfNeeded(p);
|
||||
@ -84,6 +85,9 @@ public class ChestSortListener implements Listener {
|
||||
|
||||
@EventHandler
|
||||
public void onPlayerInventoryClose(InventoryCloseEvent event) {
|
||||
|
||||
if(!plugin.getConfig().getBoolean("allow-automatic-inventory-sorting")) return;
|
||||
|
||||
if (event.getInventory().getHolder() == null) return;
|
||||
// Might be obsolete, because its @NotNull in 1.15, but who knows if thats for 1.8
|
||||
if (event.getInventory().getType() == null) return;
|
||||
@ -112,6 +116,8 @@ public class ChestSortListener implements Listener {
|
||||
@EventHandler
|
||||
public void onChestClose(InventoryCloseEvent event) {
|
||||
|
||||
if(!plugin.getConfig().getBoolean("allow-automatic-sorting")) return;
|
||||
|
||||
if (!(plugin.getConfig().getString("sort-time").equalsIgnoreCase("close")
|
||||
|| plugin.getConfig().getString("sort-time").equalsIgnoreCase("both"))) {
|
||||
return;
|
||||
@ -151,6 +157,8 @@ public class ChestSortListener implements Listener {
|
||||
@EventHandler(priority = EventPriority.MONITOR)
|
||||
public void onChestOpen(InventoryOpenEvent event) {
|
||||
|
||||
if(!plugin.getConfig().getBoolean("allow-automatic-sorting")) return;
|
||||
|
||||
if (!(plugin.getConfig().getString("sort-time").equalsIgnoreCase("open")
|
||||
|| plugin.getConfig().getString("sort-time").equalsIgnoreCase("both"))) {
|
||||
return;
|
||||
@ -287,6 +295,8 @@ public class ChestSortListener implements Listener {
|
||||
@EventHandler
|
||||
public void onEnderChestOpen(InventoryOpenEvent event) {
|
||||
|
||||
if(!plugin.getConfig().getBoolean("allow-automatic-sorting")) return;
|
||||
|
||||
if (!(event.getPlayer() instanceof Player)) {
|
||||
return;
|
||||
}
|
||||
@ -319,7 +329,7 @@ public class ChestSortListener implements Listener {
|
||||
|
||||
plugin.registerPlayerIfNeeded(p);
|
||||
|
||||
if (!plugin.getConfig().getBoolean("allow-hotkeys")) {
|
||||
if (!plugin.getConfig().getBoolean("allow-sorting-hotkeys")) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -376,7 +386,7 @@ public class ChestSortListener implements Listener {
|
||||
if (event.getWhoClicked().getGameMode() != GameMode.CREATIVE) {
|
||||
sort = true;
|
||||
} else {
|
||||
if (event.getCurrentItem() == null || event.getCurrentItem().getType() == Material.AIR) {
|
||||
if (event.getCurrentItem() != null || event.getCurrentItem().getType() != Material.AIR) {
|
||||
sort = false;
|
||||
}
|
||||
}
|
||||
@ -463,7 +473,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)) {
|
||||
|
@ -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 = 41;
|
||||
boolean usingMatchingConfig = true;
|
||||
protected boolean debug = false;
|
||||
boolean verbose = true;
|
||||
@ -161,7 +161,10 @@ public class ChestSortPlugin extends JavaPlugin implements de.jeff_media.ChestSo
|
||||
|
||||
// Using old config version, but it's no problem. We just print a warning and
|
||||
// use the default values later on
|
||||
} else*/ if (getConfig().getInt("config-version", 0) != currentConfigVersion) {
|
||||
|
||||
} else*/
|
||||
|
||||
if (getConfig().getInt("config-version", 0) != currentConfigVersion) {
|
||||
showOldConfigWarning();
|
||||
ChestSortConfigUpdater configUpdater = new ChestSortConfigUpdater(this);
|
||||
configUpdater.updateConfig();
|
||||
@ -181,6 +184,8 @@ public class ChestSortPlugin extends JavaPlugin implements de.jeff_media.ChestSo
|
||||
// for every missing option.
|
||||
// By default, sorting is disabled. Every player has to run /chestsort once
|
||||
getConfig().addDefault("use-permissions", true);
|
||||
getConfig().addDefault("allow-automatic-sorting",true);
|
||||
getConfig().addDefault("allow-automatic-inventory-sorting",true);
|
||||
getConfig().addDefault("sorting-enabled-by-default", false);
|
||||
getConfig().addDefault("inv-sorting-enabled-by-default", false);
|
||||
getConfig().addDefault("show-message-when-using-chest", true);
|
||||
@ -192,7 +197,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);
|
||||
@ -279,6 +285,12 @@ public class ChestSortPlugin extends JavaPlugin implements de.jeff_media.ChestSo
|
||||
new Metrics.SimplePie("check_for_updates", () -> getConfig().getString("check-for-updates", "true")));
|
||||
bStats.addCustomChart(
|
||||
new Metrics.SimplePie("update_interval", () -> Long.toString(updateCheckInterval)));
|
||||
|
||||
bStats.addCustomChart(new Metrics.SimplePie("allow_automatic_sorting",
|
||||
() -> Boolean.toString(getConfig().getBoolean("allow-automatic-sorting"))));
|
||||
bStats.addCustomChart(new Metrics.SimplePie("allow_automatic_inv_sorting",
|
||||
() -> Boolean.toString(getConfig().getBoolean("allow-automatic-inventory-sorting"))));
|
||||
|
||||
bStats.addCustomChart(new Metrics.SimplePie("show_message_when_using_chest",
|
||||
() -> Boolean.toString(getConfig().getBoolean("show-message-when-using-chest"))));
|
||||
bStats.addCustomChart(new Metrics.SimplePie("show_message_when_using_chest_and_sorting_is_enabl", () -> Boolean
|
||||
@ -295,7 +307,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",
|
||||
@ -483,19 +497,23 @@ public class ChestSortPlugin extends JavaPlugin implements de.jeff_media.ChestSo
|
||||
if (verbose) {
|
||||
getLogger().info("Use permissions: " + getConfig().getBoolean("use-permissions"));
|
||||
getLogger().info("Current sorting method: " + sortingMethod);
|
||||
getLogger().info("Chest sorting enabled by default: " + getConfig().getBoolean("sorting-enabled-by-default"));
|
||||
getLogger().info("Inventory sorting enabled by default: " + getConfig().getBoolean("inv-sorting-enabled-by-default"));
|
||||
getLogger().info("Allow automatic chest sorting:" + getConfig().getBoolean("allow-automatic-sorting"));
|
||||
getLogger().info(" |- Chest sorting enabled by default: " + getConfig().getBoolean("sorting-enabled-by-default"));
|
||||
getLogger().info(" |- Sort time: " + getConfig().getString("sort-time"));
|
||||
getLogger().info("Allow automatic inventory sorting:" + getConfig().getBoolean("allow-automatic-inventory-sorting"));
|
||||
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"));
|
||||
}
|
||||
|
@ -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);
|
||||
|
@ -28,6 +28,14 @@
|
||||
# - chestsort.use.inventory (allow inventory sorting by hotkeys and via /invsort)
|
||||
use-permissions: true
|
||||
|
||||
# when set to false, no player is allowed to enable automatic chest sorting
|
||||
# hotkeys will still work if enabled
|
||||
allow-automatic-sorting: true
|
||||
|
||||
# when set to false, no player is allowed to enable automatic inventory sorting
|
||||
# hotkeys will still work if enabled
|
||||
allow-automatic-inventory-sorting: true
|
||||
|
||||
# when set to false, new players will have to run /chestsort
|
||||
# once to enable automatic chest sorting.
|
||||
sorting-enabled-by-default: false
|
||||
@ -89,12 +97,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 +117,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 +588,4 @@ log: false
|
||||
|
||||
# Please DO NOT change the following line manually!
|
||||
# It is used by the automatic config updater.
|
||||
config-version: 38
|
||||
config-version: 41
|
@ -1,6 +1,6 @@
|
||||
main: de.jeff_media.ChestSort.ChestSortPlugin
|
||||
name: ChestSort
|
||||
version: 8.15.2-SNAPSHOT
|
||||
version: 8.17.0
|
||||
api-version: "1.13"
|
||||
description: Allows automatic chest sorting
|
||||
author: mfnalex
|
||||
|
Loading…
Reference in New Issue
Block a user