diff --git a/CHANGELOG.md b/CHANGELOG.md index d52a45a..1605004 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,9 @@ # Changelog ## 8.8-pre1 +- Improved Minepacks hook +- Update Checker interval is now configurable (default: every 4 hours) - Changed class names and moved API to its own class - can be accessed via ChestSortPlugin#getAPI() + ## 8.7 - When using Minepacks, the backpack item in the inventory will not be moved - Added use-permissions option. If you do not use a permissions plugin, you can set this to false to allow every player to use ChestSort diff --git a/pom.xml b/pom.xml index 96f4f21..8e517f8 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ de.jeffclan JeffChestSort - 8.7 + 8.8-pre1 jar JeffChestSort diff --git a/src/main/java/de/jeff_media/ChestSort/ChestSortChestSortCommand.java b/src/main/java/de/jeff_media/ChestSort/ChestSortChestSortCommand.java index adff35c..1a72d82 100644 --- a/src/main/java/de/jeff_media/ChestSort/ChestSortChestSortCommand.java +++ b/src/main/java/de/jeff_media/ChestSort/ChestSortChestSortCommand.java @@ -44,10 +44,10 @@ public class ChestSortChestSortCommand implements CommandExecutor { if(args.length>0) { if(args[0].equalsIgnoreCase("hotkey") || args[0].equalsIgnoreCase("hotkeys")) { -// if(plugin.hotkeyGUI==false) { -// p.sendMessage(plugin.messages.MSG_ERR_HOTKEYSDISABLED); -// return true; -// } + if(plugin.hotkeyGUI==false) { + p.sendMessage(plugin.messages.MSG_ERR_HOTKEYSDISABLED); + return true; + } plugin.settingsGUI.openGUI(p); diff --git a/src/main/java/de/jeff_media/ChestSort/ChestSortMessages.java b/src/main/java/de/jeff_media/ChestSort/ChestSortMessages.java index 3da3e86..fc39242 100644 --- a/src/main/java/de/jeff_media/ChestSort/ChestSortMessages.java +++ b/src/main/java/de/jeff_media/ChestSort/ChestSortMessages.java @@ -20,6 +20,8 @@ public class ChestSortMessages { final String MSG_GUI_MIDDLECLICK, MSG_GUI_SHIFTCLICK, MSG_GUI_DOUBLECLICK, MSG_GUI_SHIFTRIGHTCLICK, MSG_GUI_LEFTCLICK, MSG_GUI_RIGHTCLICK; + final String MSG_ERR_HOTKEYSDISABLED; + ChestSortMessages(ChestSortPlugin plugin) { this.plugin = plugin; @@ -72,7 +74,7 @@ public class ChestSortMessages { MSG_GUI_RIGHTCLICK = ChatColor.translateAlternateColorCodes('&', plugin.getConfig().getString("message-gui-right-click","Unload Chest (Right-Click)")); - //MSG_ERR_HOTKEYSDISABLED = ChatColor.RED + "[ChestSort] Hotkeys are only available for Minecraft 1.9 and later."; + MSG_ERR_HOTKEYSDISABLED = ChatColor.RED + "[ChestSort] Hotkeys have been disabled by the admin."; } } diff --git a/src/main/java/de/jeff_media/ChestSort/ChestSortPlugin.java b/src/main/java/de/jeff_media/ChestSort/ChestSortPlugin.java index c8a1186..577c68e 100644 --- a/src/main/java/de/jeff_media/ChestSort/ChestSortPlugin.java +++ b/src/main/java/de/jeff_media/ChestSort/ChestSortPlugin.java @@ -65,7 +65,7 @@ public class ChestSortPlugin extends JavaPlugin { String sortingMethod; ArrayList disabledWorlds; ChestSortAPI api; - int currentConfigVersion = 30; + int currentConfigVersion = 31; boolean usingMatchingConfig = true; protected boolean debug = false; boolean verbose = true; @@ -170,6 +170,7 @@ public class ChestSortPlugin extends JavaPlugin { getConfig().addDefault("sorting-method", "{category},{itemsFirst},{name},{color}"); getConfig().addDefault("allow-player-inventory-sorting", false); getConfig().addDefault("check-for-updates", "true"); + getConfig().addDefault("check-interval", 4); getConfig().addDefault("auto-generate-category-files", true); getConfig().addDefault("sort-time", "close"); getConfig().addDefault("allow-hotkeys", true); @@ -282,6 +283,8 @@ public class ChestSortPlugin extends JavaPlugin { permissionsHandler = new ChestSortPermissionsHandler(this); usePermissions = getConfig().getBoolean("use-permissions"); + + updateCheckInterval = (int) (getConfig().getDouble("check-interval")*60*60); // The sorting method will determine how stuff is sorted sortingMethod = getConfig().getString("sorting-method"); @@ -322,11 +325,14 @@ public class ChestSortPlugin extends JavaPlugin { getLogger().info(" |- Right-Click: " + getConfig().getBoolean("additional-hotkeys.right-click")); } getLogger().info("Check for updates: " + getConfig().getString("check-for-updates")); + if(getConfig().getString("check-for-updates").equalsIgnoreCase("true")) { + getLogger().info("Check interval: " + getConfig().getString("check-interval") + " hours ("+updateCheckInterval+" seconds)"); + } getLogger().info("Categories: " + getCategoryList()); } // Check for updates (async, of course) - // When set to true, we check for updates right now, and every 24 hours (see + // When set to true, we check for updates right now, and every X hours (see // updateCheckInterval) if (getConfig().getString("check-for-updates", "true").equalsIgnoreCase("true")) { Bukkit.getScheduler().scheduleSyncRepeatingTask(this, new Runnable() { @@ -381,6 +387,8 @@ public class ChestSortPlugin extends JavaPlugin { () -> Integer.toString(getConfig().getInt("config-version", 0)))); bStats.addCustomChart( 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("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 diff --git a/src/main/resources/config.yml b/src/main/resources/config.yml index d32d7cd..1bd441f 100644 --- a/src/main/resources/config.yml +++ b/src/main/resources/config.yml @@ -79,6 +79,9 @@ auto-generate-category-files: true # Available options: open, close, both sort-time: close +# when set to true, show some verbose information on startup +verbose: true + ########################### ##### Default Hotkeys ##### ########################### @@ -118,14 +121,14 @@ additional-hotkeys: # Checks for updates (asynchronously). # When enabled, a message is printed in the console if a new # version has been found, and OPs will be notified when they join the server -# When set to true, check for updates on startup and every 4 hours +# When set to true, check for updates on startup and every X hours (see "check-interval" below) # When set to on-startup, only check on server startup # When set to false, don't check for updates check-for-updates: true -# when set to true, show some verbose information on startup -verbose: true - +# When you set "check-for-updates" to true, you can define the amount +# of hours inbetween each update check. +check-interval: 4 ######################### #### Disabled Worlds #### ######################### @@ -552,4 +555,4 @@ debug: false # Please DO NOT change the following line manually! # It is used by the automatic config updater. -config-version: 30 +config-version: 31 diff --git a/src/main/resources/plugin.yml b/src/main/resources/plugin.yml index aed71bf..837024a 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.7 +version: 8.8-pre1 api-version: 1.13 description: Allows automatic chest sorting author: mfnalex @@ -8,7 +8,7 @@ website: https://www.chestsort.de prefix: ChestSort database: false loadbefore: [InvUnload] -softdepend: [CrackShot, InventoryPages,Minepacks] +softdepend: [CrackShot,InventoryPages,Minepacks] commands: chestsort: description: Toggle automatic chest sorting.